@semacode/cli 4.2.4 → 4.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agentBootstrap.js +4 -3
- package/dist/agentContextPack.js +9 -9
- package/dist/agentEntryPoints.js +19 -11
- package/dist/agentFlowHelp.d.ts +4 -0
- package/dist/agentFlowHelp.js +37 -0
- package/dist/bin.js +6 -2
- package/dist/changeCommands.d.ts +1 -0
- package/dist/changeCommands.js +79 -0
- package/dist/changeScope.d.ts +18 -0
- package/dist/changeScope.js +89 -0
- package/dist/cliArgs.js +1 -0
- package/dist/cliGrammar.js +5 -5
- package/dist/cliHelpTexto.js +5 -5
- package/dist/comandoSessao.js +30 -2
- package/dist/contexto.js +2 -2
- package/dist/discovery/catalog.js +2 -2
- package/dist/docs.part02.js +2 -2
- package/dist/drift.part06.js +4 -0
- package/dist/drift.part13.js +1 -1
- package/dist/driftPack.d.ts +4 -0
- package/dist/driftPack.js +6 -0
- package/dist/iaPrompts.d.ts +3 -3
- package/dist/iaPrompts.js +10 -9
- package/dist/index.part01.js +0 -3
- package/dist/index.part03.js +2 -20
- package/dist/index.part04.js +14 -82
- package/dist/index.part06.js +3 -55
- package/dist/initCommand.js +1 -0
- package/dist/initProjectPlan.d.ts +2 -0
- package/dist/initProjectPlan.js +30 -0
- package/dist/initTemplatesBase.js +16 -83
- package/dist/javascriptBindings.d.ts +2 -0
- package/dist/javascriptBindings.js +75 -0
- package/dist/projetoBusca.js +2 -0
- package/dist/saidaCli.js +4 -1
- package/dist/sessionContext.js +1 -1
- package/docs/ai-integration.md +9 -5
- package/docs/ai-workflow.md +3 -3
- package/docs/cli.md +1 -1
- package/docs/commands.md +7 -3
- package/docs/documentation.md +19 -4
- package/docs/getting-started.md +10 -2
- package/node_modules/@sema/gerador-cpp/dist/index.js +177 -177
- package/node_modules/@sema/gerador-css/dist/index.part01.js +24 -24
- package/node_modules/@sema/gerador-dart/dist/index.js +1 -1
- package/node_modules/@sema/gerador-dotnet/dist/index.js +170 -170
- package/node_modules/@sema/gerador-html/dist/index.js +100 -100
- package/node_modules/@sema/gerador-javascript/dist/index.js +93 -93
- package/node_modules/@sema/gerador-lua/dist/index.js +85 -85
- package/node_modules/@sema/gerador-php/dist/index.js +114 -114
- package/node_modules/@sema/gerador-python/dist/index.part02.js +97 -97
- package/node_modules/@sema/gerador-typescript/dist/index.part02.js +145 -145
- package/node_modules/@sema/nucleo/dist/parser/parser.part02.js +3 -0
- package/package.json +1 -1
- package/skills/sema/SKILL.md +13 -2
|
@@ -1,64 +1,12 @@
|
|
|
1
1
|
// SEMA-GOVERNED: sema.produto.cli_init_templates, sema.produto.governanca_ia.drift.cache.modos
|
|
2
2
|
// Descrição: contrato base e dispatcher dos templates multi-agente de inicialização.
|
|
3
|
+
import { separarDemonstracoesTemplate } from "./initProjectPlan.js";
|
|
3
4
|
import { arquivosInitTemplatesBackend } from "./initTemplatesBackend.js";
|
|
4
5
|
import { arquivosInitTemplatesWeb } from "./initTemplatesWeb.js";
|
|
5
6
|
import { arquivosInitTemplatesFlutter } from "./initTemplatesFlutter.js";
|
|
6
7
|
import { arquivosInitTemplatesRuntime } from "./initTemplatesRuntime.js";
|
|
7
8
|
export function arquivosBaseIniciar() {
|
|
8
|
-
return [
|
|
9
|
-
{
|
|
10
|
-
caminhoRelativo: "contratos/pedidos.sema",
|
|
11
|
-
conteudo: `module app.pedidos {
|
|
12
|
-
entity Pedido {
|
|
13
|
-
fields {
|
|
14
|
-
id: Id
|
|
15
|
-
status: Texto
|
|
16
|
-
total: Decimal
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
task criar_pedido {
|
|
21
|
-
input {
|
|
22
|
-
cliente_id: Id required
|
|
23
|
-
total: Decimal required
|
|
24
|
-
}
|
|
25
|
-
output {
|
|
26
|
-
pedido_id: Id
|
|
27
|
-
status: Texto
|
|
28
|
-
}
|
|
29
|
-
rules {
|
|
30
|
-
total > 0
|
|
31
|
-
}
|
|
32
|
-
effects {
|
|
33
|
-
persistencia Pedido criticidade=alta
|
|
34
|
-
auditoria pedidos
|
|
35
|
-
}
|
|
36
|
-
guarantees {
|
|
37
|
-
pedido_id existe
|
|
38
|
-
status existe
|
|
39
|
-
}
|
|
40
|
-
tests {
|
|
41
|
-
caso "pedido valido" {
|
|
42
|
-
given {
|
|
43
|
-
cliente_id: "cli-1"
|
|
44
|
-
total: 10
|
|
45
|
-
}
|
|
46
|
-
expect {
|
|
47
|
-
sucesso: verdadeiro
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
route criar_pedido_publico {
|
|
54
|
-
metodo: POST
|
|
55
|
-
caminho: /pedidos
|
|
56
|
-
task: criar_pedido
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
`,
|
|
60
|
-
},
|
|
61
|
-
];
|
|
9
|
+
return [{ caminhoRelativo: "contratos/.gitkeep", conteudo: "" }];
|
|
62
10
|
}
|
|
63
11
|
function arquivosApoioIaIniciar() {
|
|
64
12
|
return [
|
|
@@ -66,40 +14,25 @@ function arquivosApoioIaIniciar() {
|
|
|
66
14
|
caminhoRelativo: "README.md",
|
|
67
15
|
conteudo: `# Projeto Sema
|
|
68
16
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
## Entrada oficial do Codex
|
|
72
|
-
|
|
73
|
-
Antes de alterar codigo, contrato ou documentacao:
|
|
74
|
-
|
|
75
|
-
1. leia \`AGENTS.md\`;
|
|
76
|
-
2. rode \`sema --version\`; se o shell não localizar o comando, use \`$HOME/.sema/bin/sema\` no macOS/Linux; no Windows, PowerShell usa \`sema.ps1\` no PATH, cmd.exe usa \`sema.cmd\`, e o fallback absoluto é \`& "$env:SystemRoot\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\\.sema\\bin\\sema-managed.ps1" --version\`;
|
|
77
|
-
3. rode \`sema resumo --drift none\` para contexto contratual; score, confiança e implementação ficam não avaliados;
|
|
78
|
-
4. rode \`sema docs-impacto --intencao "<acao>" --json\`;
|
|
79
|
-
5. leia \`docs/commands.md\` antes de escolher comando ou interpretar \`--saida\`;
|
|
80
|
-
6. use \`sema descobrir recomendar --intencao "<objetivo>" --json\` quando não souber qual capacidade ou pipeline aplicar;
|
|
81
|
-
7. use \`exemplos/\` e \`docs/syntax.md\` antes de criar ou corrigir \`.sema\`.
|
|
17
|
+
Sema foi adotado neste projeto. A inicialização prepara configuração, protocolo e exemplos; o contrato de negócio deve representar o pedido do usuário.
|
|
82
18
|
|
|
83
|
-
|
|
19
|
+
1. Use AGENTS.md, SEMA_BOOT.md e sema sessao "<intenção>" --json.
|
|
20
|
+
2. Se ainda não houver contrato aplicável, modele o comportamento solicitado em contratos/ antes de implementar. Consulte somente exemplos pertinentes em exemplos/ para sintaxe.
|
|
21
|
+
3. Valide o contrato e siga os gates locais antes de alterar o código da aplicação.
|
|
84
22
|
|
|
85
|
-
|
|
23
|
+
Contratos já existentes são preservados. Não trate exemplos como funcionalidades solicitadas nem como evidência de implementação.
|
|
86
24
|
|
|
87
|
-
|
|
88
|
-
- \`AGENTS.md\`: entrypoint oficial do Codex.
|
|
89
|
-
- \`exemplos/\`: exemplos oficiais da DSL Sema.
|
|
90
|
-
- \`docs/commands.md\`: catalogo de comandos, pipelines, gates e regra de \`--saida\`.
|
|
91
|
-
- \`docs/syntax.md\`: referencia curta para escrever \`.sema\`.
|
|
92
|
-
- \`docs/ai-workflow.md\`: fluxo minimo para agentes.
|
|
93
|
-
- \`SEMA_BOOT.md\`: regras de operação. A CLI gera somente o resumo correspondente ao perfil e ao orçamento.
|
|
94
|
-
- \`AGENT_CONTEXT_PACK.json\` e \`SEMA_INDEX.json\`: bases internas da CLI, não carregar no contexto da IA.
|
|
25
|
+
## Estrutura
|
|
95
26
|
|
|
96
|
-
|
|
27
|
+
- contratos/: contratos reais do projeto; a inicialização não inventa um domínio.
|
|
28
|
+
- exemplos/: referências da DSL e demonstrações de templates. Não são origens de contratos ativos.
|
|
29
|
+
- AGENTS.md e SEMA_BOOT.md: protocolo de operação.
|
|
30
|
+
- sema.config.json: configuração do projeto.
|
|
31
|
+
- SEMA_INDEX.json e AGENT_CONTEXT_PACK.json: bases internas da CLI, sem leitura integral obrigatória.
|
|
32
|
+
- docs/: referências sob demanda.
|
|
97
33
|
|
|
98
|
-
|
|
34
|
+
Depois de modelar e validar o contrato solicitado, gere o suporte necessário com sema compilar <contrato.sema> --alvo <alvo-configurado> --saida <diretório> e implemente o comportamento real.
|
|
99
35
|
|
|
100
|
-
\`\`\`bash
|
|
101
|
-
sema compilar contratos/pedidos.sema --alvo javascript --saida ./generated/javascript
|
|
102
|
-
\`\`\`
|
|
103
36
|
`,
|
|
104
37
|
},
|
|
105
38
|
];
|
|
@@ -124,6 +57,6 @@ export function arquivosTemplateIniciar(template) {
|
|
|
124
57
|
},
|
|
125
58
|
...arquivosBase,
|
|
126
59
|
];
|
|
127
|
-
return anexarApoioIaSemDuplicar(arquivosTemplate);
|
|
60
|
+
return anexarApoioIaSemDuplicar(separarDemonstracoesTemplate(template, arquivosTemplate));
|
|
128
61
|
}
|
|
129
62
|
//# sourceMappingURL=initTemplatesBase.js.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// SEMA-GOVERNED: sema.produto.governanca_ia.drift
|
|
2
|
+
// Descrição: reconhece declarações em IIFEs e exports CommonJS/browser sem executar código nem exigir ES modules.
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
export function simbolosJavaScriptLocais(source) {
|
|
5
|
+
const nomes = new Set();
|
|
6
|
+
const unwrap = (node) => ts.isParenthesizedExpression(node) ? unwrap(node.expression) : node;
|
|
7
|
+
function bloco(statements, prefixo = "") {
|
|
8
|
+
const objetos = new Map();
|
|
9
|
+
const funcoes = new Set();
|
|
10
|
+
for (const s of statements) {
|
|
11
|
+
if (ts.isFunctionDeclaration(s) && s.name)
|
|
12
|
+
funcoes.add(s.name.text);
|
|
13
|
+
if (ts.isVariableStatement(s))
|
|
14
|
+
for (const d of s.declarationList.declarations) {
|
|
15
|
+
if (!ts.isIdentifier(d.name) || !d.initializer)
|
|
16
|
+
continue;
|
|
17
|
+
const value = unwrap(d.initializer);
|
|
18
|
+
if (ts.isObjectLiteralExpression(value))
|
|
19
|
+
objetos.set(d.name.text, value);
|
|
20
|
+
if (ts.isArrowFunction(value) || ts.isFunctionExpression(value))
|
|
21
|
+
funcoes.add(d.name.text);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
for (const f of funcoes)
|
|
25
|
+
nomes.add(prefixo + f);
|
|
26
|
+
function publicacao(expr) {
|
|
27
|
+
expr = unwrap(expr);
|
|
28
|
+
if (ts.isBinaryExpression(expr) && expr.operatorToken.kind === ts.SyntaxKind.EqualsToken) {
|
|
29
|
+
const left = expr.left.getText(source);
|
|
30
|
+
const publico = /^(?:(?:window|globalThis)\.([\w$]+)|module\.exports|exports)(?:\.([\w$]+))?$/.exec(left);
|
|
31
|
+
if (publico) {
|
|
32
|
+
const value = unwrap(expr.right);
|
|
33
|
+
const nome = [publico[1], publico[2]].filter(Boolean).join(".");
|
|
34
|
+
if (nome && (ts.isFunctionExpression(value) || ts.isArrowFunction(value) || (ts.isIdentifier(value) && funcoes.has(value.text))))
|
|
35
|
+
nomes.add(nome);
|
|
36
|
+
const obj = ts.isObjectLiteralExpression(value) ? value : ts.isIdentifier(value) ? objetos.get(value.text) : undefined;
|
|
37
|
+
for (const prop of obj?.properties ?? []) {
|
|
38
|
+
if (!prop.name || !(ts.isIdentifier(prop.name) || ts.isStringLiteral(prop.name)))
|
|
39
|
+
continue;
|
|
40
|
+
const key = prop.name.text;
|
|
41
|
+
const callable = ts.isMethodDeclaration(prop)
|
|
42
|
+
|| (ts.isShorthandPropertyAssignment(prop) && funcoes.has(key))
|
|
43
|
+
|| (ts.isPropertyAssignment(prop) && (ts.isArrowFunction(unwrap(prop.initializer)) || ts.isFunctionExpression(unwrap(prop.initializer))
|
|
44
|
+
|| (ts.isIdentifier(prop.initializer) && funcoes.has(prop.initializer.text))));
|
|
45
|
+
if (callable)
|
|
46
|
+
nomes.add([nome, key].filter(Boolean).join("."));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (ts.isCallExpression(expr)) {
|
|
51
|
+
const fn = unwrap(expr.expression);
|
|
52
|
+
if ((ts.isFunctionExpression(fn) || ts.isArrowFunction(fn)) && ts.isBlock(fn.body))
|
|
53
|
+
bloco(fn.body.statements);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function visitar(s) {
|
|
57
|
+
if (ts.isExpressionStatement(s))
|
|
58
|
+
publicacao(s.expression);
|
|
59
|
+
// Exports condicionais comuns (typeof module) continuam sendo referências, não prova de execução.
|
|
60
|
+
if (ts.isIfStatement(s)) {
|
|
61
|
+
visitar(s.thenStatement);
|
|
62
|
+
if (s.elseStatement)
|
|
63
|
+
visitar(s.elseStatement);
|
|
64
|
+
}
|
|
65
|
+
if (ts.isBlock(s))
|
|
66
|
+
for (const child of s.statements)
|
|
67
|
+
visitar(child);
|
|
68
|
+
}
|
|
69
|
+
for (const s of statements)
|
|
70
|
+
visitar(s);
|
|
71
|
+
}
|
|
72
|
+
bloco(source.statements);
|
|
73
|
+
return [...nomes];
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=javascriptBindings.js.map
|
package/dist/projetoBusca.js
CHANGED
package/dist/saidaCli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SEMA-GOVERNED: sema.produto.cli_invocacao_publica, sema.produto.cli_invocacao_publica.resultados
|
|
2
2
|
// Descrição: cria e emite os envelopes JSON públicos de controle v1 e resultado v1 da CLI.
|
|
3
3
|
import { criarEnvelopeResultadoCliV1, } from "./resultadoCli.js";
|
|
4
|
+
import { mensagemArgumentosIaPermitida } from "./agentFlowHelp.js";
|
|
4
5
|
export { CODIGO_SAIDA_FATAL_RUNTIME_CLI, SCHEMA_RESULTADO_CLI_V1, criarEnvelopeResultadoCliV1, interpretarPayloadRuntimeCli, } from "./resultadoCli.js";
|
|
5
6
|
export const SCHEMA_CONTROLE_CLI_V1 = "sema.cli.control/v1";
|
|
6
7
|
const CODIGO_PADRAO = {
|
|
@@ -51,6 +52,8 @@ function normalizarCodigoPublico(categoria, codigo) {
|
|
|
51
52
|
return CODIGO_PUBLICO_VALIDO.test(candidato) ? candidato : CODIGO_PADRAO[categoria];
|
|
52
53
|
}
|
|
53
54
|
function normalizarMensagemPublica(categoria, mensagem) {
|
|
55
|
+
if (categoria === "ARGUMENT_ERROR" && mensagemArgumentosIaPermitida(mensagem))
|
|
56
|
+
return mensagem;
|
|
54
57
|
if (categoria !== "HELP") {
|
|
55
58
|
return MENSAGEM_PADRAO[categoria];
|
|
56
59
|
}
|
|
@@ -93,7 +96,7 @@ function envelopeSeguroParaInvocacao(resultado, envelope, mensagemTexto) {
|
|
|
93
96
|
return criarEnvelopeControleJsonV1({
|
|
94
97
|
categoria: resultado,
|
|
95
98
|
codigoPublico: coerente?.code ?? CODIGO_PADRAO[resultado],
|
|
96
|
-
mensagemPublica: resultado === "HELP"
|
|
99
|
+
mensagemPublica: resultado === "HELP" || resultado === "ARGUMENT_ERROR"
|
|
97
100
|
? coerente?.message ?? mensagemTexto ?? MENSAGEM_PADRAO.HELP
|
|
98
101
|
: MENSAGEM_PADRAO[resultado],
|
|
99
102
|
codigoSaida: coerente?.exitCode ?? (resultado === "HELP" ? 0 : 1),
|
package/dist/sessionContext.js
CHANGED
|
@@ -34,7 +34,7 @@ export async function navegarContextoSessao(base, pedido, arquivo) {
|
|
|
34
34
|
resumo: m.purpose,
|
|
35
35
|
arquivos: (m.likelyFiles ?? []).map(relativo),
|
|
36
36
|
})),
|
|
37
|
-
status: encontrados.length === 0 ? "sem_correspondencia" : encontrados.length === 1 ? "contrato_localizado" : "selecionar_contrato",
|
|
37
|
+
status: indice.modulos.length === 0 ? "contrato_necessario" : encontrados.length === 0 ? "sem_correspondencia" : encontrados.length === 1 ? "contrato_localizado" : "selecionar_contrato",
|
|
38
38
|
execucaoAutorizada: false,
|
|
39
39
|
};
|
|
40
40
|
}
|
package/docs/ai-integration.md
CHANGED
|
@@ -28,7 +28,7 @@ Already-open tasks may need a reload. The distribution contains no
|
|
|
28
28
|
MCP server, remote workspace bridge, login, license, billing, token, credit,
|
|
29
29
|
panel, or runtime authorization gate.
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Legacy aliases (fraca, pequena, media, forte, grande) remain compatible; they do not choose the context window. Use the confirmed token profile.
|
|
32
32
|
|
|
33
33
|
## Local-Only Rule
|
|
34
34
|
|
|
@@ -47,18 +47,22 @@ service, control panel, or external authorization request.
|
|
|
47
47
|
## Before Editing
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
|
-
sema docs-impacto --intencao "describe the change" --json
|
|
50
|
+
sema docs-impacto --intencao "describe the change" --arquivo contratos/example.sema --json
|
|
51
51
|
sema inspecionar contratos/example.sema --drift none --json
|
|
52
|
-
sema drift contratos/example.sema --escopo modulo --cache fresh --json
|
|
52
|
+
sema drift contratos/example.sema --escopo modulo --cache fresh --pacote --json
|
|
53
53
|
sema impacto contratos/example.sema --alvo app.example --mudanca "describe the change" --json
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
Read
|
|
56
|
+
Read the required documents listed by `docs-impacto` before changing code, contracts,
|
|
57
57
|
operational docs, generated artifacts, workflows, profiles, or release material.
|
|
58
58
|
A cache hit is acceleration, not evidence: closing requires `--cache fresh`,
|
|
59
59
|
while contract-only queries keep unobserved implementation fields null inside the command payload.
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
Retain mudancaId. Resume with `sema sessao --mudanca-id <id> --json` after compaction.
|
|
62
|
+
Close documentation using `sema finalizar-mudanca --mudanca-id <id> --doc-lida <doc> --json`.
|
|
63
|
+
Repeat --doc-lida for actual readings. Declarations expire when file hashes change; they do not prove behavior.
|
|
64
|
+
|
|
65
|
+
## Configured Context
|
|
62
66
|
|
|
63
67
|
All context capacities start with AGENTS.md, SEMA_BOOT.md and sema sessao.
|
|
64
68
|
The first session asks for the effective window in tokens. Declare --janela-contexto
|
package/docs/ai-workflow.md
CHANGED
|
@@ -6,15 +6,15 @@ This is the minimum workflow for Codex in a local workspace.
|
|
|
6
6
|
1. Read `SEMA_BOOT.md`.
|
|
7
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
8
|
3. Run `sema sessao "<intenção>" --json`; then `sema resumo <contrato> --micro --drift none --json` only for the selected contract.
|
|
9
|
-
4. Run `sema docs-impacto --intencao "<change>" --arquivo <contract> --json`.
|
|
9
|
+
4. Run `sema docs-impacto --intencao "<change>" --arquivo <contract> --json` and retain mudancaId. After compaction, resume `sema sessao --mudanca-id <id> --json`.
|
|
10
10
|
5. Read every required document returned by the command.
|
|
11
11
|
6. Consult command help or the relevant section of `docs/commands.md` when syntax, a gate or `--saida` is unclear.
|
|
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 --cache fresh` and `sema impacto` before editing existing code.
|
|
14
|
+
9. Run `sema drift <contract> --cache fresh --pacote --json` and `sema impacto` before editing existing code.
|
|
15
15
|
10. For a new module with a validated contract, scaffold with `sema compilar <contract> --alvo <default target>`, fill the real implementation keeping `impl`/`vinculos`, and close with `sema verificar`.
|
|
16
16
|
11. Run `sema formatar` and `sema validar` after changing a `.sema` contract.
|
|
17
|
-
12. Run `sema finalizar-mudanca
|
|
17
|
+
12. Run `sema finalizar-mudanca --mudanca-id <id> --doc-lida <doc> --json`, repeating --doc-lida for actual readings. The id preserves intention and files; declarations expire when hashes change. This checks documentation, not comprehension or behavior; validation, drift and tests remain separate.
|
|
18
18
|
|
|
19
19
|
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`.
|
|
20
20
|
|
package/docs/cli.md
CHANGED
|
@@ -170,7 +170,7 @@ gate.
|
|
|
170
170
|
- `sema drift`: compare contracts and implementation with `--cache none|cache|fresh` (default `fresh`).
|
|
171
171
|
- `sema impacto`: map the blast radius of a planned change.
|
|
172
172
|
- `sema docs-impacto`: identify docs that must be read or updated.
|
|
173
|
-
- `sema finalizar-mudanca`:
|
|
173
|
+
- `sema finalizar-mudanca`: check reading declarations and hashes for the scope saved by `docs-impacto`; use `--mudanca-id`. Does not run or replace validation, drift or application tests.
|
|
174
174
|
- `sema compilar`: generate code from contracts.
|
|
175
175
|
- `sema testar`: generate, compile, and execute local contract tests, including `dotnet` and `cpp`.
|
|
176
176
|
- `sema verificar`: run the final local verification bundle.
|
package/docs/commands.md
CHANGED
|
@@ -9,7 +9,7 @@ Use this file when Codex does not know which command to run. A Sema command is a
|
|
|
9
9
|
sema --version
|
|
10
10
|
sema sessao "<intencao>" --json
|
|
11
11
|
sema resumo --drift none
|
|
12
|
-
sema docs-impacto --intencao "<acao>" --json
|
|
12
|
+
sema docs-impacto --intencao "<acao>" --arquivo <contract> --json
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
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.
|
|
@@ -45,11 +45,11 @@ Then read every required doc returned by `docs-impacto`.
|
|
|
45
45
|
|
|
46
46
|
## Change and Closure
|
|
47
47
|
|
|
48
|
-
- `sema docs-impacto --intencao "<acao>" --json`: discovers required docs and
|
|
48
|
+
- `sema docs-impacto --intencao "<acao>" --arquivo <contract> --json`: discovers required docs and returns mudancaId with next argument arrays.
|
|
49
49
|
- `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.
|
|
50
50
|
- `sema impacto <arquivo-ou-pasta> --alvo <token> --mudanca "<descricao>" --json`: maps impact before changing behavior.
|
|
51
51
|
- `sema verificar <arquivo-ou-pasta> --json`: runs aggregated final verification.
|
|
52
|
-
- `sema finalizar-mudanca --
|
|
52
|
+
- `sema finalizar-mudanca --mudanca-id <id> --doc-lida <arquivo> --json`: checks scoped reading declarations and file hashes, not comprehension or application behavior. Repeat --doc-lida for actual readings. Explicit --intencao and --arquivo remain supported.
|
|
53
53
|
|
|
54
54
|
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. `payload.vinculos_fora_do_escopo` is informational: the file exists in the workspace outside `diretoriosCodigo`, and each entry carries a `diretorioSugerido` for `sema.config.json`.
|
|
55
55
|
|
|
@@ -91,6 +91,10 @@ Ready UI rule: if the task generates an app, site, dashboard, form, or static HT
|
|
|
91
91
|
|
|
92
92
|
## Codex and Context
|
|
93
93
|
|
|
94
|
+
Project initialization creates configuration and agent rules without inventing a business contract.
|
|
95
|
+
Demonstrations stay under exemplos/; active contracts are authored in contratos/ for the actual request.
|
|
96
|
+
An adopted workspace with no contracts returns contrato_necessario and does not validate an application.
|
|
97
|
+
|
|
94
98
|
The CLI selects context files before generation: micro up to 32,768 tokens,
|
|
95
99
|
short up to 131,072, expanded above that. The budget may lower the selected
|
|
96
100
|
level further. Only the matching summary is materialized; other variants
|
package/docs/documentation.md
CHANGED
|
@@ -9,7 +9,7 @@ Public Sema documentation is English and local-only.
|
|
|
9
9
|
## Required Flow
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
sema docs-impacto --intencao "describe the change" --json
|
|
12
|
+
sema docs-impacto --intencao "describe the change" --arquivo contratos/app.sema --json
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
The result lists:
|
|
@@ -19,16 +19,31 @@ The result lists:
|
|
|
19
19
|
- `docsCriadas`: generated draft docs that must be completed by Codex;
|
|
20
20
|
- `bloqueios`: blocking diagnostics.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Retain `mudancaId` and `proximasChamadas` (arrays of CLI arguments, not shell
|
|
23
|
+
strings). Before closing, declare the required documents actually read:
|
|
23
24
|
|
|
24
25
|
```bash
|
|
25
26
|
sema finalizar-mudanca \
|
|
26
|
-
--
|
|
27
|
+
--mudanca-id <returned-id> \
|
|
27
28
|
--doc-lida README.md \
|
|
28
29
|
--doc-lida docs/documentation.md \
|
|
29
30
|
--json
|
|
30
31
|
```
|
|
31
32
|
|
|
33
|
+
Repeat `--doc-lida` for every required reading. Sema cannot observe a client's
|
|
34
|
+
read tool or prove comprehension. It checks declarations against existing files
|
|
35
|
+
and stores SHA-256 hashes in `.sema/mudancas/<id>.json`. Unchanged declarations
|
|
36
|
+
can be reused; changed or removed documents invalidate them. Missing files,
|
|
37
|
+
missing scope, and scope conflicting with the id block closure.
|
|
38
|
+
|
|
39
|
+
Resume after compaction with `sema sessao --mudanca-id <id> --json`. The original
|
|
40
|
+
intention and target files remain fixed. For an independent change, open another
|
|
41
|
+
`docs-impacto` with explicit intention and targets. Legacy explicit closure with
|
|
42
|
+
`--intencao` and repeated `--arquivo` remains supported; intention-only closure
|
|
43
|
+
is rejected. The result distinguishes `documentacao_conferida` from pending
|
|
44
|
+
documentation. Run contract validation, fresh drift and application tests
|
|
45
|
+
separately; this command does not execute or certify them.
|
|
46
|
+
|
|
32
47
|
## Public Docs Rules
|
|
33
48
|
|
|
34
49
|
- Write public docs in English.
|
|
@@ -72,7 +87,7 @@ through `vinculos.arquivo`. Required expansion follows declared `use` dependenci
|
|
|
72
87
|
with reasons and originating contracts. Missing or ambiguous dependencies block.
|
|
73
88
|
`docs.arquivo` references are recommendations and do not expand the dependency
|
|
74
89
|
graph. Intent suggestions stay in `leituraRecomendada`, distinct from
|
|
75
|
-
`leituraObrigatoria`, and do not block closure.
|
|
90
|
+
`leituraObrigatoria`, and do not block closure. Retain the id or pass the same target at closure
|
|
76
91
|
and confirm the selected contracts before editing code.
|
|
77
92
|
|
|
78
93
|
The context-budget and docs-relevancia tests measure actual CLI output, prove
|
package/docs/getting-started.md
CHANGED
|
@@ -48,12 +48,20 @@ depend on `PATH`.
|
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
50
|
sema descobrir explicar flow.project-adoption --json
|
|
51
|
-
sema iniciar --template base
|
|
51
|
+
sema iniciar --template base --janela-contexto 32768 # example: confirmed window
|
|
52
52
|
sema sync-codex --json
|
|
53
|
-
sema
|
|
53
|
+
sema sessao "describe the requested application" --json
|
|
54
|
+
# Model the actual request in contratos/app.sema before implementation.
|
|
55
|
+
sema validar contratos/app.sema --json
|
|
54
56
|
sema resumo --drift none
|
|
55
57
|
```
|
|
56
58
|
|
|
59
|
+
Initialization creates no business contracts. Examples and template demonstrations
|
|
60
|
+
stay under `exemplos/`, outside the active contract origins. Existing contracts are
|
|
61
|
+
preserved. An empty adopted project asks for the actual requested contract and
|
|
62
|
+
does not claim that an application has been validated. Confirm the configured
|
|
63
|
+
context window; 32,768 above is only an example.
|
|
64
|
+
|
|
57
65
|
Run this sequence only after explicit project-adoption authorization. The
|
|
58
66
|
`sema iniciar` command preserves existing project files and refuses symlink or
|
|
59
67
|
junction escapes. The bootstrap skill never uses `--force`; explicit overwrite
|