@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
@@ -0,0 +1,5 @@
1
+ import { type ResultadoDistribuicaoGlobal } from "./distribuicao/index.js";
2
+ type OperacaoSkill = "status" | "sync";
3
+ export declare function renderizarResultadoSkill(operacao: OperacaoSkill, resultado: ResultadoDistribuicaoGlobal): string;
4
+ export declare function comandoSkill(posicionais: string[], args: string[], emJson: boolean): Promise<number>;
5
+ export {};
@@ -0,0 +1,88 @@
1
+ // SEMA-GOVERNED: sema.produto.distribuicao_global, sema.produto.distribuicao_global.skill
2
+ // Descrição: expõe diagnóstico read-only e reparo explícito da distribuição global gerenciada.
3
+ import { sincronizarDistribuicaoGlobal, statusDistribuicaoGlobal, } from "./distribuicao/index.js";
4
+ export function renderizarResultadoSkill(operacao, resultado) {
5
+ const linhas = [
6
+ `Distribuição global Sema (${operacao}): ${resultado.estado}`,
7
+ ` Alterada: ${resultado.alterado ? "sim" : "não"}`,
8
+ ` Launcher: ${resultado.launcher.estado} (${resultado.launcher.destino_simbolico})`,
9
+ ...(resultado.launcher.fallback_simbolico
10
+ ? [` Fallback PowerShell: ${resultado.launcher.fallback_simbolico}`]
11
+ : []),
12
+ ` Diagnóstico launcher: ${resultado.launcher.codigo}`,
13
+ ` Skill: ${resultado.skill.estado} (${resultado.skill.origem_simbolica})`,
14
+ ` Destino .agents: ${resultado.skill.destino_agents}`,
15
+ ` Destino Claude: ${resultado.skill.destino_claude}`,
16
+ ` Diagnósticos skill: ${resultado.skill.destinos
17
+ .map((destino) => `${destino.id}=${destino.codigo}`)
18
+ .join(", ") || "nenhum"}`,
19
+ ];
20
+ return linhas.join("\n");
21
+ }
22
+ function imprimirSubcomandoInvalido(emJson) {
23
+ const mensagem = "Use `sema skill status` ou `sema skill sync`.";
24
+ if (emJson) {
25
+ console.log(JSON.stringify({
26
+ schema: "sema.skill-distribution/v1",
27
+ comando: "skill",
28
+ sucesso: false,
29
+ erro: {
30
+ codigo: "SUBCOMANDO_SKILL_INVALIDO",
31
+ mensagem,
32
+ },
33
+ }, null, 2));
34
+ return;
35
+ }
36
+ console.error(mensagem);
37
+ }
38
+ export async function comandoSkill(posicionais, args, emJson) {
39
+ const operacao = (posicionais[0] ?? "status").toLocaleLowerCase("en-US");
40
+ const possuiArgumentoExtra = posicionais.length > 1;
41
+ const possuiFlagDesconhecida = args.some((arg) => arg.startsWith("-") && arg !== "--json");
42
+ if ((operacao !== "status" && operacao !== "sync")
43
+ || possuiArgumentoExtra
44
+ || possuiFlagDesconhecida) {
45
+ imprimirSubcomandoInvalido(emJson);
46
+ return 1;
47
+ }
48
+ try {
49
+ const resultado = operacao === "sync"
50
+ ? await sincronizarDistribuicaoGlobal()
51
+ : await statusDistribuicaoGlobal();
52
+ const sucesso = resultado.estado === "READY";
53
+ if (emJson) {
54
+ const payload = {
55
+ schema: "sema.skill-distribution/v1",
56
+ comando: "skill",
57
+ operacao,
58
+ sucesso,
59
+ resultado,
60
+ };
61
+ console.log(JSON.stringify(payload, null, 2));
62
+ }
63
+ else {
64
+ console.log(renderizarResultadoSkill(operacao, resultado));
65
+ }
66
+ return sucesso ? 0 : 1;
67
+ }
68
+ catch {
69
+ const mensagem = "Falha ao consultar ou sincronizar a distribuição global Sema.";
70
+ if (emJson) {
71
+ console.log(JSON.stringify({
72
+ schema: "sema.skill-distribution/v1",
73
+ comando: "skill",
74
+ operacao,
75
+ sucesso: false,
76
+ erro: {
77
+ codigo: "FALHA_DISTRIBUICAO_GLOBAL",
78
+ mensagem,
79
+ },
80
+ }, null, 2));
81
+ }
82
+ else {
83
+ console.error(mensagem);
84
+ }
85
+ return 1;
86
+ }
87
+ }
88
+ //# sourceMappingURL=skillCommand.js.map
package/docs/README.md CHANGED
@@ -1,34 +1,38 @@
1
- # Sema Documentation
2
-
3
- These docs describe the public Codex-native local CLI distribution of Sema.
4
-
1
+ # Sema Documentation
2
+
3
+ These docs describe the public Codex-native local CLI distribution of Sema.
4
+
5
5
  Sema is local-first: Codex runs the CLI inside a project folder, reads `.sema`
6
6
  contracts, checks drift, maps impact, and closes changes with documentation
7
- evidence. `AGENTS.md` is the official Codex entrypoint. Public docs are written
7
+ evidence. In 3.0.0, valid commands using `--json` return the exact
8
+ `sema.cli.result/v1` envelope with command data nested under `payload`, while
9
+ help and command-control failures keep the separate `sema.cli.control/v1`
10
+ envelope. `AGENTS.md` is the official Codex entrypoint. Public docs are written
8
11
  in English.
9
-
10
- Sema is an independent product and is not affiliated with or endorsed by
11
- OpenAI. Codex-native describes Sema's product direction, not an official OpenAI
12
- program or submission.
13
-
14
- Start here:
15
-
16
- - [CLI](./cli.md)
17
- - [Commands](./commands.md)
12
+
13
+ Sema is an independent product and is not affiliated with or endorsed by
14
+ OpenAI. Codex-native describes Sema's product direction, not an official OpenAI
15
+ program or submission.
16
+
17
+ Start here:
18
+
19
+ - [CLI](./cli.md) — installation and the public JSON output contract
20
+ - [Commands](./commands.md) — command catalog and envelope-consumption rules
21
+ - [Drift Cache And Query Evidence](./drift-cache.md)
18
22
  - [Syntax](./syntax.md)
19
- - [Profiles](./profiles.md)
20
- - [Capability Discovery](./descoberta-capacidades.md) — one explainable catalog
21
- for governance flows, profiles, specialized workflows, pipelines, generators,
22
- capability tokens, and adapters.
23
- - [AI-native Interactive Systems](./sistemas-interativos.md) — declarative
24
- control plane for games, simulations, and hybrids across 3D, 2D, retro,
25
- text, XR, and headless execution.
26
- - [AI-native Content Pipeline](./pipeline-conteudo.md) — signed-policy,
27
- multi-channel and multi-format orchestration for external AI runners, with
28
- canonical ledger replay and no native human-review path.
29
- - [Documentation Governance](./documentation.md)
30
- - [Repository Boundary](./repositories.md)
31
- - [Security](./security.md)
32
- - [Codex Integration](./ai-integration.md)
33
-
34
- Official support: [suporte@otimitare.online](mailto:suporte@otimitare.online)
23
+ - [Profiles](./profiles.md)
24
+ - [Capability Discovery](./descoberta-capacidades.md) — one explainable catalog
25
+ for governance flows, profiles, specialized workflows, pipelines, generators,
26
+ capability tokens, and adapters.
27
+ - [AI-native Interactive Systems](./sistemas-interativos.md) — declarative
28
+ control plane for games, simulations, and hybrids across 3D, 2D, retro,
29
+ text, XR, and headless execution.
30
+ - [AI-native Content Pipeline](./pipeline-conteudo.md) — signed-policy,
31
+ multi-channel and multi-format orchestration for external AI runners, with
32
+ canonical ledger replay and no native human-review path.
33
+ - [Documentation Governance](./documentation.md)
34
+ - [Repository Boundary](./repositories.md)
35
+ - [Security](./security.md)
36
+ - [Codex Integration](./ai-integration.md)
37
+
38
+ Official support: [suporte@otimitare.online](mailto:suporte@otimitare.online)
@@ -11,18 +11,22 @@ https://learn.chatgpt.com/docs/agent-configuration/agents-md.
11
11
 
12
12
  ## Before AGENTS.md Exists
13
13
 
14
- The official Sema skill is the required first-contact bootstrap for Codex in a
15
- project that does not have Sema yet. Install it explicitly:
14
+ The official Sema skill is the first-contact bootstrap for a project that does
15
+ not have Sema yet. A global CLI install bundles and synchronizes it:
16
16
 
17
17
  ```bash
18
- codex plugin marketplace add gerlanss/Sema
19
- codex plugin add sema@sema
18
+ npm install -g @semacode/cli
19
+ sema skill status --json
20
20
  ```
21
21
 
22
- The skill locates the local CLI, runs `sema iniciar`, generates `AGENTS.md`, and
23
- then delegates all ongoing workspace governance to that file. It contains no
22
+ The package creates an absolute launcher under `~/.sema/bin`, synchronizes the
23
+ canonical skill under `~/.agents/skills/sema`, and mirrors Claude only when
24
+ detected. Informational requests stay read-only; before implementation the skill asks
25
+ for explicit project-adoption authorization, then generates `AGENTS.md` and delegates
26
+ ongoing governance. Installing or updating the global CLI authorizes distribution only.
27
+ Already-open tasks may need a reload. The distribution contains no
24
28
  MCP server, remote workspace bridge, login, license, billing, token, credit,
25
- panel, or authorization gate.
29
+ panel, or runtime authorization gate.
26
30
 
27
31
  Supported capacity labels: fraca, pequena, media, forte, grande.
28
32
 
@@ -32,10 +36,11 @@ For a local workspace, use the local CLI:
32
36
 
33
37
  ```bash
34
38
  sema --version
35
- sema resumo
39
+ sema resumo --drift none
36
40
  ```
37
41
 
38
- A successful `sema --version` is enough to use the local CLI directly. Local
42
+ If the shell cannot resolve `sema`, use `~/.sema/bin/sema` on macOS/Linux. On Windows, PowerShell uses `sema.ps1` from PATH and cmd.exe uses `sema.cmd`; use `& "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\.sema\bin\sema-managed.ps1" --version` as the absolute fallback
43
+ before declaring the CLI unavailable. A successful version check is enough. Local
39
44
  commands require no login, activation key, license check, token, credits, billing
40
45
  service, control panel, or external authorization request.
41
46
 
@@ -43,13 +48,15 @@ service, control panel, or external authorization request.
43
48
 
44
49
  ```bash
45
50
  sema docs-impacto --intencao "describe the change" --json
46
- sema inspecionar contratos/example.sema --json
47
- sema drift contratos/example.sema --escopo modulo --json
51
+ sema inspecionar contratos/example.sema --drift none --json
52
+ sema drift contratos/example.sema --escopo modulo --cache fresh --json
48
53
  sema impacto contratos/example.sema --alvo app.example --mudanca "describe the change" --json
49
54
  ```
50
55
 
51
56
  Read every document listed by `docs-impacto` before changing code, contracts,
52
57
  operational docs, generated artifacts, workflows, profiles, or release material.
58
+ A cache hit is acceleration, not evidence: closing requires `--cache fresh`,
59
+ while contract-only queries keep unobserved implementation fields null inside the command payload.
53
60
 
54
61
  ## Codex Context Tiers
55
62
 
@@ -73,6 +80,12 @@ Generated or governed code should keep a short `SEMA-GOVERNED` marker that
73
80
  points back to the applicable contract. The marker is not a substitute for
74
81
  validation, drift, impact, or finalization gates.
75
82
 
83
+ Generated Lua tests preserve the contract's failure shape. A case whose only
84
+ expectation is `sucesso: falso` may terminate without an output, while a case
85
+ that also declares observable output fields must return a structured failure
86
+ result. The generator keeps these paths distinct instead of forcing every
87
+ failure into one representation.
88
+
76
89
  Governed code above 1000 lines requires a
77
90
  split plan. Governed code above 2000
78
91
  lines blocks closure. Markdown documentation is not counted as governed code
@@ -106,4 +119,4 @@ user-facing experience, closure requires evidence:
106
119
  ## Platform Policy
107
120
 
108
121
  Sema governs contract, scope, drift, evidence, and quality. It does not bypass
109
- platform policies, terms of use, permissions, security controls, or laws.
122
+ platform policies, terms of use, permissions, security controls, or laws.
@@ -1,18 +1,24 @@
1
1
  # Codex Onboarding
2
2
 
3
- The official Sema skill is required for Codex to recognize and initialize Sema
4
- before a project has its own protocol:
3
+ The official Sema skill lets Codex and compatible agents recognize and
4
+ initialize Sema before a project has its own protocol:
5
5
 
6
6
  ```bash
7
- codex plugin marketplace add gerlanss/Sema
8
- codex plugin add sema@sema
7
+ npm install -g @semacode/cli
8
+ sema skill status --json
9
9
  ```
10
10
 
11
- Open a new Codex task in the target repository after installation. Codex loads
12
- the plugin/skill catalog at task start, so `$sema` is not added retroactively to
13
- an already-open task. Invoke `$sema` in the new task; it bootstraps the project,
14
- reads the generated `AGENTS.md`, and later tasks load that protocol
15
- automatically.
11
+ The install maintains the canonical copy in `~/.agents/skills/sema` and a Claude
12
+ mirror in `~/.claude/skills/sema` only when Claude is detected. Open a new task
13
+ after installation or update because an already-open task does not reload its
14
+ skill catalog. Invoking `$sema` for information does not initialize the
15
+ workspace. Before implementation, the skill asks for explicit adoption
16
+ authorization; installing or updating the global CLI authorizes distribution
17
+ changes only. After authorized adoption, it reads the generated `AGENTS.md`,
18
+ and later tasks load that protocol automatically.
19
+
20
+ The optional Codex plugin remains available as a separate namespaced channel;
21
+ the npm lifecycle never writes into its cache.
16
22
 
17
23
  `AGENTS.md` is the official Sema entrypoint for Codex. It gives Codex the durable
18
24
  repository rule that contracts come first and the local CLI is the source of
@@ -32,18 +38,31 @@ This workspace is governed by Sema. Before editing code, contracts, docs,
32
38
  workflows, profiles, or release scripts, run:
33
39
 
34
40
  1. sema --version
35
- 2. sema resumo
41
+ 2. sema resumo --drift none
36
42
  3. sema docs-impacto --intencao "<change>" --json
37
- 4. sema inspecionar on the applicable .sema contract
38
- 5. sema drift before editing existing code
43
+ 4. sema inspecionar <contract.sema> --drift none --json
44
+ 5. sema drift <contract.sema> --escopo modulo --cache fresh --json before
45
+ editing existing code
39
46
  6. sema impacto before changing behavior
40
47
  7. sema finalizar-mudanca before closing
41
48
 
42
- If the CLI is unavailable, stop and install or repair @semacode/cli. There is
43
- no separate Sema login, license activation, or authorization gate. Do not
44
- replace Sema with manual search or guessed contracts.
49
+ If `sema --version` is unavailable, try the managed absolute launcher at
50
+ `~/.sema/bin/sema` on macOS/Linux. On Windows, PowerShell uses `sema.ps1` from
51
+ `PATH`, `cmd.exe` uses `sema.cmd`, and the absolute PowerShell fallback is:
52
+ & "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\.sema\bin\sema-managed.ps1" --version
53
+ If that also fails, stop and install or repair @semacode/cli. There is no
54
+ separate Sema login or license-activation gate. Distribution installation does
55
+ not authorize workspace adoption. Do not replace Sema with manual search or
56
+ guessed contracts.
45
57
  ```
46
58
 
59
+ Query commands default to `--drift none`, so their `analiseDrift` envelope marks
60
+ the analysis as not executed and keeps drift-derived evidence `null`. Direct
61
+ `sema drift` defaults to `--cache fresh`; `--cache none` still executes drift
62
+ without persistent cache access. The cache is non-authoritative, lives outside
63
+ the workspace, and safely falls back to recalculation when unavailable or
64
+ corrupt. See [Drift Cache And Query Evidence](./drift-cache.md).
65
+
47
66
  ## What Codex Should Not Do
48
67
 
49
68
  - Do not invent `.sema` contracts.
@@ -52,9 +71,9 @@ replace Sema with manual search or guessed contracts.
52
71
  - Do not publish private or sensitive operational material.
53
72
  - Do not replace the local CLI when the local workspace is available.
54
73
 
55
- Other AI clients can invoke the public CLI manually, but Sema does not ship or
56
- manage an official repository entrypoint for them. The supported product path
57
- is Codex plus `AGENTS.md`.
74
+ Compatible AI clients can discover the same portable skill through the
75
+ canonical global `.agents/skills` root. Sema does not create client-specific
76
+ repository rules: `AGENTS.md` remains the only official workspace entrypoint.
58
77
 
59
78
  Sema is an independent product and is not affiliated with or endorsed by
60
79
  OpenAI.
@@ -4,26 +4,28 @@
4
4
  This is the minimum workflow for Codex in a local workspace.
5
5
 
6
6
  1. Read `SEMA_BOOT.md`.
7
- 2. Run `sema --version`. Success enables direct local execution; there is no login, license, token, billing, panel, or authorization gate.
8
- 3. Run `sema resumo`.
7
+ 2. Run `sema --version`. If the shell cannot find it, use `$HOME/.sema/bin/sema` on macOS/Linux. On Windows, PowerShell resolves `sema.ps1` from PATH and cmd.exe resolves `sema.cmd`; use `& "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\.sema\bin\sema-managed.ps1" --version` as the absolute fallback. Only then declare the CLI unavailable.
8
+ 3. Run `sema resumo --drift none` for contract-only orientation; request `--drift cache` or `--drift fresh` only when code evidence is needed.
9
9
  4. Run `sema docs-impacto --intencao "<change>" --json`.
10
10
  5. Read every required document returned by the command.
11
11
  6. Read `docs/commands.md` before selecting a command or interpreting `--saida`.
12
12
  7. If the right capability is unclear, run `sema descobrir recomendar --intencao "<goal>" --json`; do not auto-run ambiguous recommendations.
13
13
  8. Use `exemplos/` and `docs/syntax.md` before creating or editing a contract.
14
- 9. Run `sema drift` and `sema impacto` before editing existing code.
14
+ 9. Run `sema drift --cache fresh` and `sema impacto` before editing existing code.
15
15
  10. Run `sema formatar` and `sema validar` after changing a `.sema` contract.
16
16
  11. Run `sema finalizar-mudanca` with the documents read before closure.
17
17
 
18
18
  Contract edit rule: `.sema` has its own size budget. Above 300 lines, plan a split by domain/capability; above 500, do not create or edit before splitting. Do not use parte_1/parte_2 and do not force a 1:1 contract-to-file relationship; several contracts can govern the same file through `vinculos`.
19
19
 
20
- Closing rule: `sema drift --json` must return `sucesso:true`. If it reports `sucesso:false`, `vinculos_quebrados`, `rotas_divergentes`, or broken impls, the task is still blocked. Passing unit tests do not replace green drift.
20
+ Closing rule: the `payload` of `sema drift --cache fresh --json` must return `sucesso:true`. If it reports `sucesso:false`, `vinculos_quebrados`, `rotas_divergentes`, or `impls_quebrados`, the task is still blocked. Passing unit tests or a cache hit do not replace fresh green drift. In 3.0.0, `ok` describes the CLI result path and never replaces a command-specific domain verdict.
21
21
 
22
- UI rule: if the task involves an interface, minimum evidence includes desktop and mobile. On a narrow viewport such as 390px, `document.documentElement.scrollWidth <= document.documentElement.clientWidth` must pass; horizontal scroll blocks closure.
22
+ Focused drift rule: file and module scopes plan their physical file set before cataloging. They never fall back to a whole-project walk when no safe anchor exists. All indexers and semantic-budget checks reuse the same in-memory source read; a global walk is reserved for explicit `--escopo projeto`. Code discovery is deferred until that plan exists, homonymous candidates fail as ambiguous, and configured contract origins or code roots resolving outside the workspace are rejected before enumeration. `inspecionar`, `impacto`, and `renomear-semantico` preserve the same directed boundary. Missing local dependencies make coverage partial and block success.
23
+
24
+ Cache rule: a closure gate should use `sema drift <contrato> --escopo modulo --cache fresh --json`. `--cache none` executes the same analysis without persistent-cache I/O, while `--cache cache` may reuse only extraction data whose schema, workspace identity, Git HEAD, plan, configuration, contracts, member paths, and strong content digests all match. Cache objects are stored in the operating system's user-cache directory, never below the workspace. A hit is acceleration, not evidence: final links, diagnostics, score, and success are always recalculated. Corruption or an unavailable cache degrades to an in-memory calculation.
23
25
 
24
- Focused inspection rule: `sema inspecionar <contrato.sema>` and `sema resumo <contrato.sema> --micro` default to `--drift none`. They load the target plus its transitive `use` closure and must state that live code was not verified. Use `--drift cache`, `--drift fresh`, or `--com-drift` only when implementation evidence is required.
26
+ Query honesty rule: `resumo` and `inspecionar` default to `--drift none`. When analysis is skipped, score, confidence, implementation, routes, and other unobserved code claims inside the command payload must be `null` or explicitly marked not evaluated; zero is not a substitute for absent evidence.
25
27
 
26
- Drift scope rule: a file/module run plans its physical file set before cataloging and never falls back to a whole-project walk when no safe anchor exists. `--cache auto` reuses validated catalog, file, and semantic-group entries; `--cache refresh` recalculates them; `--cache off` disables persistent cache I/O. Inspect `escopo_aplicado.catalogo`, `escopo_aplicado.cache.incremental`, and `escopo_aplicado.cache.fasesMs` for the work actually performed.
28
+ UI rule: if the task involves an interface, minimum evidence includes desktop and mobile. On a narrow viewport such as 390px, `document.documentElement.scrollWidth <= document.documentElement.clientWidth` must pass; horizontal scroll blocks closure.
27
29
 
28
30
  ## Codex Context Capacity
29
31
 
package/docs/cli.md CHANGED
@@ -13,16 +13,122 @@ Support: suporte@otimitare.online
13
13
  ```bash
14
14
  npm install -g @semacode/cli
15
15
  sema --version
16
+ sema skill status --json
16
17
  ```
17
18
 
19
+ The global install bundles the portable Sema skill and creates a launcher under
20
+ `~/.sema/bin` with absolute Node.js and CLI paths. If the npm shim is absent
21
+ from `PATH`, run `~/.sema/bin/sema` on macOS/Linux. On Windows, PowerShell
22
+ resolves `sema.ps1` from `PATH`, while `cmd.exe` resolves `sema.cmd`; invoke the
23
+ managed fallback through the absolute system executable:
24
+
25
+ ```powershell
26
+ & "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\.sema\bin\sema-managed.ps1" --version
27
+ ```
28
+
29
+ Use `sema skill sync --json` to repair an installation performed with lifecycle
30
+ scripts disabled.
31
+
18
32
  For development inside this repository:
19
33
 
20
34
  ```bash
21
35
  npm install
22
36
  npm run build
23
- node pacotes/cli/dist/index.js --help
37
+ node pacotes/cli/dist/bin.js --help
24
38
  ```
25
39
 
40
+ ## Side-Effect-Free Help
41
+
42
+ `--help` and `-h` take precedence wherever they appear in argv, including after
43
+ an unknown command or option. The CLI exits with status `0` before command
44
+ runtime import, command dispatch, or handler resolution. Help does not inspect or mutate the workspace,
45
+ home, user cache, or plugin cache, start a subprocess, or make a network call.
46
+
47
+ `dist/bin.js` is the executable bootstrap and imports the operational runtime
48
+ only after these control paths finish. `dist/index.js` remains the package API
49
+ entrypoint and is not an executable alias.
50
+
51
+ ```bash
52
+ sema iniciar --help
53
+ sema formatar --help
54
+ sema sync-codex --help
55
+ sema skill sync --help
56
+ sema unknown --option value --help
57
+ ```
58
+
59
+ ## Public JSON Output
60
+
61
+ `sema --version` (and its version aliases) prints one plain exact SemVer string.
62
+ It is intentionally not wrapped in JSON.
63
+
64
+ ### Help and command control
65
+
66
+ Adding `--json` to help or a command-control failure emits exactly one JSON
67
+ document on stdout and keeps stderr empty:
68
+
69
+ ```json
70
+ {
71
+ "schemaVersion": "sema.cli.control/v1",
72
+ "ok": true,
73
+ "kind": "HELP",
74
+ "code": "CLI_HELP",
75
+ "message": "Sema CLI help",
76
+ "exitCode": 0
77
+ }
78
+ ```
79
+
80
+ The envelope contains exactly `schemaVersion`, `ok`, `kind`, `code`, `message`,
81
+ and `exitCode`. Supported control kinds are `HELP`, `UNKNOWN_COMMAND`,
82
+ `ARGUMENT_ERROR`, and `FATAL_ERROR`. Help uses exit code `0`; failures preserve
83
+ a non-zero process status equal to `exitCode`. Failure messages are public and
84
+ redacted: they do not include stacks, absolute paths, raw argv, or internal
85
+ causes.
86
+
87
+ Command-control failures are unknown top-level commands or subcommands, missing
88
+ or invalid required CLI arguments/options rejected before valid dispatch, and
89
+ uncaught runtime exceptions. An uncaught exception uses the redacted
90
+ `FATAL_ERROR` control envelope. `sema.cli.control/v1` is never nested inside a
91
+ command result.
92
+
93
+ ### Valid command results
94
+
95
+ In 3.0.0, every syntactically valid command invoked with `--json` emits exactly
96
+ one `sema.cli.result/v1` document on stdout with empty stderr:
97
+
98
+ ```json
99
+ {
100
+ "schemaVersion": "sema.cli.result/v1",
101
+ "ok": true,
102
+ "kind": "SUCCESS",
103
+ "command": "resumo",
104
+ "code": "CLI_SUCCESS",
105
+ "message": null,
106
+ "exitCode": 0,
107
+ "payload": {
108
+ "comando": "resumo",
109
+ "sucesso": true
110
+ }
111
+ }
112
+ ```
113
+
114
+ The result envelope contains exactly `schemaVersion`, `ok`, `kind`, `command`,
115
+ `code`, `message`, `exitCode`, and `payload`; extra or missing fields are
116
+ invalid, and `data` is not an alias for `payload`. `command` is the canonical
117
+ top-level command name. `payload` is always present and may be any JSON value,
118
+ including an object, array, scalar, or `null`.
119
+
120
+ - `SUCCESS` requires `ok: true`, `code: "CLI_SUCCESS"`, `message: null`, and
121
+ `exitCode: 0`.
122
+ - `DOMAIN_ERROR` requires `ok: false`, `code: "CLI_DOMAIN_ERROR"`, a non-empty
123
+ safe public `message`, and a positive `exitCode` equal to the process status.
124
+
125
+ The envelope describes the CLI result transport and classification. It does
126
+ not replace the command's domain model: consumers must unwrap `payload` and
127
+ evaluate fields such as `payload.sucesso`, `payload.aprovado`,
128
+ `payload.bloqueado`, or another command-specific verdict separately. A
129
+ syntactically valid operation that returns a structured domain failure uses
130
+ `DOMAIN_ERROR`; it does not fall back to `sema.cli.control/v1`.
131
+
26
132
  ## Codex Setup
27
133
 
28
134
  `AGENTS.md` is the official Sema entrypoint for Codex. Create or refresh it from
@@ -42,22 +148,24 @@ code, contracts, workflows, release scripts, or operational docs:
42
148
 
43
149
  ```bash
44
150
  sema --version
45
- sema resumo
151
+ sema resumo --drift none
46
152
  sema docs-impacto --intencao "describe the change" --json
47
- sema inspecionar contratos/example.sema --json
48
- sema drift contratos/example.sema --escopo modulo --json
153
+ sema inspecionar contratos/example.sema --drift none --json
154
+ sema drift contratos/example.sema --escopo modulo --cache fresh --json
49
155
  sema impacto contratos/example.sema --alvo sema.example.target --mudanca "describe the change" --json
50
156
  ```
51
157
 
52
158
  Commands run directly against the local workspace. If `sema --version` fails,
53
- install or repair the npm package; there is no separate authorization gate.
159
+ try the managed absolute launcher before declaring the CLI unavailable. If both
160
+ fail, install or repair the npm package; there is no separate authorization
161
+ gate.
54
162
 
55
163
  ## Core Commands
56
164
 
57
165
  - `sema iniciar`: create a governed starting point.
58
166
  - `sema validar`: validate `.sema` contracts.
59
- - `sema inspecionar`: inspect the applicable contract surface.
60
- - `sema drift`: compare contracts and implementation.
167
+ - `sema inspecionar`: inspect the applicable contract surface; add `--drift cache|fresh` to request code evidence.
168
+ - `sema drift`: compare contracts and implementation with `--cache none|cache|fresh` (default `fresh`).
61
169
  - `sema impacto`: map the blast radius of a planned change.
62
170
  - `sema docs-impacto`: identify docs that must be read or updated.
63
171
  - `sema finalizar-mudanca`: close the governed change with evidence.
@@ -66,6 +174,16 @@ install or repair the npm package; there is no separate authorization gate.
66
174
  - `sema verificar`: run the final local verification bundle.
67
175
  - `sema contexto-ia`: build local AI context from a contract.
68
176
  - `sema sync-codex`: create or refresh the official `AGENTS.md` entrypoint.
177
+ - `sema skill status|sync`: inspect or repair the managed launcher and bundled
178
+ global skill without touching plugin caches or workspace files.
179
+
180
+ `resumo` and `inspecionar` default to `--drift none`, so they do not fabricate
181
+ scores or implementation evidence. In this mode those fields inside `payload`
182
+ are `null` or explicitly not evaluated. `sema drift --cache none` still runs
183
+ the analysis but does not touch persistent cache. `cache` reuses only a validated extraction hit;
184
+ `fresh` ignores hits and republishes recalculated extraction data. Cache objects
185
+ live in the operating system's user-cache directory outside the workspace, and
186
+ the final links, diagnostics, score, and success decision are always recomputed.
69
187
 
70
188
  Generation targets are `typescript`, `python`, `php`, `dart`, `lua`,
71
189
  `javascript`, `html`, `css`, `dotnet`, and `cpp`. The aliases `cs` and