@semacode/cli 4.2.0 → 4.2.1
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 +34 -33
- package/dist/agentProtocol.d.ts +1 -0
- package/dist/agentProtocol.js +41 -0
- package/dist/comandoSessao.js +2 -2
- package/dist/distribuicao/skillIntentPolicy.d.ts +1 -1
- package/dist/distribuicao/skillIntentPolicy.js +1 -0
- package/dist/driftPack.js +19 -6
- package/dist/entradaContratos.d.ts +2 -0
- package/dist/entradaContratos.js +20 -0
- package/dist/index.part04.d.ts +2 -0
- package/dist/index.part04.js +13 -5
- package/dist/index.part05.js +1 -1
- package/dist/index.part06.js +15 -0
- package/docs/commands.md +13 -0
- package/docs/drift-cache.md +7 -0
- package/package.json +1 -1
- package/skills/sema/SKILL.md +63 -101
- package/skills/sema/agents/openai.yaml +4 -2
- package/skills/sema/references/distribution.md +70 -0
package/dist/agentBootstrap.js
CHANGED
|
@@ -1,44 +1,45 @@
|
|
|
1
1
|
const FALLBACK = 'No Windows, tente & "$env:SystemRoot\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\\.sema\\bin\\sema-managed.ps1" --version; em macOS/Linux, $HOME/.sema/bin/sema --version. Só então declare a CLI indisponível.';
|
|
2
2
|
export function renderizarInstrucaoCodexSema(_pack) {
|
|
3
|
-
return `# Sema para Codex
|
|
4
|
-
|
|
5
|
-
Use diretamente a CLI local na raiz do workspace. Sema governa; a IA executa.
|
|
6
|
-
1. Rode \`sema --version\` e \`sema sessao "<intenção>" --json\`.
|
|
7
|
-
2. Se a sessão pedir a janela de contexto, obtenha o valor realmente configurado. Não adivinhe pelo nome ou tamanho do modelo. Repita com \`--janela-contexto <tokens> --salvar-perfil\`; orçamento e reserva de saída são ajustáveis. Reconfigure ao trocar de modelo.
|
|
8
|
-
3. Leia \`SEMA_BOOT.md\` uma vez. Siga os contratos e caminhos indicados pela sessão; resolva ambiguidades antes de editar. Se o índice estiver desatualizado, rode \`sema sync-codex --json\`.
|
|
9
|
-
4. No contrato selecionado: \`sema inspecionar <contrato> --drift none --json\`, \`sema docs-impacto --intencao "<intenção>" --arquivo <contrato> --json\`, \`sema drift <contrato> --cache fresh --json\` e \`sema impacto <contrato> --alvo <símbolo> --mudanca "<mudança>" --json\`.
|
|
10
|
-
5. Preserve SEMA-GOVERNED, impl e vinculos. Valide contrato alterado, teste o comportamento, confira drift fresh e feche com \`sema finalizar-mudanca\`, informando o arquivo e as docs efetivamente lidas.
|
|
11
|
-
|
|
12
|
-
SEMA_INDEX.json e AGENT_CONTEXT_PACK.json são bases internas da CLI, sem leitura integral obrigatória. Expanda pelo contrato indicado; não carregue o projeto inteiro. Cache acelera, não é prova final.
|
|
13
|
-
Falha do Sema, vínculo quebrado, rota divergente ou impl quebrada impedem conclusão. Score não substitui evidência. Sema não autoriza deploy, mensagens, dinheiro, segredos, destruição nem bypass de políticas.
|
|
14
|
-
Use PT-BR com acentos quando esse for o idioma do usuário. Confirme escopo fora do workspace.
|
|
15
|
-
${FALLBACK}
|
|
3
|
+
return `# Sema para Codex
|
|
4
|
+
|
|
5
|
+
Use diretamente a CLI local na raiz do workspace. Sema governa; a IA executa.
|
|
6
|
+
1. Rode \`sema --version\` e \`sema sessao "<intenção>" --json\`.
|
|
7
|
+
2. Se a sessão pedir a janela de contexto, obtenha o valor realmente configurado. Não adivinhe pelo nome ou tamanho do modelo. Repita com \`--janela-contexto <tokens> --salvar-perfil\`; orçamento e reserva de saída são ajustáveis. Reconfigure ao trocar de modelo.
|
|
8
|
+
3. Leia \`SEMA_BOOT.md\` uma vez. Siga os contratos e caminhos indicados pela sessão; resolva ambiguidades antes de editar. Se o índice ou protocolo estiver desatualizado, rode \`sema sync-codex --json\`.
|
|
9
|
+
4. No contrato selecionado: \`sema inspecionar <contrato> --drift none --json\`, \`sema docs-impacto --intencao "<intenção>" --arquivo <contrato> --json\`, \`sema drift <contrato> --cache fresh --pacote --json\` e \`sema impacto <contrato> --alvo <símbolo> --mudanca "<mudança>" --json\`.
|
|
10
|
+
5. Preserve SEMA-GOVERNED, impl e vinculos. Valide contrato alterado, teste o comportamento, confira drift fresh e feche com \`sema finalizar-mudanca\`, informando o arquivo e as docs efetivamente lidas.
|
|
11
|
+
|
|
12
|
+
SEMA_INDEX.json e AGENT_CONTEXT_PACK.json são bases internas da CLI, sem leitura integral obrigatória. Expanda pelo contrato indicado; não carregue o projeto inteiro. Cache acelera, não é prova final.
|
|
13
|
+
Falha do Sema, vínculo quebrado, rota divergente ou impl quebrada impedem conclusão. Score não substitui evidência. Sema não autoriza deploy, mensagens, dinheiro, segredos, destruição nem bypass de políticas.
|
|
14
|
+
Use PT-BR com acentos quando esse for o idioma do usuário. Confirme escopo fora do workspace.
|
|
15
|
+
${FALLBACK}
|
|
16
16
|
`;
|
|
17
17
|
}
|
|
18
18
|
export function renderizarSemaBoot(_pack) {
|
|
19
|
-
return `# SEMA_BOOT
|
|
20
|
-
|
|
21
|
-
Comece por \`sema --version\` e \`sema sessao "<intenção>" --json\`. O retorno é navegação, não autorização de execução. A skill
|
|
22
|
-
Declare a janela real com \`--janela-contexto <tokens>\`. Use \`--salvar-perfil\` para lembrar neste workspace; \`--orcamento-contexto\` limita a resposta estimada e \`--reserva-saida\` reserva geração. A estimativa por caracteres não é tokenização exata e não mede o contexto já usado pela conversa.
|
|
23
|
-
|
|
24
|
-
Leia somente o contrato selecionado, suas dependências declaradas e as docs bloqueantes da mudança. Referências recomendadas ficam disponíveis sob demanda. SEMA_INDEX.json e AGENT_CONTEXT_PACK.json são consultados internamente; não os carregue integralmente. Para aprofundar: \`sema resumo <contrato> --micro --para mudanca --drift none --json\`. Uma consulta com --drift none não comprova código; valores nulos são não avaliados.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Antes de
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
return `# SEMA_BOOT
|
|
20
|
+
|
|
21
|
+
Comece por \`sema --version\` e \`sema sessao "<intenção>" --json\`. O retorno é navegação, não autorização de execução. A skill é acionada ao criar ou editar; num projeto já adotado, delega a este protocolo.
|
|
22
|
+
Declare a janela real com \`--janela-contexto <tokens>\`. Use \`--salvar-perfil\` para lembrar neste workspace; \`--orcamento-contexto\` limita a resposta estimada e \`--reserva-saida\` reserva geração. A estimativa por caracteres não é tokenização exata e não mede o contexto já usado pela conversa.
|
|
23
|
+
|
|
24
|
+
Leia somente o contrato selecionado, suas dependências declaradas e as docs bloqueantes da mudança. Referências recomendadas ficam disponíveis sob demanda. SEMA_INDEX.json e AGENT_CONTEXT_PACK.json são consultados internamente; não os carregue integralmente. Para aprofundar: \`sema resumo <contrato> --micro --para mudanca --drift none --json\`. Uma consulta com --drift none não comprova código; valores nulos são não avaliados.
|
|
25
|
+
|
|
26
|
+
Drift: use --pacote para receber estado, bloqueios e avisos compactos; sem --pacote o JSON completo continua disponível para aprofundar.
|
|
27
|
+
Antes de editar: inspecionar o contrato, docs-impacto com intenção e arquivo exato, drift fresh e impacto. Para sintaxe .sema, leia exemplos/; use instalar-exemplos se ausente. Módulo novo: contrato validado -> compilar no alvo padrão -> implementação real -> verificar. Preserve SEMA-GOVERNED, impl e vinculos. Sem contrato aplicável, modele e vincule antes do código.
|
|
28
|
+
Antes de concluir: validar contrato alterado, verificar/testes pertinentes, drift --cache fresh --pacote e finalizar-mudanca com --arquivo e --doc-lida. Cache acelera, não é prova final. sucesso:false, vinculos_quebrados, rotas_divergentes e impls_quebrados bloqueiam fechamento; vinculos_fora_do_escopo é informativo. Avalie payload, não só ok. Scores, regex e validação inline não substituem evidência física e comportamental.
|
|
29
|
+
|
|
30
|
+
Divida por responsabilidade: código avisa acima de 1000 linhas e bloqueia acima de 2000; .sema avisa acima de 300 e bloqueia acima de 500. Não use parte_1/parte_2. Payload inline acima de 262144 caracteres exige divisão, não retry.
|
|
31
|
+
UI/CLI: acabamento moderno e contextual, estados e responsividade; prove desktop/mobile sem overflow horizontal a 390px e smoke de saída, erro e ajuda no terminal. Preserve acentos no texto humano.
|
|
32
|
+
Timeout do agente não é falha do Sema: reduza escopo e tente 120s -> 300s -> 600s. Se indisponível, pare antes de editar. ${FALLBACK}
|
|
33
|
+
Sema não concede autorização externa nem contorna políticas da plataforma. Confirme caminhos fora do workspace, não invente evidência e não use --force sem decisão humana explícita.
|
|
33
34
|
`;
|
|
34
35
|
}
|
|
35
36
|
export function renderizarSemaSmallModel(_pack) {
|
|
36
|
-
return `# SEMA_SMALL_MODEL
|
|
37
|
-
|
|
38
|
-
Use a mesma entrada curta de qualquer IA: AGENTS.md -> sema sessao "<intenção>" --json.
|
|
39
|
-
Informe a janela efetiva quando solicitado. O perfil controla o orçamento; fraca/média/forte não substitui quantidade de tokens. Leia SEMA_BOOT.md uma vez e depois somente o contrato indicado. Não carregue SEMA_INDEX.json, AGENT_CONTEXT_PACK.json ou o código inteiro.
|
|
40
|
-
Consulta: --drift none. Fechamento: --cache fresh; cache não é prova final. Preserve SEMA-GOVERNED, os testes e os gates. Pare em ambiguidade, falha ou dependência não resolvida e solicite um recorte menor.
|
|
41
|
-
${FALLBACK}
|
|
37
|
+
return `# SEMA_SMALL_MODEL
|
|
38
|
+
|
|
39
|
+
Use a mesma entrada curta de qualquer IA: AGENTS.md -> sema sessao "<intenção>" --json.
|
|
40
|
+
Informe a janela efetiva quando solicitado. O perfil controla o orçamento; fraca/média/forte não substitui quantidade de tokens. Leia SEMA_BOOT.md uma vez e depois somente o contrato indicado. Não carregue SEMA_INDEX.json, AGENT_CONTEXT_PACK.json ou o código inteiro.
|
|
41
|
+
Consulta: --drift none. Fechamento: --cache fresh --pacote; cache não é prova final. Preserve SEMA-GOVERNED, os testes e os gates. Pare em ambiguidade, falha ou dependência não resolvida e solicite um recorte menor.
|
|
42
|
+
${FALLBACK}
|
|
42
43
|
`;
|
|
43
44
|
}
|
|
44
45
|
//# sourceMappingURL=agentBootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function arquivosProtocoloDesatualizados(base: string): Promise<string[]>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// SEMA-GOVERNED: sema.produto.cli_sessao
|
|
2
|
+
// Descrição: verifica a versão materializada do protocolo sem ler o índice nem alterar regras manuais.
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { criarAgentContextPack, criarGuiaCapacidadeIa } from "./agentContextPack.js";
|
|
6
|
+
import { renderizarInstrucaoCodexSema, renderizarSemaBoot, renderizarSemaSmallModel } from "./agentBootstrap.js";
|
|
7
|
+
export async function arquivosProtocoloDesatualizados(base) {
|
|
8
|
+
const pack = criarAgentContextPack(criarGuiaCapacidadeIa());
|
|
9
|
+
const normalize = (text) => text.replace(/\r\n/g, "\n").trim();
|
|
10
|
+
const esperados = [
|
|
11
|
+
["AGENTS.md", renderizarInstrucaoCodexSema(pack)],
|
|
12
|
+
["SEMA_BOOT.md", renderizarSemaBoot(pack)],
|
|
13
|
+
["SEMA_SMALL_MODEL.md", renderizarSemaSmallModel(pack)],
|
|
14
|
+
];
|
|
15
|
+
const desatualizados = [];
|
|
16
|
+
for (const [arquivo, esperado] of esperados) {
|
|
17
|
+
let atual;
|
|
18
|
+
try {
|
|
19
|
+
atual = normalize(await readFile(path.join(base, arquivo), "utf8"));
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
if (error.code !== "ENOENT")
|
|
23
|
+
throw error;
|
|
24
|
+
desatualizados.push(arquivo);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (arquivo === "AGENTS.md") {
|
|
28
|
+
// Somente o bloco gerenciado pertence ao gerador; regras manuais são preservadas.
|
|
29
|
+
const blocos = [...atual.matchAll(/<!-- sema:agent-entrypoint:start -->([\s\S]*?)<!-- sema:agent-entrypoint:end -->/g)];
|
|
30
|
+
const inicios = atual.match(/<!-- sema:agent-entrypoint:start -->/g)?.length ?? 0;
|
|
31
|
+
const finais = atual.match(/<!-- sema:agent-entrypoint:end -->/g)?.length ?? 0;
|
|
32
|
+
if (blocos.length !== 1 || inicios !== 1 || finais !== 1 || normalize(blocos[0][1]) !== normalize(esperado)) {
|
|
33
|
+
desatualizados.push(arquivo);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if (atual !== normalize(esperado))
|
|
37
|
+
desatualizados.push(arquivo);
|
|
38
|
+
}
|
|
39
|
+
return desatualizados;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=agentProtocol.js.map
|
package/dist/comandoSessao.js
CHANGED
|
@@ -57,12 +57,12 @@ export async function comandoSessao(posicionais, args, emJson, cwd = process.cwd
|
|
|
57
57
|
contexto: contexto ? { ...contexto, candidatosOmitidos: 0 } : undefined,
|
|
58
58
|
intencoes: { intencao, docsBloqueantes: docs?.leituraObrigatoria.map((doc) => doc.relativo) ?? [], leituraPendente: true },
|
|
59
59
|
gates: {
|
|
60
|
-
drift: `sema drift ${alvo} --cache fresh --json`,
|
|
60
|
+
drift: `sema drift ${alvo} --cache fresh --pacote --json`,
|
|
61
61
|
validar: `sema validar ${alvo} --json`,
|
|
62
62
|
verificar: `sema verificar ${alvo} --alvo <alvo> --json`,
|
|
63
63
|
finalizar: `sema finalizar-mudanca --intencao "<intenção>" --arquivo ${alvo} --doc-lida <doc> --json`,
|
|
64
64
|
},
|
|
65
|
-
proximosPassos: !frescor.fresco ? ["
|
|
65
|
+
proximosPassos: !frescor.fresco ? [frescor.sugestao, "Repita a sessão após a sincronização; não carregue o índice bruto."]
|
|
66
66
|
: contrato ? [`Leia ${contrato}; consulte docs-impacto com esse --arquivo para motivos e dependências. Depois inspecione apenas o código vinculado.`, "Referências do índice são navegação. Confirme regras completas e gates antes de agir."]
|
|
67
67
|
: ["Informe uma intenção específica ou --arquivo <contrato-ou-código> para resolver o escopo. Não edite enquanto houver ambiguidade."],
|
|
68
68
|
orcamento: { metodo: "chars_div_4", tokensEstimadosResposta: 0, limiteTokens: perfil.orcamentoTokens, contagemExata: false, contextoDaConversaMedido: false },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const INTENCOES_SKILL_SEMA: readonly ["INFORMAR", "INSTALAR_GLOBAL", "ATUALIZAR_GLOBAL", "REPARAR_GLOBAL", "ADOTAR_WORKSPACE"];
|
|
2
2
|
export type IntencaoSkillSema = typeof INTENCOES_SKILL_SEMA[number];
|
|
3
|
-
export type AcaoIntencaoSkillSema = "npm_view_version:@semacode/cli@latest" | "validar_semver_exata_resolvida" | `npm_install_global:@semacode/cli@${string}` | "provar_cli_path_com_versao_e_skill" | "provar_launcher_gerenciado_com_versao_e_skill" | "preferir_launcher_gerenciado_se_path_stale_ou_sem_skill" | "provar_versao_instalada" | "consultar_status_distribuicao" | "sincronizar_distribuicao_se_necessario" | "consultar_status_final_ready" | "declarar_cli_indisponivel_apos_path_e_launcher_gerenciado_invalidos" | "responder_sem_mutar" | "pedir_autorizacao_adocao" | "descobrir_explicar_flow_project_adoption" | "iniciar_template_base" | "sync_codex" | "ler_agents_e_boot";
|
|
3
|
+
export type AcaoIntencaoSkillSema = "npm_view_version:@semacode/cli@latest" | "validar_semver_exata_resolvida" | `npm_install_global:@semacode/cli@${string}` | "provar_cli_path_com_versao_e_skill" | "provar_launcher_gerenciado_com_versao_e_skill" | "preferir_launcher_gerenciado_se_path_stale_ou_sem_skill" | "provar_versao_instalada" | "consultar_status_distribuicao" | "sincronizar_distribuicao_se_necessario" | "consultar_status_final_ready" | "declarar_cli_indisponivel_apos_path_e_launcher_gerenciado_invalidos" | "responder_sem_mutar" | "pedir_autorizacao_adocao" | "descobrir_explicar_flow_project_adoption" | "confirmar_janela_contexto_efetiva" | "iniciar_template_base" | "sync_codex" | "ler_agents_e_boot";
|
|
4
4
|
export interface EntradaIntencaoSkillSema {
|
|
5
5
|
intencao: IntencaoSkillSema;
|
|
6
6
|
versaoSolicitada?: string;
|
package/dist/driftPack.js
CHANGED
|
@@ -12,8 +12,7 @@ export function criarDriftPack(resultado, options = {}) {
|
|
|
12
12
|
.filter((task) => !targetModule || task.modulo === targetModule)
|
|
13
13
|
.filter((task) => task.semImplementacao || task.implsQuebrados > 0 || task.lacunas.length > 0)
|
|
14
14
|
.map((task) => compactarRegistro(task, [
|
|
15
|
-
"modulo", "task", "
|
|
16
|
-
"confiancaVinculo", "riscoOperacional", "lacunas", "arquivosProvaveisEditar", "checksSugeridos",
|
|
15
|
+
"modulo", "task", "implsQuebrados", "semImplementacao", "riscoOperacional", "lacunas",
|
|
17
16
|
]));
|
|
18
17
|
const base = {
|
|
19
18
|
schema: "sema.ai.drift-pack/v1",
|
|
@@ -54,8 +53,12 @@ export function criarDriftPack(resultado, options = {}) {
|
|
|
54
53
|
tasksWithoutImplementation: tarefas,
|
|
55
54
|
},
|
|
56
55
|
guidance: {
|
|
57
|
-
touchFirst: resultado.resumo_operacional.oQueTocar,
|
|
58
|
-
|
|
56
|
+
touchFirst: [...new Set([...resultado.resumo_operacional.oQueTocar, ...resultado.tasks
|
|
57
|
+
.filter((task) => !targetModule || task.modulo === targetModule)
|
|
58
|
+
.flatMap((task) => task.arquivosProvaveisEditar)])],
|
|
59
|
+
validate: [...new Set([...resultado.resumo_operacional.oQueValidar, ...resultado.tasks
|
|
60
|
+
.filter((task) => !targetModule || task.modulo === targetModule)
|
|
61
|
+
.flatMap((task) => task.checksSugeridos)])],
|
|
59
62
|
loose: resultado.resumo_operacional.oQueEstaFrouxo,
|
|
60
63
|
inferred: resultado.resumo_operacional.oQueFoiInferido,
|
|
61
64
|
risks: resultado.resumo_operacional.riscosPrincipais,
|
|
@@ -69,12 +72,14 @@ export function criarDriftPack(resultado, options = {}) {
|
|
|
69
72
|
"vínculos válidos detalhados",
|
|
70
73
|
"catálogo de arquivos e bytes lidos",
|
|
71
74
|
"cache interno e candidatos não bloqueantes",
|
|
75
|
+
"caminhos e checks repetidos por task; disponíveis uma vez em guidance",
|
|
76
|
+
"detalhes completos: repetir drift no mesmo contrato sem --pacote",
|
|
72
77
|
],
|
|
73
78
|
},
|
|
74
79
|
};
|
|
75
|
-
const packChars = JSON.stringify(base).length;
|
|
80
|
+
const packChars = JSON.stringify(base, null, 2).length;
|
|
76
81
|
const rawDriftChars = options.rawDriftChars ?? 0;
|
|
77
|
-
|
|
82
|
+
const pack = {
|
|
78
83
|
...base,
|
|
79
84
|
telemetry: {
|
|
80
85
|
packChars,
|
|
@@ -92,5 +97,13 @@ export function criarDriftPack(resultado, options = {}) {
|
|
|
92
97
|
],
|
|
93
98
|
},
|
|
94
99
|
};
|
|
100
|
+
// Inclui a própria telemetria e a indentação do pacote; o envelope CLI é externo.
|
|
101
|
+
for (let i = 0; i < 4; i++) {
|
|
102
|
+
pack.telemetry.packChars = JSON.stringify(pack, null, 2).length;
|
|
103
|
+
pack.telemetry.packEstimatedTokens = estimarTokens(pack.telemetry.packChars);
|
|
104
|
+
pack.telemetry.reductionPercent = rawDriftChars === 0 ? 0
|
|
105
|
+
: Math.round((1 - pack.telemetry.packChars / rawDriftChars) * 10000) / 100;
|
|
106
|
+
}
|
|
107
|
+
return pack;
|
|
95
108
|
}
|
|
96
109
|
//# sourceMappingURL=driftPack.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function diagnosticarEntradaContratos(arquivos) {
|
|
2
|
+
if (arquivos.length === 0) {
|
|
3
|
+
return [{
|
|
4
|
+
codigo: "SEM_CLI_SEM_CONTRATOS",
|
|
5
|
+
severidade: "erro",
|
|
6
|
+
mensagem: "Nenhum contrato .sema encontrado no escopo. A aplicação não foi validada nem formatada.",
|
|
7
|
+
dica: "Confirme o escopo. Se este projeto ainda não usa Sema, obtenha autorização de adoção e a janela de contexto antes de iniciar; depois modele o contrato da tarefa.",
|
|
8
|
+
}];
|
|
9
|
+
}
|
|
10
|
+
if (arquivos.some((arquivo) => !arquivo.toLowerCase().endsWith(".sema"))) {
|
|
11
|
+
return [{
|
|
12
|
+
codigo: "SEM_CLI_ENTRADA_NAO_CONTRATO",
|
|
13
|
+
severidade: "erro",
|
|
14
|
+
mensagem: "Validar e formatar operam sobre contratos .sema, não sobre arquivos da aplicação.",
|
|
15
|
+
dica: "Informe o contrato aplicável e use testes próprios para verificar a implementação.",
|
|
16
|
+
}];
|
|
17
|
+
}
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=entradaContratos.js.map
|
package/dist/index.part04.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export declare function verificarFrescorArtefatos(baseProjeto: string): Promise<
|
|
|
7
7
|
hashArtefato: string | null;
|
|
8
8
|
hashAtual: string;
|
|
9
9
|
contratosMudaram: boolean;
|
|
10
|
+
protocoloAtualizado: boolean;
|
|
11
|
+
arquivosProtocoloDesatualizados: string[];
|
|
10
12
|
sugestao: string;
|
|
11
13
|
}>;
|
|
12
14
|
export declare function gerarResumoProjetoIa(entrada: string | undefined, pastaSaidaOpcional?: string, escreverNaRaiz?: boolean, analiseDrift?: ResolucaoModoCacheDrift): Promise<{
|
package/dist/index.part04.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// SEMA-GOVERNED: sema.governanca_ia_contexto, sema.produto.escrita_segura_workspace, sema.produto.governanca_ia.drift.cache.modos
|
|
2
2
|
// Descrição: gera contexto local e grava artefatos somente dentro da base validada.
|
|
3
3
|
import { mkdir, readFile } from "node:fs/promises";
|
|
4
|
+
import { diagnosticarEntradaContratos } from "./entradaContratos.js";
|
|
5
|
+
import { arquivosProtocoloDesatualizados } from "./agentProtocol.js";
|
|
4
6
|
import { createHash } from "node:crypto";
|
|
5
7
|
import path from "node:path";
|
|
6
8
|
import { formatarDiagnosticos, gerarRespostaValidacao, temErros, } from "@sema/nucleo";
|
|
@@ -82,13 +84,17 @@ export async function verificarFrescorArtefatos(baseProjeto) {
|
|
|
82
84
|
const { listarArquivosDeOrigens } = await import("./projetoOrigens.js");
|
|
83
85
|
const contratos = await listarArquivosDeOrigens(origens);
|
|
84
86
|
const hashAtual = await calcularHashContratos(contratos, baseProjeto);
|
|
85
|
-
const
|
|
87
|
+
const protocoloPendente = await arquivosProtocoloDesatualizados(baseProjeto);
|
|
88
|
+
const contratosMudaram = hashArtefato !== hashAtual;
|
|
89
|
+
const fresco = !contratosMudaram && protocoloPendente.length === 0;
|
|
86
90
|
return {
|
|
87
91
|
fresco,
|
|
88
92
|
hashArtefato,
|
|
89
93
|
hashAtual,
|
|
90
|
-
contratosMudaram
|
|
91
|
-
|
|
94
|
+
contratosMudaram,
|
|
95
|
+
protocoloAtualizado: protocoloPendente.length === 0,
|
|
96
|
+
arquivosProtocoloDesatualizados: protocoloPendente,
|
|
97
|
+
sugestao: fresco ? "" : "Índice ou protocolo de entrada desatualizado; rode sema sync-codex --json para atualizar o bloco gerenciado e preservar as regras manuais.",
|
|
92
98
|
};
|
|
93
99
|
}
|
|
94
100
|
export async function gerarResumoProjetoIa(entrada, pastaSaidaOpcional, escreverNaRaiz = false, analiseDrift = { modo: "none", executar: false, avisos: [] }) {
|
|
@@ -490,13 +496,15 @@ export async function comandoFinalizarMudanca(posicionais, args, emJson) {
|
|
|
490
496
|
}
|
|
491
497
|
export async function comandoValidar(entrada) {
|
|
492
498
|
const modulos = await carregarModulos(entrada);
|
|
493
|
-
const diagnosticos = modulos.
|
|
499
|
+
const diagnosticos = [...diagnosticarEntradaContratos(modulos.map((item) => item.caminho)),
|
|
500
|
+
...modulos.flatMap((item) => item.resultado.diagnosticos)];
|
|
494
501
|
console.log(formatarDiagnosticos(diagnosticos));
|
|
495
502
|
return temErros(diagnosticos) ? 1 : 0;
|
|
496
503
|
}
|
|
497
504
|
export async function comandoValidarJson(entrada) {
|
|
498
505
|
const modulos = await carregarModulos(entrada);
|
|
499
|
-
const diagnosticos = modulos.
|
|
506
|
+
const diagnosticos = [...diagnosticarEntradaContratos(modulos.map((item) => item.caminho)),
|
|
507
|
+
...modulos.flatMap((item) => item.resultado.diagnosticos)];
|
|
500
508
|
const resultado = gerarRespostaValidacao(diagnosticos);
|
|
501
509
|
console.log(JSON.stringify(resultado, null, 2));
|
|
502
510
|
return resultado.valido ? 0 : 1;
|
package/dist/index.part05.js
CHANGED
|
@@ -137,7 +137,7 @@ export async function comandoDrift(entrada, args, emJson, cwd = process.cwd()) {
|
|
|
137
137
|
});
|
|
138
138
|
const resultado = await analisarDriftLegado(contextoProjeto, opcoes);
|
|
139
139
|
if (possuiFlag(args, "--pacote")) {
|
|
140
|
-
const pacote = criarDriftPack(resultado, { rawDriftChars: JSON.stringify(resultado).length });
|
|
140
|
+
const pacote = criarDriftPack(resultado, { rawDriftChars: JSON.stringify(resultado, null, 2).length });
|
|
141
141
|
console.log(JSON.stringify(pacote, null, 2));
|
|
142
142
|
return resultado.sucesso ? 0 : 1;
|
|
143
143
|
}
|
package/dist/index.part06.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SEMA-GOVERNED: sema.governanca_ia_contexto, sema.produto.governanca_ia.drift.cache.modos
|
|
2
2
|
// Descrição: resume contrato ou projeto com política explícita de análise de drift.
|
|
3
3
|
import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
4
|
+
import { diagnosticarEntradaContratos } from "./entradaContratos.js";
|
|
4
5
|
import path from "node:path";
|
|
5
6
|
import { compilarCodigo, formatarCodigo, formatarDiagnosticos, lerArquivoTexto, temErros, } from "@sema/nucleo";
|
|
6
7
|
import { carregarProjeto, } from "./projeto.js";
|
|
@@ -63,6 +64,20 @@ export async function comandoFormatar(entrada, verificarApenas, emJson) {
|
|
|
63
64
|
const arquivos = estatisticas.isFile()
|
|
64
65
|
? [entradaResolvida]
|
|
65
66
|
: contextoProjeto.arquivosProjeto.filter((arquivo) => arquivo.startsWith(path.resolve(entradaResolvida)));
|
|
67
|
+
const errosEntrada = diagnosticarEntradaContratos(arquivos);
|
|
68
|
+
if (errosEntrada.length > 0) {
|
|
69
|
+
if (emJson) {
|
|
70
|
+
console.log(JSON.stringify({
|
|
71
|
+
comando: "formatar", sucesso: false, modo: verificarApenas ? "check" : "write",
|
|
72
|
+
arquivos: [], totais: { arquivos: 0, alterados: 0, erros: errosEntrada.length },
|
|
73
|
+
diagnosticos: errosEntrada,
|
|
74
|
+
}, null, 2));
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
console.error(formatarDiagnosticos(errosEntrada));
|
|
78
|
+
}
|
|
79
|
+
return 1;
|
|
80
|
+
}
|
|
66
81
|
const resultados = [];
|
|
67
82
|
for (const arquivo of arquivos) {
|
|
68
83
|
const codigo = await lerArquivoTexto(arquivo);
|
package/docs/commands.md
CHANGED
|
@@ -91,6 +91,19 @@ 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
|
+
Session freshness checks the managed `AGENTS.md` block, `SEMA_BOOT.md` and
|
|
95
|
+
`SEMA_SMALL_MODEL.md` against the current CLI templates as well as contract
|
|
96
|
+
hashes. Older instructions can therefore require `sync-codex` even when no
|
|
97
|
+
contract changed. Synchronization preserves manual rules outside the managed
|
|
98
|
+
block. The generated workflow uses `drift --cache fresh --pacote --json`; omit
|
|
99
|
+
`--pacote` only when full evidence is needed. A session budget limits that
|
|
100
|
+
session response, not subsequent commands, file reads or the full conversation.
|
|
101
|
+
|
|
102
|
+
`validar` and `formatar` require selected `.sema` contracts. An empty scope
|
|
103
|
+
returns a nonzero exit code and `SEM_CLI_SEM_CONTRATOS`; it does not validate
|
|
104
|
+
an application or adopt the project. Before first-time adoption, the agent
|
|
105
|
+
must obtain consent and the effective context window.
|
|
106
|
+
|
|
94
107
|
- `sema ajuda-ia`: short guidance for Codex.
|
|
95
108
|
- `sema starter-ia`: operational starter.
|
|
96
109
|
- `sema contexto-ia <arquivo.sema> --saida <dir> --json`: AI context package.
|
package/docs/drift-cache.md
CHANGED
|
@@ -15,6 +15,13 @@ Use `--cache none` when a direct analysis must leave no persistent cache access.
|
|
|
15
15
|
Use `--drift none` when a summary or inspection should not perform drift at all.
|
|
16
16
|
The two forms are not interchangeable.
|
|
17
17
|
|
|
18
|
+
For agent workflows, use `sema drift <contract> --cache fresh --pacote --json`.
|
|
19
|
+
The compact packet preserves blockers, diagnostics and task gaps, while
|
|
20
|
+
consolidating repeated file paths and suggested checks under `guidance`.
|
|
21
|
+
Remove `--pacote` for the complete evidence. Packet telemetry estimates the
|
|
22
|
+
pretty-printed packet, including its own telemetry, using characters/4; the
|
|
23
|
+
outer CLI envelope and other conversation content are not part of that count.
|
|
24
|
+
|
|
18
25
|
## Honest Query Evidence
|
|
19
26
|
|
|
20
27
|
`sema resumo` and `sema inspecionar` default to `--drift none`. Their JSON
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semacode/cli",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "Local-first semantic governance CLI for AI agents, proven with Claude, Codex, zCode (GLM) and Kimi: contracts, drift, impact, docs gates, and code generation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"icon": "logo.png",
|
package/skills/sema/SKILL.md
CHANGED
|
@@ -1,112 +1,74 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sema
|
|
3
|
-
description:
|
|
3
|
+
description: Use before creating or editing software in a workspace, including small fixes, plain HTML/CSS/JavaScript apps, and empty projects. Ask about first-time Sema adoption, confirm the effective context window, then follow local contracts before implementation. Also handles Sema installation, updates and repair. The user need not mention Sema.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Sema
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
6
|
+
# Sema
|
|
7
|
+
|
|
8
|
+
Load this skill before the first project write for creation or editing tasks.
|
|
9
|
+
Sema applies to simple static apps as well as larger systems. A request to
|
|
10
|
+
create an app, fix a bug or change a feature enters this workflow even when
|
|
11
|
+
it does not name Sema. Loading the skill is not consent to adopt it.
|
|
12
|
+
|
|
13
|
+
## Create or edit a project
|
|
14
|
+
|
|
15
|
+
1. In the current workspace, run `sema --version`. If PATH fails, use the
|
|
16
|
+
fallback below. Look for `AGENTS.md`, `SEMA_BOOT.md` and applicable contracts
|
|
17
|
+
without reading the whole project.
|
|
18
|
+
2. **First use in a project without Sema:** before implementation, ask whether
|
|
19
|
+
the user wants to adopt Sema in this project and wait for the answer. This
|
|
20
|
+
applies both to an empty project and to editing existing ungoverned code.
|
|
21
|
+
Do not infer consent from installation, automatic skill activation or a
|
|
22
|
+
generic request to create/edit software. An explicit adoption request or
|
|
23
|
+
previous acceptance for this same project already answers the question;
|
|
24
|
+
do not ask again. If declined, do not initialize Sema or claim its validation;
|
|
25
|
+
follow the remaining user and project instructions.
|
|
26
|
+
3. **After acceptance, or in an existing Sema project:** obtain the model's
|
|
27
|
+
effective configured context window in tokens from the client or user.
|
|
28
|
+
If unknown, ask and wait before loading project context or implementing.
|
|
29
|
+
Parameter count (4B, 9B), advertised maximum and output-token limit are not
|
|
30
|
+
the configured context window. Recheck when the model/configuration changes.
|
|
31
|
+
4. **Adopting this project:** preserve existing files and run:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
sema descobrir explicar flow.project-adoption --json
|
|
35
|
+
sema iniciar --template base --janela-contexto <confirmed-tokens>
|
|
36
|
+
sema sync-codex --json
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Read the generated `AGENTS.md` and `SEMA_BOOT.md`. Model the requested
|
|
40
|
+
behavior in an applicable contract before implementing. Never add `--force`
|
|
41
|
+
without an explicit overwrite decision.
|
|
42
|
+
5. **Existing Sema project:** read its `AGENTS.md` and `SEMA_BOOT.md`, then run
|
|
43
|
+
`sema sessao "<task intention>" --janela-contexto <confirmed-tokens> --json`.
|
|
44
|
+
Follow the local gates and selected contract through implementation/testing.
|
|
45
|
+
Save a context profile only with `--salvar-perfil` as requested.
|
|
46
|
+
|
|
47
|
+
`sema formatar` formats .sema contracts and `sema validar` validates those
|
|
48
|
+
contracts. Neither adopts a project or proves that HTML, CSS, JavaScript or
|
|
49
|
+
the application works. Report what was actually checked, including no contracts
|
|
50
|
+
found. If the user corrects a missed Sema workflow, resume it before more writes.
|
|
51
|
+
|
|
52
|
+
Read only the selected contract, declared dependencies and blocking docs.
|
|
53
|
+
`SEMA_INDEX.json` and `AGENT_CONTEXT_PACK.json` are internal CLI databases,
|
|
54
|
+
not files to preload. Resolve stale indexes or ambiguous targets before editing.
|
|
55
|
+
The session budget estimates its response, not the whole chat.
|
|
56
|
+
|
|
57
|
+
## CLI fallback and results
|
|
58
|
+
|
|
59
|
+
On Windows PowerShell, use this directly if PATH fails:
|
|
46
60
|
|
|
47
61
|
```powershell
|
|
48
62
|
& "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\.sema\bin\sema-managed.ps1" --version
|
|
49
63
|
```
|
|
50
64
|
|
|
51
|
-
On macOS/Linux: `"$HOME/.sema/bin/sema" --version`.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
If valid candidates disagree, prefer the managed candidate. Use it when PATH
|
|
56
|
-
is stale, fails, or does not support `sema skill status --json`. During an
|
|
57
|
-
update, any selected candidate must match the installed exact version.
|
|
58
|
-
Do not declare Sema unavailable until both candidates have failed validation.
|
|
59
|
-
If unavailable, stop before governed edits; install only within an authorized
|
|
60
|
-
global install/update request. Repair alone does not authorize a new version.
|
|
61
|
-
|
|
62
|
-
`--version` is plain SemVer. JSON help/control failures use the six-field
|
|
63
|
-
`sema.cli.control/v1` envelope. Valid commands use the eight-field
|
|
64
|
-
`sema.cli.result/v1`: schemaVersion, ok, kind, command, code, message, exitCode,
|
|
65
|
-
payload. Read domain state inside `payload`; `data` is not an alias and `ok`
|
|
66
|
-
does not replace `payload.sucesso` or another domain verdict.
|
|
67
|
-
|
|
68
|
-
## Repair without upgrading
|
|
69
|
-
|
|
70
|
-
Resolve the current CLI, inspect status, and synchronize only non-READY
|
|
71
|
-
managed components. Prove the result with status again. Repair may synchronize the current
|
|
72
|
-
launcher and skill, but must not run `npm install`, choose a new version or
|
|
73
|
-
mutate the workspace.
|
|
74
|
-
|
|
75
|
-
## Adopt a workspace with a bounded context
|
|
76
|
-
|
|
77
|
-
If no contract/protocol exists, obtain explicit adoption authorization before
|
|
78
|
-
implementation. A request to adopt or initialize this project already grants
|
|
79
|
-
it. After authorization, inspect the official flow:
|
|
80
|
-
|
|
81
|
-
`sema descobrir explicar flow.project-adoption --json`
|
|
82
|
-
|
|
83
|
-
Before creating files, obtain the model's **effective configured context
|
|
84
|
-
window in tokens** from the client or user. Model size, advertised capacity
|
|
85
|
-
and names such as 9B do not prove that value. Do not invent a default.
|
|
86
|
-
Initialize with the confirmed value:
|
|
87
|
-
|
|
88
|
-
`sema iniciar --template base --janela-contexto <tokens>`
|
|
89
|
-
|
|
90
|
-
Then run `sema sync-codex --json`. Read the generated `AGENTS.md` and
|
|
91
|
-
`SEMA_BOOT.md`, and delegate the governed workflow to them. For an existing
|
|
92
|
-
workspace, the session requests a missing profile; persist it only when
|
|
93
|
-
requested with `--salvar-perfil`, and reconfigure after changing models.
|
|
94
|
-
The context budget estimates a session response, not the entire conversation
|
|
95
|
-
or exact tokenizer usage. Expand through the selected contract and declared
|
|
96
|
-
links, leaving recommended documents available on demand. A stale index or
|
|
97
|
-
ambiguous target requires correction or refinement before acting.
|
|
65
|
+
On macOS/Linux: `"$HOME/.sema/bin/sema" --version`. Do not declare the CLI
|
|
66
|
+
unavailable before trying the managed fallback. If both fail, stop governed
|
|
67
|
+
edits. JSON results nest domain state in `payload`; `ok` alone is not proof
|
|
68
|
+
of success. Respect `payload.sucesso`, `valido`, blockers and scope.
|
|
98
69
|
|
|
99
|
-
##
|
|
70
|
+
## Install, update or repair Sema
|
|
100
71
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
`~/.agents/skills/sema`; the mirror at `~/.claude/skills/sema` is managed
|
|
105
|
-
when Claude is detected. Client-specific copies require an explicit request
|
|
106
|
-
and the client's supported discovery location; preserve unrelated skills.
|
|
107
|
-
- Never write into a host-managed plugin cache or overwrite an unmanaged or
|
|
108
|
-
modified skill silently. Preserve files and stop on symlink/junction escapes.
|
|
109
|
-
- Do not introduce runtime access gates: no Sema login, activation key,
|
|
110
|
-
license check, tokens, credits, billing or remote workspace mirror. This
|
|
111
|
-
does not waive explicit human
|
|
112
|
-
authorization for workspace adoption or overwrite.
|
|
72
|
+
Only for distribution work, read [references/distribution.md](references/distribution.md).
|
|
73
|
+
Do not load it for ordinary project creation or editing. Informational requests
|
|
74
|
+
do not mutate a workspace. Installation and repair remain separate from adoption.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Sema"
|
|
3
|
-
short_description: "
|
|
4
|
-
default_prompt: "Use $sema
|
|
3
|
+
short_description: "Use Sema before creating or editing software"
|
|
4
|
+
default_prompt: "Use $sema before creating or editing this project: ask about first-time adoption, confirm the effective context window, and follow local contracts; route install, update or repair separately."
|
|
5
|
+
policy:
|
|
6
|
+
allow_implicit_invocation: true
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Sema distribution
|
|
2
|
+
|
|
3
|
+
Read only for installation, updates or repair. Never treat a request to install, update, or repair the global distribution as permission to adopt the current workspace.
|
|
4
|
+
|
|
5
|
+
## Install or update globally
|
|
6
|
+
|
|
7
|
+
1. Accept an exact SemVer, or resolve an omitted version / `latest` once:
|
|
8
|
+
`npm view @semacode/cli@latest version --json`.
|
|
9
|
+
Require one exact SemVer JSON string; stop on failure, range or malformed
|
|
10
|
+
output. Freeze that version before installing:
|
|
11
|
+
`npm install --global @semacode/cli@<resolved-exact-semver>`.
|
|
12
|
+
Substitute the validated version; never pass the placeholder literally.
|
|
13
|
+
2. Run that `npm install --global` even when an older `sema --version` already
|
|
14
|
+
works. Synchronizing a skill does not upgrade the package.
|
|
15
|
+
3. Probe both CLI candidates below. Require the selected candidate to report
|
|
16
|
+
the exact installed version and support the skill status command.
|
|
17
|
+
4. Run `sema skill status --json`. If a managed component is not `READY`, run
|
|
18
|
+
`sema skill sync --json`, then status again. Require the final `READY`
|
|
19
|
+
state and version match; npm exit code alone is insufficient proof.
|
|
20
|
+
5. Report the installed version. Existing chats may need a skill reload or
|
|
21
|
+
a new chat. Do not initialize a workspace unless adoption was also requested.
|
|
22
|
+
|
|
23
|
+
## Resolve the CLI and its results
|
|
24
|
+
|
|
25
|
+
Probe `sema --version` and `sema skill status --json` from the workspace root.
|
|
26
|
+
Also probe the PATH-independent fallback with the same two arguments.
|
|
27
|
+
Windows PowerShell fallback:
|
|
28
|
+
|
|
29
|
+
```powershell
|
|
30
|
+
& "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\.sema\bin\sema-managed.ps1" --version
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
On macOS/Linux: `"$HOME/.sema/bin/sema" --version`.
|
|
34
|
+
Windows PATH uses `sema.ps1` in PowerShell and `sema.cmd` in cmd.exe. Do not
|
|
35
|
+
invoke the batch shim as the absolute PowerShell fallback.
|
|
36
|
+
|
|
37
|
+
If valid candidates disagree, prefer the managed candidate. Use it when PATH
|
|
38
|
+
is stale, fails, or does not support `sema skill status --json`. During an
|
|
39
|
+
update, any selected candidate must match the installed exact version.
|
|
40
|
+
Do not declare Sema unavailable until both candidates have failed validation.
|
|
41
|
+
If unavailable, stop before governed edits; install only within an authorized
|
|
42
|
+
global install/update request. Repair alone does not authorize a new version.
|
|
43
|
+
|
|
44
|
+
`--version` is plain SemVer. JSON help/control failures use the six-field
|
|
45
|
+
`sema.cli.control/v1` envelope. Valid commands use the eight-field
|
|
46
|
+
`sema.cli.result/v1`: schemaVersion, ok, kind, command, code, message, exitCode,
|
|
47
|
+
payload. Read domain state inside `payload`; `data` is not an alias and `ok`
|
|
48
|
+
does not replace `payload.sucesso` or another domain verdict.
|
|
49
|
+
|
|
50
|
+
## Repair without upgrading
|
|
51
|
+
|
|
52
|
+
Resolve the current CLI, inspect status, and synchronize only non-READY
|
|
53
|
+
managed components. Prove the result with status again. Repair may synchronize the current
|
|
54
|
+
launcher and skill, but must not run `npm install`, choose a new version or
|
|
55
|
+
mutate the workspace.
|
|
56
|
+
|
|
57
|
+
## Distribution boundaries
|
|
58
|
+
|
|
59
|
+
- `AGENTS.md` is the automatic, continuous workspace protocol for Codex.
|
|
60
|
+
Compatible clients follow the same local protocol; do not duplicate it here.
|
|
61
|
+
- Launchers are managed at `~/.sema/bin`. The canonical skill is managed at
|
|
62
|
+
`~/.agents/skills/sema`; the mirror at `~/.claude/skills/sema` is managed
|
|
63
|
+
when Claude is detected. Client-specific copies require an explicit request
|
|
64
|
+
and the client's supported discovery location; preserve unrelated skills.
|
|
65
|
+
- Never write into a host-managed plugin cache or overwrite an unmanaged or
|
|
66
|
+
modified skill silently. Preserve files and stop on symlink/junction escapes.
|
|
67
|
+
- Do not introduce runtime access gates: no Sema login, activation key,
|
|
68
|
+
license check, tokens, credits, billing or remote workspace mirror. This
|
|
69
|
+
does not waive explicit human
|
|
70
|
+
authorization for workspace adoption or overwrite.
|