@semacode/cli 1.5.39 → 1.5.41
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/AGENT_CONTEXT_PACK.json +8 -3
- package/SEMA_BRIEF.curto.txt +3 -3
- package/SEMA_BRIEF.md +5 -5
- package/SEMA_BRIEF.micro.txt +2 -2
- package/SEMA_INDEX.json +134 -109
- package/dist/agentContextPack.js +8 -3
- package/dist/agentContextPack.js.map +1 -1
- package/dist/agentEntryPoints.js +27 -12
- package/dist/agentEntryPoints.js.map +1 -1
- package/dist/docs.js +1 -1
- package/dist/docs.js.map +1 -1
- package/dist/docs.part01.d.ts +5 -1
- package/dist/docs.part01.js +16 -0
- package/dist/docs.part01.js.map +1 -1
- package/dist/docs.part02.js +17 -3
- package/dist/docs.part02.js.map +1 -1
- package/dist/profileArtefatoValidadores.js +2 -0
- package/dist/profileArtefatoValidadores.js.map +1 -1
- package/dist/profileI18nCatalogo.d.ts +12 -0
- package/dist/profileI18nCatalogo.js +92 -0
- package/dist/profileI18nCatalogo.js.map +1 -0
- package/dist/profileI18nVisivel.d.ts +11 -0
- package/dist/profileI18nVisivel.js +157 -0
- package/dist/profileI18nVisivel.js.map +1 -0
- package/docs/agentes-por-capacidade.md +1 -1
- package/docs/como-ensinar-a-sema-para-ia.md +3 -3
- package/docs/documentacao.md +12 -6
- package/docs/integracao-com-ia.md +3 -3
- package/docs/mcp.md +3 -3
- package/node_modules/@sema/gerador-css/package.json +1 -1
- package/node_modules/@sema/gerador-dart/package.json +1 -1
- package/node_modules/@sema/gerador-html/package.json +1 -1
- package/node_modules/@sema/gerador-javascript/package.json +1 -1
- package/node_modules/@sema/gerador-lua/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 +10 -10
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// SEMA-GOVERNED: sema.produto.governanca_ia.qualidade_contrato
|
|
2
|
+
// Descricao: catalogo de termos i18n por idioma para validacao observavel de texto visivel.
|
|
3
|
+
export const VALIDADORES_I18N = {
|
|
4
|
+
"pt-BR": {
|
|
5
|
+
idioma: "pt-BR",
|
|
6
|
+
nome: "Portugues do Brasil",
|
|
7
|
+
termos: [
|
|
8
|
+
{ regex: /\bDescricao\b/i, esperado: "Descrição" },
|
|
9
|
+
{ regex: /\bDescricoes\b/i, esperado: "Descrições" },
|
|
10
|
+
{ regex: /\bAcao\b/i, esperado: "Ação" },
|
|
11
|
+
{ regex: /\bAcoes\b/i, esperado: "Ações" },
|
|
12
|
+
{ regex: /\bAtencao\b/i, esperado: "Atenção" },
|
|
13
|
+
{ regex: /\bConfiguracao\b/i, esperado: "Configuração" },
|
|
14
|
+
{ regex: /\bInformacao\b/i, esperado: "Informação" },
|
|
15
|
+
{ regex: /\bInformacoes\b/i, esperado: "Informações" },
|
|
16
|
+
{ regex: /\bEducacao\b/i, esperado: "Educação" },
|
|
17
|
+
{ regex: /\bSaude\b/i, esperado: "Saúde" },
|
|
18
|
+
{ regex: /\bAlimentacao\b/i, esperado: "Alimentação" },
|
|
19
|
+
{ regex: /\bOnibus\b/i, esperado: "Ônibus" },
|
|
20
|
+
{ regex: /\balmoco\b/i, esperado: "almoço" },
|
|
21
|
+
{ regex: /\brapido\b/i, esperado: "rápido" },
|
|
22
|
+
{ regex: /\brapida\b/i, esperado: "rápida" },
|
|
23
|
+
{ regex: /\bnumero\b/i, esperado: "número" },
|
|
24
|
+
{ regex: /\binvalido\b/i, esperado: "inválido" },
|
|
25
|
+
{ regex: /\binvalida\b/i, esperado: "inválida" },
|
|
26
|
+
{ regex: /\bobrigatorio\b/i, esperado: "obrigatório" },
|
|
27
|
+
{ regex: /\bobrigatoria\b/i, esperado: "obrigatória" },
|
|
28
|
+
{ regex: /\busuario\b/i, esperado: "usuário" },
|
|
29
|
+
{ regex: /\busuarios\b/i, esperado: "usuários" },
|
|
30
|
+
{ regex: /\bcartao\b/i, esperado: "cartão" },
|
|
31
|
+
{ regex: /\bcredito\b/i, esperado: "crédito" },
|
|
32
|
+
{ regex: /\bdebito\b/i, esperado: "débito" },
|
|
33
|
+
{ regex: /\bvalidacao\b/i, esperado: "validação" },
|
|
34
|
+
{ regex: /\bexclusao\b/i, esperado: "exclusão" },
|
|
35
|
+
{ regex: /\bhistorico\b/i, esperado: "histórico" },
|
|
36
|
+
{ regex: /\bVoce\b/i, esperado: "Você" },
|
|
37
|
+
{ regex: /\bvoce\b/i, esperado: "você" },
|
|
38
|
+
{ regex: /\bNao\b/i, esperado: "Não" },
|
|
39
|
+
{ regex: /\bnao\b/i, esperado: "não" },
|
|
40
|
+
{ regex: /\bJa\b/i, esperado: "Já" },
|
|
41
|
+
{ regex: /\bja\b/i, esperado: "já" },
|
|
42
|
+
{ regex: /\bAte\b/i, esperado: "Até" },
|
|
43
|
+
{ regex: /\bate\b/i, esperado: "até" },
|
|
44
|
+
{ regex: /\bProximo\b/i, esperado: "Próximo" },
|
|
45
|
+
{ regex: /\bproximo\b/i, esperado: "próximo" },
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
es: {
|
|
49
|
+
idioma: "es",
|
|
50
|
+
nome: "Espanhol",
|
|
51
|
+
termos: [
|
|
52
|
+
{ regex: /\bDescripcion\b/i, esperado: "Descripción" },
|
|
53
|
+
{ regex: /\bAccion\b/i, esperado: "Acción" },
|
|
54
|
+
{ regex: /\bAcciones\b/i, esperado: "Acciones" },
|
|
55
|
+
{ regex: /\bAtencion\b/i, esperado: "Atención" },
|
|
56
|
+
{ regex: /\bConfiguracion\b/i, esperado: "Configuración" },
|
|
57
|
+
{ regex: /\bInformacion\b/i, esperado: "Información" },
|
|
58
|
+
{ regex: /\bEducacion\b/i, esperado: "Educación" },
|
|
59
|
+
{ regex: /\brapido\b/i, esperado: "rápido" },
|
|
60
|
+
{ regex: /\brapida\b/i, esperado: "rápida" },
|
|
61
|
+
{ regex: /\bnumero\b/i, esperado: "número" },
|
|
62
|
+
{ regex: /\binvalido\b/i, esperado: "inválido" },
|
|
63
|
+
{ regex: /\binvalida\b/i, esperado: "inválida" },
|
|
64
|
+
{ regex: /\bobligacion\b/i, esperado: "obligación" },
|
|
65
|
+
{ regex: /\bcredito\b/i, esperado: "crédito" },
|
|
66
|
+
{ regex: /\bdebito\b/i, esperado: "débito" },
|
|
67
|
+
{ regex: /\btelefono\b/i, esperado: "teléfono" },
|
|
68
|
+
{ regex: /\bproximo\b/i, esperado: "próximo" },
|
|
69
|
+
{ regex: /\bTambien\b/i, esperado: "También" },
|
|
70
|
+
{ regex: /\btambien\b/i, esperado: "también" },
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
fr: {
|
|
74
|
+
idioma: "fr",
|
|
75
|
+
nome: "Frances",
|
|
76
|
+
termos: [
|
|
77
|
+
{ regex: /\bResume\b/i, esperado: "Résumé" },
|
|
78
|
+
{ regex: /\bresume\b/i, esperado: "résumé" },
|
|
79
|
+
{ regex: /\btelephone\b/i, esperado: "téléphone" },
|
|
80
|
+
{ regex: /\bnumero\b/i, esperado: "numéro" },
|
|
81
|
+
{ regex: /\bdeja\b/i, esperado: "déjà" },
|
|
82
|
+
{ regex: /\becole\b/i, esperado: "école" },
|
|
83
|
+
{ regex: /\beleve\b/i, esperado: "élève" },
|
|
84
|
+
{ regex: /\bfrancais\b/i, esperado: "français" },
|
|
85
|
+
{ regex: /\bFrancais\b/i, esperado: "Français" },
|
|
86
|
+
{ regex: /\baout\b/i, esperado: "août" },
|
|
87
|
+
{ regex: /\bNoel\b/i, esperado: "Noël" },
|
|
88
|
+
{ regex: /\bNoe?l\b/i, esperado: "Noël" },
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=profileI18nCatalogo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileI18nCatalogo.js","sourceRo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|
+
idiomaNaoDeclarado: boolean;
|
|
6
|
+
idiomas: IdiomaI18nSuportado[];
|
|
7
|
+
idiomasSemValidador: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare function detectarEscopoI18nObservavel(contrato: string): EscopoI18nObservavel;
|
|
10
|
+
export declare function avaliarI18nVisivelArtefato(contrato: string, artefato: string, maturidade: MaturidadeProfile): AchadoProfile[];
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// SEMA-GOVERNED: sema.produto.governanca_ia.qualidade_contrato
|
|
2
|
+
// Descricao: validador observavel de i18n por idioma em artefatos reais do profile Software.
|
|
3
|
+
import { localizacaoDoMatchProfile } from "./profileArtefatoBase.js";
|
|
4
|
+
import { VALIDADORES_I18N } from "./profileI18nCatalogo.js";
|
|
5
|
+
import { criarAchadoArtefatoProfile } from "./profileRegras.js";
|
|
6
|
+
const REGEX_TEXTO_TAG = />\s*([^<>{}]{1,240}?[A-Za-zÀ-ÿ][^<>{}]{0,240})\s*</g;
|
|
7
|
+
const REGEX_ATRIBUTO_VISIVEL = /\b(?:placeholder|aria-label|title|alt|value|label)\s*=\s*(["'])([^"']{1,240})\1/gi;
|
|
8
|
+
const REGEX_LITERAL_STRING = /"([^"\\\r\n]{1,240}(?:\\.[^"\\\r\n]{0,240})*)"|'([^'\\\r\n]{1,240}(?:\\.[^'\\\r\n]{0,240})*)'|`([^`\\]{1,240}(?:\\.[^`\\]{0,240})*)`/g;
|
|
9
|
+
function semAcentos(texto) {
|
|
10
|
+
return texto.normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
11
|
+
}
|
|
12
|
+
function normalizarTokenIdioma(token) {
|
|
13
|
+
return token.trim().toLowerCase().replace(/_/g, "-");
|
|
14
|
+
}
|
|
15
|
+
function idiomaSuportado(token) {
|
|
16
|
+
const normalizado = normalizarTokenIdioma(token);
|
|
17
|
+
if (normalizado === "pt" || normalizado === "pt-br" || normalizado === "ptbr")
|
|
18
|
+
return "pt-BR";
|
|
19
|
+
if (normalizado === "es" || normalizado === "es-es" || normalizado === "es-mx" || normalizado === "es-419")
|
|
20
|
+
return "es";
|
|
21
|
+
if (normalizado === "fr" || normalizado === "fr-fr" || normalizado === "fr-ca")
|
|
22
|
+
return "fr";
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
function adicionarIdioma(idiomas, semValidador, token) {
|
|
26
|
+
const suportado = idiomaSuportado(token);
|
|
27
|
+
if (suportado) {
|
|
28
|
+
idiomas.add(suportado);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
semValidador.add(normalizarTokenIdioma(token));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function detectarEscopoI18nObservavel(contrato) {
|
|
35
|
+
const normalizado = semAcentos(contrato).toLowerCase();
|
|
36
|
+
const mencionaI18n = /\bi18n\b|\bi18n[-_][a-z0-9_-]+/i.test(normalizado);
|
|
37
|
+
const declaraTextoVisivel = mencionaI18n || /\b(?:texto[_ -]?visivel|interface|ui|labels?|mensagens?|placeholder|aria-label|locale|idioma|language|traducao|traducoes|translation|acento|acentos|diacritico|diacriticos|cedilha|mojibake)\b/.test(normalizado);
|
|
38
|
+
const declaraIdiomaOuI18n = mencionaI18n || /\b(?:locale|idioma|language|traducao|traducoes|translation|pt[-_ ]?br|portugues|portuguese|espanhol|spanish|frances|french)\b/.test(normalizado);
|
|
39
|
+
const ativo = declaraTextoVisivel && declaraIdiomaOuI18n;
|
|
40
|
+
if (!ativo)
|
|
41
|
+
return { ativo: false, idiomaNaoDeclarado: false, idiomas: [], idiomasSemValidador: [] };
|
|
42
|
+
const idiomas = new Set();
|
|
43
|
+
const semValidador = new Set();
|
|
44
|
+
if (/\bi18n[-_]ptbr\b|\b(?:pt[-_ ]?br|portugues|portuguese)\b/.test(normalizado))
|
|
45
|
+
idiomas.add("pt-BR");
|
|
46
|
+
if (/\b(?:espanhol|espanol|spanish)\b/.test(normalizado))
|
|
47
|
+
idiomas.add("es");
|
|
48
|
+
if (/\b(?:frances|french)\b/.test(normalizado))
|
|
49
|
+
idiomas.add("fr");
|
|
50
|
+
for (const match of normalizado.matchAll(/\bi18n[-_]([a-z]{2,4}(?:[-_][a-z0-9]{2,3})?)\b/g)) {
|
|
51
|
+
adicionarIdioma(idiomas, semValidador, match[1] ?? "");
|
|
52
|
+
}
|
|
53
|
+
for (const match of normalizado.matchAll(/\b(?:locale|idioma|language)\s*[:=]?\s*["']?([a-z]{2}(?:[-_][a-z0-9]{2,3})?)\b/g)) {
|
|
54
|
+
adicionarIdioma(idiomas, semValidador, match[1] ?? "");
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
ativo: true,
|
|
58
|
+
idiomaNaoDeclarado: idiomas.size === 0 && semValidador.size === 0,
|
|
59
|
+
idiomas: [...idiomas],
|
|
60
|
+
idiomasSemValidador: [...semValidador],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function limparTextoSegmento(texto) {
|
|
64
|
+
return texto.replace(/\s+/g, " ").trim();
|
|
65
|
+
}
|
|
66
|
+
function contextoPareceScriptOuEstilo(artefato, indice) {
|
|
67
|
+
const antes = artefato.slice(Math.max(0, indice - 40), indice).toLowerCase();
|
|
68
|
+
return /<\s*(?:script|style|template)\b/.test(antes);
|
|
69
|
+
}
|
|
70
|
+
function textoTemTermoSemDiacritico(texto, validadores) {
|
|
71
|
+
return validadores.some((validador) => validador.termos.some((termo) => termo.regex.test(texto)));
|
|
72
|
+
}
|
|
73
|
+
function literalPareceTecnico(texto, validadores) {
|
|
74
|
+
const valor = texto.trim();
|
|
75
|
+
if (!valor || valor.length > 240)
|
|
76
|
+
return true;
|
|
77
|
+
if (/^(?:GET|POST|PUT|PATCH|DELETE|true|false|null|undefined)$/i.test(valor))
|
|
78
|
+
return true;
|
|
79
|
+
if (/^(?:https?:\/\/|\/|\.\/|#|[A-Z_][A-Z0-9_]*$)/.test(valor))
|
|
80
|
+
return true;
|
|
81
|
+
return /^[a-z0-9_.:/#-]+$/.test(valor) && !textoTemTermoSemDiacritico(valor, validadores);
|
|
82
|
+
}
|
|
83
|
+
function coletarSegmentosTextoVisivel(artefato, validadores) {
|
|
84
|
+
const segmentos = [];
|
|
85
|
+
for (const match of artefato.matchAll(REGEX_TEXTO_TAG)) {
|
|
86
|
+
if (contextoPareceScriptOuEstilo(artefato, match.index ?? 0))
|
|
87
|
+
continue;
|
|
88
|
+
const texto = limparTextoSegmento(match[1] ?? "");
|
|
89
|
+
if (texto)
|
|
90
|
+
segmentos.push({ texto, inicio: (match.index ?? 0) + match[0].indexOf(match[1] ?? ""), contexto: "texto_tag_html" });
|
|
91
|
+
}
|
|
92
|
+
for (const match of artefato.matchAll(REGEX_ATRIBUTO_VISIVEL)) {
|
|
93
|
+
const texto = limparTextoSegmento(match[2] ?? "");
|
|
94
|
+
if (texto)
|
|
95
|
+
segmentos.push({ texto, inicio: (match.index ?? 0) + match[0].indexOf(match[2] ?? ""), contexto: "atributo_visivel_html" });
|
|
96
|
+
}
|
|
97
|
+
for (const match of artefato.matchAll(REGEX_LITERAL_STRING)) {
|
|
98
|
+
const texto = limparTextoSegmento(match[1] ?? match[2] ?? match[3] ?? "");
|
|
99
|
+
if (literalPareceTecnico(texto, validadores) || !textoTemTermoSemDiacritico(texto, validadores))
|
|
100
|
+
continue;
|
|
101
|
+
segmentos.push({ texto, inicio: (match.index ?? 0) + match[0].indexOf(texto), contexto: "literal_string_ui" });
|
|
102
|
+
}
|
|
103
|
+
return segmentos;
|
|
104
|
+
}
|
|
105
|
+
function severidadeI18n(maturidade) {
|
|
106
|
+
if (maturidade === "critical")
|
|
107
|
+
return "critical";
|
|
108
|
+
if (maturidade === "draft")
|
|
109
|
+
return "warning";
|
|
110
|
+
return "blocking";
|
|
111
|
+
}
|
|
112
|
+
function criarAchadoIdiomaNaoDeclarado(maturidade) {
|
|
113
|
+
return criarAchadoArtefatoProfile("software_i18n_idioma_nao_declarado", "contrato declara i18n observavel, mas nao declara idioma/locale verificavel", false, severidadeI18n(maturidade), undefined, "declare o idioma explicitamente, por exemplo i18n_ptbr, i18n_es ou locale: pt-BR.", "i18n sem idioma impede validar acentos, diacriticos e texto visivel de forma observavel.", { regra: "i18n_idioma_obrigatorio", risco: "garantia_i18n_ambigua" });
|
|
114
|
+
}
|
|
115
|
+
function criarAchadoIdiomaSemValidador(idioma, maturidade) {
|
|
116
|
+
return criarAchadoArtefatoProfile("software_i18n_idioma_sem_validador_observavel", "contrato declara idioma i18n sem validador observavel registrado", false, severidadeI18n(maturidade), undefined, `adicione validador observavel para "${idioma}" ou remova a garantia de i18n desse idioma.`, "a garantia i18n nao pode aprovar idioma sem regra de verificacao executavel.", { regra: "i18n_validador_por_idioma_obrigatorio", risco: "garantia_i18n_sem_checker" });
|
|
117
|
+
}
|
|
118
|
+
export function avaliarI18nVisivelArtefato(contrato, artefato, maturidade) {
|
|
119
|
+
const escopo = detectarEscopoI18nObservavel(contrato);
|
|
120
|
+
if (!escopo.ativo)
|
|
121
|
+
return [];
|
|
122
|
+
const achados = [];
|
|
123
|
+
if (escopo.idiomaNaoDeclarado)
|
|
124
|
+
achados.push(criarAchadoIdiomaNaoDeclarado(maturidade));
|
|
125
|
+
for (const idioma of escopo.idiomasSemValidador) {
|
|
126
|
+
achados.push(criarAchadoIdiomaSemValidador(idioma, maturidade));
|
|
127
|
+
}
|
|
128
|
+
const validadores = escopo.idiomas.map((idioma) => VALIDADORES_I18N[idioma]);
|
|
129
|
+
const vistos = new Set();
|
|
130
|
+
for (const segmento of coletarSegmentosTextoVisivel(artefato, validadores)) {
|
|
131
|
+
for (const validador of validadores) {
|
|
132
|
+
for (const termo of validador.termos) {
|
|
133
|
+
const match = termo.regex.exec(segmento.texto);
|
|
134
|
+
if (!match)
|
|
135
|
+
continue;
|
|
136
|
+
const inicio = segmento.inicio + match.index;
|
|
137
|
+
const chave = `${validador.idioma}:${inicio}:${match[0].toLowerCase()}`;
|
|
138
|
+
if (vistos.has(chave))
|
|
139
|
+
continue;
|
|
140
|
+
vistos.add(chave);
|
|
141
|
+
const localizacao = localizacaoDoMatchProfile(artefato, inicio, match[0].length);
|
|
142
|
+
achados.push(criarAchadoArtefatoProfile("software_i18n_diacritico_ausente", "texto visivel perdeu diacritico obrigatorio para idioma declarado no contrato", false, severidadeI18n(maturidade), localizacao.trecho, `troque "${match[0]}" por "${termo.esperado}" em ${validador.nome} ou remova essa garantia i18n do contrato.`, `contrato declara i18n observavel para ${validador.idioma}, mas o artefato contem literal de UI sem diacritico no contexto ${segmento.contexto}.`, {
|
|
143
|
+
linha: localizacao.linha,
|
|
144
|
+
coluna: localizacao.coluna,
|
|
145
|
+
inicio: localizacao.inicio,
|
|
146
|
+
fim: localizacao.fim,
|
|
147
|
+
regra: `i18n_${validador.idioma.toLowerCase()}_diacriticos_observaveis`,
|
|
148
|
+
risco: "garantia_i18n_nao_observada",
|
|
149
|
+
}));
|
|
150
|
+
if (achados.length >= 16)
|
|
151
|
+
return achados;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return achados;
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=profileI18nVisivel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileI18nVisivel.js","sourceRoot":"","sources":["../src/profileI18nVisivel.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,6FAA6F;AAE7F,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAkD,MAAM,0BAA0B,CAAC;AAE5G,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAehE,MAAM,eAAe,GAAG,qDAAqD,CAAC;AAC9E,MAAM,sBAAsB,GAAG,mFAAmF,CAAC;AACnH,MAAM,oBAAoB,GAAG,uIAAuI,CAAC;AAErK,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,iBAAiB,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,0BAA0B,CACrC,kCAAkC,EAClC,+EAA+E,EAC/E,KAAK,EACL,cAAc,CAAC,UAAU,CAAC,EAC1B,WAAW,CAAC,MAAM,EAClB,WAAW,KAAK,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,QAAQ,QAAQ,SAAS,CAAC,IAAI,4CAA4C,EAC7G,yCAAyC,SAAS,CAAC,MAAM,oEAAoE,QAAQ,CAAC,QAAQ,GAAG,EACjJ;oBACE,KAAK,EAAE,WAAW,CAAC,KAAK;oBACxB,MAAM,EAAE,WAAW,CAAC,MAAM;oBAC1B,MAAM,EAAE,WAAW,CAAC,MAAM;oBAC1B,GAAG,EAAE,WAAW,CAAC,GAAG;oBACpB,KAAK,EAAE,QAAQ,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,0BAA0B;oBACvE,KAAK,EAAE,6BAA6B;iBACrC,CACF,CAAC,CAAC;gBAEH,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE;oBAAE,OAAO,OAAO,CAAC;YAC3C,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -110,7 +110,7 @@ Timeout definido pelo agente não é falha do Sema. Se `sema resumo`, `inspecion
|
|
|
110
110
|
|
|
111
111
|
## Idioma
|
|
112
112
|
|
|
113
|
-
A linguagem humana da resposta deve seguir o idioma do usuário e preservar acentos, cedilha, pontuação e símbolos esperados. A DSL .sema pode ter palavras-chave ASCII; isso não autoriza PT-BR sem acentos.
|
|
113
|
+
A linguagem humana da resposta deve seguir o idioma do usuário e preservar acentos, cedilha, pontuação e símbolos esperados. A DSL .sema pode ter palavras-chave ASCII; isso não autoriza PT-BR sem acentos. Em PT-BR, texto humano sem acentos é entrega inválida.
|
|
114
114
|
|
|
115
115
|
A gramática Sema pode ter palavras-chave ASCII. Isso não autoriza resposta humana sem acentos.
|
|
116
116
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
Sema is taught to an AI through operational context, not through vague explanations. The agent needs syntax, semantics, intermediate representation, examples, and the project contract before it touches code or documents.
|
|
11
11
|
|
|
12
|
-
In local IDEs, the first step is to confirm that `AGENTS.md` exists in the project root. If it does not exist, download `https://sema.otimitare.online/AGENTS.md` into the project. In web chats, do not download files into the chat environment;
|
|
12
|
+
In local IDEs, the first step is to confirm that `AGENTS.md` exists in the project root. If it does not exist, download `https://sema.otimitare.online/AGENTS.md` into the project. Then call `sema_resumo`. If the remote MCP cannot read the local path, call `sema_sync` with the applicable `.sema` contract, affected files, operational docs, and an index; use the returned `projeto`; call `sema_resumo` again; inspect the contract; then run drift and impact. In web chats, do not download files into the chat environment; call `sema_chat_contexto` and then `sema_sync` with the same typed snapshot.
|
|
13
13
|
|
|
14
14
|
The correct framing is simple: contract first, evidence before action, and no guessing from raw code when Sema can provide summary, drift, impact, and required docs.
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@ The correct framing is simple: contract first, evidence before action, and no gu
|
|
|
17
17
|
|
|
18
18
|
A Sema é ensinada para IA por contexto operacional, não por explicação vaga. O agente precisa de sintaxe, semântica, representação intermediária, exemplos e contrato do projeto antes de tocar código ou documentos.
|
|
19
19
|
|
|
20
|
-
Em IDE local, o primeiro passo é confirmar que `AGENTS.md` existe na raiz do projeto. Se não existir, baixe `https://sema.otimitare.online/AGENTS.md` para o projeto. Em chats web, não baixe arquivos no ambiente do chat;
|
|
20
|
+
Em IDE local, o primeiro passo é confirmar que `AGENTS.md` existe na raiz do projeto. Se não existir, baixe `https://sema.otimitare.online/AGENTS.md` para o projeto. Depois chame `sema_resumo`. Se o MCP remoto não conseguir ler o caminho local, chame `sema_sync` com o contrato `.sema` aplicável, arquivos afetados, docs operacionais e índice; use o `projeto` retornado; chame `sema_resumo` de novo; inspecione o contrato; então rode drift e impacto. Em chats web, não baixe arquivos no ambiente do chat; chame `sema_chat_contexto` e depois `sema_sync` com o mesmo snapshot tipado.
|
|
21
21
|
|
|
22
22
|
A moldura correta é simples: contrato primeiro, evidência antes da ação e nada de adivinhar lendo código cru quando a Sema pode entregar resumo, drift, impacto e docs obrigatórias.
|
|
23
23
|
|
|
@@ -25,6 +25,6 @@ A moldura correta é simples: contrato primeiro, evidência antes da ação e na
|
|
|
25
25
|
|
|
26
26
|
Sema se enseña a una IA con contexto operativo, no con explicaciones vagas. El agente necesita sintaxis, semántica, representación intermedia, ejemplos y contrato del proyecto antes de tocar código o documentos.
|
|
27
27
|
|
|
28
|
-
En IDE local, el primer paso es confirmar que `AGENTS.md` existe en la raíz del proyecto. Si no existe, descarga `https://sema.otimitare.online/AGENTS.md` en el proyecto. En chats web, no descargues archivos en el entorno del chat;
|
|
28
|
+
En IDE local, el primer paso es confirmar que `AGENTS.md` existe en la raíz del proyecto. Si no existe, descarga `https://sema.otimitare.online/AGENTS.md` en el proyecto. Después llama `sema_resumo`. Si el MCP remoto no puede leer la ruta local, llama `sema_sync` con el contrato `.sema` aplicable, archivos afectados, docs operativas e índice; usa el `projeto` devuelto; llama `sema_resumo` otra vez; inspecciona el contrato; después ejecuta drift e impacto. En chats web, no descargues archivos en el entorno del chat; llama `sema_chat_contexto` y después `sema_sync` con el mismo snapshot tipado.
|
|
29
29
|
|
|
30
30
|
El encuadre correcto es simple: contrato primero, evidencia antes de la acción y nada de adivinar leyendo código crudo cuando Sema puede entregar resumen, drift, impacto y docs obligatorias.
|
package/docs/documentacao.md
CHANGED
|
@@ -20,8 +20,10 @@ The `docs-impacto` result returns:
|
|
|
20
20
|
|
|
21
21
|
- `leituraObrigatoria`: docs, readmes, and contracts that must be read.
|
|
22
22
|
- `docsAusentes`: docs that block the action.
|
|
23
|
-
- `docsCriadas`: docs created automatically when authorized.
|
|
24
|
-
- `bloqueios`: severity 4 diagnostics.
|
|
23
|
+
- `docsCriadas`: docs created automatically when authorized.
|
|
24
|
+
- `bloqueios`: severity 4 diagnostics.
|
|
25
|
+
|
|
26
|
+
Automatically created docs are scaffolds, not proof. The agent must replace the generic template with real procedure, validation, and rollback before `finalizar-mudanca` can pass.
|
|
25
27
|
|
|
26
28
|
Before declaring the work done, the agent must run:
|
|
27
29
|
|
|
@@ -49,8 +51,10 @@ O resultado de `docs-impacto` retorna:
|
|
|
49
51
|
|
|
50
52
|
- `leituraObrigatoria`: docs, readmes e contratos que precisam ser lidos.
|
|
51
53
|
- `docsAusentes`: docs que bloqueiam a ação.
|
|
52
|
-
- `docsCriadas`: docs criadas automaticamente quando autorizado.
|
|
53
|
-
- `bloqueios`: diagnósticos de severidade 4.
|
|
54
|
+
- `docsCriadas`: docs criadas automaticamente quando autorizado.
|
|
55
|
+
- `bloqueios`: diagnósticos de severidade 4.
|
|
56
|
+
|
|
57
|
+
Docs criadas automaticamente são esqueletos, não prova. A IA precisa trocar o template genérico por procedimento, validação e rollback reais antes de `finalizar-mudanca` passar.
|
|
54
58
|
|
|
55
59
|
Antes de dizer que o trabalho terminou, o agente precisa rodar:
|
|
56
60
|
|
|
@@ -78,8 +82,10 @@ El resultado de `docs-impacto` devuelve:
|
|
|
78
82
|
|
|
79
83
|
- `leituraObrigatoria`: docs, readmes y contratos que deben leerse.
|
|
80
84
|
- `docsAusentes`: docs que bloquean la acción.
|
|
81
|
-
- `docsCriadas`: docs creadas automáticamente cuando se autoriza.
|
|
82
|
-
- `bloqueios`: diagnósticos de severidad 4.
|
|
85
|
+
- `docsCriadas`: docs creadas automáticamente cuando se autoriza.
|
|
86
|
+
- `bloqueios`: diagnósticos de severidad 4.
|
|
87
|
+
|
|
88
|
+
Los documentos creados automáticamente son esqueletos, no prueba. El agente debe reemplazar el template genérico con procedimiento, validación y rollback reales antes de que `finalizar-mudanca` pueda aprobar.
|
|
83
89
|
|
|
84
90
|
Antes de decir que el trabajo terminó, el agente debe ejecutar:
|
|
85
91
|
|
|
@@ -23,16 +23,16 @@ Sema pode usar palavras-chave de DSL em ASCII. A IA não deve copiar essa estét
|
|
|
23
23
|
|
|
24
24
|
Sema exists for AI agents operating live systems. The agent should ask Sema for summary, docs impact, drift, impact, profile validation, and finalization instead of guessing from raw code.
|
|
25
25
|
|
|
26
|
-
In local IDEs, confirm `AGENTS.md` exists before `sema_resumo`. In web chats, use `sema_chat_contexto` first, then `sema_sync`
|
|
26
|
+
In local IDEs, confirm `AGENTS.md` exists before `sema_resumo`. If the remote MCP cannot read the local path, call `sema_sync` with the applicable contract, selected code, documentation, and index; then use the returned `projeto`. In web chats, use `sema_chat_contexto` first, then `sema_sync` with the same typed snapshot. The MCP coordinates the flow and charges SEMAS; the CLI executes local or VPS-side checks.
|
|
27
27
|
|
|
28
28
|
## Português
|
|
29
29
|
|
|
30
30
|
A Sema existe para agentes de IA operarem sistemas vivos. O agente deve pedir resumo, impacto documental, drift, impacto, validação de profile e finalização para a Sema em vez de adivinhar pelo código cru.
|
|
31
31
|
|
|
32
|
-
Em IDE local, confirme que `AGENTS.md` existe antes de `sema_resumo`. Em chats web, use primeiro `sema_chat_contexto`, depois `sema_sync`
|
|
32
|
+
Em IDE local, confirme que `AGENTS.md` existe antes de `sema_resumo`. Se o MCP remoto não conseguir ler o caminho local, chame `sema_sync` com contrato aplicável, código selecionado, documentação e índice; depois use o `projeto` retornado. Em chats web, use primeiro `sema_chat_contexto`, depois `sema_sync` com o mesmo snapshot tipado. O MCP coordena o fluxo e cobra SEMAS; a CLI executa checks locais ou na VPS.
|
|
33
33
|
|
|
34
34
|
## Español
|
|
35
35
|
|
|
36
36
|
Sema existe para agentes de IA que operan sistemas vivos. El agente debe pedir resumen, impacto documental, drift, impacto, validación de profile y finalización a Sema en vez de adivinar desde código crudo.
|
|
37
37
|
|
|
38
|
-
En IDE local, confirma que `AGENTS.md` existe antes de `sema_resumo`. En chats web, usa primero `sema_chat_contexto`, después `sema_sync`
|
|
38
|
+
En IDE local, confirma que `AGENTS.md` existe antes de `sema_resumo`. Si el MCP remoto no puede leer la ruta local, llama `sema_sync` con contrato aplicable, código seleccionado, documentación e índice; después usa el `projeto` devuelto. En chats web, usa primero `sema_chat_contexto`, después `sema_sync` con el mismo snapshot tipado. El MCP coordina el flujo y cobra SEMAS; la CLI ejecuta checks locales o en la VPS.
|
package/docs/mcp.md
CHANGED
|
@@ -15,7 +15,7 @@ It must also stay compatible with local IDEs. In that mode, the client sends typ
|
|
|
15
15
|
|
|
16
16
|
The MCP must never pretend that a local Windows path exists on the Linux server. If the server cannot see the workspace, the next action is to request or create a mirror/snapshot.
|
|
17
17
|
|
|
18
|
-
The app or connector must recognize the remote MCP from connection/authentication even when no project workspace has been synchronized. Missing workspace is not a missing active session; it
|
|
18
|
+
The app or connector must recognize the remote MCP from connection/authentication even when no project workspace has been synchronized. Missing workspace is not a missing active session; it means project work must use `sema_sync` with the applicable contract, selected code, documentation, and index. The remote MCP must not ask for or try to read the user's local folder.
|
|
19
19
|
|
|
20
20
|
Official Sema examples and grammar references must be exposed through `sema_exemplos`. Remote agents must not read `C:\GitHub\Sema\exemplos` or any other local user checkout just to learn the DSL.
|
|
21
21
|
|
|
@@ -35,7 +35,7 @@ Ele também precisa continuar compatível com IDEs locais. Nesse modo, o cliente
|
|
|
35
35
|
|
|
36
36
|
O MCP nunca deve fingir que um caminho Windows local existe no servidor Linux. Se o servidor não enxerga o workspace, a próxima ação é pedir ou criar um espelho/snapshot.
|
|
37
37
|
|
|
38
|
-
O app ou conector deve reconhecer o MCP remoto pela
|
|
38
|
+
O app ou conector deve reconhecer o MCP remoto pela conexão/autenticação, mesmo sem workspace de projeto sincronizado. Falta de workspace não é falta de sessão ativa: é o sinal de que a próxima ação de projeto deve usar `sema_sync` com contrato aplicável, código selecionado, documentação e índice. O MCP remoto não deve pedir nem tentar ler a pasta local do usuário.
|
|
39
39
|
|
|
40
40
|
Exemplos oficiais da Sema e referencias de gramatica devem ser expostos por `sema_exemplos`. Agentes remotos nao devem ler `C:\GitHub\Sema\exemplos` nem qualquer checkout local do usuario so para aprender a DSL.
|
|
41
41
|
|
|
@@ -55,7 +55,7 @@ También debe seguir compatible con IDEs locales. En ese modo, el cliente envía
|
|
|
55
55
|
|
|
56
56
|
El MCP nunca debe fingir que una ruta local de Windows existe en el servidor Linux. Si el servidor no ve el workspace, la siguiente acción es pedir o crear un espejo/snapshot.
|
|
57
57
|
|
|
58
|
-
La app o el conector debe reconocer el MCP remoto por
|
|
58
|
+
La app o el conector debe reconocer el MCP remoto por conexión/autenticación, incluso sin workspace de proyecto sincronizado. Falta de workspace no es falta de sesión activa: indica que la siguiente acción de proyecto debe usar `sema_sync` con contrato aplicable, código seleccionado, documentación e índice. El MCP remoto no debe pedir ni intentar leer la carpeta local del usuario.
|
|
59
59
|
|
|
60
60
|
Los ejemplos oficiales de Sema y las referencias de gramatica deben exponerse mediante `sema_exemplos`. Los agentes remotos no deben leer `C:\GitHub\Sema\exemplos` ni ningun checkout local del usuario solo para aprender la DSL.
|
|
61
61
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semacode/cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.41",
|
|
4
4
|
"description": "Semantic governance CLI for AI agents: contracts, drift, impact, documentation gates, and Sema profiles for live systems.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"icon": "logo.png",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"LICENSE"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@sema/nucleo": "1.5.
|
|
50
|
-
"@sema/gerador-dart": "1.5.
|
|
51
|
-
"@sema/gerador-lua": "1.5.
|
|
52
|
-
"@sema/gerador-python": "1.5.
|
|
53
|
-
"@sema/gerador-typescript": "1.5.
|
|
54
|
-
"@sema/gerador-javascript": "1.5.
|
|
55
|
-
"@sema/gerador-html": "1.5.
|
|
56
|
-
"@sema/gerador-css": "1.5.
|
|
57
|
-
"@sema/padroes": "1.5.
|
|
49
|
+
"@sema/nucleo": "1.5.41",
|
|
50
|
+
"@sema/gerador-dart": "1.5.41",
|
|
51
|
+
"@sema/gerador-lua": "1.5.41",
|
|
52
|
+
"@sema/gerador-python": "1.5.41",
|
|
53
|
+
"@sema/gerador-typescript": "1.5.41",
|
|
54
|
+
"@sema/gerador-javascript": "1.5.41",
|
|
55
|
+
"@sema/gerador-html": "1.5.41",
|
|
56
|
+
"@sema/gerador-css": "1.5.41",
|
|
57
|
+
"@sema/padroes": "1.5.41",
|
|
58
58
|
"typescript": "^5.8.3"
|
|
59
59
|
},
|
|
60
60
|
"bundledDependencies": [
|