@semacode/cli 3.13.1 → 4.1.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 (76) hide show
  1. package/dist/cliGrammar.js +16 -5
  2. package/dist/cliHelpTexto.js +4 -3
  3. package/dist/contextPack.d.ts +75 -0
  4. package/dist/contextPack.js +133 -0
  5. package/dist/driftPack.d.ts +65 -0
  6. package/dist/driftPack.js +96 -0
  7. package/dist/entrypointPack.d.ts +47 -0
  8. package/dist/entrypointPack.js +79 -0
  9. package/dist/index.part05.js +7 -1
  10. package/dist/index.part06.js +48 -17
  11. package/dist/index.part07.d.ts +1 -1
  12. package/dist/index.part07.js +16 -2
  13. package/dist/index.part08.js +1 -1
  14. package/dist/indexPack.d.ts +54 -0
  15. package/dist/indexPack.js +146 -0
  16. package/dist/init/templates.part01.js +393 -393
  17. package/dist/init/templates.part02.js +189 -189
  18. package/dist/initTemplatesBackend.js +73 -73
  19. package/dist/initTemplatesFlutter.js +137 -137
  20. package/dist/initTemplatesRuntime.js +350 -350
  21. package/dist/initTemplatesWeb.js +309 -309
  22. package/dist/sync/index.js +35 -35
  23. package/docs/auth.md +26 -26
  24. package/docs/database.md +15 -15
  25. package/docs/env.md +16 -16
  26. package/docs/frontend.md +41 -41
  27. package/docs/i18n.md +15 -15
  28. package/exemplos/agendamento.sema +1 -1
  29. package/exemplos/assinatura.sema +1 -1
  30. package/exemplos/auditoria.sema +1 -1
  31. package/exemplos/autenticacao.sema +1 -1
  32. package/exemplos/author_obra_comum.sema +1 -1
  33. package/exemplos/author_tema_sensivel.sema +1 -1
  34. package/exemplos/automacao.sema +1 -1
  35. package/exemplos/cadastro_usuario.sema +1 -1
  36. package/exemplos/calculadora.sema +1 -1
  37. package/exemplos/crud_simples.sema +1 -1
  38. package/exemplos/estoque.sema +1 -1
  39. package/exemplos/exportacao.sema +1 -1
  40. package/exemplos/fila.sema +1 -1
  41. package/exemplos/integracao_externa.sema +1 -1
  42. package/exemplos/multi_tenant.sema +1 -1
  43. package/exemplos/notificacao.sema +1 -1
  44. package/exemplos/operacao_estrategia.sema +132 -132
  45. package/exemplos/operacao_estrategia_discovery.sema +220 -220
  46. package/exemplos/operacao_estrategia_fluxo.sema +114 -114
  47. package/exemplos/operacao_estrategia_gates.sema +106 -106
  48. package/exemplos/operacao_estrategia_quarentena.sema +133 -133
  49. package/exemplos/operacao_estrategia_rollout.sema +124 -124
  50. package/exemplos/pagamento.sema +1 -1
  51. package/exemplos/pagamento_dominio.sema +1 -1
  52. package/exemplos/pedido.sema +1 -1
  53. package/exemplos/permissao.sema +1 -1
  54. package/exemplos/persistencia_vendor_first.sema +1 -1
  55. package/exemplos/php_crud.sema +170 -170
  56. package/exemplos/profile_conversas.sema +165 -165
  57. package/exemplos/profile_game.sema +1 -1
  58. package/exemplos/profile_legal.sema +1 -1
  59. package/exemplos/profile_ops.sema +1 -1
  60. package/exemplos/profile_research.sema +1 -1
  61. package/exemplos/profile_software.sema +1 -1
  62. package/exemplos/profile_workflow_n8n.sema +1 -1
  63. package/exemplos/relatorio.sema +1 -1
  64. package/exemplos/replica_analitica_erp.sema +1 -1
  65. package/exemplos/testes_embutidos.sema +1 -1
  66. package/exemplos/tratamento_erro.sema +1 -1
  67. package/exemplos/upload_arquivo.sema +1 -1
  68. package/exemplos/webhook.sema +1 -1
  69. package/node_modules/@sema/gerador-cpp/dist/index.js +176 -176
  70. package/node_modules/@sema/gerador-css/dist/index.part01.js +10 -10
  71. package/node_modules/@sema/gerador-dotnet/dist/index.js +169 -169
  72. package/node_modules/@sema/gerador-html/dist/index.js +17 -17
  73. package/node_modules/@sema/gerador-python/dist/index.part02.js +3 -3
  74. package/node_modules/@sema/gerador-typescript/dist/index.part02.js +11 -11
  75. package/node_modules/@sema/nucleo/dist/diagnosticos/melhorador.js +42 -42
  76. package/package.json +1 -1
@@ -46,25 +46,25 @@ export async function gerarSchemaPrisma(pastaContratos, saidaSchema, datasourceP
46
46
  for (const contrato of contratos) {
47
47
  const nomeModel = path.basename(contrato, '.sema').replace(/\./g, '_');
48
48
  // Schema simplificado - em producao, fazer parsing real do contrato
49
- models += `\nmodel ${nomeModel.charAt(0).toUpperCase() + nomeModel.slice(1)} {
50
- id String @id @default(uuid())
51
- criadoEm DateTime @default(now())
52
- // Gerado a partir de: ${contrato}
53
- // TODO: Adicionar campos do contrato Sema
49
+ models += `\nmodel ${nomeModel.charAt(0).toUpperCase() + nomeModel.slice(1)} {
50
+ id String @id @default(uuid())
51
+ criadoEm DateTime @default(now())
52
+ // Gerado a partir de: ${contrato}
53
+ // TODO: Adicionar campos do contrato Sema
54
54
  }\n`;
55
55
  modelCount++;
56
56
  }
57
- const schema = `// Gerado automaticamente pelo Sema
58
- // Fonte: ${pastaContratos}
59
-
60
- generator client {
61
- provider = "prisma-client-js"
62
- }
63
-
64
- datasource db {
65
- provider = "${datasourceProvider}"
66
- url = env("SEMA_PRISMA_URL")
67
- }
57
+ const schema = `// Gerado automaticamente pelo Sema
58
+ // Fonte: ${pastaContratos}
59
+
60
+ generator client {
61
+ provider = "prisma-client-js"
62
+ }
63
+
64
+ datasource db {
65
+ provider = "${datasourceProvider}"
66
+ url = env("SEMA_PRISMA_URL")
67
+ }
68
68
  ${models}`;
69
69
  // Salvar
70
70
  fs.writeFileSync(saidaSchema, schema, 'utf-8');
@@ -90,25 +90,25 @@ export async function importarSchemaPrisma(caminhoSchema, pastaSaida, nomeModulo
90
90
  const nomeContrato = `${nomeModel.toLowerCase()}.sema`;
91
91
  const caminhoContrato = path.join(pastaSaida, nomeContrato);
92
92
  // Gerar contrato basico
93
- const conteudo = `module ${nomeModulo}.${nomeModel.toLowerCase()} {
94
- entity ${nomeModel} {
95
- fields {
96
- id: Id
97
- // TODO: Mapear campos do schema Prisma
98
- }
99
- }
100
-
101
- task criar_${nomeModel.toLowerCase()} {
102
- input {
103
- // TODO: Definir inputs
104
- }
105
- output {
106
- ${nomeModel.toLowerCase()}: ${nomeModel}
107
- }
108
- effects {
109
- persistencia ${nomeModel}
110
- }
111
- }
93
+ const conteudo = `module ${nomeModulo}.${nomeModel.toLowerCase()} {
94
+ entity ${nomeModel} {
95
+ fields {
96
+ id: Id
97
+ // TODO: Mapear campos do schema Prisma
98
+ }
99
+ }
100
+
101
+ task criar_${nomeModel.toLowerCase()} {
102
+ input {
103
+ // TODO: Definir inputs
104
+ }
105
+ output {
106
+ ${nomeModel.toLowerCase()}: ${nomeModel}
107
+ }
108
+ effects {
109
+ persistencia ${nomeModel}
110
+ }
111
+ }
112
112
  }`;
113
113
  fs.writeFileSync(caminhoContrato, conteudo, 'utf-8');
114
114
  contratos.push(caminhoContrato);
package/docs/auth.md CHANGED
@@ -1,26 +1,26 @@
1
- # Local Runtime Boundary
2
-
3
- The public Sema CLI executes directly against the local workspace. It does not
4
- require a Sema login, user authentication, product authorization, license
5
- activation, install key, token, credits, billing service, control panel, or an
6
- external request.
7
-
8
- Use local commands:
9
-
10
- ```bash
11
- sema --version
12
- sema resumo
13
- sema validar contratos/example.sema --json
14
- ```
15
-
16
- The repository license governs use and redistribution. It is not checked as a
17
- runtime activation mechanism.
18
-
19
- An `authz` block inside a `.sema` contract describes authorization in the
20
- application being governed. It does not authenticate a person before the Sema
21
- CLI can run.
22
-
23
- Do not put private or sensitive operational material in this repository.
24
-
25
- Application-specific authentication belongs in the application repository that
26
- owns it.
1
+ # Local Runtime Boundary
2
+
3
+ The public Sema CLI executes directly against the local workspace. It does not
4
+ require a Sema login, user authentication, product authorization, license
5
+ activation, install key, token, credits, billing service, control panel, or an
6
+ external request.
7
+
8
+ Use local commands:
9
+
10
+ ```bash
11
+ sema --version
12
+ sema resumo
13
+ sema validar contratos/example.sema --json
14
+ ```
15
+
16
+ The repository license governs use and redistribution. It is not checked as a
17
+ runtime activation mechanism.
18
+
19
+ An `authz` block inside a `.sema` contract describes authorization in the
20
+ application being governed. It does not authenticate a person before the Sema
21
+ CLI can run.
22
+
23
+ Do not put private or sensitive operational material in this repository.
24
+
25
+ Application-specific authentication belongs in the application repository that
26
+ owns it.
package/docs/database.md CHANGED
@@ -1,15 +1,15 @@
1
- # Database Boundary
2
-
3
- The public Sema CLI does not require a database.
4
-
5
- Sema reads contracts and source files from the local workspace. Any database used
6
- by an application governed by Sema belongs to that application, not to the public
7
- Sema CLI distribution.
8
-
9
- ## Public Rule
10
-
11
- Do not ship private database material, real credentials, operational schemas, or
12
- project-specific data in the public Sema package.
13
-
14
- Application-specific database docs should live in the application repository
15
- that owns the database.
1
+ # Database Boundary
2
+
3
+ The public Sema CLI does not require a database.
4
+
5
+ Sema reads contracts and source files from the local workspace. Any database used
6
+ by an application governed by Sema belongs to that application, not to the public
7
+ Sema CLI distribution.
8
+
9
+ ## Public Rule
10
+
11
+ Do not ship private database material, real credentials, operational schemas, or
12
+ project-specific data in the public Sema package.
13
+
14
+ Application-specific database docs should live in the application repository
15
+ that owns the database.
package/docs/env.md CHANGED
@@ -1,16 +1,16 @@
1
- # Environment
2
-
3
- The public Sema CLI works without private service credentials. No environment
4
- variable unlocks local execution: there is no login, activation, product
5
- authorization, license-key, billing, credit, token, or panel gate.
6
-
7
- Allowed public examples may use placeholders:
8
-
9
- ```bash
10
- EXAMPLE_API_KEY=replace-me
11
- ```
12
-
13
- Do not publish private or sensitive operational material in public Sema docs.
14
-
15
- If an application governed by Sema needs environment variables, document them in
16
- that application repository.
1
+ # Environment
2
+
3
+ The public Sema CLI works without private service credentials. No environment
4
+ variable unlocks local execution: there is no login, activation, product
5
+ authorization, license-key, billing, credit, token, or panel gate.
6
+
7
+ Allowed public examples may use placeholders:
8
+
9
+ ```bash
10
+ EXAMPLE_API_KEY=replace-me
11
+ ```
12
+
13
+ Do not publish private or sensitive operational material in public Sema docs.
14
+
15
+ If an application governed by Sema needs environment variables, document them in
16
+ that application repository.
package/docs/frontend.md CHANGED
@@ -1,41 +1,41 @@
1
- # User Experience Quality
2
-
3
- When Sema governs a UI, dashboard, app, site, game, or terminal tool, the
4
- experience must be modern, contextual, and verified. This is a quality gate, not
5
- decoration.
6
-
7
- ## Before Building
8
-
9
- Define:
10
-
11
- - audience and domain
12
- - primary workflow
13
- - density and information hierarchy
14
- - interaction states
15
- - responsive behavior
16
- - accessibility basics
17
- - evidence needed before closing
18
-
19
- ## Browser Evidence
20
-
21
- For web UI, check desktop and mobile. On a narrow viewport such as 390px, this
22
- must be true:
23
-
24
- ```js
25
- document.documentElement.scrollWidth <= document.documentElement.clientWidth
26
- ```
27
-
28
- Fix overlapping text, broken wrapping, hidden controls, and incoherent layout
29
- before closing the change.
30
-
31
- ## Terminal Evidence
32
-
33
- For CLI/TUI work, smoke-check:
34
-
35
- - `--help`
36
- - success output
37
- - error output
38
- - JSON output when supported
39
-
40
- The public Sema CLI itself must stay local-only and must not depend on private
41
- or sensitive operational material for these checks.
1
+ # User Experience Quality
2
+
3
+ When Sema governs a UI, dashboard, app, site, game, or terminal tool, the
4
+ experience must be modern, contextual, and verified. This is a quality gate, not
5
+ decoration.
6
+
7
+ ## Before Building
8
+
9
+ Define:
10
+
11
+ - audience and domain
12
+ - primary workflow
13
+ - density and information hierarchy
14
+ - interaction states
15
+ - responsive behavior
16
+ - accessibility basics
17
+ - evidence needed before closing
18
+
19
+ ## Browser Evidence
20
+
21
+ For web UI, check desktop and mobile. On a narrow viewport such as 390px, this
22
+ must be true:
23
+
24
+ ```js
25
+ document.documentElement.scrollWidth <= document.documentElement.clientWidth
26
+ ```
27
+
28
+ Fix overlapping text, broken wrapping, hidden controls, and incoherent layout
29
+ before closing the change.
30
+
31
+ ## Terminal Evidence
32
+
33
+ For CLI/TUI work, smoke-check:
34
+
35
+ - `--help`
36
+ - success output
37
+ - error output
38
+ - JSON output when supported
39
+
40
+ The public Sema CLI itself must stay local-only and must not depend on private
41
+ or sensitive operational material for these checks.
package/docs/i18n.md CHANGED
@@ -1,15 +1,15 @@
1
- # Language And Identifiers
2
-
3
- Public Sema documentation is English.
4
-
5
- Do not translate commands, file paths, package names, endpoint paths, environment
6
- variable names, code symbols, DSL keywords, or brand names.
7
-
8
- Examples:
9
-
10
- - Keep `sema validar`, not an English paraphrase.
11
- - Keep `.sema`, `task`, `input`, `output`, `rules`, `effects`, and `guarantees`.
12
- - Keep package names such as `@semacode/cli`.
13
-
14
- Human-facing prose should be clear English. Contract DSL can keep its own
15
- keywords and domain identifiers.
1
+ # Language And Identifiers
2
+
3
+ Public Sema documentation is English.
4
+
5
+ Do not translate commands, file paths, package names, endpoint paths, environment
6
+ variable names, code symbols, DSL keywords, or brand names.
7
+
8
+ Examples:
9
+
10
+ - Keep `sema validar`, not an English paraphrase.
11
+ - Keep `.sema`, `task`, `input`, `output`, `rules`, `effects`, and `guarantees`.
12
+ - Keep package names such as `@semacode/cli`.
13
+
14
+ Human-facing prose should be clear English. Contract DSL can keep its own
15
+ keywords and domain identifiers.
@@ -102,4 +102,4 @@ module exemplos.agendamento {
102
102
  }
103
103
  }
104
104
  }
105
- }
105
+ }
@@ -130,4 +130,4 @@ module exemplos.assinatura {
130
130
  }
131
131
  }
132
132
  }
133
- }
133
+ }
@@ -86,4 +86,4 @@ module exemplos.auditoria {
86
86
  }
87
87
  }
88
88
  }
89
- }
89
+ }
@@ -122,4 +122,4 @@ module exemplos.autenticacao {
122
122
  }
123
123
  }
124
124
  }
125
- }
125
+ }
@@ -291,4 +291,4 @@ module exemplos.author.obra_comum {
291
291
  auditoria author_flow criticidade = media
292
292
  }
293
293
  }
294
- }
294
+ }
@@ -261,4 +261,4 @@ module exemplos.author.tema_sensivel {
261
261
  auditoria author_flow_sensivel criticidade = alta
262
262
  }
263
263
  }
264
- }
264
+ }
@@ -104,4 +104,4 @@ module exemplos.automacao {
104
104
  etapa auditar usa registrar_auditoria com protocolo = receber.protocolo depende_de receber
105
105
  etapa registrar_falha usa registrar_falha_onboarding com lead_id = lead_id depende_de receber
106
106
  }
107
- }
107
+ }
@@ -51,4 +51,4 @@ module exemplos.cadastro.usuario {
51
51
  }
52
52
  }
53
53
  }
54
- }
54
+ }
@@ -75,4 +75,4 @@ module exemplos.calculadora {
75
75
  }
76
76
  }
77
77
  }
78
- }
78
+ }
@@ -86,4 +86,4 @@ module exemplos.crud.simples {
86
86
  produto: Produto
87
87
  }
88
88
  }
89
- }
89
+ }
@@ -124,4 +124,4 @@ module exemplos.estoque {
124
124
  }
125
125
  }
126
126
  }
127
- }
127
+ }
@@ -91,4 +91,4 @@ module exemplos.exportacao {
91
91
  }
92
92
  }
93
93
  }
94
- }
94
+ }
@@ -127,4 +127,4 @@ module exemplos.fila {
127
127
  }
128
128
  }
129
129
  }
130
- }
130
+ }
@@ -91,4 +91,4 @@ module exemplos.integracao.externa {
91
91
  }
92
92
  }
93
93
  }
94
- }
94
+ }
@@ -137,4 +137,4 @@ module exemplos.multi.tenant {
137
137
  }
138
138
  }
139
139
  }
140
- }
140
+ }
@@ -146,4 +146,4 @@ module exemplos.notificacao {
146
146
  etapa registrar_falha_push usa registrar_falha_notificacao com canal = canal_push depende_de push
147
147
  etapa concluir usa confirmar_notificacao com destinatario_id = destinatario_id depende_de email
148
148
  }
149
- }
149
+ }