@mocoto/mahoraga 0.14.1 → 0.14.3
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 +0 -34
- package/dist/analysts/architects/analyst-structure.js +20 -20
- package/dist/analysts/architects/archetypes-custom.js +16 -19
- package/dist/analysts/architects/detector-archetypes.js +43 -36
- package/dist/analysts/architects/orchestrator-archetypes.js +3 -3
- package/dist/analysts/architects/signals-project-advanced.js +26 -28
- package/dist/analysts/architects/signals-project.js +2 -2
- package/dist/analysts/architects/strategist-structure.js +47 -66
- package/dist/analysts/azure-pipelines/analysts/analyst-azure.js +41 -35
- package/dist/analysts/azure-pipelines/corrections/correction-azure.js +22 -19
- package/dist/analysts/azure-pipelines/detectors/detector-azure-performance.js +21 -18
- package/dist/analysts/azure-pipelines/detectors/detector-azure-security.js +25 -20
- package/dist/analysts/azure-pipelines/detectors/detector-azure-structure.js +39 -40
- package/dist/analysts/azure-pipelines/scorers/scorer-azure.js +10 -7
- package/dist/analysts/circleci/analysts/analyst-circleci.js +33 -27
- package/dist/analysts/circleci/corrections/correction-circleci.js +22 -20
- package/dist/analysts/circleci/detectors/detector-circleci-performance.js +23 -19
- package/dist/analysts/circleci/detectors/detector-circleci-security.js +78 -82
- package/dist/analysts/circleci/detectors/detector-circleci-structure.js +22 -22
- package/dist/analysts/converters/convert-registry.js +1 -1
- package/dist/analysts/converters/engines/converter-gha-to-gitlab.js +17 -15
- package/dist/analysts/converters/index.js +1 -1
- package/dist/analysts/corrections/analyst-quick-fixes.js +25 -28
- package/dist/analysts/corrections/analyst-scoring.js +24 -21
- package/dist/analysts/corrections/auto-fix-engine.js +1 -1
- package/dist/analysts/corrections/corrector-structure.js +43 -42
- package/dist/analysts/corrections/fix-alias-imports.js +10 -6
- package/dist/analysts/corrections/fix-md-fences.js +23 -23
- package/dist/analysts/corrections/map-reversion.js +56 -53
- package/dist/analysts/corrections/pruning.js +19 -16
- package/dist/analysts/corrections/quick-fixes/fix-any-to-proper-type.js +57 -61
- package/dist/analysts/corrections/quick-fixes/fix-unknown-to-specific-type.js +30 -30
- package/dist/analysts/corrections/reorganize-barrels.js +13 -13
- package/dist/analysts/corrections/rewrite-testes-aliases.js +23 -22
- package/dist/analysts/corrections/scoring-shared.js +19 -18
- package/dist/analysts/corrections/type-safety/context-analyzer.js +15 -10
- package/dist/analysts/corrections/type-safety/type-analyzer.js +3 -3
- package/dist/analysts/corrections/type-safety/type-validator.js +4 -3
- package/dist/analysts/corrections/type-safety/usage-analyzer.js +39 -42
- package/dist/analysts/css/analysts/analyst-css.js +42 -42
- package/dist/analysts/css/corrections/correction-css.js +19 -11
- package/dist/analysts/css/detectors/detector-css-best-practices.js +129 -118
- package/dist/analysts/css/scorers/scorer-css.js +23 -18
- package/dist/analysts/css-in-js/analysts/analyst-css-in-js.js +24 -17
- package/dist/analysts/css-in-js/corrections/correction-css-in-js.js +31 -16
- package/dist/analysts/css-in-js/detectors/detector-css-in-js-best-practices.js +28 -30
- package/dist/analysts/css-in-js/scorers/scorer-css-in-js.js +79 -54
- package/dist/analysts/css-in-js/shared.js +7 -0
- package/dist/analysts/detectors/detector-architecture.js +91 -85
- package/dist/analysts/detectors/detector-bugs-ml.js +29 -27
- package/dist/analysts/detectors/detector-code-fragile.js +41 -36
- package/dist/analysts/detectors/detector-dependencies.js +5 -5
- package/dist/analysts/detectors/detector-duplications.js +26 -26
- package/dist/analysts/detectors/detector-monorepo.js +51 -45
- package/dist/analysts/detectors/detector-performance.js +24 -17
- package/dist/analysts/detectors/detector-recommendation-architecture.js +40 -36
- package/dist/analysts/detectors/detector-security.js +43 -42
- package/dist/analysts/detectors/detector-structure.js +31 -28
- package/dist/analysts/github-actions/analysts/analyst-github-actions.js +5 -8
- package/dist/analysts/github-actions/detectors/detector-workflow-accessibility.js +1 -9
- package/dist/analysts/github-actions/detectors/detector-workflow-structure.js +1 -4
- package/dist/analysts/github-actions/detectors/detector-workflow-trigger-unsafe.js +6 -5
- package/dist/analysts/gitlab-ci/analysts/analyst-gitlab-ci.js +2 -2
- package/dist/analysts/gitlab-ci/detectors/detector-gitlab-ci-structure.js +0 -3
- package/dist/analysts/go/analysts/analyst-best-practices.js +2 -2
- package/dist/analysts/go/analysts/analyst-concurrency.js +1 -1
- package/dist/analysts/go/analysts/analyst-security.js +1 -1
- package/dist/analysts/go/detectors/detector-conventions.js +1 -1
- package/dist/analysts/html/analysts/analyst-html.js +10 -12
- package/dist/analysts/html/detectors/detector-html.js +3 -3
- package/dist/analysts/js-ts/analysts/analyst-commands-cli.js +22 -22
- package/dist/analysts/js-ts/analysts/analyst-functions-long.js +5 -5
- package/dist/analysts/js-ts/analysts/analyst-patterns-usage.js +6 -2
- package/dist/analysts/js-ts/detectors/detector-anti-patterns-async.js +84 -9
- package/dist/analysts/js-ts/detectors/detector-constructions-syntactic.js +33 -10
- package/dist/analysts/js-ts/detectors/detector-context-smart.js +6 -6
- package/dist/analysts/js-ts/detectors/detector-leaks-memory.js +1 -1
- package/dist/analysts/js-ts/detectors/detector-types-unsafe.js +33 -2
- package/dist/analysts/php/analysts/analyst-php.js +3 -3
- package/dist/analysts/php/detectors/detector-php-best-practices.js +5 -5
- package/dist/analysts/php/detectors/detector-php-security.js +5 -5
- package/dist/analysts/php/scorers/scorer-php.js +2 -2
- package/dist/analysts/plugins/detector-documentation.js +6 -6
- package/dist/analysts/plugins/detector-markdown.js +7 -7
- package/dist/analysts/python/analysts/analyst-python.js +2 -5
- package/dist/analysts/react/analysts/analyst-react-hooks.js +66 -9
- package/dist/analysts/react/analysts/analyst-react.js +46 -2
- package/dist/analysts/react/corrections/correction-react.js +41 -1
- package/dist/analysts/react/detectors/detector-react-best-practices.js +5 -5
- package/dist/analysts/react/scorers/scorer-react.js +36 -1
- package/dist/analysts/registry/autodiscovery.js +2 -2
- package/dist/analysts/rust/analysts/analyst-best-practices.js +42 -3
- package/dist/analysts/rust/analysts/analyst-memory.js +2 -2
- package/dist/analysts/rust/analysts/analyst-rust.js +52 -5
- package/dist/analysts/rust/analysts/analyst-security.js +29 -1
- package/dist/analysts/scorers/scorer.js +5 -5
- package/dist/analysts/shell/analysts/analyst-shell.js +81 -5
- package/dist/analysts/shell/corrections/correction-shell.js +34 -1
- package/dist/analysts/shell/detectors/detector-shell-security.js +88 -0
- package/dist/analysts/shell/scorers/scorer-shell.js +58 -1
- package/dist/analysts/strategists/operator-structure.js +5 -7
- package/dist/analysts/strategists/suggestions-contextuais.js +5 -2
- package/dist/analysts/svg/analysts/analyst-svg.js +1 -0
- package/dist/analysts/tailwind/analysts/analyst-tailwind.js +79 -55
- package/dist/analysts/tailwind/corrections/correction-tailwind.js +108 -9
- package/dist/analysts/tailwind/detectors/detector-tailwind-best-practices.js +122 -7
- package/dist/analysts/tailwind/scorers/scorer-tailwind.js +62 -11
- package/dist/analysts/xml/analysts/analyst-xml.js +2 -2
- package/dist/app/index.js +1 -0
- package/dist/bin/cli-bootstrap.js +6 -4
- package/dist/bin/index.js +6 -4
- package/dist/caretakers/scoring.js +1 -0
- package/dist/cli/commands/command-analysts.js +4 -3
- package/dist/cli/commands/command-azure.js +1 -1
- package/dist/cli/commands/command-circleci.js +1 -1
- package/dist/cli/commands/command-compliance.js +1 -1
- package/dist/cli/commands/command-diagnose.js +10 -13
- package/dist/cli/commands/command-fix-types.js +9 -32
- package/dist/cli/commands/command-formatters.js +2 -2
- package/dist/cli/commands/command-github-actions.js +1 -1
- package/dist/cli/commands/command-gitlab-ci.js +1 -1
- package/dist/cli/commands/command-guardian.js +1 -1
- package/dist/cli/commands/command-imports.js +6 -6
- package/dist/cli/commands/command-jenkins.js +1 -1
- package/dist/cli/commands/command-licenses.js +1 -1
- package/dist/cli/commands/command-marketplace.js +7 -7
- package/dist/cli/commands/command-names.js +3 -8
- package/dist/cli/commands/command-perf.js +7 -9
- package/dist/cli/commands/command-plugins.js +4 -4
- package/dist/cli/diagnostic/auto-fix.js +2 -2
- package/dist/cli/diagnostic/exporters/json-exporter.js +1 -1
- package/dist/cli/diagnostic/exporters/sharded-exporter.js +0 -3
- package/dist/cli/diagnostic/exporters/svg-optimization-exporter.js +1 -1
- package/dist/cli/diagnostic/filters.js +9 -9
- package/dist/cli/diagnostic/handlers/archetype-handler.js +3 -6
- package/dist/cli/diagnostic/handlers/auto-fix-handler.js +4 -4
- package/dist/cli/diagnostic/handlers/guardian-handler.js +1 -1
- package/dist/cli/diagnostic/processing-diagnostic.js +31 -35
- package/dist/cli/diagnostic/processing-helpers.js +2 -2
- package/dist/cli/handlers/fix-types-exporter.js +1 -4
- package/dist/cli/helpers/display-frame.js +5 -5
- package/dist/core/config/auto/auto-fix-config.js +0 -6
- package/dist/core/config/chalk-safe.js +6 -6
- package/dist/core/config/config.js +11 -13
- package/dist/core/config/conventions.js +1 -1
- package/dist/core/config/security.js +2 -2
- package/dist/core/execution/analysis-cache.js +5 -8
- package/dist/core/execution/ast-cache.js +1 -3
- package/dist/core/execution/executor.js +8 -21
- package/dist/core/execution/inquisitor.js +24 -21
- package/dist/core/execution/results.js +1 -0
- package/dist/core/execution/scanner.js +4 -4
- package/dist/core/messages/en/analysts/analyst-github-actions-messages.js +1 -1
- package/dist/core/messages/en/analysts/analyst-patterns-usage-messages.js +1 -0
- package/dist/core/messages/en/analysts/analyst-shell-messages.js +15 -0
- package/dist/core/messages/en/analysts/detector-constructions-syntactic-messages.js +6 -0
- package/dist/core/messages/en/analysts/detector-js-ts-messages.js +27 -0
- package/dist/core/messages/en/analysts/detector-react-messages.js +8 -0
- package/dist/core/messages/en/analysts/detector-shell-messages.js +17 -0
- package/dist/core/messages/en/analysts/detector-tailwind-messages.js +3 -3
- package/dist/core/messages/en/analysts/report-circleci-messages.js +7 -7
- package/dist/core/messages/en/caretakers/caretaker-messages.js +1 -7
- package/dist/core/messages/en/core/plugin-messages.js +31 -3
- package/dist/core/messages/en/log/log.js +4 -4
- package/dist/core/messages/en/ui/filter-config.js +1 -5
- package/dist/core/messages/i18n-system.js +3 -3
- package/dist/core/messages/index.js +3 -3
- package/dist/core/messages/ja/analysts/analyst-github-actions-messages.js +1 -1
- package/dist/core/messages/ja/analysts/analyst-patterns-usage-messages.js +1 -0
- package/dist/core/messages/ja/analysts/analyst-shell-messages.js +15 -0
- package/dist/core/messages/ja/analysts/detector-constructions-syntactic-messages.js +6 -0
- package/dist/core/messages/ja/analysts/detector-js-ts-messages.js +27 -0
- package/dist/core/messages/ja/analysts/detector-react-messages.js +8 -0
- package/dist/core/messages/ja/analysts/detector-shell-messages.js +17 -0
- package/dist/core/messages/ja/analysts/detector-tailwind-messages.js +3 -3
- package/dist/core/messages/ja/analysts/report-circleci-messages.js +7 -7
- package/dist/core/messages/ja/caretakers/caretaker-messages.js +1 -7
- package/dist/core/messages/ja/core/plugin-messages.js +31 -3
- package/dist/core/messages/ja/log/log.js +4 -4
- package/dist/core/messages/ja/ui/filter-config.js +1 -1
- package/dist/core/messages/pt/analysts/analyst-github-actions-messages.js +1 -1
- package/dist/core/messages/pt/analysts/analyst-patterns-usage-messages.js +1 -0
- package/dist/core/messages/pt/analysts/analyst-shell-messages.js +15 -0
- package/dist/core/messages/pt/analysts/detector-constructions-syntactic-messages.js +6 -0
- package/dist/core/messages/pt/analysts/detector-js-ts-messages.js +27 -0
- package/dist/core/messages/pt/analysts/detector-react-messages.js +8 -0
- package/dist/core/messages/pt/analysts/detector-shell-messages.js +17 -0
- package/dist/core/messages/pt/analysts/detector-tailwind-messages.js +3 -3
- package/dist/core/messages/pt/analysts/report-circleci-messages.js +7 -7
- package/dist/core/messages/pt/caretakers/caretaker-messages.js +1 -7
- package/dist/core/messages/pt/core/plugin-messages.js +31 -3
- package/dist/core/messages/pt/log/log-engine.js +6 -6
- package/dist/core/messages/pt/log/log.js +3 -3
- package/dist/core/messages/pt/ui/filter-config.js +1 -1
- package/dist/core/messages/shared/icons.js +3 -3
- package/dist/core/messages/zh/analysts/analyst-github-actions-messages.js +1 -1
- package/dist/core/messages/zh/analysts/analyst-patterns-usage-messages.js +1 -0
- package/dist/core/messages/zh/analysts/analyst-shell-messages.js +15 -0
- package/dist/core/messages/zh/analysts/detector-constructions-syntactic-messages.js +6 -0
- package/dist/core/messages/zh/analysts/detector-js-ts-messages.js +27 -0
- package/dist/core/messages/zh/analysts/detector-react-messages.js +8 -0
- package/dist/core/messages/zh/analysts/detector-shell-messages.js +17 -0
- package/dist/core/messages/zh/analysts/detector-tailwind-messages.js +3 -3
- package/dist/core/messages/zh/analysts/report-circleci-messages.js +7 -7
- package/dist/core/messages/zh/caretakers/caretaker-messages.js +1 -7
- package/dist/core/messages/zh/core/plugin-messages.js +31 -3
- package/dist/core/messages/zh/log/log.js +3 -3
- package/dist/core/messages/zh/ui/filter-config.js +1 -5
- package/dist/core/parsing/filters.js +3 -3
- package/dist/core/parsing/langs/json.js +1 -1
- package/dist/core/parsing/langs/python.js +1 -1
- package/dist/core/parsing/langs/typescript.js +1 -1
- package/dist/core/parsing/parser.js +3 -4
- package/dist/core/parsing/utils.js +1 -0
- package/dist/core/registry/file-registry.js +3 -2
- package/dist/core/registry/paths.js +3 -3
- package/dist/core/reporting/default-reporter.js +2 -2
- package/dist/core/schema/version.js +6 -6
- package/dist/core/workers/worker-executor.js +3 -3
- package/dist/core/workers/worker-pool.js +0 -0
- package/dist/guardian/baseline.js +1 -1
- package/dist/guardian/gpg.js +3 -1
- package/dist/guardian/integrity.js +2 -7
- package/dist/guardian/records.js +7 -1
- package/dist/guardian/result.js +1 -1
- package/dist/guardian/sentinel.js +7 -1
- package/dist/guardian/watcher-hidden.js +6 -1
- package/dist/licenses/fs-utils.js +5 -1
- package/dist/licenses/generate-notices.js +1 -1
- package/dist/licenses/index.js +1 -0
- package/dist/licenses/normalizer.js +10 -9
- package/dist/node.loader.js +224 -4
- package/dist/reports/analise-async-patterns.js +1 -1
- package/dist/reports/filter-smart.js +2 -5
- package/dist/reports/generator-report.js +7 -7
- package/dist/reports/report-archetypes.js +10 -10
- package/dist/reports/report-caretaker-health.js +2 -1
- package/dist/reports/report-patterns-usage.js +1 -1
- package/dist/sdk/analyzer.js +1 -1
- package/dist/shared/data-processing/fragment-report.js +11 -11
- package/dist/shared/data-processing/json.js +1 -1
- package/dist/shared/data-processing/occurrences.js +3 -2
- package/dist/shared/formatters/code-min-formatter.js +1 -1
- package/dist/shared/formatters/engines/prettier.js +1 -1
- package/dist/shared/formatters/engines/stylelint.js +43 -40
- package/dist/shared/formatters/formatter.js +8 -8
- package/dist/shared/formatters/formatters/code.js +3 -3
- package/dist/shared/formatters/formatters/css.js +2 -10
- package/dist/shared/formatters/formatters/dotfiles.js +1 -1
- package/dist/shared/formatters/formatters/html.js +1 -5
- package/dist/shared/formatters/formatters/json.js +0 -3
- package/dist/shared/formatters/formatters/markdown.js +19 -24
- package/dist/shared/formatters/formatters/properties.js +2 -2
- package/dist/shared/formatters/formatters/shell.js +1 -4
- package/dist/shared/formatters/formatters/sql.js +0 -3
- package/dist/shared/formatters/formatters/xml.js +5 -7
- package/dist/shared/formatters/formatters/yaml.js +2 -7
- package/dist/shared/formatters/index.js +1 -1
- package/dist/shared/helpers/framework-detector.js +6 -2
- package/dist/shared/helpers/json.js +1 -1
- package/dist/shared/helpers/magic-constants-whitelist.js +1 -1
- package/dist/shared/helpers/masking.js +17 -17
- package/dist/shared/helpers/reader-report.js +0 -12
- package/dist/shared/helpers/structural-hash.js +3 -2
- package/dist/shared/helpers/structure.js +1 -1
- package/dist/shared/marketplace/registry.js +1 -1
- package/dist/shared/marketplace/remote.js +4 -4
- package/dist/shared/persistence/persistence.js +13 -6
- package/dist/shared/plugins/core-plugin.js +5 -1
- package/dist/shared/plugins/registry.js +3 -2
- package/dist/types/analysts/tailwind-correction.js +2 -0
- package/dist/types/caretakers/imports-barrel.js +1 -0
- package/dist/types/caretakers/index.js +4 -0
- package/dist/types/caretakers/map-reversion.js +1 -0
- package/dist/types/caretakers/pruning.js +1 -0
- package/dist/types/caretakers/scoring.js +1 -0
- package/dist/types/common/analysts.js +1 -1
- package/dist/types/core/config/filters.js +1 -0
- package/dist/types/core/config/index.js +2 -0
- package/dist/types/core/execution/ambiente.js +1 -0
- package/dist/types/core/execution/linguagens.js +1 -0
- package/dist/types/core/execution/parse-errors.js +1 -0
- package/dist/types/core/execution/results.js +1 -0
- package/dist/types/core/execution/structure-json.js +1 -0
- package/dist/types/core/index.js +1 -0
- package/dist/types/core/messages/index.js +1 -0
- package/dist/types/core/messages/log.js +1 -0
- package/dist/types/core/parsing/babel-narrow.js +1 -0
- package/dist/types/core/parsing/index.js +1 -0
- package/dist/types/core/runtime.js +1 -0
- package/dist/types/guardian/index.js +2 -0
- package/dist/types/guardian/integrity.js +7 -0
- package/dist/types/guardian/snapshot.js +1 -0
- package/dist/types/index.js +4 -4
- package/dist/types/licenses/index.js +2 -0
- package/dist/types/processing/display.js +16 -13
- package/dist/types/processing/filters.js +8 -11
- package/dist/types/reports/compliance.js +1 -0
- package/dist/types/reports/streaming.js +1 -0
- package/dist/types/scripts/index.js +1 -0
- package/dist/types/scripts/migrar-aliases.js +1 -0
- package/dist/types/sdk/index.js +1 -0
- package/dist/types/shared/index.js +2 -0
- package/dist/types/vulnerabilities/index.js +2 -0
- package/dist/vulnerabilities/scanner.js +3 -2
- package/package.json +14 -20
|
@@ -63,9 +63,7 @@ async function carregarSnapshots(dir) {
|
|
|
63
63
|
for (const arquivo of jsons) {
|
|
64
64
|
try {
|
|
65
65
|
const parsed = await lerEstado(path.join(dir, arquivo));
|
|
66
|
-
|
|
67
|
-
out.push(parsed);
|
|
68
|
-
}
|
|
66
|
+
out.push(parsed);
|
|
69
67
|
}
|
|
70
68
|
catch {
|
|
71
69
|
/* ignore */
|
|
@@ -108,8 +106,8 @@ function compararSnapshots(base, atual) {
|
|
|
108
106
|
export function comandoPerf() {
|
|
109
107
|
return new Command('perf').description(messages.CliComandoDesempMensagens.descricao).option('-d, --dir <dir>', 'Diretório de snapshots', config.PERF_SNAPSHOT_DIR).option('-j, --json', 'Saída JSON').option('-l, --limite <n>', 'Limite para regressão (%)', valor => Number(valor), 30).addCommand(new Command('baseline').description(messages.CliComandoDesempMensagens.descricaoBaseline).action(async (opts, cmd) => {
|
|
110
108
|
try {
|
|
111
|
-
const parent = cmd.parent?.opts
|
|
112
|
-
const dir = parent.dir ?
|
|
109
|
+
const parent = cmd.parent?.opts() ?? {};
|
|
110
|
+
const dir = typeof parent.dir === 'string' ? parent.dir : config.PERF_SNAPSHOT_DIR;
|
|
113
111
|
const globalMetrics = globalThis;
|
|
114
112
|
const metricas = globalMetrics.__ULTIMAS_METRICAS_SUKUNA__;
|
|
115
113
|
const snap = await gerarBaseline(dir, metricas ?? undefined);
|
|
@@ -128,8 +126,8 @@ export function comandoPerf() {
|
|
|
128
126
|
sair(ExitCode.Failure);
|
|
129
127
|
}
|
|
130
128
|
})).addCommand(new Command('compare').description(messages.CliComandoDesempMensagens.descricaoCompare).action(async (opts, cmd) => {
|
|
131
|
-
const parent = cmd.parent?.opts
|
|
132
|
-
const dir = parent.dir ?
|
|
129
|
+
const parent = cmd.parent?.opts() ?? {};
|
|
130
|
+
const dir = typeof parent.dir === 'string' ? parent.dir : config.PERF_SNAPSHOT_DIR;
|
|
133
131
|
const limite = parent.limite;
|
|
134
132
|
let snaps;
|
|
135
133
|
try {
|
|
@@ -155,7 +153,7 @@ export function comandoPerf() {
|
|
|
155
153
|
const anterior = snaps[snaps.length - 2];
|
|
156
154
|
const atual = snaps[snaps.length - 1];
|
|
157
155
|
const diffs = compararSnapshots(anterior, atual);
|
|
158
|
-
const regressao = diffs.filter(diretorio => diretorio.campo === 'tempoAnaliseMs' || diretorio.campo === 'tempoParsingMs').some(diretorio => diretorio.variacaoPct > limite);
|
|
156
|
+
const regressao = diffs.filter(diretorio => diretorio.campo === 'tempoAnaliseMs' || diretorio.campo === 'tempoParsingMs').some(diretorio => diretorio.variacaoPct > (limite ?? 0));
|
|
159
157
|
if (parent.json) {
|
|
160
158
|
console.log(JSON.stringify({
|
|
161
159
|
base: anterior.hashConteudo,
|
|
@@ -171,7 +169,7 @@ export function comandoPerf() {
|
|
|
171
169
|
log.info(` ${diretorio.campo}: ${diretorio.anterior ?? '-'} => ${diretorio.novo ?? '-'} (${formatPct(diretorio.variacaoPct)})`);
|
|
172
170
|
});
|
|
173
171
|
if (regressao) {
|
|
174
|
-
logSistema.performanceRegressaoDetectada(limite);
|
|
172
|
+
logSistema.performanceRegressaoDetectada(limite ?? 0);
|
|
175
173
|
}
|
|
176
174
|
else {
|
|
177
175
|
logSistema.performanceSemRegressoes();
|
|
@@ -10,7 +10,7 @@ const msgs = messages.CliComandoPluginsMensagens;
|
|
|
10
10
|
*/
|
|
11
11
|
export function comandoPlugins() {
|
|
12
12
|
const plugins = new Command('plugins').description(msgs.descricao);
|
|
13
|
-
plugins.command('list').description(msgs.listDescricao).option('--json', msgs.jsonDescricao).action(opts => {
|
|
13
|
+
plugins.command('list').description(msgs.listDescricao).option('--json', msgs.jsonDescricao).action((opts) => {
|
|
14
14
|
try {
|
|
15
15
|
const lista = listarAnalistas();
|
|
16
16
|
if (opts.json) {
|
|
@@ -28,7 +28,7 @@ export function comandoPlugins() {
|
|
|
28
28
|
sair(ExitCode.Failure);
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
plugins.command('install <pacote>').description(msgs.installDescricao).action(pacote => {
|
|
31
|
+
plugins.command('install <pacote>').description(msgs.installDescricao).action((pacote) => {
|
|
32
32
|
log.info(msgs.buscandoPacote(pacote));
|
|
33
33
|
log.info(msgs.instalando);
|
|
34
34
|
// Mock de instalação para v0.5.0
|
|
@@ -37,11 +37,11 @@ export function comandoPlugins() {
|
|
|
37
37
|
log.info(msgs.dicaAnalistas);
|
|
38
38
|
}, 500);
|
|
39
39
|
});
|
|
40
|
-
plugins.command('remove <pacote>').description(msgs.removeDescricao).action(pacote => {
|
|
40
|
+
plugins.command('remove <pacote>').description(msgs.removeDescricao).action((pacote) => {
|
|
41
41
|
log.info(msgs.removendo(pacote));
|
|
42
42
|
log.sucesso(msgs.pluginRemovido(pacote));
|
|
43
43
|
});
|
|
44
|
-
plugins.command('init <nome>').description(msgs.initDescricao).action(nome => {
|
|
44
|
+
plugins.command('init <nome>').description(msgs.initDescricao).action((nome) => {
|
|
45
45
|
log.info(msgs.gerandoTemplate(nome));
|
|
46
46
|
log.sucesso(msgs.arquivoCriado(nome));
|
|
47
47
|
log.info(msgs.dicaImplementar);
|
|
@@ -41,10 +41,10 @@ export async function executarAutoFixInterno(opts, ocorrenciasFiltradas, fileEnt
|
|
|
41
41
|
}
|
|
42
42
|
correcoesPorArquivo.get(arquivo)?.push(fix);
|
|
43
43
|
}
|
|
44
|
-
const maxFixesPerArquivo = autoCorrecaoConfiguracao.maxFixesPerArquivo
|
|
44
|
+
const maxFixesPerArquivo = autoCorrecaoConfiguracao.maxFixesPerArquivo;
|
|
45
45
|
for (const [arquivo] of correcoesPorArquivo) {
|
|
46
46
|
try {
|
|
47
|
-
const fileEntrada = fileEntriesComAst
|
|
47
|
+
const fileEntrada = fileEntriesComAst?.find(fe => fe.relPath === arquivo || fe.fullCaminho === arquivo);
|
|
48
48
|
if (!fileEntrada || typeof fileEntrada.content !== 'string') {
|
|
49
49
|
logSistema.autoFixArquivoNaoEncontrado(arquivo);
|
|
50
50
|
continue;
|
|
@@ -140,7 +140,7 @@ function escapeNonAscii(str) {
|
|
|
140
140
|
export function traduzirRelatorioJson(json) {
|
|
141
141
|
try {
|
|
142
142
|
const { CAMPO_ROTULOS } = getMessages();
|
|
143
|
-
if (
|
|
143
|
+
if (Object.keys(CAMPO_ROTULOS).length === 0) {
|
|
144
144
|
return json;
|
|
145
145
|
}
|
|
146
146
|
const obj = JSON.parse(json);
|
|
@@ -134,9 +134,6 @@ export function validarOptionsSharding(options) {
|
|
|
134
134
|
if (!options.formato) {
|
|
135
135
|
erros.push('Formato é obrigatório');
|
|
136
136
|
}
|
|
137
|
-
else if (options.formato !== 'json' && options.formato !== 'markdown') {
|
|
138
|
-
erros.push('Formato deve ser "json" ou "markdown"');
|
|
139
|
-
}
|
|
140
137
|
if (!options.ocorrenciasPorShard || options.ocorrenciasPorShard <= 0) {
|
|
141
138
|
erros.push('ocorrenciasPorShard deve ser maior que 0');
|
|
142
139
|
}
|
|
@@ -22,7 +22,7 @@ export async function exportarRelatorioSvgOtimizacao(params) {
|
|
|
22
22
|
const { entries, relatoriosDir, ts } = params;
|
|
23
23
|
const candidatos = [];
|
|
24
24
|
for (const erro of entries) {
|
|
25
|
-
if (
|
|
25
|
+
if (typeof erro.relPath !== 'string') {
|
|
26
26
|
continue;
|
|
27
27
|
}
|
|
28
28
|
if (!/\.svg$/i.test(erro.relPath)) {
|
|
@@ -100,10 +100,9 @@ export function detectarTipoProjeto(baseDir = process.cwd()) {
|
|
|
100
100
|
export function getDefaultExcludes(tipoProjeto) {
|
|
101
101
|
// Tenta obter do mahoraga.config.json
|
|
102
102
|
const configIncluirExcluir = config.INCLUDE_EXCLUDE_RULES;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
103
|
+
const globalExclude = configIncluirExcluir.globalExcludeGlob;
|
|
104
|
+
if (Array.isArray(globalExclude) && globalExclude.length > 0) {
|
|
105
|
+
return Array.from(new Set(globalExclude));
|
|
107
106
|
}
|
|
108
107
|
// Fallback: usa padrões do sistema baseado no tipo de projeto
|
|
109
108
|
const tipo = tipoProjeto ?? detectarTipoProjeto();
|
|
@@ -162,16 +161,17 @@ export function processarFiltros(opcoes) {
|
|
|
162
161
|
*/
|
|
163
162
|
export function aplicarFiltrosAoConfig(filtros) {
|
|
164
163
|
// Configurar includes
|
|
164
|
+
const cfg = config;
|
|
165
165
|
if (filtros.includeFlat.length > 0) {
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
cfg.CLI_INCLUDE_GROUPS = filtros.includeGroups;
|
|
167
|
+
cfg.CLI_INCLUDE_PATTERNS = filtros.includeFlat;
|
|
168
168
|
}
|
|
169
169
|
else {
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
cfg.CLI_INCLUDE_GROUPS = [];
|
|
171
|
+
cfg.CLI_INCLUDE_PATTERNS = [];
|
|
172
172
|
}
|
|
173
173
|
// Configurar excludes
|
|
174
|
-
|
|
174
|
+
cfg.CLI_EXCLUDE_PATTERNS = filtros.excludePadroes;
|
|
175
175
|
}
|
|
176
176
|
/**
|
|
177
177
|
* API simplificada: processa e aplica filtros em uma única chamada
|
|
@@ -50,7 +50,7 @@ export async function executarDeteccaoArquetipos(entries, baseDir, options) {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
// Processar resultado
|
|
53
|
-
const arquetipos = resultado.candidatos
|
|
53
|
+
const arquetipos = resultado.candidatos;
|
|
54
54
|
const principal = arquetipos.length > 0 ? arquetipos[0] : undefined; // Log de resultado (se não silencioso)
|
|
55
55
|
if (!options.silent && principal) {
|
|
56
56
|
log.info(messages.MENSAGENS_ARQUETIPOS.identificado(principal.nome, principal.confidence));
|
|
@@ -59,16 +59,13 @@ export async function executarDeteccaoArquetipos(entries, baseDir, options) {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
// Salvar se solicitado
|
|
62
|
-
|
|
63
|
-
if (options.salvar && resultado) {
|
|
64
|
-
salvo = await salvarArquetipo(resultado, baseDir, options.silent);
|
|
65
|
-
}
|
|
62
|
+
const salvo = await salvarArquetipo(resultado, baseDir, options.silent);
|
|
66
63
|
return {
|
|
67
64
|
executado: true,
|
|
68
65
|
arquetipos: arquetipos.map(arquivo => ({
|
|
69
66
|
tipo: arquivo.nome,
|
|
70
67
|
confianca: arquivo.confidence,
|
|
71
|
-
caracteristicas: arquivo.matchedRequired
|
|
68
|
+
caracteristicas: arquivo.matchedRequired
|
|
72
69
|
})),
|
|
73
70
|
principal: principal ? {
|
|
74
71
|
tipo: principal.nome,
|
|
@@ -83,14 +83,14 @@ async function executarComTimeout(entries, options, timeoutMs) {
|
|
|
83
83
|
resolve(resultado);
|
|
84
84
|
}).catch((erro) => {
|
|
85
85
|
clearTimeout(timer);
|
|
86
|
-
reject(erro);
|
|
86
|
+
reject(erro instanceof Error ? erro : new Error(String(erro)));
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* Lógica interna de auto-fix
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
function executarAutoFixInterno(entries, options) {
|
|
94
94
|
// NOTA: Integração real com sistema de auto-fix pendente de implementação
|
|
95
95
|
// Por enquanto, retornar resultado mock
|
|
96
96
|
const stats = {
|
|
@@ -100,12 +100,12 @@ async function executarAutoFixInterno(entries, options) {
|
|
|
100
100
|
correcoesSugeridas: 0,
|
|
101
101
|
correcoesPuladas: 0
|
|
102
102
|
};
|
|
103
|
-
return {
|
|
103
|
+
return Promise.resolve({
|
|
104
104
|
executado: true,
|
|
105
105
|
mode: options.mode,
|
|
106
106
|
dryRun: options.dryRun,
|
|
107
107
|
stats
|
|
108
|
-
};
|
|
108
|
+
});
|
|
109
109
|
}
|
|
110
110
|
// ─── Formatação para JSON ─────────────────────────────────────
|
|
111
111
|
/**
|
|
@@ -40,7 +40,7 @@ export async function executarGuardian(entries, options) {
|
|
|
40
40
|
const resultado = await scanSystemIntegrity(entries, {
|
|
41
41
|
suppressLogs: options.silent,
|
|
42
42
|
}); // Processar resultado
|
|
43
|
-
const status = resultado.status
|
|
43
|
+
const status = resultado.status;
|
|
44
44
|
const drift = resultado.detalhes?.length ?? 0;
|
|
45
45
|
const temProblemas = status === IntegridadeStatus.AlteracoesDetectadas;
|
|
46
46
|
// Log de resultado (se não silencioso)
|
|
@@ -98,7 +98,7 @@ function buildJsonSaida(ocorrencias, guardianResultado, fileEntries, opts, arque
|
|
|
98
98
|
};
|
|
99
99
|
if (arquetiposResultado) {
|
|
100
100
|
saida.estruturaIdentificada = {
|
|
101
|
-
melhores: arquetiposResultado.candidatos
|
|
101
|
+
melhores: arquetiposResultado.candidatos,
|
|
102
102
|
baseline: arquetiposResultado.baseline ?? null,
|
|
103
103
|
drift: arquetiposResultado.drift ?? {
|
|
104
104
|
alterouArquetipo: false,
|
|
@@ -116,7 +116,7 @@ async function emitJsonSaida(ocorrencias, guardianResultado, fileEntries, opts,
|
|
|
116
116
|
try {
|
|
117
117
|
const pkgRaw = await fs.promises.readFile(path.join(process.cwd(), 'package.json'), 'utf-8');
|
|
118
118
|
const pkgObj = JSON.parse(pkgRaw);
|
|
119
|
-
if (
|
|
119
|
+
if (typeof pkgObj.version === 'string') {
|
|
120
120
|
pkgVersion = pkgObj.version;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -192,7 +192,7 @@ function emitTypeSummary(ocorrencias, nivelOcorrencias, opts) {
|
|
|
192
192
|
for (const oc of ocorrencias) {
|
|
193
193
|
const key = (oc.relPath || (oc.arquivo ?? 'desconhecido'));
|
|
194
194
|
const nv = oc.nivel ?? 'info';
|
|
195
|
-
if (nv === 'erro'
|
|
195
|
+
if (nv === 'erro') {
|
|
196
196
|
arquivoContagem.set(key, (arquivoContagem.get(key) ?? 0) + 1);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
@@ -311,7 +311,7 @@ function emitArchetypeDisplay(arquetiposResultado, opts) {
|
|
|
311
311
|
const candidatosCount = arquetiposResultado.candidatos.length || 0;
|
|
312
312
|
log.info(`DEBUG: arquetiposResultado=${!!arquetiposResultado}, candidatos=${candidatosCount}`);
|
|
313
313
|
}
|
|
314
|
-
if (!opts.json &&
|
|
314
|
+
if (!opts.json && (arquetiposResultado.baseline || arquetiposResultado.drift)) {
|
|
315
315
|
const linhas = [];
|
|
316
316
|
if (arquetiposResultado.baseline) {
|
|
317
317
|
const b = arquetiposResultado.baseline;
|
|
@@ -389,7 +389,7 @@ async function emitReportsAndExport(resultadoExecucao, fileEntriesComAst, baseDi
|
|
|
389
389
|
const analistasAgregados = {};
|
|
390
390
|
for (const a of metricasOriginais?.analistas ?? []) {
|
|
391
391
|
const nome = a.nome || 'desconhecido';
|
|
392
|
-
if (!analistasAgregados
|
|
392
|
+
if (!(nome in analistasAgregados)) {
|
|
393
393
|
analistasAgregados[nome] = { duracaoMs: 0, ocorrencias: 0, execucoes: 0 };
|
|
394
394
|
}
|
|
395
395
|
analistasAgregados[nome].duracaoMs += a.duracaoMs || 0;
|
|
@@ -615,7 +615,7 @@ function emitVerboseResultSummary(ocorrenciasFiltradas, tiposOcorrencias, nivelO
|
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
617
|
const SAMPLE_MAX = 50;
|
|
618
|
-
const sample = ocorrenciasFiltradas.slice(0, SAMPLE_MAX).map(oc => `${oc.relPath}:${oc.linha ?? ''} [${oc.nivel
|
|
618
|
+
const sample = ocorrenciasFiltradas.slice(0, SAMPLE_MAX).map(oc => `${oc.relPath}:${oc.linha ?? ''} [${oc.nivel}] ${oc.mensagem.replace(/\n/g, ' ')}`);
|
|
619
619
|
if (sample.length) {
|
|
620
620
|
const logExt = log;
|
|
621
621
|
if (typeof logExt.imprimirBloco === 'function') {
|
|
@@ -663,7 +663,7 @@ export async function processarDiagnostico(opts) {
|
|
|
663
663
|
const subOpts = { ...opts, paths: undefined };
|
|
664
664
|
const subResult = await processarDiagnosticoInterno(subOpts);
|
|
665
665
|
if (subResult) {
|
|
666
|
-
const ocorr = subResult.resultadoFinal.ocorrencias
|
|
666
|
+
const ocorr = subResult.resultadoFinal.ocorrencias;
|
|
667
667
|
const tagged = ocorr.map(o => ({
|
|
668
668
|
...o,
|
|
669
669
|
projeto: projetoNome,
|
|
@@ -798,10 +798,10 @@ async function processarDiagnosticoInterno(opts) {
|
|
|
798
798
|
}
|
|
799
799
|
let nomeProjeto = path.basename(baseDir);
|
|
800
800
|
try {
|
|
801
|
-
const pkg = fileEntries
|
|
801
|
+
const pkg = fileEntries?.find(fe => /(^|[\\/])package\.json$/.test(fe.relPath || fe.fullCaminho));
|
|
802
802
|
if (pkg && typeof pkg.content === 'string' && pkg.content.trim()) {
|
|
803
803
|
const parsed = JSON.parse(pkg.content);
|
|
804
|
-
if (
|
|
804
|
+
if (typeof parsed.name === 'string' && parsed.name.trim()) {
|
|
805
805
|
nomeProjeto = parsed.name.trim();
|
|
806
806
|
}
|
|
807
807
|
}
|
|
@@ -810,7 +810,7 @@ async function processarDiagnosticoInterno(opts) {
|
|
|
810
810
|
try {
|
|
811
811
|
const raw = await fs.promises.readFile(pkgCaminho, 'utf-8');
|
|
812
812
|
const parsed = JSON.parse(raw);
|
|
813
|
-
if (
|
|
813
|
+
if (typeof parsed.name === 'string' && parsed.name.trim()) {
|
|
814
814
|
nomeProjeto = parsed.name.trim();
|
|
815
815
|
}
|
|
816
816
|
}
|
|
@@ -982,7 +982,7 @@ async function processarDiagnosticoInterno(opts) {
|
|
|
982
982
|
fast: opts.fast,
|
|
983
983
|
});
|
|
984
984
|
registrarUltimasMetricas(resultadoExecucao.metricas);
|
|
985
|
-
let ocorrenciasFiltradas = dedupeOcorrencias(resultadoExecucao.ocorrencias
|
|
985
|
+
let ocorrenciasFiltradas = dedupeOcorrencias(resultadoExecucao.ocorrencias);
|
|
986
986
|
const trustCompiler = Boolean(optsDyn.trustCompiler ?? configDyn.SPECIAL_TRUST_COMPILER);
|
|
987
987
|
if (trustCompiler) {
|
|
988
988
|
try {
|
|
@@ -1064,7 +1064,7 @@ async function processarDiagnosticoInterno(opts) {
|
|
|
1064
1064
|
}
|
|
1065
1065
|
if (config.VERBOSE || config.DEV_MODE) {
|
|
1066
1066
|
if (config.DEV_MODE && !opts.json && resultadoExecucao.metricas) {
|
|
1067
|
-
const analistasComOcorrencias = resultadoExecucao.metricas.analistas?.filter(a =>
|
|
1067
|
+
const analistasComOcorrencias = resultadoExecucao.metricas.analistas?.filter(a => a.ocorrencias > 0);
|
|
1068
1068
|
if (analistasComOcorrencias?.length) {
|
|
1069
1069
|
logSistema.processamentoAnalistasProblemas(analistasComOcorrencias.length);
|
|
1070
1070
|
analistasComOcorrencias.forEach(a => {
|
|
@@ -1074,7 +1074,7 @@ async function processarDiagnosticoInterno(opts) {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
1076
1076
|
try {
|
|
1077
|
-
if (
|
|
1077
|
+
if (totalOcorrencias === 0) {
|
|
1078
1078
|
logRelatorio.repositorioImpecavel();
|
|
1079
1079
|
}
|
|
1080
1080
|
}
|
|
@@ -1086,11 +1086,11 @@ async function processarDiagnosticoInterno(opts) {
|
|
|
1086
1086
|
}
|
|
1087
1087
|
emitArchetypeDisplay(arquetiposResultado, opts);
|
|
1088
1088
|
if (opts.json) {
|
|
1089
|
-
await emitJsonSaida(resultadoExecucao.ocorrencias
|
|
1089
|
+
await emitJsonSaida(resultadoExecucao.ocorrencias, guardianResultado, fileEntriesComAst, opts, arquetiposResultado);
|
|
1090
1090
|
_jsonEmitted = true;
|
|
1091
1091
|
if (!process.env.VITEST) {
|
|
1092
1092
|
const erros = (nivelOcorrencias.get('erro') ?? 0);
|
|
1093
|
-
const { parseErros } = buildJsonSaida(resultadoExecucao.ocorrencias
|
|
1093
|
+
const { parseErros } = buildJsonSaida(resultadoExecucao.ocorrencias, guardianResultado, fileEntriesComAst, opts, arquetiposResultado);
|
|
1094
1094
|
const exitCode = parseErros.totalOriginais > 0 && config.PARSE_ERRO_FALHA
|
|
1095
1095
|
? 2
|
|
1096
1096
|
: erros > 0
|
|
@@ -1099,27 +1099,23 @@ async function processarDiagnosticoInterno(opts) {
|
|
|
1099
1099
|
process.exit(exitCode);
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
|
-
if (
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
log.info(messages.CliProcessamentoDiagnosticoMensagens.diagnosticoConcluido);
|
|
1112
|
-
}
|
|
1102
|
+
if (totalOcorrencias > 0) {
|
|
1103
|
+
emitTypeSummary(ocorrenciasFiltradas, nivelOcorrencias, opts);
|
|
1104
|
+
}
|
|
1105
|
+
if (!config.COMPACT_MODE && !process.env.__SUKUNA_TUDO_PRONTO_EMITIDO) {
|
|
1106
|
+
log.info(messages.CliProcessamentoDiagnosticoMensagens.tudoPronto);
|
|
1107
|
+
process.env['__SUKUNA_TUDO_PRONTO_EMITIDO'] = '1';
|
|
1108
|
+
}
|
|
1109
|
+
if (process.env.VITEST) {
|
|
1110
|
+
log.info(messages.CliProcessamentoDiagnosticoMensagens.diagnosticoConcluido);
|
|
1113
1111
|
}
|
|
1114
1112
|
await emitReportsAndExport(resultadoExecucao, fileEntriesComAst, baseDir, guardianResultado, totalOcorrencias, opts);
|
|
1115
|
-
if (
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
process.env['__SUKUNA_TUDO_PRONTO_EMITIDO'] = '1';
|
|
1122
|
-
}
|
|
1113
|
+
if (totalOcorrencias > 0) {
|
|
1114
|
+
emitTypeSummary(ocorrenciasFiltradas, nivelOcorrencias, opts);
|
|
1115
|
+
}
|
|
1116
|
+
if (!config.COMPACT_MODE && !process.env.__SUKUNA_TUDO_PRONTO_EMITIDO) {
|
|
1117
|
+
log.info(messages.CliProcessamentoDiagnosticoMensagens.tudoPronto);
|
|
1118
|
+
process.env['__SUKUNA_TUDO_PRONTO_EMITIDO'] = '1';
|
|
1123
1119
|
}
|
|
1124
1120
|
}
|
|
1125
1121
|
catch (error) {
|
|
@@ -1152,7 +1148,7 @@ async function processarDiagnosticoInterno(opts) {
|
|
|
1152
1148
|
};
|
|
1153
1149
|
}
|
|
1154
1150
|
try {
|
|
1155
|
-
if (
|
|
1151
|
+
if (totalOcorrencias === 0) {
|
|
1156
1152
|
logRelatorio.repositorioImpecavel();
|
|
1157
1153
|
}
|
|
1158
1154
|
}
|
|
@@ -76,7 +76,7 @@ export async function exportarPorNivel(ocorrenciasLimpas, dir, id, salvar) {
|
|
|
76
76
|
export function computeLinguagens(fes) {
|
|
77
77
|
const extensoes = {};
|
|
78
78
|
let sem_ext = 0;
|
|
79
|
-
for (const arquivo of fes
|
|
79
|
+
for (const arquivo of fes) {
|
|
80
80
|
const rel = arquivo.relPath || arquivo.fullCaminho || '';
|
|
81
81
|
const base = rel.split(/[\\/]/).pop() ?? '';
|
|
82
82
|
const idx = base.lastIndexOf('.');
|
|
@@ -88,7 +88,7 @@ export function computeLinguagens(fes) {
|
|
|
88
88
|
extensoes[ext] = (extensoes[ext] || 0) + 1;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
return { total:
|
|
91
|
+
return { total: fes.length, extensoes: { ...extensoes, sem_ext } };
|
|
92
92
|
}
|
|
93
93
|
export function limparOcorrencia(oc) {
|
|
94
94
|
return {
|
|
@@ -192,15 +192,12 @@ function agruparPorArquivo(casos) {
|
|
|
192
192
|
*/
|
|
193
193
|
function agruparPorCategoria(casos) {
|
|
194
194
|
return casos.reduce((acc, caso) => {
|
|
195
|
-
if (!acc[caso.categoria]) {
|
|
196
|
-
acc[caso.categoria] = [];
|
|
197
|
-
}
|
|
198
195
|
acc[caso.categoria].push({
|
|
199
196
|
arquivo: caso.arquivo,
|
|
200
197
|
linha: caso.linha
|
|
201
198
|
});
|
|
202
199
|
return acc;
|
|
203
|
-
}, {});
|
|
200
|
+
}, { legitimo: [], melhoravel: [], corrigir: [] });
|
|
204
201
|
}
|
|
205
202
|
/**
|
|
206
203
|
* Exporta relatórios de fix-types (Markdown e JSON)
|
|
@@ -80,8 +80,8 @@ export function exibirMolduraConflitos(conflitos, limite = 10) {
|
|
|
80
80
|
const linhas = [messages.CliExibirMolduraMensagens.conflitosCabecalhoLinha1, messages.CliExibirMolduraMensagens.conflitosCabecalhoLinha2];
|
|
81
81
|
const primeiros = conflitos.slice(0, limite);
|
|
82
82
|
for (const elem of primeiros) {
|
|
83
|
-
const alvo = normalizePath(
|
|
84
|
-
const motivo =
|
|
83
|
+
const alvo = normalizePath(elem.alvo ?? JSON.stringify(elem)).slice(0, 31).padEnd(31, ' ');
|
|
84
|
+
const motivo = (elem.motivo ?? '-').slice(0, 30);
|
|
85
85
|
linhas.push(`${alvo} ${motivo}`);
|
|
86
86
|
}
|
|
87
87
|
if (conflitos.length > limite) {
|
|
@@ -89,9 +89,9 @@ export function exibirMolduraConflitos(conflitos, limite = 10) {
|
|
|
89
89
|
}
|
|
90
90
|
exibirMolduraSegura(messages.CliExibirMolduraMensagens.conflitosTitulo, linhas, () => {
|
|
91
91
|
primeiros.forEach(elem => {
|
|
92
|
-
const alvoStr =
|
|
93
|
-
const motivoStr =
|
|
94
|
-
log.aviso(messages.CliExibirMolduraMensagens.conflitosFallbackLinha(
|
|
92
|
+
const alvoStr = elem.alvo ?? 'alvo desconhecido';
|
|
93
|
+
const motivoStr = elem.motivo ?? '-';
|
|
94
|
+
log.aviso(messages.CliExibirMolduraMensagens.conflitosFallbackLinha(alvoStr, motivoStr));
|
|
95
95
|
});
|
|
96
96
|
if (conflitos.length > limite) {
|
|
97
97
|
log.aviso(messages.CliExibirMolduraMensagens.conflitosFallbackOverflow(conflitos.length - limite));
|
|
@@ -35,9 +35,6 @@ export const AGRESSIVA_AUTO_CORRECAO_CONFIGURACAO = {
|
|
|
35
35
|
// Backwards compat constant name used elsewhere in the codebase
|
|
36
36
|
export const AUTO_CORRECAO_CONFIGURACAO_PADROES = PADRAO_AUTO_CORRECAO_CONFIGURACAO;
|
|
37
37
|
export function shouldExcludeFile(fileCaminho, config) {
|
|
38
|
-
if (!config.excludePadroes) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
38
|
return config.excludePadroes.some(pattern => {
|
|
42
39
|
const regexPadrao = pattern.replace(/\*\*/g, '.*').replace(/\*/g, '[^/]*').replace(/\?/g, '.');
|
|
43
40
|
return new RegExp(regexPadrao).test(fileCaminho);
|
|
@@ -50,9 +47,6 @@ export function shouldExcludeFunction(functionName, config) {
|
|
|
50
47
|
return config.excludeFunctionPatterns.some(pattern => new RegExp(pattern, 'i').test(functionName));
|
|
51
48
|
}
|
|
52
49
|
export function isCategoryAllowed(category, config) {
|
|
53
|
-
if (!config.allowedCategories) {
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
50
|
// allowedCategories is an array of known category strings - coerce to string[] for safe includes check
|
|
57
51
|
return (config.allowedCategories).includes(category);
|
|
58
52
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// - Fornecer API estável com funções obrigatórias (não opcionais) para evitar 'possibly undefined'.
|
|
5
5
|
// - Suportar encadeamento básico usado no projeto (ex.: chalk.cyan.bold(...)).
|
|
6
6
|
// - Em ambientes sem chalk, aplicar fallback de identidade (retorna a string sem cor/estilo).
|
|
7
|
-
import chalkDefault
|
|
7
|
+
import chalkDefault from 'chalk';
|
|
8
8
|
const ID = (string) => string;
|
|
9
9
|
function getSourceFns(x) {
|
|
10
10
|
if (!x) {
|
|
@@ -12,7 +12,7 @@ function getSourceFns(x) {
|
|
|
12
12
|
}
|
|
13
13
|
const src = x;
|
|
14
14
|
const pick = (chave) => {
|
|
15
|
-
const valor = src[chave];
|
|
15
|
+
const valor = (src)[chave];
|
|
16
16
|
return typeof valor === 'function' ? valor : undefined;
|
|
17
17
|
};
|
|
18
18
|
return {
|
|
@@ -38,7 +38,7 @@ function makeChalkLike(src) {
|
|
|
38
38
|
dim: src.dim ?? ID
|
|
39
39
|
};
|
|
40
40
|
const attachBoldChain = (colorFn) => {
|
|
41
|
-
const fn = (
|
|
41
|
+
const fn = (string) => colorFn(string);
|
|
42
42
|
// suporte a encadeamento como chalk.cyan.bold(...)
|
|
43
43
|
fn.bold = ((string) => colorFn(base.bold(string)));
|
|
44
44
|
return fn;
|
|
@@ -49,9 +49,9 @@ function makeChalkLike(src) {
|
|
|
49
49
|
const yellow = attachBoldChain(base.yellow);
|
|
50
50
|
const magenta = attachBoldChain(base.magenta);
|
|
51
51
|
const gray = attachBoldChain(base.gray);
|
|
52
|
-
const dim = (
|
|
52
|
+
const dim = (string) => base.dim(string); // dim sem encadeamento usado
|
|
53
53
|
// bold em si (sem necessidade de cor encadeada no projeto)
|
|
54
|
-
const bold = (
|
|
54
|
+
const bold = (string) => base.bold(string);
|
|
55
55
|
// Opcional: permitir bold.cyan(...), caso apareça futuramente
|
|
56
56
|
bold.cyan = ((string) => base.cyan(base.bold(string)));
|
|
57
57
|
bold.green = ((string) => base.green(base.bold(string)));
|
|
@@ -72,7 +72,7 @@ function makeChalkLike(src) {
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
// Preferimos a instância default; se não existir, usamos o namespace (CJS)
|
|
75
|
-
const resolvedUnknown = chalkDefault
|
|
75
|
+
const resolvedUnknown = chalkDefault;
|
|
76
76
|
/**
|
|
77
77
|
* Instância segura de chalk com API estável e suporte a encadeamento.
|
|
78
78
|
* Em ambientes sem chalk nativo, fornece fallback de identidade (sem cores).
|
|
@@ -64,7 +64,7 @@ export const configPadrao = {
|
|
|
64
64
|
'.deprecados/**', '**/deprecados/**', '.pensando/**', '**/pensando/**',
|
|
65
65
|
'**/.mahoraga/**', 'mahoraga/**',
|
|
66
66
|
'**/*.log', '**/*.lock', 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml',
|
|
67
|
-
'**/.git/**',
|
|
67
|
+
'**/.git/**', 'next/**',
|
|
68
68
|
]
|
|
69
69
|
},
|
|
70
70
|
// ─── Scanner & Extensões ──────────────────────────────────────
|
|
@@ -193,7 +193,7 @@ function ehObjetoPlano(valor) {
|
|
|
193
193
|
return !!valor && typeof valor === 'object' && !Array.isArray(valor);
|
|
194
194
|
}
|
|
195
195
|
function mesclarProfundo(target, src, fonte, diffs, prefix = '') {
|
|
196
|
-
for (const chave of Object.keys(src
|
|
196
|
+
for (const chave of Object.keys(src)) {
|
|
197
197
|
if (chave === '__proto__' || chave === 'constructor' || chave === 'prototype') {
|
|
198
198
|
continue;
|
|
199
199
|
}
|
|
@@ -236,9 +236,9 @@ function converterConfigSimplificada(config) {
|
|
|
236
236
|
javascript: { parser: 'babel', plugin: 'core' },
|
|
237
237
|
typescript: { parser: 'babel', plugin: 'core' },
|
|
238
238
|
html: { parser: 'htmlparser2', plugin: 'core' },
|
|
239
|
-
css: { parser: '
|
|
240
|
-
scss: { parser: '
|
|
241
|
-
sass: { parser: '
|
|
239
|
+
css: { parser: 'postcss', plugin: 'core' },
|
|
240
|
+
scss: { parser: 'postcss', plugin: 'core' },
|
|
241
|
+
sass: { parser: 'postcss', plugin: 'core' },
|
|
242
242
|
xml: { parser: 'fast-xml-parser', plugin: 'core' },
|
|
243
243
|
php: { parser: 'heuristic', plugin: 'core' },
|
|
244
244
|
python: { parser: 'heuristic', plugin: 'core' },
|
|
@@ -254,12 +254,10 @@ function converterConfigSimplificada(config) {
|
|
|
254
254
|
};
|
|
255
255
|
for (const [lang, enabled] of Object.entries(langs)) {
|
|
256
256
|
const defaults = langPadroes[lang];
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
};
|
|
262
|
-
}
|
|
257
|
+
resultado.languageSupport[lang] = {
|
|
258
|
+
enabled,
|
|
259
|
+
...defaults
|
|
260
|
+
};
|
|
263
261
|
}
|
|
264
262
|
const enabledPlugins = ['core'];
|
|
265
263
|
resultado.plugins = {
|
|
@@ -288,9 +286,9 @@ function converterConfigSimplificada(config) {
|
|
|
288
286
|
return resultado;
|
|
289
287
|
}
|
|
290
288
|
function sincronizarIgnorados() {
|
|
291
|
-
const dyn =
|
|
289
|
+
const dyn = config.INCLUDE_EXCLUDE_RULES;
|
|
292
290
|
const glob = Array.isArray(dyn.globalExcludeGlob) ? dyn.globalExcludeGlob : [];
|
|
293
|
-
Array.from(new Set(glob
|
|
291
|
+
Array.from(new Set(glob));
|
|
294
292
|
const cfg = config;
|
|
295
293
|
delete cfg.ZELADOR_IGNORE_PATTERNS;
|
|
296
294
|
delete cfg.GUARDIAN_IGNORE_PATTERNS;
|
|
@@ -10,8 +10,8 @@ export function sanitizarRelPath(rel) {
|
|
|
10
10
|
if (!rel) {
|
|
11
11
|
return '';
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
const norm =
|
|
13
|
+
const safe = rel.replace(/^[A-Za-z]:\\?/u, '').replace(/^\/+/, '');
|
|
14
|
+
const norm = safe.replace(/\\+/g, '/');
|
|
15
15
|
const collapsed = path.posix.normalize(norm);
|
|
16
16
|
if (collapsed.startsWith('..')) {
|
|
17
17
|
// remove todos os prefixos de ../ e ./ e barras iniciais resultantes
|