@semacode/cli 2.3.1 → 3.5.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 +265 -217
- package/dist/agentContextPack.js +14 -10
- package/dist/agentEntryPoints.d.ts +5 -0
- package/dist/agentEntryPoints.js +592 -568
- package/dist/angular-consumer-standalone.js +1 -1
- package/dist/bin.d.ts +6 -0
- package/dist/bin.js +130 -0
- package/dist/cliArgs.js +4 -4
- package/dist/cliControlError.d.ts +12 -0
- package/dist/cliControlError.js +47 -0
- package/dist/cliGrammar.d.ts +11 -0
- package/dist/cliGrammar.js +551 -0
- package/dist/cliHelp.d.ts +13 -0
- package/dist/cliHelp.js +19 -0
- package/dist/cliHelpTexto.d.ts +3 -0
- package/dist/cliHelpTexto.js +168 -0
- package/dist/cliRuntime.d.ts +2 -0
- package/dist/cliRuntime.js +31 -0
- package/dist/comandos.js +9 -22
- package/dist/contexto.js +5 -5
- package/dist/dev/index.d.ts +1 -0
- package/dist/dev/index.js +51 -9
- package/dist/discovery/catalog.js +3 -3
- package/dist/distribuicao/filesystemGlobal.d.ts +63 -0
- package/dist/distribuicao/filesystemGlobal.js +701 -0
- package/dist/distribuicao/index.d.ts +7 -0
- package/dist/distribuicao/index.js +227 -0
- package/dist/distribuicao/launcherGlobal.d.ts +53 -0
- package/dist/distribuicao/launcherGlobal.js +643 -0
- package/dist/distribuicao/launcherWindows.d.ts +28 -0
- package/dist/distribuicao/launcherWindows.js +326 -0
- package/dist/distribuicao/lockContextGlobal.d.ts +10 -0
- package/dist/distribuicao/lockContextGlobal.js +17 -0
- package/dist/distribuicao/lockGlobal.d.ts +6 -0
- package/dist/distribuicao/lockGlobal.js +520 -0
- package/dist/distribuicao/skillGlobal.d.ts +48 -0
- package/dist/distribuicao/skillGlobal.js +652 -0
- package/dist/distribuicao/skillIntentPolicy.d.ts +21 -0
- package/dist/distribuicao/skillIntentPolicy.js +115 -0
- package/dist/distribuicao/tipos.d.ts +50 -0
- package/dist/distribuicao/tipos.js +10 -0
- package/dist/distribuicao/versaoSemantica.d.ts +3 -0
- package/dist/distribuicao/versaoSemantica.js +62 -0
- package/dist/docs.part01.d.ts +4 -1
- package/dist/docs.part01.js +8 -0
- package/dist/docs.part02.js +9 -1
- package/dist/drift.part01.d.ts +33 -25
- package/dist/drift.part01.js +2 -1
- package/dist/drift.part04.d.ts +26 -5
- package/dist/drift.part04.js +123 -19
- package/dist/drift.part05.d.ts +2 -2
- package/dist/drift.part05.js +8 -6
- package/dist/drift.part06.d.ts +2 -2
- package/dist/drift.part06.js +113 -26
- package/dist/drift.part07.d.ts +11 -11
- package/dist/drift.part07.js +261 -265
- package/dist/drift.part08.d.ts +2 -2
- package/dist/drift.part08.js +35 -26
- package/dist/drift.part09.d.ts +2 -2
- package/dist/drift.part09.js +10 -3
- package/dist/drift.part11.js +261 -58
- package/dist/drift.part12.d.ts +1 -1
- package/dist/drift.part12.js +193 -21
- package/dist/drift.part13.d.ts +20 -39
- package/dist/drift.part13.js +601 -647
- package/dist/drift.part14.js +23 -7
- package/dist/driftCacheCas.d.ts +43 -0
- package/dist/driftCacheCas.js +351 -0
- package/dist/driftCacheFilesystem.d.ts +64 -0
- package/dist/driftCacheFilesystem.js +313 -0
- package/dist/driftCacheModes.d.ts +38 -0
- package/dist/driftCacheModes.js +147 -0
- package/dist/driftCacheStore.d.ts +80 -0
- package/dist/driftCacheStore.js +603 -0
- package/dist/driftCatalogo.d.ts +2 -28
- package/dist/driftCatalogo.js +143 -284
- package/dist/driftEscopo.d.ts +1 -3
- package/dist/driftEscopo.js +235 -151
- package/dist/driftEscopoReferencias.d.ts +5 -1
- package/dist/driftEscopoReferencias.js +375 -28
- package/dist/driftOrcamento.d.ts +0 -6
- package/dist/driftOrcamento.js +2 -1
- package/dist/execucoesExternas.js +19 -5
- package/dist/exemplosOficiais.d.ts +2 -1
- package/dist/exemplosOficiais.js +9 -3
- package/dist/geracaoCore.d.ts +1 -0
- package/dist/geracaoCore.js +6 -6
- package/dist/iaPrompts.d.ts +3 -3
- package/dist/iaPrompts.js +312 -313
- package/dist/importador.part01.d.ts +1 -1
- package/dist/importador.part06.d.ts +2 -0
- package/dist/importador.part06.js +87 -1
- package/dist/importador.part09.js +7 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +6 -25
- package/dist/index.part01.d.ts +20 -28
- package/dist/index.part01.js +16 -237
- package/dist/index.part02.js +36 -22
- package/dist/index.part03.d.ts +24 -2
- package/dist/index.part03.js +83 -19
- package/dist/index.part04.d.ts +10 -2
- package/dist/index.part04.js +152 -123
- package/dist/index.part05.js +80 -78
- package/dist/index.part06.js +34 -17
- package/dist/index.part07.d.ts +8 -2
- package/dist/index.part07.js +153 -7
- package/dist/index.part08.d.ts +1 -1
- package/dist/index.part08.js +25 -30
- package/dist/initCommand.d.ts +1 -0
- package/dist/initCommand.js +20 -4
- package/dist/initTemplatesBase.js +6 -4
- package/dist/pipelineConteudo/command.d.ts +1 -0
- package/dist/pipelineConteudo/command.js +9 -2
- package/dist/pipelineConteudo/help.d.ts +2 -0
- package/dist/pipelineConteudo/help.js +33 -0
- package/dist/profileAuthorCommand.js +3 -7
- package/dist/profileCommand.js +3 -7
- package/dist/projetoCarregar.js +35 -17
- package/dist/projetoCatalogo.d.ts +1 -0
- package/dist/projetoCatalogo.js +64 -25
- package/dist/projetoConfig.js +2 -0
- package/dist/projetoLegado.js +18 -0
- package/dist/projetoOrigens.d.ts +2 -0
- package/dist/projetoOrigens.js +65 -9
- package/dist/projetoTipos.d.ts +1 -0
- package/dist/resultadoCli.d.ts +20 -0
- package/dist/resultadoCli.js +57 -0
- package/dist/saidaCli.d.ts +35 -0
- package/dist/saidaCli.js +118 -0
- package/dist/sistemasInterativos/acceptanceEvidence.d.ts +22 -0
- package/dist/sistemasInterativos/acceptanceEvidence.js +345 -0
- package/dist/sistemasInterativos/engineObservation.d.ts +12 -0
- package/dist/sistemasInterativos/engineObservation.js +438 -0
- package/dist/sistemasInterativos/jobOrchestration.d.ts +2 -0
- package/dist/sistemasInterativos/jobOrchestration.js +204 -0
- package/dist/sistemasInterativos/operationPrimitives.d.ts +21 -0
- package/dist/sistemasInterativos/operationPrimitives.js +194 -0
- package/dist/sistemasInterativos/operations.d.ts +4 -39
- package/dist/sistemasInterativos/operations.js +5 -1164
- package/dist/skillCommand.d.ts +5 -0
- package/dist/skillCommand.js +88 -0
- package/dist/tipos.d.ts +1 -1
- package/dist/typescript-http-modelos.d.ts +1 -1
- package/dist/typescript-http-rotas.d.ts +1 -0
- package/dist/typescript-http-rotas.js +93 -0
- package/dist/typescript-http.d.ts +1 -1
- package/dist/typescript-http.js +1 -1
- package/dist/verificacaoCache.d.ts +25 -0
- package/dist/verificacaoCache.js +80 -0
- package/docs/README.md +34 -30
- package/docs/ai-integration.md +25 -12
- package/docs/ai-onboarding.md +37 -18
- package/docs/ai-workflow.md +9 -7
- package/docs/cli.md +125 -7
- package/docs/commands.md +41 -20
- package/docs/deploy.md +21 -8
- package/docs/descoberta-capacidades.md +106 -106
- package/docs/documentation.md +49 -39
- package/docs/drift-cache.md +108 -0
- package/docs/getting-started.md +43 -18
- package/docs/pipeline-conteudo.md +246 -246
- package/docs/profiles.md +54 -54
- package/docs/repositories.md +19 -2
- package/docs/rollback.md +15 -8
- package/docs/security.md +25 -3
- package/docs/sistemas-interativos.md +379 -374
- package/docs/syntax.md +14 -0
- package/docs/testing.md +139 -40
- package/exemplos/express_crud.sema +139 -0
- package/exemplos/fastify_crud.sema +146 -0
- package/exemplos/pipeline-conteudo/README.md +44 -44
- package/exemplos/pipeline-conteudo/alvos.json +23 -23
- package/exemplos/pipeline-conteudo/definicao.json +136 -136
- package/exemplos/profile_simulation.sema +211 -211
- package/exemplos/sistemas-interativos/README.md +100 -100
- package/exemplos/sistemas-interativos/advanced/acceptance-context-evaluate-valid.json +5 -5
- package/exemplos/sistemas-interativos/advanced/acceptance-lock-valid.json +16 -16
- package/exemplos/sistemas-interativos/advanced/asset-provenance-valid.json +32 -32
- package/exemplos/sistemas-interativos/advanced/autonomy-repair-valid.json +93 -93
- package/exemplos/sistemas-interativos/advanced/control-run-definition-valid.json +78 -78
- package/exemplos/sistemas-interativos/advanced/control-run-valid.json +27 -27
- package/exemplos/sistemas-interativos/advanced/distributed-workers-valid.json +79 -79
- package/exemplos/sistemas-interativos/advanced/editor-state-valid.json +42 -42
- package/exemplos/sistemas-interativos/advanced/engine-snapshot-after-valid.json +32 -32
- package/exemplos/sistemas-interativos/advanced/engine-snapshot-before-valid.json +23 -23
- package/exemplos/sistemas-interativos/advanced/job-orchestration-valid.json +39 -39
- package/exemplos/sistemas-interativos/advanced/multimodal-evidence-valid.json +46 -46
- package/exemplos/sistemas-interativos/advanced/multiplayer-authority-valid.json +39 -39
- package/exemplos/sistemas-interativos/advanced/playtest-fuzz-valid.json +37 -37
- package/exemplos/sistemas-interativos/advanced/portability-valid.json +104 -104
- package/exemplos/sistemas-interativos/advanced/temporal-evidence-valid.json +27 -27
- package/exemplos/sistemas-interativos/advanced/temporal-valid.json +118 -118
- package/exemplos/sistemas-interativos/experience-ir-valid.json +459 -459
- package/exemplos/sistemas-interativos/game-2d.json +83 -83
- package/exemplos/sistemas-interativos/game-3d-human.json +81 -81
- package/exemplos/sistemas-interativos/game-pixel-16-bit.json +97 -97
- package/exemplos/sistemas-interativos/game-pixel-8-bit.json +94 -94
- package/exemplos/sistemas-interativos/game-xr-human.json +80 -80
- package/exemplos/sistemas-interativos/hybrid-2-5d.json +108 -108
- package/exemplos/sistemas-interativos/protocol-mutating-rollback-valid.json +75 -75
- package/exemplos/sistemas-interativos/protocol-read-only-valid.json +58 -58
- package/exemplos/sistemas-interativos/simulation-2d-controlled.json +97 -97
- package/exemplos/sistemas-interativos/simulation-3d-calibrated-autonomous.json +141 -141
- package/exemplos/sistemas-interativos/simulation-headless-autonomous-batch.json +112 -112
- package/exemplos/sistemas-interativos/simulation-pixel-16-bit.json +103 -103
- package/exemplos/sistemas-interativos/simulation-text-controlled.json +95 -95
- package/node_modules/@sema/gerador-cpp/package.json +1 -1
- package/node_modules/@sema/gerador-dotnet/package.json +1 -1
- package/node_modules/@sema/gerador-lua/dist/index.js +51 -51
- package/node_modules/@sema/gerador-php/dist/index.js +113 -113
- package/node_modules/@sema/nucleo/dist/ir/conversor.part01.js +37 -38
- package/node_modules/@sema/nucleo/dist/ir/modelos.d.ts +1 -0
- package/node_modules/@sema/nucleo/dist/semantico/analisador.d.ts +1 -0
- package/node_modules/@sema/nucleo/dist/semantico/analisador.js +1 -0
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part01.d.ts +7 -0
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part01.js +33 -10
- package/package.json +9 -4
- package/scripts/postinstall.mjs +148 -0
- package/skills/sema/SKILL.md +199 -0
- package/skills/sema/agents/openai.yaml +4 -0
- package/dist/driftCache.d.ts +0 -49
- package/dist/driftCache.js +0 -311
- package/dist/driftCacheIncremental.d.ts +0 -98
- package/dist/driftCacheIncremental.js +0 -596
- package/dist/driftCatalogoPersistente.d.ts +0 -8
- package/dist/driftCatalogoPersistente.js +0 -77
- package/node_modules/@sema/gerador-cpp/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-css/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-css/dist/index.part01.js.map +0 -1
- package/node_modules/@sema/gerador-css/dist/index.part02.js.map +0 -1
- package/node_modules/@sema/gerador-dart/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-dotnet/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-html/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-javascript/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-lua/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-php/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-python/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-python/dist/index.part01.js.map +0 -1
- package/node_modules/@sema/gerador-python/dist/index.part02.js.map +0 -1
- package/node_modules/@sema/gerador-typescript/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-typescript/dist/index.part01.js.map +0 -1
- package/node_modules/@sema/gerador-typescript/dist/index.part02.js.map +0 -1
- package/node_modules/@sema/gerador-typescript/dist/index.part03.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/ast/tipos.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/diagnosticos/index.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/diagnosticos/melhorador.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/diagnosticos/snippets.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/formatador/index.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/formatador/index.part01.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/formatador/index.part02.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/index.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/ir/conversor.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/ir/conversor.part01.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/ir/conversor.part02.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/ir/conversor.part03.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/ir/modelos.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/lexer/lexer.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/lexer/tokens.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/parser/parser.declaracoes.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/parser/parser.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/parser/parser.modulo.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/parser/parser.part01.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/parser/parser.part02.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/parser/parser.part03.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/persistencia/contratos.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part01.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part02.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part03.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part04.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part05.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part06.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part07.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part08.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/estruturas.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/estruturas.part01.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/estruturas.part02.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/orcamentoSemantico.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/seguranca.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/util/arquivos.js.map +0 -1
- package/node_modules/@sema/padroes/dist/index.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import { type Diagnostico } from "@sema/nucleo";
|
|
3
|
-
export type FonteImportacao = "nestjs" | "fastapi" | "flask" | "nextjs" | "nextjs-consumer" | "react-vite-consumer" | "angular-consumer" | "flutter-consumer" | "firebase" | "typescript" | "python" | "dart" | "dotnet" | "java" | "go" | "rust" | "cpp" | "php";
|
|
3
|
+
export type FonteImportacao = "nestjs" | "express" | "fastify" | "fastapi" | "flask" | "nextjs" | "nextjs-consumer" | "react-vite-consumer" | "angular-consumer" | "flutter-consumer" | "firebase" | "typescript" | "python" | "dart" | "dotnet" | "java" | "go" | "rust" | "cpp" | "php";
|
|
4
4
|
export type OrigemInteropImportada = "ts" | "py" | "dart" | "cs" | "java" | "go" | "rust" | "cpp" | "php";
|
|
5
5
|
export interface CampoImportado {
|
|
6
6
|
nome: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { extrairRotasTypeScriptHttp } from "./typescript-http.js";
|
|
2
2
|
import { CampoImportado, ModuloImportado, TipoDescoberto } from "./importador.part01.js";
|
|
3
3
|
export declare function importarNestJsDeArquivo(diretorioBase: string, arquivo: string, namespaceBase: string, tiposGlobais: Map<string, TipoDescoberto>): ModuloImportado[];
|
|
4
|
+
export declare function importarExpressFastifyDeArquivo(diretorioBase: string, arquivo: string, namespaceBase: string, origemDesejada: "express" | "fastify"): ModuloImportado[];
|
|
5
|
+
export declare function importarExpressFastifyBase(diretorio: string, namespaceBase: string, origem: "express" | "fastify"): Promise<ModuloImportado[]>;
|
|
4
6
|
export declare function importarTypeScriptBase(diretorio: string, namespaceBase: string, modoNestjs?: boolean): Promise<ModuloImportado[]>;
|
|
5
7
|
export declare function nomeTaskParaRotaTypeScript(caminho: string, metodo: string): string;
|
|
6
8
|
export declare function camposDeParametrosRotaTypeScript(parametros: ReturnType<typeof extrairRotasTypeScriptHttp>[number]["parametros"]): CampoImportado[];
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import ts from "typescript";
|
|
6
|
-
import { extrairRotasTypeScriptHttp, inferirSemanticaHandlerTypeScriptHttp, localizarExportacaoTypeScriptHttp, } from "./typescript-http.js";
|
|
6
|
+
import { extrairRotasExpressFastify, extrairRotasTypeScriptHttp, inferirSemanticaHandlerTypeScriptHttp, localizarExportacaoTypeScriptHttp, } from "./typescript-http.js";
|
|
7
7
|
import { extrairTextoLiteral, inferirContextoPorArquivo, juntarCaminhoHttp, lerDecorator, listarArquivosRecursivos, mapearTipoPrimitivo, paraSnakeCase } from "./importador.part01.js";
|
|
8
8
|
import { deduplicarCampos, extrairChamadaServiceTs } from "./importador.part04.js";
|
|
9
9
|
import { caminhoImplTs, camposDeSemanticaTypeScriptHttp, criarEntidadesReferenciadas, descreverEfeitosPorHeuristica, expandirCamposTs, extrairErrosTs } from "./importador.part02.js";
|
|
@@ -98,6 +98,92 @@ export function importarNestJsDeArquivo(diretorioBase, arquivo, namespaceBase, t
|
|
|
98
98
|
routes: deduplicarRotas(routes),
|
|
99
99
|
}];
|
|
100
100
|
}
|
|
101
|
+
function nomearTarefaRotaChamada(metodo, caminho) {
|
|
102
|
+
const ultimoSegmento = caminho.replace(/\{[^}]+\}/g, "").split("/").filter(Boolean).pop() ?? "recurso";
|
|
103
|
+
const singular = ultimoSegmento.length > 3 && /es$/.test(ultimoSegmento)
|
|
104
|
+
? ultimoSegmento.replace(/es$/, "")
|
|
105
|
+
: ultimoSegmento.replace(/s$/, "");
|
|
106
|
+
switch (metodo) {
|
|
107
|
+
case "POST":
|
|
108
|
+
return `criar_${singular}`;
|
|
109
|
+
case "PUT":
|
|
110
|
+
case "PATCH":
|
|
111
|
+
return `atualizar_${singular}`;
|
|
112
|
+
case "DELETE":
|
|
113
|
+
return `remover_${singular}`;
|
|
114
|
+
case "GET":
|
|
115
|
+
return caminho.includes("{") ? `obter_${singular}` : `listar_${ultimoSegmento}`;
|
|
116
|
+
default:
|
|
117
|
+
return `${metodo.toLowerCase()}_${ultimoSegmento}`;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export function importarExpressFastifyDeArquivo(diretorioBase, arquivo, namespaceBase, origemDesejada) {
|
|
121
|
+
const relacao = path.relative(diretorioBase, arquivo);
|
|
122
|
+
const codigo = ts.sys.readFile(arquivo, "utf8") ?? "";
|
|
123
|
+
const sourceFile = ts.createSourceFile(arquivo, codigo, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
124
|
+
const contextoSegmentos = inferirContextoPorArquivo(relacao);
|
|
125
|
+
const nomeModulo = [namespaceBase, ...contextoSegmentos].join(".");
|
|
126
|
+
const rotasArquivo = extrairRotasExpressFastify(sourceFile).filter((rota) => rota.origem === origemDesejada);
|
|
127
|
+
if (rotasArquivo.length === 0) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
const tasks = [];
|
|
131
|
+
const routes = [];
|
|
132
|
+
for (const rota of rotasArquivo) {
|
|
133
|
+
const taskNome = nomearTarefaRotaChamada(rota.metodo, rota.caminho);
|
|
134
|
+
const implSimbolo = /^[A-Za-z_]\w*$/.test(rota.simbolo) ? rota.simbolo : undefined;
|
|
135
|
+
tasks.push({
|
|
136
|
+
nome: taskNome,
|
|
137
|
+
resumo: `Task importada automaticamente da rota ${rota.metodo} ${rota.caminho} em ${relacao}.`,
|
|
138
|
+
input: rota.parametros.map((parametro) => ({
|
|
139
|
+
nome: parametro.nome,
|
|
140
|
+
tipo: parametro.tipoSema,
|
|
141
|
+
obrigatorio: true,
|
|
142
|
+
})),
|
|
143
|
+
output: [],
|
|
144
|
+
errors: [],
|
|
145
|
+
effects: [],
|
|
146
|
+
impl: implSimbolo ? { ts: caminhoImplTs(diretorioBase, arquivo, implSimbolo) } : undefined,
|
|
147
|
+
origemArquivo: relacao,
|
|
148
|
+
origemSimbolo: rota.simbolo,
|
|
149
|
+
});
|
|
150
|
+
routes.push({
|
|
151
|
+
nome: `${taskNome}_publico`,
|
|
152
|
+
resumo: `Rota ${origemDesejada} importada automaticamente de ${relacao}.`,
|
|
153
|
+
metodo: rota.metodo,
|
|
154
|
+
caminho: rota.caminho,
|
|
155
|
+
task: taskNome,
|
|
156
|
+
input: rota.parametros.map((parametro) => ({
|
|
157
|
+
nome: parametro.nome,
|
|
158
|
+
tipo: parametro.tipoSema,
|
|
159
|
+
obrigatorio: true,
|
|
160
|
+
})),
|
|
161
|
+
output: [],
|
|
162
|
+
errors: [],
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
const { entities, enums } = criarEntidadesReferenciadas(new Map(), new Set(), new Set());
|
|
166
|
+
sincronizarRotasComTasks(routes, tasks);
|
|
167
|
+
return [{
|
|
168
|
+
nome: nomeModulo,
|
|
169
|
+
resumo: `Rascunho Sema importado de um contexto ${origemDesejada === "express" ? "Express" : "Fastify"} legado em ${contextoSegmentos.join("/")}.`,
|
|
170
|
+
entities,
|
|
171
|
+
enums,
|
|
172
|
+
tasks: deduplicarTarefas(tasks),
|
|
173
|
+
routes: deduplicarRotas(routes),
|
|
174
|
+
}];
|
|
175
|
+
}
|
|
176
|
+
export async function importarExpressFastifyBase(diretorio, namespaceBase, origem) {
|
|
177
|
+
const arquivos = await listarArquivosRecursivos(diretorio, [".ts"]);
|
|
178
|
+
const uteis = arquivos.filter((arquivo) => !arquivo.endsWith(".spec.ts")
|
|
179
|
+
&& !arquivo.endsWith(".test.ts")
|
|
180
|
+
&& !arquivo.endsWith(".d.ts"));
|
|
181
|
+
const modulos = [];
|
|
182
|
+
for (const arquivo of uteis) {
|
|
183
|
+
modulos.push(...importarExpressFastifyDeArquivo(diretorio, arquivo, namespaceBase, origem));
|
|
184
|
+
}
|
|
185
|
+
return modulos;
|
|
186
|
+
}
|
|
101
187
|
export async function importarTypeScriptBase(diretorio, namespaceBase, modoNestjs = false) {
|
|
102
188
|
const arquivos = await listarArquivosRecursivos(diretorio, [".ts"]);
|
|
103
189
|
const uteis = arquivos.filter((arquivo) => !arquivo.endsWith(".spec.ts")
|
|
@@ -12,7 +12,7 @@ import { inferirContextoPorArquivo, inferirNamespaceBase, listarArquivosRecursiv
|
|
|
12
12
|
import { camposDeParametrosRotaBackend, criarCampoResultadoBackend, descreverEfeitosPorHeuristica, inferirDatabasesPorHeuristica, mapearTipoBackendParaSema } from "./importador.part02.js";
|
|
13
13
|
import { caminhoImplGenerico, importarFirebaseBase } from "./importador.part07.js";
|
|
14
14
|
import { acumularModuloImportado, criarModuloImportadoSimples, importarDartBase, importarDotnetBase, importarPythonBase, resolverArquivoRustParaSimbolo, selecionarSimbolosPreferidos } from "./importador.part08.js";
|
|
15
|
-
import { importarNextJsBase, importarTypeScriptBase } from "./importador.part06.js";
|
|
15
|
+
import { importarExpressFastifyBase, importarNextJsBase, importarTypeScriptBase } from "./importador.part06.js";
|
|
16
16
|
import { importarAngularConsumerBase, importarFlutterConsumerBase, importarNextJsConsumerBase, importarReactViteConsumerBase } from "./importador.part04.js";
|
|
17
17
|
import { formatarModuloImportado, moduloParaCodigo, montarArquivoImportado } from "./importador.part05.js";
|
|
18
18
|
export async function importarJavaBase(diretorio, namespaceBase) {
|
|
@@ -300,6 +300,12 @@ export async function importarProjetoLegado(fonte, diretorio, namespaceBase) {
|
|
|
300
300
|
if (fonte === "nestjs") {
|
|
301
301
|
modulos = await importarTypeScriptBase(base, namespace, true);
|
|
302
302
|
}
|
|
303
|
+
else if (fonte === "express") {
|
|
304
|
+
modulos = await importarExpressFastifyBase(base, namespace, "express");
|
|
305
|
+
}
|
|
306
|
+
else if (fonte === "fastify") {
|
|
307
|
+
modulos = await importarExpressFastifyBase(base, namespace, "fastify");
|
|
308
|
+
}
|
|
303
309
|
else if (fonte === "nextjs") {
|
|
304
310
|
modulos = await importarNextJsBase(base, namespace);
|
|
305
311
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
export * from "./index.part01.js";
|
|
3
2
|
export * from "./index.part08.js";
|
|
3
|
+
export * from "./cliHelp.js";
|
|
4
|
+
export { criarAjudaRaiz } from "./cliHelpTexto.js";
|
|
5
|
+
export * from "./saidaCli.js";
|
|
4
6
|
export { iniciarProfileAuthor, comandoAuthor, criarAuthorBriefing, revisarClichesAuthor } from "./profileAuthorCommand.js";
|
|
5
7
|
export { validarProfileSemantico } from "./profileCommand.js";
|
|
6
8
|
export { materializarExemplosOficiais } from "./exemplosOficiais.js";
|
|
@@ -8,3 +10,4 @@ export { expandirIntencaoSemanticaProfile, sugerirStarterPresetProfile, validarP
|
|
|
8
10
|
export * from "./pipelineConteudo/index.js";
|
|
9
11
|
export * from "./sistemasInterativos/index.js";
|
|
10
12
|
export * from "./discovery/index.js";
|
|
13
|
+
export * from "./distribuicao/index.js";
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
// Descricao: CLI particionada; consulte contratos/sema/governanca_ia_contexto.sema antes de editar.
|
|
4
|
-
import { realpathSync } from "node:fs";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { principal } from "./index.part08.js";
|
|
1
|
+
// SEMA-GOVERNED: sema.governanca_ia_contexto, sema.produto.distribuicao_global, sema.produto.cli_invocacao_publica
|
|
2
|
+
// Descrição: superfície de biblioteca da CLI; o executável público vive exclusivamente em bin.ts.
|
|
8
3
|
export * from "./index.part01.js";
|
|
9
4
|
export * from "./index.part08.js";
|
|
5
|
+
export * from "./cliHelp.js";
|
|
6
|
+
export { criarAjudaRaiz } from "./cliHelpTexto.js";
|
|
7
|
+
export * from "./saidaCli.js";
|
|
10
8
|
export { iniciarProfileAuthor, comandoAuthor, criarAuthorBriefing, revisarClichesAuthor } from "./profileAuthorCommand.js";
|
|
11
9
|
export { validarProfileSemantico } from "./profileCommand.js";
|
|
12
10
|
export { materializarExemplosOficiais } from "./exemplosOficiais.js";
|
|
@@ -14,22 +12,5 @@ export { expandirIntencaoSemanticaProfile, sugerirStarterPresetProfile, validarP
|
|
|
14
12
|
export * from "./pipelineConteudo/index.js";
|
|
15
13
|
export * from "./sistemasInterativos/index.js";
|
|
16
14
|
export * from "./discovery/index.js";
|
|
17
|
-
|
|
18
|
-
if (!process.argv[1]) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
try {
|
|
22
|
-
return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
return path.resolve(process.argv[1]) === path.resolve(fileURLToPath(import.meta.url));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (moduloExecutadoDiretamente()) {
|
|
29
|
-
principal().catch((erro) => {
|
|
30
|
-
console.error("Falha ao executar a CLI da Sema.");
|
|
31
|
-
console.error(erro instanceof Error ? erro.stack ?? erro.message : erro);
|
|
32
|
-
process.exit(1);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
15
|
+
export * from "./distribuicao/index.js";
|
|
35
16
|
//# sourceMappingURL=index.js.map
|
package/dist/index.part01.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { compilarCodigo, type IrModulo } from "@sema/nucleo";
|
|
2
|
-
import { type ContextoProjetoCarregado } from "./projeto.js";
|
|
3
2
|
import { analisarDriftLegado, type OpcoesDriftLegado } from "./drift.js";
|
|
4
3
|
import { type GuiaCapacidadeIaMap } from './agentContextTipos.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
4
|
+
import { renderizarCaixaAscii, renderizarSecaoAscii } from './cliHelpTexto.js';
|
|
5
|
+
import { criarBriefingAgente, criarBriefingAgenteContratos, resumirDriftPorModulo } from "./index.part03.js";
|
|
6
|
+
import { type ComandoConsultaDrift, type ModoCacheDrift, type ResolucaoModoCacheDrift } from "./driftCacheModes.js";
|
|
7
|
+
export type Comando = "iniciar" | "init" | "dev" | "sync" | "author" | "profile" | "conteudo" | "interativo" | "descobrir" | "pipeline" | "capabilities" | "validar" | "ast" | "ir" | "compilar" | "gerar" | "testar" | "diagnosticos" | "verificar" | "inspecionar" | "drift" | "impacto" | "renomear-semantico" | "importar" | "doctor" | "formatar" | "ajuda-ia" | "starter-ia" | "sync-codex" | "skill" | "instalar-exemplos" | "rule-packs" | "docs-impacto" | "finalizar-mudanca" | "resumo" | "prompt-curto" | "prompt-ia" | "prompt-ia-ui" | "prompt-ia-react" | "prompt-ia-sema-primeiro" | "exemplos-prompt-ia" | "contexto-ia";
|
|
7
8
|
export interface ResultadoFormatacaoArquivo {
|
|
8
9
|
caminho: string;
|
|
9
10
|
alterado: boolean;
|
|
@@ -30,8 +31,6 @@ export interface DescobertaDocsIa {
|
|
|
30
31
|
}
|
|
31
32
|
export type TamanhoResumoIa = "micro" | "curto" | "medio";
|
|
32
33
|
export type ModoResumoIa = "resumo" | "onboarding" | "review" | "mudanca" | "bug" | "arquitetura";
|
|
33
|
-
export type ModoAnaliseDriftCli = "fresh" | "cache" | "none";
|
|
34
|
-
export type PoliticaCacheDriftCli = "auto" | "refresh" | "off";
|
|
35
34
|
export type ResultadoDriftIa = Awaited<ReturnType<typeof analisarDriftLegado>>;
|
|
36
35
|
export type ResumoModuloDrift = ReturnType<typeof resumirDriftPorModulo>;
|
|
37
36
|
export interface PacoteContextoModuloIa {
|
|
@@ -77,16 +76,14 @@ export interface PacoteContextoModuloIa {
|
|
|
77
76
|
comando: "drift";
|
|
78
77
|
caminho: string;
|
|
79
78
|
modulo: string | null;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
aviso
|
|
84
|
-
resumo: ResumoModuloDrift;
|
|
85
|
-
drift: ResultadoDriftIa;
|
|
79
|
+
modo: ModoCacheDrift;
|
|
80
|
+
executada: boolean;
|
|
81
|
+
sucesso: boolean | null;
|
|
82
|
+
aviso: string | null;
|
|
83
|
+
resumo: ResumoModuloDrift | null;
|
|
84
|
+
drift: ResultadoDriftIa | null;
|
|
86
85
|
};
|
|
87
|
-
briefing: ReturnType<typeof criarBriefingAgente>;
|
|
88
|
-
modoVerificacaoCodigo?: ResumoSemanticoModuloIa["modoVerificacaoCodigo"];
|
|
89
|
-
fontesConclusao?: string[];
|
|
86
|
+
briefing: ReturnType<typeof criarBriefingAgente> | ReturnType<typeof criarBriefingAgenteContratos>;
|
|
90
87
|
}
|
|
91
88
|
export interface ResumoSemanticoModuloIa {
|
|
92
89
|
geradoEm: string;
|
|
@@ -96,8 +93,8 @@ export interface ResumoSemanticoModuloIa {
|
|
|
96
93
|
avisoVerificacaoCodigo: string | null;
|
|
97
94
|
fontesConclusao: string[];
|
|
98
95
|
perfilCompatibilidade: string;
|
|
99
|
-
scoreSemantico: number;
|
|
100
|
-
confiancaGeral: string;
|
|
96
|
+
scoreSemantico: number | null;
|
|
97
|
+
confiancaGeral: string | null;
|
|
101
98
|
riscoOperacional: string;
|
|
102
99
|
faz: string;
|
|
103
100
|
tarefasPrincipais: string[];
|
|
@@ -116,29 +113,24 @@ export interface ResumoSemanticoModuloIa {
|
|
|
116
113
|
checksSugeridos: string[];
|
|
117
114
|
testesMinimos: string[];
|
|
118
115
|
consumerFramework: string | null;
|
|
119
|
-
appRoutes: string[];
|
|
120
|
-
consumerSurfaces: string[];
|
|
121
|
-
consumerBridges: string[];
|
|
122
|
-
ancoragensVinculo: string[];
|
|
116
|
+
appRoutes: string[] | null;
|
|
117
|
+
consumerSurfaces: string[] | null;
|
|
118
|
+
consumerBridges: string[] | null;
|
|
119
|
+
ancoragensVinculo: string[] | null;
|
|
123
120
|
arquivosProvaveisEditar: string[];
|
|
124
121
|
}
|
|
125
122
|
export declare const DIRETORIO_CLI_ATUAL: string;
|
|
126
123
|
export declare const VERSAO_CLI: string;
|
|
124
|
+
export { renderizarCaixaAscii, renderizarSecaoAscii };
|
|
127
125
|
export declare function obterArgumentos(): {
|
|
128
126
|
comando?: Comando;
|
|
129
127
|
resto: string[];
|
|
130
128
|
};
|
|
131
|
-
export declare function renderizarCaixaAscii(linhas: string[]): string;
|
|
132
|
-
export declare function renderizarSecaoAscii(titulo: string, linhas: string[]): string;
|
|
133
129
|
export declare function ajuda(): string;
|
|
134
|
-
export declare function
|
|
135
|
-
export declare function
|
|
136
|
-
export declare function resolverOpcoesDriftCli(args: string[], cacheForcado?: PoliticaCacheDriftCli): OpcoesDriftLegado;
|
|
137
|
-
export declare function resolverAnaliseDriftCli(args: string[], padrao?: ModoAnaliseDriftCli): {
|
|
138
|
-
modo: ModoAnaliseDriftCli;
|
|
130
|
+
export declare function resolverOpcoesDriftCli(args: string[]): OpcoesDriftLegado;
|
|
131
|
+
export declare function resolverAnaliseDriftConsultaCli(args: string[], comando: ComandoConsultaDrift): ResolucaoModoCacheDrift & {
|
|
139
132
|
opcoes: OpcoesDriftLegado;
|
|
140
133
|
};
|
|
141
|
-
export declare function criarResultadoDriftNaoExecutado(contextoProjeto: ContextoProjetoCarregado, opcoes?: OpcoesDriftLegado): ResultadoDriftIa;
|
|
142
134
|
export declare function normalizarTamanhoResumo(args: string[]): TamanhoResumoIa;
|
|
143
135
|
export declare function normalizarModoResumo(valor?: string): ModoResumoIa;
|
|
144
136
|
export declare function descobrirDocsIa(): Promise<DescobertaDocsIa>;
|
package/dist/index.part01.js
CHANGED
|
@@ -3,257 +3,36 @@ import { fileURLToPath } from "node:url";
|
|
|
3
3
|
import pacoteCli from "../package.json" with { type: "json" };
|
|
4
4
|
import { caminhoExiste } from './fsGovernado.js';
|
|
5
5
|
import { obterOpcao, possuiFlag } from './cliArgs.js';
|
|
6
|
+
import { criarAjudaRaiz, renderizarCaixaAscii, renderizarSecaoAscii } from './cliHelpTexto.js';
|
|
7
|
+
import { resolverModoCacheComandoDrift, resolverModoCacheConsultaDrift, } from "./driftCacheModes.js";
|
|
6
8
|
export const DIRETORIO_CLI_ATUAL = path.dirname(fileURLToPath(import.meta.url));
|
|
7
9
|
export const VERSAO_CLI = pacoteCli.version;
|
|
10
|
+
export { renderizarCaixaAscii, renderizarSecaoAscii };
|
|
8
11
|
export function obterArgumentos() {
|
|
9
12
|
const [, , comando, ...resto] = process.argv;
|
|
10
13
|
return { comando: comando, resto };
|
|
11
14
|
}
|
|
12
|
-
export function renderizarCaixaAscii(linhas) {
|
|
13
|
-
const largura = Math.max(...linhas.map((linha) => linha.length), 12);
|
|
14
|
-
const borda = `+${"-".repeat(largura + 2)}+`;
|
|
15
|
-
return [
|
|
16
|
-
borda,
|
|
17
|
-
...linhas.map((linha) => `| ${linha.padEnd(largura, " ")} |`),
|
|
18
|
-
borda,
|
|
19
|
-
].join("\n");
|
|
20
|
-
}
|
|
21
|
-
export function renderizarSecaoAscii(titulo, linhas) {
|
|
22
|
-
return [
|
|
23
|
-
titulo,
|
|
24
|
-
...linhas.map((linha) => ` ${linha}`),
|
|
25
|
-
].join("\n");
|
|
26
|
-
}
|
|
27
15
|
export function ajuda() {
|
|
28
|
-
return
|
|
29
|
-
renderizarCaixaAscii([
|
|
30
|
-
`Sema CLI v${VERSAO_CLI}`,
|
|
31
|
-
"IA-first para contrato, geração e adoção incremental",
|
|
32
|
-
"novo projeto, edição guiada e legado sem contrato inicial",
|
|
33
|
-
]),
|
|
34
|
-
"",
|
|
35
|
-
renderizarSecaoAscii("Fluxos rápidos", [
|
|
36
|
-
"[1] Projeto novo / produção inicial",
|
|
37
|
-
"sema iniciar --template <base|nestjs|fastapi|nextjs-api|nextjs-consumer|react-vite-consumer|angular-consumer|flutter-consumer> [--force]",
|
|
38
|
-
"Arquivos existentes sao preservados; use --force somente para sobrescrita explicita.",
|
|
39
|
-
"sema validar contratos/<modulo>.sema --json",
|
|
40
|
-
"sema compilar <arquivo-ou-pasta> --alvo <typescript|python|php|dart|lua|javascript|html|css|dotnet|cpp> --saida <diretorio>",
|
|
41
|
-
"sema verificar <arquivo-ou-pasta> --json",
|
|
42
|
-
"",
|
|
43
|
-
"[2] Editar projeto que já usa Sema",
|
|
44
|
-
"sema inspecionar . --json",
|
|
45
|
-
"sema resumo <arquivo-ou-pasta> --micro --para mudanca",
|
|
46
|
-
"sema drift <arquivo-ou-pasta> --escopo modulo --json",
|
|
47
|
-
"sema impacto <arquivo-ou-pasta> --alvo <token> --mudanca <descricao> --json",
|
|
48
|
-
"sema docs-impacto --intencao \"fazer deploy\" --criar-ausentes --json",
|
|
49
|
-
"sema contexto-ia <arquivo.sema> --saida ./.tmp/contexto --json",
|
|
50
|
-
"",
|
|
51
|
-
"[3] Governar escrita autoral com Sema Author",
|
|
52
|
-
"sema author iniciar [--tema-sensivel] [--saida contratos/author.sema]",
|
|
53
|
-
"sema author validar contratos/author.sema --json",
|
|
54
|
-
"sema author briefing contratos/author.sema --json",
|
|
55
|
-
"sema author revisar-cliches contratos/author.sema --texto <texto> --json # reprova se houver bloqueio",
|
|
56
|
-
"sema author validar-narrativa contratos/author.sema --texto <texto> --texto-anterior <texto> --json",
|
|
57
|
-
"sema author validar-proibicoes contratos/author.sema --texto <texto> --json",
|
|
58
|
-
"",
|
|
59
|
-
"[4] Validar profiles semânticos",
|
|
60
|
-
"sema profile validar workflow contratos/sema/workflow_ops.sema --maturidade production --preset webhook --artefato-arquivo workflow.md --json",
|
|
61
|
-
"sema profile validar ops contratos/sema/workflow_ops.sema --maturidade critical --preset deploy --artefato-arquivo runbook.md --json",
|
|
62
|
-
"sema profile validar game contratos/sema/game.sema --maturidade prototype --preset playtest --artefato-arquivo playtest.md --json",
|
|
63
|
-
"sema profile validar simulation contratos/sema/simulation.sema --maturidade production --preset calibration --artefato-arquivo calibration.md --json",
|
|
64
|
-
"sema profile validar redacao contratos/sema/redator.sema --maturidade production --preset seo --artefato-arquivo materia.md --json",
|
|
65
|
-
"sema profile validar propostas contratos/sema/propostas_comerciais.sema --maturidade production --preset score90 --artefato-arquivo proposta.md --json",
|
|
66
|
-
"sema profile validar conversas contratos/sema/conversas.sema --maturidade production --preset vendas --artefato-arquivo conversa.md --json",
|
|
67
|
-
"sema profile capabilities --json",
|
|
68
|
-
"sema rule-packs --profile legal --json",
|
|
69
|
-
"",
|
|
70
|
-
"[5] Descobrir a capacidade ou pipeline certo",
|
|
71
|
-
"sema descobrir catalogo --json",
|
|
72
|
-
"sema descobrir recomendar --intencao \"validar simulador 3D autonomo calibrado\" --json",
|
|
73
|
-
"sema descobrir explicar simulation.calibrate --json",
|
|
74
|
-
"sema pipeline listar --json",
|
|
75
|
-
"sema capabilities --json",
|
|
76
|
-
"",
|
|
77
|
-
"[6] Modelar jogos e simulações em qualquer combinação espacial, visual e de render",
|
|
78
|
-
"sema interativo capabilities --json",
|
|
79
|
-
"sema interativo schema --json",
|
|
80
|
-
"sema interativo pipelines --json",
|
|
81
|
-
"sema interativo adapters --spatial-model THREE_D --render-mode VISUAL --json",
|
|
82
|
-
"sema interativo validar <definition.json> --json",
|
|
83
|
-
"sema interativo planejar <definition.json> --json",
|
|
84
|
-
"sema interativo validar-evidencias <definition.json> [--plano-arquivo <plan.json>] --bundle-arquivo <bundle.json> --json",
|
|
85
|
-
"sema interativo validar-protocolo <adapter-run.json> --json",
|
|
86
|
-
"sema interativo validar-ir <experience-ir.json> --json",
|
|
87
|
-
"sema interativo consultar-ir <experience-ir.json> --semantic-id <id> --json",
|
|
88
|
-
"sema interativo validar-engine-snapshot <snapshot.json> --json",
|
|
89
|
-
"sema interativo validar-temporal <temporal.json> --json",
|
|
90
|
-
"sema interativo validar-autonomia <cycle.json> --json",
|
|
91
|
-
"sema interativo validar-playtest-fuzz <plan.json> --json",
|
|
92
|
-
"sema interativo validar-multiplayer <model.json> --json",
|
|
93
|
-
"sema interativo analisar-portabilidade <plan.json> --json",
|
|
94
|
-
"sema interativo validar-workers <plan.json> --json",
|
|
95
|
-
"",
|
|
96
|
-
"[7] Orquestrar criação de conteúdo por IA",
|
|
97
|
-
"sema conteudo capabilities --json",
|
|
98
|
-
"sema conteudo validar <definition.json> --json",
|
|
99
|
-
"sema conteudo planejar <definition.json> --alvos-arquivo <targets.json> --json",
|
|
100
|
-
"sema conteudo registrar <ledger.ndjson> --envelope-arquivo <envelope.json> --politica-arquivo <policy-envelope.json> --confianca-arquivo <trust.json> --trust-root-digest <sha256:...> --revocation-digest <sha256:...> --ledger-id <id> --expected-head <sha256:...> --json",
|
|
101
|
-
"sema conteudo status <definition.json> --politica-arquivo <policy-envelope.json> --confianca-arquivo <trust.json> --trust-root-digest <sha256:...> --revocation-digest <sha256:...> --ledger-arquivo <ledger.ndjson> --expected-head <sha256:...> --json",
|
|
102
|
-
"",
|
|
103
|
-
"[8] Adotar Sema em projeto que ainda não usa",
|
|
104
|
-
"sema importar <fonte> <diretorio> --saida <diretorio> --json",
|
|
105
|
-
"sema formatar <arquivo-ou-pasta>",
|
|
106
|
-
"sema validar <arquivo-ou-pasta> --json",
|
|
107
|
-
"sema drift <arquivo-ou-pasta> --escopo modulo --json",
|
|
108
|
-
]),
|
|
109
|
-
"",
|
|
110
|
-
renderizarSecaoAscii("IA por capacidade", [
|
|
111
|
-
"fraca: sema resumo <arquivo> --micro --json (stdout compacto)",
|
|
112
|
-
"média: sema resumo <arquivo> --curto --json + sema drift <arquivo> --json",
|
|
113
|
-
"forte: sema contexto-ia <arquivo.sema> --saida <diretorio> --json",
|
|
114
|
-
]),
|
|
115
|
-
"",
|
|
116
|
-
renderizarSecaoAscii("Comandos principais", [
|
|
117
|
-
"descoberta: sema inspecionar [arquivo-ou-pasta] [--drift <fresh|cache|none>|--com-drift] [--json] (padrão: none)",
|
|
118
|
-
"catálogo: sema descobrir <catalogo|recomendar|explicar> [id] [--intencao <objetivo>] [--json]",
|
|
119
|
-
"pipelines: sema pipeline <listar|descrever> [id] [--json]",
|
|
120
|
-
"todas as capacidades: sema capabilities [--json]",
|
|
121
|
-
"auditoria: sema drift <arquivo-ou-pasta> [--escopo <arquivo|modulo|projeto>] [--cache <auto|refresh|off>] [--incluir-worktrees] [--incluir-consumidores-laterais] [--json]",
|
|
122
|
-
"impacto: sema impacto <arquivo-ou-pasta> --alvo <token> [--mudanca <descricao>] [--escopo <arquivo|modulo|projeto>] [--json]",
|
|
123
|
-
"renomeação: sema renomear-semantico <arquivo-ou-pasta> --de <nome-atual> --para <nome-novo> [--escopo <arquivo|modulo|projeto>] [--json]",
|
|
124
|
-
"importação: sema importar <nestjs|fastapi|flask|nextjs|nextjs-consumer|react-vite-consumer|angular-consumer|flutter-consumer|firebase|dotnet|java|go|rust|cpp|php|typescript|python|dart> <diretorio> [--saida <diretorio>] [--namespace <base>] [--json]",
|
|
125
|
-
"validação: sema validar <arquivo-ou-pasta> [--json]",
|
|
126
|
-
"diagnóstico: sema diagnosticos <arquivo.sema> [--json]",
|
|
127
|
-
"geração: sema compilar <arquivo-ou-pasta> --alvo <typescript|python|php|dart|lua|javascript|html|css|dotnet|cpp> --saida <diretorio> [--estrutura <flat|modulos|backend>] [--framework <base|nestjs|fastapi>]",
|
|
128
|
-
"teste local: sema testar <arquivo.sema> --alvo <typescript|python|php|dart|lua|javascript|html|css|dotnet|cpp> --saida <diretorio-temporario> [--estrutura <flat|modulos|backend>] [--framework <base|nestjs|fastapi>]",
|
|
129
|
-
"aliases nativos: cs|csharp -> dotnet; c++|cxx|cc -> cpp (CLI e sema.config.json)",
|
|
130
|
-
"verificação final: sema verificar <arquivo-ou-pasta> [--saida <diretorio-base>] [--json]",
|
|
131
|
-
"formatação: sema formatar <arquivo-ou-pasta> [--check] [--json]",
|
|
132
|
-
"author: sema author <iniciar|validar|briefing|revisar-cliches|validar-narrativa|validar-proibicoes> [arquivo] [--tema-sensivel] [--preset conto|romance|roteiro|lore|campanha] [--saida <arquivo>] [--texto <texto>] [--json]",
|
|
133
|
-
"profile: sema profile validar <software|workflow|ops|game|simulation|legal|research|redacao|propostas|conversas> <arquivo-ou-pasta> [--maturidade draft|prototype|production|critical] [--preset <preset>] [--artefato <texto>|--artefato-arquivo <arquivo>] [--json]",
|
|
134
|
-
"capabilities: sema profile capabilities [--json]",
|
|
135
|
-
"conteúdo: sema conteudo <capabilities|validar|planejar|validar-envelope|registrar|status|projetar> [--trust-root-digest <sha256:...>] [--revocation-digest <sha256:...>] [--expected-head <sha256:...>] [opções] [--json]",
|
|
136
|
-
"interativo: sema interativo <capabilities|schema|pipelines|adapters|validar|planejar|validar-evidencias|status|validar-protocolo|extensões-P0-P2> [opções] [--json]",
|
|
137
|
-
"rule packs: sema rule-packs [--profile <author|software|workflow|ops|game|simulation|legal|research|redacao|propostas|conversas>] [--json]",
|
|
138
|
-
]),
|
|
139
|
-
"",
|
|
140
|
-
renderizarSecaoAscii("Ajuda IA-first", [
|
|
141
|
-
"sema ajuda-ia",
|
|
142
|
-
"sema starter-ia",
|
|
143
|
-
"sema resumo <arquivo-ou-pasta> [--micro|--curto|--medio] [--para <resumo|onboarding|review|mudanca|bug|arquitetura>] [--drift <fresh|cache|none>] [--saida <diretorio>] [--raiz] [--json]",
|
|
144
|
-
"sema prompt-curto <arquivo-ou-pasta> [--micro|--curto|--medio] [--para <resumo|onboarding|review|mudanca|bug|arquitetura>] [--json]",
|
|
145
|
-
"sema prompt-ia",
|
|
146
|
-
"sema prompt-ia-ui",
|
|
147
|
-
"sema prompt-ia-react",
|
|
148
|
-
"sema prompt-ia-sema-primeiro",
|
|
149
|
-
"sema exemplos-prompt-ia",
|
|
150
|
-
"sema contexto-ia <arquivo.sema> [--saida <diretorio>] [--json]",
|
|
151
|
-
"sema sync-codex [--json]",
|
|
152
|
-
"sema instalar-exemplos [--json]",
|
|
153
|
-
"sema docs-impacto --intencao <acao> [--arquivo <caminho>] [--criar-ausentes] [--json]",
|
|
154
|
-
"sema finalizar-mudanca --intencao <acao> [--arquivo <caminho>] [--doc-lida <caminho>] [--json]",
|
|
155
|
-
"sema author briefing <arquivo.sema> [--json]",
|
|
156
|
-
"sema author revisar-cliches <arquivo.sema> [--texto <texto>|--texto-arquivo <arquivo>] [--texto-anterior <texto>|--texto-anterior-arquivo <arquivo>] [--json]",
|
|
157
|
-
"sema author validar-narrativa <arquivo.sema> [--texto <texto>|--texto-arquivo <arquivo>] [--json]",
|
|
158
|
-
"sema author validar-proibicoes <arquivo.sema> [--texto <texto>|--texto-arquivo <arquivo>] [--json]",
|
|
159
|
-
"sema profile validar <profile> <arquivo.sema> [--maturidade draft|prototype|production|critical] [--preset <preset>] [--artefato <texto>|--artefato-arquivo <arquivo>] [--json]",
|
|
160
|
-
"sema profile capabilities [--json]",
|
|
161
|
-
"sema descobrir <catalogo|recomendar|explicar> [id] [--intencao <objetivo>] [--json]",
|
|
162
|
-
"sema pipeline <listar|descrever> [id] [--json]",
|
|
163
|
-
"sema capabilities [--json]",
|
|
164
|
-
"sema interativo <capabilities|schema|pipelines|adapters|validar|planejar|validar-evidencias|status|validar-protocolo|extensões-P0-P2> [opções] [--json]",
|
|
165
|
-
"sema conteudo <capabilities|validar|planejar|validar-envelope|registrar|status|projetar> [--trust-root-digest <sha256:...>] [--revocation-digest <sha256:...>] [--expected-head <sha256:...>] [opções] [--json]",
|
|
166
|
-
"sema rule-packs [--profile <profile>] [--json]",
|
|
167
|
-
]),
|
|
168
|
-
"",
|
|
169
|
-
renderizarSecaoAscii("Operacional", [
|
|
170
|
-
"sema doctor",
|
|
171
|
-
"sema --versao | --version | -v",
|
|
172
|
-
]),
|
|
173
|
-
].join("\n");
|
|
174
|
-
}
|
|
175
|
-
export function normalizarModoAnaliseDriftCli(args, padrao = "fresh") {
|
|
176
|
-
const valor = obterOpcao(args, "--drift");
|
|
177
|
-
if (valor === undefined)
|
|
178
|
-
return possuiFlag(args, "--com-drift") ? "fresh" : padrao;
|
|
179
|
-
if (valor === "fresh" || valor === "cache" || valor === "none")
|
|
180
|
-
return valor;
|
|
181
|
-
throw new Error("Use --drift fresh, --drift cache ou --drift none.");
|
|
16
|
+
return criarAjudaRaiz(VERSAO_CLI);
|
|
182
17
|
}
|
|
183
|
-
|
|
184
|
-
const valor = obterOpcao(args, "--cache");
|
|
185
|
-
if (valor === undefined)
|
|
186
|
-
return undefined;
|
|
187
|
-
if (valor === "auto" || valor === "refresh" || valor === "off")
|
|
188
|
-
return valor;
|
|
189
|
-
throw new Error("Use --cache auto, --cache refresh ou --cache off.");
|
|
190
|
-
}
|
|
191
|
-
export function resolverOpcoesDriftCli(args, cacheForcado) {
|
|
18
|
+
function criarOpcoesDriftCli(args, resolucao) {
|
|
192
19
|
const escopo = obterOpcao(args, "--escopo");
|
|
193
|
-
const cache = cacheForcado ?? normalizarPoliticaCacheDriftCli(args);
|
|
194
20
|
return {
|
|
195
21
|
escopo: escopo === "arquivo" || escopo === "modulo" || escopo === "projeto" ? escopo : undefined,
|
|
196
22
|
ignorarWorktrees: !possuiFlag(args, "--incluir-worktrees"),
|
|
197
23
|
ignorarConsumidoresLaterais: !possuiFlag(args, "--incluir-consumidores-laterais"),
|
|
198
|
-
|
|
24
|
+
modoCache: resolucao.modo,
|
|
25
|
+
avisosModoCache: resolucao.avisos,
|
|
199
26
|
};
|
|
200
27
|
}
|
|
201
|
-
export function
|
|
202
|
-
|
|
203
|
-
const cache = modo === "fresh" ? "refresh" : modo === "cache" ? "auto" : undefined;
|
|
204
|
-
return {
|
|
205
|
-
modo,
|
|
206
|
-
opcoes: resolverOpcoesDriftCli(args, cache),
|
|
207
|
-
};
|
|
28
|
+
export function resolverOpcoesDriftCli(args) {
|
|
29
|
+
return criarOpcoesDriftCli(args, resolverModoCacheComandoDrift(args));
|
|
208
30
|
}
|
|
209
|
-
export function
|
|
210
|
-
const
|
|
31
|
+
export function resolverAnaliseDriftConsultaCli(args, comando) {
|
|
32
|
+
const resolucao = resolverModoCacheConsultaDrift(args, comando);
|
|
211
33
|
return {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
escopo_aplicado: {
|
|
215
|
-
escopo,
|
|
216
|
-
ignorarWorktrees: opcoes?.ignorarWorktrees !== false,
|
|
217
|
-
ignorarConsumidoresLaterais: opcoes?.ignorarConsumidoresLaterais !== false,
|
|
218
|
-
termosEscopo: [],
|
|
219
|
-
},
|
|
220
|
-
consumerFramework: null,
|
|
221
|
-
appRoutes: [],
|
|
222
|
-
consumerSurfaces: [],
|
|
223
|
-
consumerBridges: [],
|
|
224
|
-
modulos: contextoProjeto.modulosSelecionados.map((item) => ({
|
|
225
|
-
caminho: item.caminho,
|
|
226
|
-
modulo: item.resultado.modulo?.nome ?? null,
|
|
227
|
-
tasks: item.resultado.ir?.tasks.length ?? 0,
|
|
228
|
-
routes: item.resultado.ir?.routes.length ?? 0,
|
|
229
|
-
})),
|
|
230
|
-
tasks: [],
|
|
231
|
-
impls_validos: [],
|
|
232
|
-
impls_quebrados: [],
|
|
233
|
-
vinculos_validos: [],
|
|
234
|
-
vinculos_quebrados: [],
|
|
235
|
-
rotas_divergentes: [],
|
|
236
|
-
recursos_validos: [],
|
|
237
|
-
recursos_divergentes: [],
|
|
238
|
-
persistencia_real: [],
|
|
239
|
-
resumo_operacional: {
|
|
240
|
-
scoreMedio: 0,
|
|
241
|
-
confiancaGeral: "baixa",
|
|
242
|
-
pontuacaoMinimaOperacional: 80,
|
|
243
|
-
pontuacaoAlvoAtual: 80,
|
|
244
|
-
pontuacaoAlvoFinal: 100,
|
|
245
|
-
passoEvolucaoPontuacao: 0.5,
|
|
246
|
-
proximaPontuacaoAlvo: 80,
|
|
247
|
-
pontuacaoAbaixoDoPiso: false,
|
|
248
|
-
pontuacaoAbaixoDoAlvo: false,
|
|
249
|
-
travasPontuacao: [],
|
|
250
|
-
riscosPrincipais: ["analise_drift_nao_executada"],
|
|
251
|
-
oQueTocar: [],
|
|
252
|
-
oQueValidar: ["executar sema drift antes de concluir sobre a implementação"],
|
|
253
|
-
oQueEstaFrouxo: ["codigo_nao_verificado_neste_modo"],
|
|
254
|
-
oQueFoiInferido: ["modo_contratos_apenas"],
|
|
255
|
-
},
|
|
256
|
-
diagnosticos: [],
|
|
34
|
+
...resolucao,
|
|
35
|
+
opcoes: criarOpcoesDriftCli(args, resolucao),
|
|
257
36
|
};
|
|
258
37
|
}
|
|
259
38
|
export function normalizarTamanhoResumo(args) {
|
|
@@ -327,9 +106,9 @@ export function renderizarCabecalhoDocsIa(descoberta) {
|
|
|
327
106
|
"Modo IA-first da instalacao atual",
|
|
328
107
|
"- Use `sema` como interface publica principal.",
|
|
329
108
|
"- A Sema entra em projeto novo, projeto ja semantizado e adocao incremental em legado sem contrato inicial.",
|
|
330
|
-
"- Nao assuma monorepo, `node pacotes/cli/dist/
|
|
331
|
-
"- Se a IA tiver contexto curto, comece por `sema resumo` e `sema prompt-curto
|
|
332
|
-
"- Se a IA aguentar mais contexto, suba para `sema drift --json` e `sema contexto-ia`.",
|
|
109
|
+
"- Nao assuma monorepo, `node pacotes/cli/dist/bin.js`, `npm run project:check` ou uma pasta `exemplos` externa ao projeto atual.",
|
|
110
|
+
"- Se a IA tiver contexto curto, comece por `sema resumo --drift none` e `sema prompt-curto`; implementação e score ficam não avaliados.",
|
|
111
|
+
"- Se a IA aguentar mais contexto e precisar de evidência viva, suba para `sema drift --cache fresh --json` e `sema contexto-ia`.",
|
|
333
112
|
"- So leia `ast.json` e `ir.json` completos quando a capacidade da IA realmente aguentar esse volume.",
|
|
334
113
|
];
|
|
335
114
|
if (documentos.length > 0) {
|