@semacode/cli 4.2.5 → 4.2.7
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 +5 -4
- package/dist/agentContextPack.js +9 -9
- package/dist/agentEntryPoints.js +37 -12
- package/dist/agentFlowHelp.d.ts +4 -0
- package/dist/agentFlowHelp.js +38 -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 +27 -0
- package/dist/contexto.js +2 -2
- package/dist/discovery/catalog.js +1 -1
- package/dist/docs.part02.js +2 -2
- package/dist/drift.part01.d.ts +5 -1
- package/dist/drift.part06.js +4 -0
- package/dist/drift.part11.js +18 -0
- package/dist/drift.part13.js +1 -1
- package/dist/driftPack.d.ts +4 -0
- package/dist/driftPack.js +8 -2
- 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 +4 -73
- package/dist/index.part06.js +3 -55
- package/dist/javascriptBindings.d.ts +2 -0
- package/dist/javascriptBindings.js +75 -0
- package/dist/saidaCli.js +4 -1
- package/docs/ai-integration.md +9 -5
- package/docs/ai-workflow.md +4 -4
- package/docs/cli.md +1 -1
- package/docs/commands.md +3 -3
- package/docs/documentation.md +19 -4
- package/docs/syntax.md +21 -0
- 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/index.d.ts +3 -0
- package/node_modules/@sema/nucleo/dist/index.js +4 -1
- package/node_modules/@sema/nucleo/dist/lexer/lexer.js +13 -0
- package/node_modules/@sema/nucleo/dist/parser/parser.declaracoes.js +14 -5
- package/node_modules/@sema/nucleo/dist/parser/parser.modulo.js +7 -5
- package/node_modules/@sema/nucleo/dist/parser/parser.part02.d.ts +3 -1
- package/node_modules/@sema/nucleo/dist/parser/parser.part02.js +60 -18
- package/node_modules/@sema/nucleo/dist/parser/parser.part03.js +2 -2
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part01.js +11 -2
- package/package.json +1 -1
- package/skills/sema/SKILL.md +15 -0
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/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.
|
|
15
|
-
10. For a new module
|
|
14
|
+
9. Run `sema drift <contract> --cache fresh --pacote --json` and `sema impacto` before editing existing code.
|
|
15
|
+
10. For a new module, plan each task's `impl` and `vinculos` before code. Validate, scaffold with `sema compilar <contract> --alvo <default target>`, then implement those symbols and files. Pending references become verified only after fresh drift; a `SEMA-GOVERNED` header alone does not link a task. Test the application and run `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
|
|
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/syntax.md
CHANGED
|
@@ -36,6 +36,11 @@ module app.example {
|
|
|
36
36
|
guarantees {
|
|
37
37
|
item existe
|
|
38
38
|
}
|
|
39
|
+
impl { js: app.createItem }
|
|
40
|
+
vinculos {
|
|
41
|
+
arquivo: "app.js"
|
|
42
|
+
simbolo: app.createItem
|
|
43
|
+
}
|
|
39
44
|
tests {
|
|
40
45
|
caso "creates valid item" {
|
|
41
46
|
given { name: "Item" }
|
|
@@ -46,6 +51,22 @@ module app.example {
|
|
|
46
51
|
}
|
|
47
52
|
```
|
|
48
53
|
|
|
54
|
+
Plan the task-to-function and task-to-file mapping when creating the contract.
|
|
55
|
+
These references are pending until implementation exists; confirm them with fresh drift.
|
|
56
|
+
An implementation identifier is a symbol, not a filename. Put `impl` inside the
|
|
57
|
+
task, never at module level. Link shared HTML/CSS with module-level
|
|
58
|
+
`vinculos { arquivo: "index.html" arquivo: "style.css" }`; do not invent JavaScript
|
|
59
|
+
implementations for assets. A `SEMA-GOVERNED` header identifies the owning contract
|
|
60
|
+
but does not replace these mappings. Multiple tasks can reference the same file.
|
|
61
|
+
|
|
62
|
+
## Enums and Module Boundaries
|
|
63
|
+
|
|
64
|
+
`enum Filtro { todas, pendentes, concluidas }` is valid. Do not wrap values in
|
|
65
|
+
`valores { ... }`. Each file contains one module, with all declarations inside it.
|
|
66
|
+
Malformed enums, trailing declarations, duplicate mapping blocks and arrow-style
|
|
67
|
+
bindings are errors with a location and repair hint. Fix them before using counts
|
|
68
|
+
from a recovered AST. An entity-only module may legitimately have no tasks.
|
|
69
|
+
|
|
49
70
|
## Common Blocks
|
|
50
71
|
|
|
51
72
|
- `docs`: module summary and notes.
|