@semacode/cli 0.9.0 → 1.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.
- package/README.md +11 -3
- package/dist/index.js +706 -55
- package/dist/index.js.map +1 -1
- package/docs/AGENT_STARTER.md +10 -4
- package/docs/como-ensinar-a-sema-para-ia.md +17 -11
- package/docs/fluxo-pratico-ia-sema.md +42 -38
- package/docs/instalacao-e-primeiro-uso.md +189 -0
- package/docs/integracao-com-ia.md +228 -0
- package/docs/pagamento-ponta-a-ponta.md +155 -0
- package/docs/prompt-base-ia-sema.md +10 -3
- package/docs/sintaxe.md +267 -0
- package/exemplos/automacao.sema +107 -0
- package/exemplos/cadastro_usuario.sema +54 -0
- package/exemplos/calculadora.sema +78 -0
- package/exemplos/crud_simples.sema +89 -0
- package/exemplos/operacao_estrategia.sema +402 -0
- package/exemplos/pagamento.sema +222 -0
- package/exemplos/pagamento_dominio.sema +35 -0
- package/exemplos/testes_embutidos.sema +45 -0
- package/exemplos/tratamento_erro.sema +157 -0
- package/node_modules/@sema/gerador-dart/package.json +1 -1
- package/node_modules/@sema/gerador-python/package.json +1 -1
- package/node_modules/@sema/gerador-typescript/package.json +1 -1
- package/node_modules/@sema/nucleo/package.json +1 -1
- package/node_modules/@sema/padroes/package.json +1 -1
- package/package.json +7 -6
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module exemplos.pagamento.dominio {
|
|
2
|
+
docs {
|
|
3
|
+
resumo: "Contratos de dominio compartilhados pelo vertical oficial de pagamento da Sema 0.5."
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
entity Pagamento {
|
|
7
|
+
fields {
|
|
8
|
+
id: Id
|
|
9
|
+
valor: Decimal
|
|
10
|
+
status: StatusPagamento
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
enum StatusPagamento {
|
|
15
|
+
PENDENTE,
|
|
16
|
+
AUTORIZADO,
|
|
17
|
+
RECUSADO,
|
|
18
|
+
PROCESSADO
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
state ciclo_pagamento {
|
|
22
|
+
fields {
|
|
23
|
+
status: StatusPagamento
|
|
24
|
+
conciliado: Booleano
|
|
25
|
+
}
|
|
26
|
+
invariants {
|
|
27
|
+
status existe
|
|
28
|
+
}
|
|
29
|
+
transitions {
|
|
30
|
+
PENDENTE -> AUTORIZADO
|
|
31
|
+
AUTORIZADO -> PROCESSADO
|
|
32
|
+
PENDENTE -> RECUSADO
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module exemplos.testes.embutidos {
|
|
2
|
+
task validar_documento {
|
|
3
|
+
input {
|
|
4
|
+
documento: Texto required
|
|
5
|
+
}
|
|
6
|
+
output {
|
|
7
|
+
valido: Booleano
|
|
8
|
+
motivo: Texto
|
|
9
|
+
}
|
|
10
|
+
rules {
|
|
11
|
+
documento deve_ser preenchido
|
|
12
|
+
}
|
|
13
|
+
effects {
|
|
14
|
+
auditoria validacao_documento
|
|
15
|
+
}
|
|
16
|
+
guarantees {
|
|
17
|
+
valido existe
|
|
18
|
+
motivo existe
|
|
19
|
+
}
|
|
20
|
+
tests {
|
|
21
|
+
caso "documento valido" {
|
|
22
|
+
given {
|
|
23
|
+
documento: 12345678900
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
expect {
|
|
27
|
+
sucesso: verdadeiro
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
caso "documento vazio" {
|
|
31
|
+
given {
|
|
32
|
+
documento: ""
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
expect {
|
|
36
|
+
sucesso: falso
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
error {
|
|
40
|
+
tipo: "entrada_invalida"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
module exemplos.tratamento.erro {
|
|
2
|
+
task executar_operacao_sensivel {
|
|
3
|
+
input {
|
|
4
|
+
chave: Texto required
|
|
5
|
+
}
|
|
6
|
+
output {
|
|
7
|
+
protocolo: Id
|
|
8
|
+
}
|
|
9
|
+
rules {
|
|
10
|
+
chave existe e chave deve_ser preenchida
|
|
11
|
+
}
|
|
12
|
+
effects {
|
|
13
|
+
consulta cofre
|
|
14
|
+
auditoria falha_operacao_sensivel
|
|
15
|
+
}
|
|
16
|
+
guarantees {
|
|
17
|
+
protocolo existe
|
|
18
|
+
}
|
|
19
|
+
error {
|
|
20
|
+
acesso_negado: "A chave informada nao tem permissao."
|
|
21
|
+
recurso_indisponivel: "O servico esta temporariamente indisponivel."
|
|
22
|
+
auditoria_obrigatoria: "Toda falha precisa ser registrada."
|
|
23
|
+
}
|
|
24
|
+
tests {
|
|
25
|
+
caso "falha por acesso negado" {
|
|
26
|
+
given {
|
|
27
|
+
chave: "sem_permissao"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
expect {
|
|
31
|
+
sucesso: falso
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
error {
|
|
35
|
+
tipo: "acesso_negado"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
task responder_acesso_negado {
|
|
42
|
+
input {
|
|
43
|
+
chave: Texto required
|
|
44
|
+
}
|
|
45
|
+
output {
|
|
46
|
+
protocolo_resposta: Id
|
|
47
|
+
}
|
|
48
|
+
effects {
|
|
49
|
+
notificacao cliente acesso_negado
|
|
50
|
+
auditoria acesso_negado
|
|
51
|
+
}
|
|
52
|
+
guarantees {
|
|
53
|
+
protocolo_resposta existe
|
|
54
|
+
}
|
|
55
|
+
tests {
|
|
56
|
+
caso "responde acesso negado" {
|
|
57
|
+
given {
|
|
58
|
+
chave: "sem_permissao"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
expect {
|
|
62
|
+
sucesso: verdadeiro
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
task responder_retentativa {
|
|
69
|
+
input {
|
|
70
|
+
chave: Texto required
|
|
71
|
+
}
|
|
72
|
+
output {
|
|
73
|
+
protocolo_resposta: Id
|
|
74
|
+
}
|
|
75
|
+
effects {
|
|
76
|
+
notificacao cliente retentativa_programada
|
|
77
|
+
auditoria retentativa
|
|
78
|
+
}
|
|
79
|
+
guarantees {
|
|
80
|
+
protocolo_resposta existe
|
|
81
|
+
}
|
|
82
|
+
tests {
|
|
83
|
+
caso "agenda retentativa" {
|
|
84
|
+
given {
|
|
85
|
+
chave: "instavel"
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
expect {
|
|
89
|
+
sucesso: verdadeiro
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
task registrar_auditoria_falha {
|
|
96
|
+
input {
|
|
97
|
+
chave: Texto required
|
|
98
|
+
}
|
|
99
|
+
output {
|
|
100
|
+
auditoria_id: Id
|
|
101
|
+
}
|
|
102
|
+
effects {
|
|
103
|
+
auditoria falha_operacional
|
|
104
|
+
persistencia auditoria_falha
|
|
105
|
+
}
|
|
106
|
+
guarantees {
|
|
107
|
+
auditoria_id existe
|
|
108
|
+
}
|
|
109
|
+
tests {
|
|
110
|
+
caso "audita falha" {
|
|
111
|
+
given {
|
|
112
|
+
chave: "sem_permissao"
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
expect {
|
|
116
|
+
sucesso: verdadeiro
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
task registrar_sucesso {
|
|
123
|
+
input {
|
|
124
|
+
protocolo: Id required
|
|
125
|
+
}
|
|
126
|
+
output {
|
|
127
|
+
registro_id: Id
|
|
128
|
+
}
|
|
129
|
+
effects {
|
|
130
|
+
auditoria operacao_concluida
|
|
131
|
+
evento operacao_sensivel_concluida
|
|
132
|
+
}
|
|
133
|
+
guarantees {
|
|
134
|
+
registro_id existe
|
|
135
|
+
}
|
|
136
|
+
tests {
|
|
137
|
+
caso "registra sucesso" {
|
|
138
|
+
given {
|
|
139
|
+
protocolo: "prot_1"
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
expect {
|
|
143
|
+
sucesso: verdadeiro
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
flow resposta_segura {
|
|
150
|
+
chave: Texto
|
|
151
|
+
etapa tentar usa executar_operacao_sensivel com chave = chave em_sucesso concluir em_erro registrar_falha por_erro acesso_negado = tratar_acesso_negado, recurso_indisponivel = agendar_retentativa
|
|
152
|
+
etapa tratar_acesso_negado usa responder_acesso_negado com chave = chave depende_de tentar
|
|
153
|
+
etapa agendar_retentativa usa responder_retentativa com chave = chave depende_de tentar
|
|
154
|
+
etapa registrar_falha usa registrar_auditoria_falha com chave = chave depende_de tentar
|
|
155
|
+
etapa concluir usa registrar_sucesso com protocolo = tentar.protocolo depende_de tentar
|
|
156
|
+
}
|
|
157
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semacode/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "CLI do Protocolo de Governanca de Intencao Sema para validar contratos, medir drift e operar backend vivo.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"icon": "logo.png",
|
|
@@ -36,16 +36,17 @@
|
|
|
36
36
|
"files": [
|
|
37
37
|
"dist",
|
|
38
38
|
"docs",
|
|
39
|
+
"exemplos",
|
|
39
40
|
"logo.png",
|
|
40
41
|
"README.md",
|
|
41
42
|
"LICENSE"
|
|
42
43
|
],
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"@sema/nucleo": "0.
|
|
45
|
-
"@sema/gerador-dart": "0.
|
|
46
|
-
"@sema/gerador-python": "0.
|
|
47
|
-
"@sema/gerador-typescript": "0.
|
|
48
|
-
"@sema/padroes": "0.
|
|
45
|
+
"@sema/nucleo": "1.0.0",
|
|
46
|
+
"@sema/gerador-dart": "1.0.0",
|
|
47
|
+
"@sema/gerador-python": "1.0.0",
|
|
48
|
+
"@sema/gerador-typescript": "1.0.0",
|
|
49
|
+
"@sema/padroes": "1.0.0",
|
|
49
50
|
"typescript": "^5.8.3"
|
|
50
51
|
},
|
|
51
52
|
"bundledDependencies": [
|