@repometry/cli 0.0.0-dev.0 → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +70 -3
- package/package.json +65 -2
- package/target/main/resources/language-catalog.json +61 -0
- package/target/main/resources/report/json/compact-json-v1.schema.json +24 -0
- package/target/main/resources/report/json/comparison-v1.schema.json +65 -0
- package/target/main/resources/report/json/config-v2.schema.json +224 -0
- package/target/main/resources/report/json/diff-coverage-v1.schema.json +55 -0
- package/target/main/resources/report/json/file-metrics-v1.schema.json +157 -0
- package/target/main/resources/report/json/metabranch-v1.schema.json +9 -0
- package/target/main/resources/report/json/metric-catalog-v1.schema.json +31 -0
- package/target/main/resources/report/json/pull-review-v1.schema.json +97 -0
- package/target/main/resources/report/json/pull-review-v2.schema.json +100 -0
- package/target/main/resources/report/json/report-v2.schema.json +530 -0
- package/target/main/resources/report/json/repository-summary-v1.schema.json +337 -0
- package/target/main/resources/report/json/viewer-inspection-v1.schema.json +534 -0
- package/target/main/resources/viewer/files.css +616 -0
- package/target/main/resources/viewer/index.html +120 -0
- package/target/main/resources/viewer/projects.html +52 -0
- package/target/main/resources/viewer/styles.css +579 -0
- package/target/main/resources/viewer/viewer-pulls.css +64 -0
- package/target/main/ts/api/cache/root.d.ts +2 -0
- package/target/main/ts/api/cache/root.js +21 -0
- package/target/main/ts/api/gh/github.d.ts +4 -0
- package/target/main/ts/api/gh/github.js +47 -0
- package/target/main/ts/api/git/blob-batch.d.ts +10 -0
- package/target/main/ts/api/git/blob-batch.js +107 -0
- package/target/main/ts/api/git/blob-history.d.ts +20 -0
- package/target/main/ts/api/git/blob-history.js +54 -0
- package/target/main/ts/api/git/changes.d.ts +27 -0
- package/target/main/ts/api/git/changes.js +117 -0
- package/target/main/ts/api/git/commit-metadata.d.ts +2 -0
- package/target/main/ts/api/git/commit-metadata.js +46 -0
- package/target/main/ts/api/git/git-churn.d.ts +9 -0
- package/target/main/ts/api/git/git-churn.js +72 -0
- package/target/main/ts/api/git/git-executable.d.ts +1 -0
- package/target/main/ts/api/git/git-executable.js +31 -0
- package/target/main/ts/api/git/git-reader.d.ts +24 -0
- package/target/main/ts/api/git/git-reader.js +113 -0
- package/target/main/ts/api/git/git.d.ts +47 -0
- package/target/main/ts/api/git/git.js +289 -0
- package/target/main/ts/api/git/inspection-source.d.ts +17 -0
- package/target/main/ts/api/git/inspection-source.js +36 -0
- package/target/main/ts/api/git/line-changes.d.ts +6 -0
- package/target/main/ts/api/git/line-changes.js +57 -0
- package/target/main/ts/api/git/local-sources.d.ts +5 -0
- package/target/main/ts/api/git/local-sources.js +48 -0
- package/target/main/ts/api/git/local.d.ts +7 -0
- package/target/main/ts/api/git/local.js +106 -0
- package/target/main/ts/api/git/source-cache.d.ts +1 -0
- package/target/main/ts/api/git/source-cache.js +42 -0
- package/target/main/ts/api/import/cobertura.d.ts +2 -0
- package/target/main/ts/api/import/cobertura.js +160 -0
- package/target/main/ts/api/import/coverage-xml.d.ts +7 -0
- package/target/main/ts/api/import/coverage-xml.js +135 -0
- package/target/main/ts/api/import/finding-import.d.ts +9 -0
- package/target/main/ts/api/import/finding-import.js +227 -0
- package/target/main/ts/api/import/go-cover.d.ts +13 -0
- package/target/main/ts/api/import/go-cover.js +150 -0
- package/target/main/ts/api/import/lcov-files.d.ts +12 -0
- package/target/main/ts/api/import/lcov-files.js +53 -0
- package/target/main/ts/api/import/profile-file.d.ts +4 -0
- package/target/main/ts/api/import/profile-file.js +17 -0
- package/target/main/ts/api/process/docker-tool-runner.d.ts +13 -0
- package/target/main/ts/api/process/docker-tool-runner.js +92 -0
- package/target/main/ts/api/process/failure.d.ts +1 -0
- package/target/main/ts/api/process/failure.js +12 -0
- package/target/main/ts/api/process/plugin.d.ts +13 -0
- package/target/main/ts/api/process/plugin.js +100 -0
- package/target/main/ts/api/process/tool-snapshot.d.ts +3 -0
- package/target/main/ts/api/process/tool-snapshot.js +26 -0
- package/target/main/ts/cli/arguments.d.ts +28 -0
- package/target/main/ts/cli/arguments.js +109 -0
- package/target/main/ts/cli/config.d.ts +63 -0
- package/target/main/ts/cli/config.js +165 -0
- package/target/main/ts/cli/imports.d.ts +9 -0
- package/target/main/ts/cli/imports.js +37 -0
- package/target/main/ts/cli/main.d.ts +2 -0
- package/target/main/ts/cli/main.js +4 -0
- package/target/main/ts/cli/range-inspection.d.ts +38 -0
- package/target/main/ts/cli/range-inspection.js +34 -0
- package/target/main/ts/cli/range-jobs.d.ts +23 -0
- package/target/main/ts/cli/range-jobs.js +152 -0
- package/target/main/ts/cli/range-worker.d.ts +1 -0
- package/target/main/ts/cli/range-worker.js +40 -0
- package/target/main/ts/cli/reporting.d.ts +42 -0
- package/target/main/ts/cli/reporting.js +98 -0
- package/target/main/ts/cli/revisions.d.ts +6 -0
- package/target/main/ts/cli/revisions.js +16 -0
- package/target/main/ts/cli/run.d.ts +2 -0
- package/target/main/ts/cli/run.js +306 -0
- package/target/main/ts/cli/store.d.ts +13 -0
- package/target/main/ts/cli/store.js +39 -0
- package/target/main/ts/compose/analysis-report.d.ts +6 -0
- package/target/main/ts/compose/analysis-report.js +131 -0
- package/target/main/ts/compose/analysis-results.d.ts +42 -0
- package/target/main/ts/compose/analysis-results.js +84 -0
- package/target/main/ts/compose/analysis-steps.d.ts +23 -0
- package/target/main/ts/compose/analysis-steps.js +217 -0
- package/target/main/ts/compose/analyze-snapshot.d.ts +7 -0
- package/target/main/ts/compose/analyze-snapshot.js +21 -0
- package/target/main/ts/compose/attach-churn.d.ts +2 -0
- package/target/main/ts/compose/attach-churn.js +50 -0
- package/target/main/ts/compose/built-ins.d.ts +6 -0
- package/target/main/ts/compose/built-ins.js +12 -0
- package/target/main/ts/compose/diff-coverage.d.ts +25 -0
- package/target/main/ts/compose/diff-coverage.js +82 -0
- package/target/main/ts/compose/distribution.d.ts +17 -0
- package/target/main/ts/compose/distribution.js +13 -0
- package/target/main/ts/compose/docker-image.d.ts +5 -0
- package/target/main/ts/compose/docker-image.js +49 -0
- package/target/main/ts/compose/file-selection.d.ts +9 -0
- package/target/main/ts/compose/file-selection.js +38 -0
- package/target/main/ts/compose/history-cache.d.ts +31 -0
- package/target/main/ts/compose/history-cache.js +62 -0
- package/target/main/ts/compose/inspect.d.ts +34 -0
- package/target/main/ts/compose/inspect.js +51 -0
- package/target/main/ts/compose/inspection-coverage.d.ts +9 -0
- package/target/main/ts/compose/inspection-coverage.js +9 -0
- package/target/main/ts/compose/js-plugin.d.ts +113 -0
- package/target/main/ts/compose/js-plugin.js +99 -0
- package/target/main/ts/compose/language-discovery.d.ts +12 -0
- package/target/main/ts/compose/language-discovery.js +51 -0
- package/target/main/ts/compose/languages.d.ts +64 -0
- package/target/main/ts/compose/languages.js +98 -0
- package/target/main/ts/compose/load-plugins.d.ts +6 -0
- package/target/main/ts/compose/load-plugins.js +71 -0
- package/target/main/ts/compose/parser-order.d.ts +20 -0
- package/target/main/ts/compose/parser-order.js +90 -0
- package/target/main/ts/compose/phases.d.ts +140 -0
- package/target/main/ts/compose/phases.js +147 -0
- package/target/main/ts/compose/plugin-list.d.ts +37 -0
- package/target/main/ts/compose/plugin-list.js +30 -0
- package/target/main/ts/compose/plugin-manifest.d.ts +14 -0
- package/target/main/ts/compose/plugin-manifest.js +50 -0
- package/target/main/ts/compose/plugin-options.d.ts +2 -0
- package/target/main/ts/compose/plugin-options.js +29 -0
- package/target/main/ts/compose/plugin-reference.d.ts +9 -0
- package/target/main/ts/compose/plugin-reference.js +40 -0
- package/target/main/ts/compose/plugin-requirements.d.ts +5 -0
- package/target/main/ts/compose/plugin-requirements.js +83 -0
- package/target/main/ts/compose/plugin-scope.d.ts +9 -0
- package/target/main/ts/compose/plugin-scope.js +60 -0
- package/target/main/ts/compose/process-plugins.d.ts +89 -0
- package/target/main/ts/compose/process-plugins.js +74 -0
- package/target/main/ts/compose/registered-plugin.d.ts +17 -0
- package/target/main/ts/compose/registered-plugin.js +8 -0
- package/target/main/ts/compose/review.d.ts +26 -0
- package/target/main/ts/compose/review.js +54 -0
- package/target/main/ts/compose/schema-error.d.ts +2 -0
- package/target/main/ts/compose/schema-error.js +16 -0
- package/target/main/ts/compose/sources.d.ts +2 -0
- package/target/main/ts/compose/sources.js +32 -0
- package/target/main/ts/compose/structure-measures.d.ts +9 -0
- package/target/main/ts/compose/structure-measures.js +63 -0
- package/target/main/ts/index.d.ts +8 -0
- package/target/main/ts/index.js +5 -0
- package/target/main/ts/plugin.d.ts +2 -0
- package/target/main/ts/plugin.js +2 -0
- package/target/main/ts/plugins/built-in.d.ts +3 -0
- package/target/main/ts/plugins/built-in.js +19 -0
- package/target/main/ts/plugins/coverage/coverage.d.ts +11 -0
- package/target/main/ts/plugins/coverage/coverage.js +289 -0
- package/target/main/ts/plugins/coverage/diff-coverage.d.ts +3 -0
- package/target/main/ts/plugins/coverage/diff-coverage.js +85 -0
- package/target/main/ts/plugins/duplication/duplication.d.ts +2 -0
- package/target/main/ts/plugins/duplication/duplication.js +95 -0
- package/target/main/ts/plugins/language-js/babel-provider.d.ts +10 -0
- package/target/main/ts/plugins/language-js/babel-provider.js +54 -0
- package/target/main/ts/plugins/language-js/clone-candidates.d.ts +3 -0
- package/target/main/ts/plugins/language-js/clone-candidates.js +65 -0
- package/target/main/ts/plugins/language-js/code-lines.d.ts +6 -0
- package/target/main/ts/plugins/language-js/code-lines.js +36 -0
- package/target/main/ts/plugins/language-js/extensions.d.ts +1 -0
- package/target/main/ts/plugins/language-js/extensions.js +3 -0
- package/target/main/ts/plugins/language-js/function-facts.d.ts +9 -0
- package/target/main/ts/plugins/language-js/function-facts.js +74 -0
- package/target/main/ts/plugins/language-js/js-security.d.ts +4 -0
- package/target/main/ts/plugins/language-js/js-security.js +497 -0
- package/target/main/ts/plugins/language-js/qualified-names.d.ts +11 -0
- package/target/main/ts/plugins/language-js/qualified-names.js +63 -0
- package/target/main/ts/plugins/language-js/structural-observations.d.ts +9 -0
- package/target/main/ts/plugins/language-js/structural-observations.js +85 -0
- package/target/main/ts/plugins/language-js/syntax.d.ts +2 -0
- package/target/main/ts/plugins/language-js/syntax.js +11 -0
- package/target/main/ts/plugins/maintainability/maintainability.d.ts +2 -0
- package/target/main/ts/plugins/maintainability/maintainability.js +38 -0
- package/target/main/ts/plugins/maintainability/structural-smells.d.ts +3 -0
- package/target/main/ts/plugins/maintainability/structural-smells.js +17 -0
- package/target/main/ts/plugins/security/actions-security.d.ts +2 -0
- package/target/main/ts/plugins/security/actions-security.js +581 -0
- package/target/main/ts/plugins/security/dockerfile.d.ts +2 -0
- package/target/main/ts/plugins/security/dockerfile.js +487 -0
- package/target/main/ts/plugins/security/npm-supply-chain.d.ts +4 -0
- package/target/main/ts/plugins/security/npm-supply-chain.js +368 -0
- package/target/main/ts/plugins/security/secrets.d.ts +12 -0
- package/target/main/ts/plugins/security/secrets.js +254 -0
- package/target/main/ts/plugins/source/forges.d.ts +4 -0
- package/target/main/ts/plugins/source/forges.js +80 -0
- package/target/main/ts/plugins/structure/structure.d.ts +2 -0
- package/target/main/ts/plugins/structure/structure.js +42 -0
- package/target/main/ts/report/html/app/viewer-chart-bars.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-chart-bars.js +59 -0
- package/target/main/ts/report/html/app/viewer-chart-label.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-chart-label.js +43 -0
- package/target/main/ts/report/html/app/viewer-chart-line.d.ts +33 -0
- package/target/main/ts/report/html/app/viewer-chart-line.js +88 -0
- package/target/main/ts/report/html/app/viewer-chart-points.d.ts +52 -0
- package/target/main/ts/report/html/app/viewer-chart-points.js +65 -0
- package/target/main/ts/report/html/app/viewer-chart-scale.d.ts +21 -0
- package/target/main/ts/report/html/app/viewer-chart-scale.js +93 -0
- package/target/main/ts/report/html/app/viewer-chart-svg.d.ts +28 -0
- package/target/main/ts/report/html/app/viewer-chart-svg.js +41 -0
- package/target/main/ts/report/html/app/viewer-chart-time.d.ts +26 -0
- package/target/main/ts/report/html/app/viewer-chart-time.js +150 -0
- package/target/main/ts/report/html/app/viewer-chart-tip.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-chart-tip.js +210 -0
- package/target/main/ts/report/html/app/viewer-chart-x.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-chart-x.js +50 -0
- package/target/main/ts/report/html/app/viewer-chart.d.ts +7 -0
- package/target/main/ts/report/html/app/viewer-chart.js +50 -0
- package/target/main/ts/report/html/app/viewer-code-map.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-code-map.js +176 -0
- package/target/main/ts/report/html/app/viewer-columns.d.ts +40 -0
- package/target/main/ts/report/html/app/viewer-columns.js +97 -0
- package/target/main/ts/report/html/app/viewer-commit-picker.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-commit-picker.js +229 -0
- package/target/main/ts/report/html/app/viewer-commits.d.ts +32 -0
- package/target/main/ts/report/html/app/viewer-commits.js +81 -0
- package/target/main/ts/report/html/app/viewer-controls.d.ts +43 -0
- package/target/main/ts/report/html/app/viewer-controls.js +141 -0
- package/target/main/ts/report/html/app/viewer-copy.d.ts +17 -0
- package/target/main/ts/report/html/app/viewer-copy.js +64 -0
- package/target/main/ts/report/html/app/viewer-data.d.ts +24 -0
- package/target/main/ts/report/html/app/viewer-data.js +78 -0
- package/target/main/ts/report/html/app/viewer-diagnostics.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-diagnostics.js +60 -0
- package/target/main/ts/report/html/app/viewer-dom.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-dom.js +99 -0
- package/target/main/ts/report/html/app/viewer-file-aside.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-file-aside.js +134 -0
- package/target/main/ts/report/html/app/viewer-file-figures.d.ts +17 -0
- package/target/main/ts/report/html/app/viewer-file-figures.js +65 -0
- package/target/main/ts/report/html/app/viewer-file-source.d.ts +7 -0
- package/target/main/ts/report/html/app/viewer-file-source.js +119 -0
- package/target/main/ts/report/html/app/viewer-files.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-files.js +40 -0
- package/target/main/ts/report/html/app/viewer-filter.d.ts +65 -0
- package/target/main/ts/report/html/app/viewer-filter.js +161 -0
- package/target/main/ts/report/html/app/viewer-hotspots.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-hotspots.js +133 -0
- package/target/main/ts/report/html/app/viewer-inspection.d.ts +69 -0
- package/target/main/ts/report/html/app/viewer-inspection.js +38 -0
- package/target/main/ts/report/html/app/viewer-issue-group.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-issue-group.js +174 -0
- package/target/main/ts/report/html/app/viewer-issues.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-issues.js +173 -0
- package/target/main/ts/report/html/app/viewer-language-bar.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-language-bar.js +76 -0
- package/target/main/ts/report/html/app/viewer-languages.d.ts +35 -0
- package/target/main/ts/report/html/app/viewer-languages.js +97 -0
- package/target/main/ts/report/html/app/viewer-layout.d.ts +14 -0
- package/target/main/ts/report/html/app/viewer-layout.js +134 -0
- package/target/main/ts/report/html/app/viewer-line-coverage.d.ts +47 -0
- package/target/main/ts/report/html/app/viewer-line-coverage.js +108 -0
- package/target/main/ts/report/html/app/viewer-locations.d.ts +16 -0
- package/target/main/ts/report/html/app/viewer-locations.js +31 -0
- package/target/main/ts/report/html/app/viewer-map-scale.d.ts +26 -0
- package/target/main/ts/report/html/app/viewer-map-scale.js +147 -0
- package/target/main/ts/report/html/app/viewer-map-shape.d.ts +42 -0
- package/target/main/ts/report/html/app/viewer-map-shape.js +102 -0
- package/target/main/ts/report/html/app/viewer-metric-format.d.ts +23 -0
- package/target/main/ts/report/html/app/viewer-metric-format.js +93 -0
- package/target/main/ts/report/html/app/viewer-metric-registry.d.ts +47 -0
- package/target/main/ts/report/html/app/viewer-metric-registry.js +138 -0
- package/target/main/ts/report/html/app/viewer-metrics-view.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-metrics-view.js +159 -0
- package/target/main/ts/report/html/app/viewer-metrics.d.ts +51 -0
- package/target/main/ts/report/html/app/viewer-metrics.js +195 -0
- package/target/main/ts/report/html/app/viewer-overview-cards.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-overview-cards.js +121 -0
- package/target/main/ts/report/html/app/viewer-overview-hotspots.d.ts +9 -0
- package/target/main/ts/report/html/app/viewer-overview-hotspots.js +173 -0
- package/target/main/ts/report/html/app/viewer-overview-lead.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-overview-lead.js +116 -0
- package/target/main/ts/report/html/app/viewer-profile-badges.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-profile-badges.js +119 -0
- package/target/main/ts/report/html/app/viewer-profile-table.d.ts +29 -0
- package/target/main/ts/report/html/app/viewer-profile-table.js +124 -0
- package/target/main/ts/report/html/app/viewer-profile.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-profile.js +180 -0
- package/target/main/ts/report/html/app/viewer-projects.d.ts +1 -0
- package/target/main/ts/report/html/app/viewer-projects.js +90 -0
- package/target/main/ts/report/html/app/viewer-pull-sections.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-pull-sections.js +118 -0
- package/target/main/ts/report/html/app/viewer-pull-trend.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-pull-trend.js +63 -0
- package/target/main/ts/report/html/app/viewer-pulls.d.ts +2 -0
- package/target/main/ts/report/html/app/viewer-pulls.js +92 -0
- package/target/main/ts/report/html/app/viewer-query-field.d.ts +19 -0
- package/target/main/ts/report/html/app/viewer-query-field.js +203 -0
- package/target/main/ts/report/html/app/viewer-route.d.ts +34 -0
- package/target/main/ts/report/html/app/viewer-route.js +55 -0
- package/target/main/ts/report/html/app/viewer-shell.d.ts +20 -0
- package/target/main/ts/report/html/app/viewer-shell.js +113 -0
- package/target/main/ts/report/html/app/viewer-source-view.d.ts +49 -0
- package/target/main/ts/report/html/app/viewer-source-view.js +150 -0
- package/target/main/ts/report/html/app/viewer-source.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-source.js +57 -0
- package/target/main/ts/report/html/app/viewer-suggest.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-suggest.js +91 -0
- package/target/main/ts/report/html/app/viewer-sunburst.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-sunburst.js +40 -0
- package/target/main/ts/report/html/app/viewer-table-cells.d.ts +25 -0
- package/target/main/ts/report/html/app/viewer-table-cells.js +135 -0
- package/target/main/ts/report/html/app/viewer-table-rows.d.ts +56 -0
- package/target/main/ts/report/html/app/viewer-table-rows.js +97 -0
- package/target/main/ts/report/html/app/viewer-tokenizer.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-tokenizer.js +241 -0
- package/target/main/ts/report/html/app/viewer-totals.d.ts +20 -0
- package/target/main/ts/report/html/app/viewer-totals.js +100 -0
- package/target/main/ts/report/html/app/viewer-treemap.d.ts +24 -0
- package/target/main/ts/report/html/app/viewer-treemap.js +112 -0
- package/target/main/ts/report/html/app/viewer-trend-data.d.ts +54 -0
- package/target/main/ts/report/html/app/viewer-trend-data.js +109 -0
- package/target/main/ts/report/html/app/viewer-trend-nav.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-trend-nav.js +86 -0
- package/target/main/ts/report/html/app/viewer-trend-points.d.ts +30 -0
- package/target/main/ts/report/html/app/viewer-trend-points.js +128 -0
- package/target/main/ts/report/html/app/viewer-trend-series.d.ts +32 -0
- package/target/main/ts/report/html/app/viewer-trend-series.js +128 -0
- package/target/main/ts/report/html/app/viewer-trends.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-trends.js +89 -0
- package/target/main/ts/report/html/app/viewer.d.ts +1 -0
- package/target/main/ts/report/html/app/viewer.js +222 -0
- package/target/main/ts/report/html/site/badges.d.ts +11 -0
- package/target/main/ts/report/html/site/badges.js +72 -0
- package/target/main/ts/report/html/site/export-site.d.ts +16 -0
- package/target/main/ts/report/html/site/export-site.js +129 -0
- package/target/main/ts/report/html/site/exported-server.d.ts +6 -0
- package/target/main/ts/report/html/site/exported-server.js +72 -0
- package/target/main/ts/report/html/site/local-server.d.ts +7 -0
- package/target/main/ts/report/html/site/local-server.js +59 -0
- package/target/main/ts/report/html/site/projects.d.ts +1 -0
- package/target/main/ts/report/html/site/projects.js +69 -0
- package/target/main/ts/report/html/site/server.d.ts +4 -0
- package/target/main/ts/report/html/site/server.js +65 -0
- package/target/main/ts/report/html/site/source-route.d.ts +6 -0
- package/target/main/ts/report/html/site/source-route.js +23 -0
- package/target/main/ts/report/json/projections/commit-summary.d.ts +13 -0
- package/target/main/ts/report/json/projections/commit-summary.js +125 -0
- package/target/main/ts/report/json/projections/components.d.ts +4 -0
- package/target/main/ts/report/json/projections/components.js +30 -0
- package/target/main/ts/report/json/projections/file-metrics.d.ts +4 -0
- package/target/main/ts/report/json/projections/file-metrics.js +260 -0
- package/target/main/ts/report/json/projections/ignore-view.d.ts +2 -0
- package/target/main/ts/report/json/projections/ignore-view.js +13 -0
- package/target/main/ts/report/json/projections/inspection-context.d.ts +5 -0
- package/target/main/ts/report/json/projections/inspection-context.js +104 -0
- package/target/main/ts/report/json/projections/inspection-details.d.ts +14 -0
- package/target/main/ts/report/json/projections/inspection-details.js +98 -0
- package/target/main/ts/report/json/projections/metric-values.d.ts +14 -0
- package/target/main/ts/report/json/projections/metric-values.js +104 -0
- package/target/main/ts/report/json/projections/profile-selectors.d.ts +8 -0
- package/target/main/ts/report/json/projections/profile-selectors.js +34 -0
- package/target/main/ts/report/json/projections/security-summary.d.ts +11 -0
- package/target/main/ts/report/json/projections/security-summary.js +22 -0
- package/target/main/ts/report/json/store/directory.d.ts +3 -0
- package/target/main/ts/report/json/store/directory.js +19 -0
- package/target/main/ts/report/json/store/local-store.d.ts +25 -0
- package/target/main/ts/report/json/store/local-store.js +214 -0
- package/target/main/ts/report/json/store/object-store.d.ts +14 -0
- package/target/main/ts/report/json/store/object-store.js +73 -0
- package/target/main/ts/report/json/store/operation-cache.d.ts +8 -0
- package/target/main/ts/report/json/store/operation-cache.js +32 -0
- package/target/main/ts/report/json/store/pull-review-store.d.ts +2 -0
- package/target/main/ts/report/json/store/pull-review-store.js +33 -0
- package/target/main/ts/report/json/store/replace-file.d.ts +1 -0
- package/target/main/ts/report/json/store/replace-file.js +35 -0
- package/target/main/ts/report/json/store/report-tree.d.ts +46 -0
- package/target/main/ts/report/json/store/report-tree.js +295 -0
- package/target/main/ts/report/json/store/store-check.d.ts +32 -0
- package/target/main/ts/report/json/store/store-check.js +153 -0
- package/target/main/ts/report/json/validation/metabranch.d.ts +4 -0
- package/target/main/ts/report/json/validation/metabranch.js +11 -0
- package/target/main/ts/report/json/validation/report.d.ts +20 -0
- package/target/main/ts/report/json/validation/report.js +77 -0
- package/target/main/ts/report/json/validation/summary-validation.d.ts +4 -0
- package/target/main/ts/report/json/validation/summary-validation.js +26 -0
- package/target/main/ts/report/json/wire/compact-json.d.ts +11 -0
- package/target/main/ts/report/json/wire/compact-json.js +76 -0
- package/target/main/ts/report/json/wire/component-model.d.ts +9 -0
- package/target/main/ts/report/json/wire/component-model.js +1 -0
- package/target/main/ts/report/json/wire/domain-types.d.ts +2 -0
- package/target/main/ts/report/json/wire/domain-types.js +1 -0
- package/target/main/ts/report/json/wire/file-metrics-model.d.ts +81 -0
- package/target/main/ts/report/json/wire/file-metrics-model.js +1 -0
- package/target/main/ts/report/json/wire/inspection-context-model.d.ts +31 -0
- package/target/main/ts/report/json/wire/inspection-context-model.js +1 -0
- package/target/main/ts/report/json/wire/inspection-details-model.d.ts +87 -0
- package/target/main/ts/report/json/wire/inspection-details-model.js +1 -0
- package/target/main/ts/report/json/wire/project-model.d.ts +7 -0
- package/target/main/ts/report/json/wire/project-model.js +1 -0
- package/target/main/ts/report/json/wire/public-history-model.d.ts +36 -0
- package/target/main/ts/report/json/wire/public-history-model.js +5 -0
- package/target/main/ts/report/json/wire/pull-review-model.d.ts +54 -0
- package/target/main/ts/report/json/wire/pull-review-model.js +3 -0
- package/target/main/ts/report/json/wire/summary-model.d.ts +45 -0
- package/target/main/ts/report/json/wire/summary-model.js +1 -0
- package/target/main/ts/report/markdown/pull-review.d.ts +5 -0
- package/target/main/ts/report/markdown/pull-review.js +132 -0
- package/target/main/ts/report.d.ts +23 -0
- package/target/main/ts/report.js +12 -0
- package/target/main/ts/runtime.d.ts +17 -0
- package/target/main/ts/runtime.js +30 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { isRecord } from '@repometry/core/internal/engine/plugin.js';
|
|
2
|
+
import { isJsonValue } from '@repometry/core/internal/model/plugin-data.js';
|
|
3
|
+
import { digest, sourceFile, sourceFiles, utf8 } from '@repometry/core/internal/model/snapshot.js';
|
|
4
|
+
import { toolFailure } from './failure.js';
|
|
5
|
+
export const pluginRequestSchema = 'urn:repometry:schema:plugin-request:1';
|
|
6
|
+
export function processPlugin(manifest, runner) {
|
|
7
|
+
if (runner.network !== 'none')
|
|
8
|
+
throw new Error('Process plugins require a runner with networking disabled');
|
|
9
|
+
return bindProcessPlugin(manifest, runner);
|
|
10
|
+
}
|
|
11
|
+
// Only the packaged, first-party parsers use the host runner.
|
|
12
|
+
export function bindProcessPlugin({ operations, ...manifest }, runner) {
|
|
13
|
+
const versions = Object.values(manifest.tools);
|
|
14
|
+
if (versions.length === 0 || versions.some(version => typeof version !== 'string' || !version.trim())) {
|
|
15
|
+
throw new Error('Process plugins must declare their tool versions');
|
|
16
|
+
}
|
|
17
|
+
return { ...manifest, operations: operations.map(operation => bindOperation(manifest.id, manifest.settings ?? null, operation, runner)) };
|
|
18
|
+
}
|
|
19
|
+
function bindOperation(plugin, settings, operation, runner) {
|
|
20
|
+
const { id, role, scope, fileIndependent, inputs, output, argv, timeoutMs, maxOutputBytes } = operation;
|
|
21
|
+
const implementation = digest(JSON.stringify([pluginRequestSchema, operation.implementation, runner.implementation, argv, timeoutMs, maxOutputBytes]));
|
|
22
|
+
return { id, role, scope, ...(fileIndependent === undefined ? {} : { fileIndependent }), inputs, output, implementation, async execute(context) {
|
|
23
|
+
const { files, stdin } = encodeRequest(`${plugin}/${id}`, settings, operation, context);
|
|
24
|
+
const result = await runner.run({ argv, timeoutMs, maxOutputBytes, files, stdin });
|
|
25
|
+
if (result.exitCode !== 0)
|
|
26
|
+
throw new Error(toolFailure(`Process plugin exited with code ${result.exitCode}`, result.stderr));
|
|
27
|
+
return decodeResponse(result.stdout, output.id, context);
|
|
28
|
+
} };
|
|
29
|
+
}
|
|
30
|
+
function encodeRequest(key, settings, operation, context) {
|
|
31
|
+
const files = new Map();
|
|
32
|
+
function referenceFile(file) {
|
|
33
|
+
const reference = { path: file.path, sha256: digest(file.bytes) };
|
|
34
|
+
const existing = files.get(file.path);
|
|
35
|
+
if (existing && existing.reference.sha256 !== reference.sha256)
|
|
36
|
+
throw new Error(`Conflicting process input file: ${file.path}`);
|
|
37
|
+
files.set(file.path, { file, reference });
|
|
38
|
+
return reference;
|
|
39
|
+
}
|
|
40
|
+
const inputs = Object.fromEntries(Object.entries(operation.inputs).map(([port, contract]) => {
|
|
41
|
+
const value = context.read(port, contract);
|
|
42
|
+
if (contract.id === sourceFile.id) {
|
|
43
|
+
if (!sourceFile.accepts(value))
|
|
44
|
+
throw new Error(`Invalid process input file: ${key}.${port}`);
|
|
45
|
+
return [port, { contract: contract.id, file: referenceFile(value) }];
|
|
46
|
+
}
|
|
47
|
+
if (contract.id === sourceFiles.id) {
|
|
48
|
+
if (!sourceFiles.accepts(value))
|
|
49
|
+
throw new Error(`Invalid process input file set: ${key}.${port}`);
|
|
50
|
+
return [port, { contract: contract.id, files: value.map(referenceFile) }];
|
|
51
|
+
}
|
|
52
|
+
if (!isJsonValue(value))
|
|
53
|
+
throw new Error(`Process input must be JSON data: ${key}.${port}`);
|
|
54
|
+
return [port, { contract: contract.id, value }];
|
|
55
|
+
}));
|
|
56
|
+
const entries = [...files.values()];
|
|
57
|
+
const request = { schema: pluginRequestSchema, operation: key, options: settings, files: entries.map(({ reference }) => reference), inputs };
|
|
58
|
+
return { files: entries.map(({ file }) => file), stdin: Buffer.from(`${JSON.stringify(request)}\n`) };
|
|
59
|
+
}
|
|
60
|
+
function decodeResponse(bytes, contract, context) {
|
|
61
|
+
let product;
|
|
62
|
+
for (const line of utf8(bytes).split(/\r?\n/)) {
|
|
63
|
+
if (!line.trim())
|
|
64
|
+
continue;
|
|
65
|
+
let entry;
|
|
66
|
+
try {
|
|
67
|
+
entry = JSON.parse(line);
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
throw new Error('Invalid JSON Lines output from the process plugin');
|
|
71
|
+
}
|
|
72
|
+
if (!isRecord(entry))
|
|
73
|
+
throw new Error('Invalid process plugin output record');
|
|
74
|
+
if (entry.kind === 'diagnostic') {
|
|
75
|
+
readDiagnostic(entry, context);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (entry.kind !== 'product' || entry.contract !== contract || product !== undefined || !isJsonValue(entry.value)) {
|
|
79
|
+
throw new Error('Expected one declared product from the process plugin');
|
|
80
|
+
}
|
|
81
|
+
product = entry.value;
|
|
82
|
+
}
|
|
83
|
+
if (product === undefined)
|
|
84
|
+
throw new Error('Missing declared product from the process plugin');
|
|
85
|
+
return product;
|
|
86
|
+
}
|
|
87
|
+
function readDiagnostic(entry, context) {
|
|
88
|
+
if (typeof entry.message !== 'string' || !entry.message.trim())
|
|
89
|
+
throw new Error('Invalid process plugin diagnostic message');
|
|
90
|
+
switch (entry.severity) {
|
|
91
|
+
case undefined:
|
|
92
|
+
case 'info': return;
|
|
93
|
+
case 'warning':
|
|
94
|
+
context.emitDiagnostic?.(entry.message);
|
|
95
|
+
return;
|
|
96
|
+
case 'error': throw new Error(entry.message);
|
|
97
|
+
default: throw new Error('Invalid process plugin diagnostic severity');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ToolInvocation } from '@repometry/core/internal/ports/tool-runner.js';
|
|
2
|
+
export declare function validateToolInvocation(invocation: ToolInvocation): void;
|
|
3
|
+
export declare function writeToolSnapshot(directory: string, files: ToolInvocation['files']): Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { isSourcePathname } from '@repometry/core/internal/ports/source-provider.js';
|
|
4
|
+
export function validateToolInvocation(invocation) {
|
|
5
|
+
if (!invocation.argv[0] || invocation.argv.some(arg => arg.includes('\0')))
|
|
6
|
+
throw new Error('A tool command and valid arguments are required');
|
|
7
|
+
if (!Number.isSafeInteger(invocation.timeoutMs) || invocation.timeoutMs < 1 || invocation.timeoutMs > 2_147_483_647) {
|
|
8
|
+
throw new Error('Invalid tool timeout');
|
|
9
|
+
}
|
|
10
|
+
if (!Number.isSafeInteger(invocation.maxOutputBytes) || invocation.maxOutputBytes < 1)
|
|
11
|
+
throw new Error('Invalid tool output limit');
|
|
12
|
+
const paths = new Set();
|
|
13
|
+
for (const { path } of invocation.files) {
|
|
14
|
+
if (!isSourcePathname(path) || paths.has(path))
|
|
15
|
+
throw new Error(`Invalid or duplicate snapshot path: ${path}`);
|
|
16
|
+
paths.add(path);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export async function writeToolSnapshot(directory, files) {
|
|
20
|
+
for (const file of files) {
|
|
21
|
+
const path = join(directory, file.path);
|
|
22
|
+
await mkdir(dirname(path), { recursive: true, mode: 0o700 });
|
|
23
|
+
await writeFile(path, file.bytes, { mode: 0o600, flag: 'wx' });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=tool-snapshot.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
interface Option {
|
|
2
|
+
readonly type: 'string' | 'boolean';
|
|
3
|
+
readonly description: string;
|
|
4
|
+
readonly value?: string;
|
|
5
|
+
readonly short?: string;
|
|
6
|
+
readonly multiple?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface Invocation {
|
|
9
|
+
readonly args: readonly string[];
|
|
10
|
+
text(name: string): string | undefined;
|
|
11
|
+
flag(name: string): boolean;
|
|
12
|
+
many(name: string): readonly string[];
|
|
13
|
+
}
|
|
14
|
+
export interface Command {
|
|
15
|
+
readonly description: string;
|
|
16
|
+
readonly parameters?: string;
|
|
17
|
+
readonly min?: number;
|
|
18
|
+
readonly max?: number;
|
|
19
|
+
readonly options?: Readonly<Record<string, Option>>;
|
|
20
|
+
run(input: Invocation): Promise<number | void> | number | void;
|
|
21
|
+
}
|
|
22
|
+
export declare function option(value: string, description: string, props?: {
|
|
23
|
+
short?: string;
|
|
24
|
+
multiple?: boolean;
|
|
25
|
+
}): Option;
|
|
26
|
+
export declare function flag(description: string, short?: string): Option;
|
|
27
|
+
export declare function dispatch(commands: Readonly<Record<string, Command>>, input: readonly string[], version: string): Promise<number>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
2
|
+
export function option(value, description, props = {}) {
|
|
3
|
+
return { type: 'string', value, description, ...props };
|
|
4
|
+
}
|
|
5
|
+
export function flag(description, short) {
|
|
6
|
+
return { type: 'boolean', description, short };
|
|
7
|
+
}
|
|
8
|
+
const globals = {
|
|
9
|
+
help: flag('Show command help.', 'h'),
|
|
10
|
+
version: flag('Show the installed version.', 'V'),
|
|
11
|
+
};
|
|
12
|
+
export async function dispatch(commands, input, version) {
|
|
13
|
+
const [name, ...rest] = placeLeadingOptions(input);
|
|
14
|
+
if (name === '--version' || name === '-V') {
|
|
15
|
+
process.stdout.write(version + '\n');
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
if (name === undefined || name === '--help' || name === '-h' || name === 'help') {
|
|
19
|
+
showHelp(commands, name === 'help' ? rest[0] : undefined);
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
const command = Object.hasOwn(commands, name) ? commands[name] : undefined;
|
|
23
|
+
if (!command)
|
|
24
|
+
throw new Error(`Unknown command: ${name}.${suggest(name, Object.keys(commands))}`);
|
|
25
|
+
const options = { ...globals, ...command.options };
|
|
26
|
+
const config = Object.fromEntries(Object.entries(options).map(([key, { type, short, multiple }]) => [key,
|
|
27
|
+
{ type, ...(short === undefined ? {} : { short }), ...(multiple === undefined ? {} : { multiple }) }]));
|
|
28
|
+
let parsed;
|
|
29
|
+
try {
|
|
30
|
+
parsed = parseArgs({ args: rest, options: config, allowPositionals: true });
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error instanceof Error && 'code' in error && error.code === 'ERR_PARSE_ARGS_UNKNOWN_OPTION') {
|
|
34
|
+
const unknown = /'([^']+)'/.exec(error.message)?.[1] ?? '';
|
|
35
|
+
const choices = Object.keys(options).map(value => '--' + value);
|
|
36
|
+
throw new Error(`${unknown || 'Unknown option'} is not an option of ${name}.${suggest(unknown, choices)}`);
|
|
37
|
+
}
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
if (parsed.values.version) {
|
|
41
|
+
process.stdout.write(version + '\n');
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
if (parsed.values.help) {
|
|
45
|
+
showHelp(commands, name);
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
const args = parsed.positionals;
|
|
49
|
+
if (args.length < (command.min ?? 0) || args.length > (command.max ?? 0)) {
|
|
50
|
+
throw new Error(`Usage: repometry ${name}${command.parameters ? ' ' + command.parameters : ''}`);
|
|
51
|
+
}
|
|
52
|
+
const result = await command.run({
|
|
53
|
+
args,
|
|
54
|
+
text: key => typeof parsed.values[key] === 'string' ? parsed.values[key] : undefined,
|
|
55
|
+
flag: key => parsed.values[key] === true,
|
|
56
|
+
many: key => Array.isArray(parsed.values[key]) ? parsed.values[key] : [],
|
|
57
|
+
});
|
|
58
|
+
return result ?? 0;
|
|
59
|
+
}
|
|
60
|
+
function placeLeadingOptions(input) {
|
|
61
|
+
const leading = [];
|
|
62
|
+
let index = 0;
|
|
63
|
+
while (index < input.length) {
|
|
64
|
+
const next = input[index];
|
|
65
|
+
if (/^(?:--repo|--store)=/.test(next))
|
|
66
|
+
leading.push(next);
|
|
67
|
+
else if (next === '-C' || next === '--repo' || next === '--store') {
|
|
68
|
+
if (input[index + 1] === undefined)
|
|
69
|
+
throw new Error(`${next} needs a value`);
|
|
70
|
+
leading.push(next, input[++index]);
|
|
71
|
+
}
|
|
72
|
+
else
|
|
73
|
+
break;
|
|
74
|
+
index++;
|
|
75
|
+
}
|
|
76
|
+
return input[index] === undefined ? [] : [input[index], ...leading, ...input.slice(index + 1)];
|
|
77
|
+
}
|
|
78
|
+
function showHelp(commands, name) {
|
|
79
|
+
if (name === undefined) {
|
|
80
|
+
process.stdout.write(['Usage: repometry <command> [options]', '', ...Object.entries(commands)
|
|
81
|
+
.map(([id, command]) => ` ${id.padEnd(15)} ${command.description}`), ' help Show help for any command.', ''].join('\n'));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const command = Object.hasOwn(commands, name) ? commands[name] : undefined;
|
|
85
|
+
if (!command)
|
|
86
|
+
throw new Error(`Unknown command: ${name}.${suggest(name, Object.keys(commands))}`);
|
|
87
|
+
const usage = `Usage: repometry ${name}${command.parameters ? ' ' + command.parameters : ''}`;
|
|
88
|
+
const help = Object.entries({ ...globals, ...command.options }).map(([key, setting]) => {
|
|
89
|
+
const flags = (setting.short ? `-${setting.short}, ` : '') + `--${key}` + (setting.value ? ' ' + setting.value : '');
|
|
90
|
+
return ` ${flags.padEnd(28)} ${setting.description}`;
|
|
91
|
+
});
|
|
92
|
+
process.stdout.write([usage, '', command.description, '', ...help, ''].join('\n'));
|
|
93
|
+
}
|
|
94
|
+
function suggest(name, candidates) {
|
|
95
|
+
const ranked = candidates.map(value => ({ value, score: distance(name, value) })).sort((a, b) => a.score - b.score);
|
|
96
|
+
const nearest = ranked[0];
|
|
97
|
+
return nearest && nearest.score <= Math.max(2, Math.floor(name.length / 3)) ? ` Did you mean ${nearest.value}?` : '';
|
|
98
|
+
}
|
|
99
|
+
function distance(a, b) {
|
|
100
|
+
let row = Array.from({ length: b.length + 1 }, (_, index) => index);
|
|
101
|
+
for (let i = 0; i < a.length; i++) {
|
|
102
|
+
const next = [i + 1];
|
|
103
|
+
for (let j = 0; j < b.length; j++)
|
|
104
|
+
next.push(Math.min(row[j + 1] + 1, next[j] + 1, row[j] + Number(a[i] !== b[j])));
|
|
105
|
+
row = next;
|
|
106
|
+
}
|
|
107
|
+
return row[b.length];
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=arguments.js.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Component } from '../report/json/wire/component-model.js';
|
|
2
|
+
import type { Invocation } from './arguments.js';
|
|
3
|
+
import type { Distribution } from '../compose/distribution.js';
|
|
4
|
+
export declare function parseConfig(value: unknown, distribution?: Distribution): {
|
|
5
|
+
exclude: readonly string[];
|
|
6
|
+
ignore: readonly import("@repometry/core/internal/model/ignore-rule.js").FindingIgnoreRule[];
|
|
7
|
+
plugins: readonly import("../compose/plugin-reference.js").PluginReference[];
|
|
8
|
+
parsers: Readonly<Record<string, readonly string[]>> | undefined;
|
|
9
|
+
imports: readonly string[];
|
|
10
|
+
reports: readonly string[];
|
|
11
|
+
source: string | undefined;
|
|
12
|
+
branch: string | undefined;
|
|
13
|
+
components: readonly Component[];
|
|
14
|
+
minCoverage: number | undefined;
|
|
15
|
+
minLines: number | undefined;
|
|
16
|
+
maxNewIssues: number | undefined;
|
|
17
|
+
};
|
|
18
|
+
/** The configuration file in effect, or undefined under --no-config. */
|
|
19
|
+
export declare function configFile(root: string, input: Invocation): string | undefined;
|
|
20
|
+
export declare function readConfig(root: string, input: Invocation, metadataOnly?: boolean, distribution?: Distribution): Promise<{
|
|
21
|
+
exclude: readonly string[];
|
|
22
|
+
ignore: readonly import("@repometry/core/internal/model/ignore-rule.js").FindingIgnoreRule[];
|
|
23
|
+
imports: readonly string[];
|
|
24
|
+
reports: readonly string[];
|
|
25
|
+
source: string | undefined;
|
|
26
|
+
branch: string | undefined;
|
|
27
|
+
components: readonly Component[];
|
|
28
|
+
minCoverage: number | undefined;
|
|
29
|
+
minLines: number | undefined;
|
|
30
|
+
maxNewIssues: number | undefined;
|
|
31
|
+
parsers: Readonly<Record<string, readonly string[]>> | undefined;
|
|
32
|
+
plugins: import("../compose/registered-plugin.js").RegisteredPlugin[];
|
|
33
|
+
}>;
|
|
34
|
+
export declare function readDisplayConfig(root: string, input: Invocation, distribution?: Distribution): Promise<{
|
|
35
|
+
exclude: readonly string[];
|
|
36
|
+
ignore: readonly import("@repometry/core/internal/model/ignore-rule.js").FindingIgnoreRule[];
|
|
37
|
+
plugins: readonly import("../compose/plugin-reference.js").PluginReference[];
|
|
38
|
+
parsers: Readonly<Record<string, readonly string[]>> | undefined;
|
|
39
|
+
imports: readonly string[];
|
|
40
|
+
reports: readonly string[];
|
|
41
|
+
source: string | undefined;
|
|
42
|
+
branch: string | undefined;
|
|
43
|
+
components: readonly Component[];
|
|
44
|
+
minCoverage: number | undefined;
|
|
45
|
+
minLines: number | undefined;
|
|
46
|
+
maxNewIssues: number | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
export declare function loadConfig(value: unknown, root: string, file: string | undefined, metadataOnly?: boolean, distribution?: Distribution): Promise<{
|
|
49
|
+
exclude: readonly string[];
|
|
50
|
+
ignore: readonly import("@repometry/core/internal/model/ignore-rule.js").FindingIgnoreRule[];
|
|
51
|
+
imports: readonly string[];
|
|
52
|
+
reports: readonly string[];
|
|
53
|
+
source: string | undefined;
|
|
54
|
+
branch: string | undefined;
|
|
55
|
+
components: readonly Component[];
|
|
56
|
+
minCoverage: number | undefined;
|
|
57
|
+
minLines: number | undefined;
|
|
58
|
+
maxNewIssues: number | undefined;
|
|
59
|
+
parsers: Readonly<Record<string, readonly string[]>> | undefined;
|
|
60
|
+
plugins: import("../compose/registered-plugin.js").RegisteredPlugin[];
|
|
61
|
+
}>;
|
|
62
|
+
export declare function readConfigValue(root: string, input: Invocation): Promise<unknown>;
|
|
63
|
+
export declare function listOption(input: Invocation, name: string, configured: readonly string[]): readonly string[];
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { isRecord } from '@repometry/core/internal/engine/plugin.js';
|
|
4
|
+
import { normalizeProfile } from '@repometry/core/internal/profile/profile.js';
|
|
5
|
+
import { readPluginReferences } from '../compose/plugin-reference.js';
|
|
6
|
+
import { distributionParsers } from '../compose/distribution.js';
|
|
7
|
+
import { loadPlugins } from '../compose/load-plugins.js';
|
|
8
|
+
import { languageRegistry } from '../compose/languages.js';
|
|
9
|
+
import { registeredPlugins } from '../compose/built-ins.js';
|
|
10
|
+
import { readParserOrder, selectParsers } from '../compose/parser-order.js';
|
|
11
|
+
import { invocationDirectory } from './store.js';
|
|
12
|
+
const keys = new Set(['$schema', 'exclude', 'ignore', 'imports', 'reports', 'source', 'branch',
|
|
13
|
+
'minCoverage', 'minLines', 'maxNewIssues', 'plugins', 'components', 'parsers']);
|
|
14
|
+
export function parseConfig(value, distribution) {
|
|
15
|
+
if (!isRecord(value))
|
|
16
|
+
throw new Error('Config must be an object');
|
|
17
|
+
if (Object.hasOwn(value, 'sources'))
|
|
18
|
+
throw new Error('Config sources is renamed. Write source.');
|
|
19
|
+
const unknown = Object.keys(value).find(key => !keys.has(key));
|
|
20
|
+
if (unknown !== undefined)
|
|
21
|
+
throw new Error('Config /' + unknown + ' is not a supported field');
|
|
22
|
+
string(value.$schema, '$schema');
|
|
23
|
+
const profile = normalizeProfile({ exclude: value.exclude, ignore: value.ignore });
|
|
24
|
+
const plugins = readPluginReferences(value.plugins);
|
|
25
|
+
const parsers = readParserOrder(value.parsers, 'Config parsers');
|
|
26
|
+
if (!plugins.length && parsers !== undefined) {
|
|
27
|
+
languageRegistry(distribution?.bundled ?? [], distributionParsers(distribution, parsers), 'Config parsers');
|
|
28
|
+
}
|
|
29
|
+
return { ...profile, plugins, parsers, imports: list(value.imports, 'imports'), reports: list(value.reports, 'reports'),
|
|
30
|
+
source: string(value.source, 'source'), branch: string(value.branch, 'branch'),
|
|
31
|
+
components: parseComponents(value.components),
|
|
32
|
+
minCoverage: number(value.minCoverage, 'minCoverage', 100), minLines: number(value.minLines, 'minLines'),
|
|
33
|
+
maxNewIssues: number(value.maxNewIssues, 'maxNewIssues') };
|
|
34
|
+
}
|
|
35
|
+
/** The configuration file in effect, or undefined under --no-config. */
|
|
36
|
+
export function configFile(root, input) {
|
|
37
|
+
const explicit = input.text('config');
|
|
38
|
+
if (input.flag('no-config')) {
|
|
39
|
+
if (explicit !== undefined)
|
|
40
|
+
throw new Error('Choose --config or --no-config');
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
return explicit === undefined ? resolve(root, 'repometry.config.json') : resolve(invocationDirectory(input), explicit);
|
|
44
|
+
}
|
|
45
|
+
export async function readConfig(root, input, metadataOnly = false, distribution) {
|
|
46
|
+
return loadConfig(await readConfigValue(root, input), root, configFile(root, input), metadataOnly, distribution);
|
|
47
|
+
}
|
|
48
|
+
export async function readDisplayConfig(root, input, distribution) {
|
|
49
|
+
const value = await readConfigValue(root, input);
|
|
50
|
+
try {
|
|
51
|
+
return parseConfig(value, distribution);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
throw configurationError(configFile(root, input), error);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export async function loadConfig(value, root, file, metadataOnly = false, distribution) {
|
|
58
|
+
try {
|
|
59
|
+
const { plugins: references, ...config } = parseConfig(value, distribution);
|
|
60
|
+
const plugins = await loadPlugins(references, root, file, metadataOnly, distribution);
|
|
61
|
+
const parsers = distributionParsers(distribution, config.parsers);
|
|
62
|
+
if (metadataOnly)
|
|
63
|
+
selectParsers(registeredPlugins(plugins), parsers, 'Config parsers');
|
|
64
|
+
else if (plugins.length)
|
|
65
|
+
languageRegistry(plugins, parsers, 'Config parsers');
|
|
66
|
+
return { ...config, parsers, plugins };
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
throw configurationError(file, error);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function configurationError(file, error) {
|
|
73
|
+
if (file === undefined)
|
|
74
|
+
return error;
|
|
75
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
76
|
+
return new Error(file + ': ' + message.replace(/^Config /, ''), { cause: error });
|
|
77
|
+
}
|
|
78
|
+
export async function readConfigValue(root, input) {
|
|
79
|
+
const explicit = input.text('config');
|
|
80
|
+
const file = configFile(root, input);
|
|
81
|
+
if (file === undefined)
|
|
82
|
+
return {};
|
|
83
|
+
let json;
|
|
84
|
+
try {
|
|
85
|
+
json = await readFile(file, 'utf8');
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
if (explicit === undefined && error instanceof Error && 'code' in error && error.code === 'ENOENT')
|
|
89
|
+
return {};
|
|
90
|
+
throw configurationError(file, error);
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
return JSON.parse(json);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
throw configurationError(file, error);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export function listOption(input, name, configured) {
|
|
100
|
+
const typed = input.many(name);
|
|
101
|
+
return typed.length ? typed : configured;
|
|
102
|
+
}
|
|
103
|
+
function list(value, key) {
|
|
104
|
+
if (value === undefined)
|
|
105
|
+
return [];
|
|
106
|
+
if (!Array.isArray(value) || !value.every(item => typeof item === 'string' && item.length > 0))
|
|
107
|
+
throw new Error(`Config ${key} must be a string list`);
|
|
108
|
+
return value;
|
|
109
|
+
}
|
|
110
|
+
function string(value, key) {
|
|
111
|
+
if (value === undefined)
|
|
112
|
+
return undefined;
|
|
113
|
+
if (typeof value !== 'string' || value.trim() === '')
|
|
114
|
+
throw new Error(`Config ${key} must be a nonempty string`);
|
|
115
|
+
return value;
|
|
116
|
+
}
|
|
117
|
+
function number(value, key, max) {
|
|
118
|
+
if (value === undefined)
|
|
119
|
+
return undefined;
|
|
120
|
+
const valid = typeof value === 'number' && value >= 0
|
|
121
|
+
&& (max === undefined ? Number.isSafeInteger(value) : value <= max);
|
|
122
|
+
if (!valid) {
|
|
123
|
+
const expected = max === undefined ? 'a non-negative integer' : 'a number from 0 to ' + max;
|
|
124
|
+
throw new Error('Config ' + key + ' must be ' + expected);
|
|
125
|
+
}
|
|
126
|
+
return value;
|
|
127
|
+
}
|
|
128
|
+
function parseComponents(config) {
|
|
129
|
+
if (config === undefined)
|
|
130
|
+
return [];
|
|
131
|
+
if (!Array.isArray(config))
|
|
132
|
+
throw new Error('Config components must be an array');
|
|
133
|
+
const names = new Set();
|
|
134
|
+
return config.map((entry, index) => {
|
|
135
|
+
const base = 'Config components/' + index;
|
|
136
|
+
const { name, include, description } = componentFields(entry, base);
|
|
137
|
+
if (names.has(name))
|
|
138
|
+
throw new Error(base + '/name duplicates ' + name);
|
|
139
|
+
names.add(name);
|
|
140
|
+
return { name, pathGlobs: [...new Set(include)], description };
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function componentFields(entry, base) {
|
|
144
|
+
if (!isRecord(entry))
|
|
145
|
+
throw new Error(base + ' must be an object');
|
|
146
|
+
if (Object.hasOwn(entry, 'pathGlobs'))
|
|
147
|
+
throw new Error(base + '/pathGlobs is renamed. Write include.');
|
|
148
|
+
const unknown = Object.keys(entry).find(key => !['name', 'include', 'description'].includes(key));
|
|
149
|
+
if (unknown !== undefined)
|
|
150
|
+
throw new Error(base + '/' + unknown + ' is not a supported field');
|
|
151
|
+
const { name, include, description } = entry;
|
|
152
|
+
if (typeof name !== 'string' || !name.trim() || name.length > 100)
|
|
153
|
+
throw new Error(base + '/name must be between 1 and 100 characters');
|
|
154
|
+
if (!Array.isArray(include) || include.length === 0 || !include.every(validPattern)) {
|
|
155
|
+
throw new Error(base + '/include must specify repository-relative include globs');
|
|
156
|
+
}
|
|
157
|
+
if (description !== undefined && typeof description !== 'string')
|
|
158
|
+
throw new Error(base + '/description must be a string');
|
|
159
|
+
return { name: name.trim(), include: include, description };
|
|
160
|
+
}
|
|
161
|
+
function validPattern(pattern) {
|
|
162
|
+
return typeof pattern === 'string' && !/^[A-Za-z]:|[\\\0]/.test(pattern)
|
|
163
|
+
&& pattern.split('/').every(part => part !== '' && part !== '.' && part !== '..');
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FindingInput } from '../api/import/finding-import.js';
|
|
2
|
+
export declare const importerIds: string[];
|
|
3
|
+
/** Typed imports resolve against the invocation directory, imports from the config against the repository root. */
|
|
4
|
+
export declare function readInputs(base: string, inputs: readonly string[]): {
|
|
5
|
+
lcov: string[] | undefined;
|
|
6
|
+
goCover: string[] | undefined;
|
|
7
|
+
cobertura: string[] | undefined;
|
|
8
|
+
findings: FindingInput[];
|
|
9
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
const scanners = {
|
|
3
|
+
sarif: { format: 'sarif', category: 'lint' },
|
|
4
|
+
'sarif-security': { format: 'sarif', category: 'security' },
|
|
5
|
+
'sarif-secrets': { format: 'sarif', category: 'secret' },
|
|
6
|
+
eslint: { format: 'eslint', category: 'lint' },
|
|
7
|
+
osv: { format: 'osv', category: 'dependency' },
|
|
8
|
+
};
|
|
9
|
+
export const importerIds = ['lcov', 'go-cover', 'cobertura', ...Object.keys(scanners)];
|
|
10
|
+
/** Typed imports resolve against the invocation directory, imports from the config against the repository root. */
|
|
11
|
+
export function readInputs(base, inputs) {
|
|
12
|
+
const lcov = [];
|
|
13
|
+
const goCover = [];
|
|
14
|
+
const cobertura = [];
|
|
15
|
+
const findings = [];
|
|
16
|
+
for (const value of inputs) {
|
|
17
|
+
const equal = value.indexOf('=');
|
|
18
|
+
const format = value.slice(0, equal);
|
|
19
|
+
const file = value.slice(equal + 1);
|
|
20
|
+
if (equal < 1 || !/^[a-z][a-z0-9-]*$/.test(format) || file === '')
|
|
21
|
+
throw new Error('Use --import FORMAT=PATH');
|
|
22
|
+
if (format === 'lcov')
|
|
23
|
+
lcov.push(resolve(base, file));
|
|
24
|
+
else if (format === 'go-cover')
|
|
25
|
+
goCover.push(resolve(base, file));
|
|
26
|
+
else if (format === 'cobertura')
|
|
27
|
+
cobertura.push(resolve(base, file));
|
|
28
|
+
else {
|
|
29
|
+
if (!Object.hasOwn(scanners, format))
|
|
30
|
+
throw new Error(`Unknown import format: ${format}. Choose ${importerIds.join(', ')}.`);
|
|
31
|
+
findings.push({ ...scanners[format], file: resolve(base, file) });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return { lcov: lcov.length ? lcov : undefined, goCover: goCover.length ? goCover : undefined,
|
|
35
|
+
cobertura: cobertura.length ? cobertura : undefined, findings };
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=imports.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { MissingLanguagePlugin } from '../compose/language-discovery.js';
|
|
2
|
+
import type { Report } from '@repometry/core/internal/model/report.js';
|
|
3
|
+
import type { loadConfig } from './config.js';
|
|
4
|
+
export interface RangeInspection {
|
|
5
|
+
readonly directory: string;
|
|
6
|
+
readonly output: string;
|
|
7
|
+
readonly exclude: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
export type CommitOutcome = {
|
|
10
|
+
readonly commit: string;
|
|
11
|
+
readonly state: 'analyzed' | 'partial';
|
|
12
|
+
readonly missingLanguagePlugins: readonly MissingLanguagePlugin[];
|
|
13
|
+
} | {
|
|
14
|
+
readonly commit: string;
|
|
15
|
+
readonly state: 'failed';
|
|
16
|
+
readonly error: string;
|
|
17
|
+
};
|
|
18
|
+
export interface RangeConfiguration {
|
|
19
|
+
readonly value: unknown;
|
|
20
|
+
readonly root: string;
|
|
21
|
+
readonly file: string | undefined;
|
|
22
|
+
readonly distributionModule?: string;
|
|
23
|
+
}
|
|
24
|
+
export type RangeMessage = {
|
|
25
|
+
readonly kind: 'start';
|
|
26
|
+
readonly commits: readonly string[];
|
|
27
|
+
readonly inspection: RangeInspection;
|
|
28
|
+
readonly configuration: RangeConfiguration;
|
|
29
|
+
} | {
|
|
30
|
+
readonly kind: 'stop';
|
|
31
|
+
};
|
|
32
|
+
export declare function rangeInspector(inspection: RangeInspection, config: Awaited<ReturnType<typeof loadConfig>>): (revision: string) => Promise<ObservedCommit>;
|
|
33
|
+
interface ObservedCommit {
|
|
34
|
+
readonly report: Report;
|
|
35
|
+
readonly missingLanguagePlugins: readonly MissingLanguagePlugin[];
|
|
36
|
+
}
|
|
37
|
+
export declare function inspectCommits(commits: readonly string[], inspectCommit: (id: string) => Promise<ObservedCommit>, stopped: () => boolean, report: (outcome: CommitOutcome) => void | Promise<void>): Promise<void>;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { HistoryCache } from '../compose/history-cache.js';
|
|
2
|
+
import { inspectWithOptions } from '../compose/inspect.js';
|
|
3
|
+
import { detectMissingLanguages } from '../compose/language-discovery.js';
|
|
4
|
+
export function rangeInspector(inspection, config) {
|
|
5
|
+
const { plugins, ...profile } = config;
|
|
6
|
+
const history = new HistoryCache(profile);
|
|
7
|
+
const { directory, output, exclude } = inspection;
|
|
8
|
+
return async (revision) => {
|
|
9
|
+
const inventory = detectMissingLanguages(plugins);
|
|
10
|
+
const report = await inspectWithOptions({ directory, output, source: { revision }, exclude,
|
|
11
|
+
ignore: config.ignore, plugins, parsers: config.parsers }, { history, deferSummary: true, inventory });
|
|
12
|
+
return { report, missingLanguagePlugins: inventory.results() };
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export async function inspectCommits(commits, inspectCommit, stopped, report) {
|
|
16
|
+
for (const commit of commits) {
|
|
17
|
+
if (stopped())
|
|
18
|
+
break;
|
|
19
|
+
const outcome = await inspectOne(commit, inspectCommit);
|
|
20
|
+
if (outcome.state === 'failed' && stopped())
|
|
21
|
+
break;
|
|
22
|
+
await report(outcome);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async function inspectOne(commit, inspectCommit) {
|
|
26
|
+
try {
|
|
27
|
+
const { report, missingLanguagePlugins } = await inspectCommit(commit);
|
|
28
|
+
return { commit, state: report.status === 'partial' ? 'partial' : 'analyzed', missingLanguagePlugins };
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
return { commit, state: 'failed', error: error instanceof Error ? error.message : String(error) };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=range-inspection.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { RangeConfiguration, RangeInspection } from './range-inspection.js';
|
|
2
|
+
import type { loadConfig } from './config.js';
|
|
3
|
+
export declare function historyChunks(commits: readonly string[], concurrency: number, memory: number): readonly (readonly string[])[];
|
|
4
|
+
interface RangeOptions {
|
|
5
|
+
readonly inspection: RangeInspection;
|
|
6
|
+
readonly config: Awaited<ReturnType<typeof loadConfig>>;
|
|
7
|
+
readonly configuration: RangeConfiguration;
|
|
8
|
+
readonly concurrency?: number;
|
|
9
|
+
readonly skipSaved: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function analyzeCommits(commits: readonly string[], options: RangeOptions): Promise<{
|
|
12
|
+
interrupted: boolean;
|
|
13
|
+
missingLanguagePlugins: readonly import("../compose/language-discovery.js").MissingLanguagePlugin[];
|
|
14
|
+
analyzed: string[];
|
|
15
|
+
partial: string[];
|
|
16
|
+
skipped: string[];
|
|
17
|
+
failed: {
|
|
18
|
+
commit: string;
|
|
19
|
+
error: string;
|
|
20
|
+
}[];
|
|
21
|
+
}>;
|
|
22
|
+
export declare function isSaved(store: string, id: string): Promise<boolean>;
|
|
23
|
+
export {};
|