@untangle-code/cli 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/NOTICE +90 -0
- package/README.md +451 -2
- package/THIRD_PARTY_LICENSES.md +152 -0
- package/dist/cli/args.d.ts +48 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +167 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/command.d.ts +69 -0
- package/dist/cli/command.d.ts.map +1 -0
- package/dist/cli/command.js +82 -0
- package/dist/cli/command.js.map +1 -0
- package/dist/cli/deadline.d.ts +33 -0
- package/dist/cli/deadline.d.ts.map +1 -0
- package/dist/cli/deadline.js +49 -0
- package/dist/cli/deadline.js.map +1 -0
- package/dist/cli/embedder-deadline.d.ts +72 -0
- package/dist/cli/embedder-deadline.d.ts.map +1 -0
- package/dist/cli/embedder-deadline.js +117 -0
- package/dist/cli/embedder-deadline.js.map +1 -0
- package/dist/cli/exit.d.ts +71 -0
- package/dist/cli/exit.d.ts.map +1 -0
- package/dist/cli/exit.js +81 -0
- package/dist/cli/exit.js.map +1 -0
- package/dist/cli/graphs.d.ts +65 -0
- package/dist/cli/graphs.d.ts.map +1 -0
- package/dist/cli/graphs.js +108 -0
- package/dist/cli/graphs.js.map +1 -0
- package/dist/cli/index-freshness.d.ts +13 -0
- package/dist/cli/index-freshness.d.ts.map +1 -0
- package/dist/cli/index-freshness.js +226 -0
- package/dist/cli/index-freshness.js.map +1 -0
- package/dist/cli/index-refresh.d.ts +10 -0
- package/dist/cli/index-refresh.d.ts.map +1 -0
- package/dist/cli/index-refresh.js +76 -0
- package/dist/cli/index-refresh.js.map +1 -0
- package/dist/cli/index-state.d.ts +184 -0
- package/dist/cli/index-state.d.ts.map +1 -0
- package/dist/cli/index-state.js +852 -0
- package/dist/cli/index-state.js.map +1 -0
- package/dist/cli/io.d.ts +29 -0
- package/dist/cli/io.d.ts.map +1 -0
- package/dist/cli/io.js +42 -0
- package/dist/cli/io.js.map +1 -0
- package/dist/cli/language-support.d.ts +77 -0
- package/dist/cli/language-support.d.ts.map +1 -0
- package/dist/cli/language-support.js +152 -0
- package/dist/cli/language-support.js.map +1 -0
- package/dist/cli/renewing-lease.d.ts +26 -0
- package/dist/cli/renewing-lease.d.ts.map +1 -0
- package/dist/cli/renewing-lease.js +102 -0
- package/dist/cli/renewing-lease.js.map +1 -0
- package/dist/cli/search-graph-enrichment.d.ts +16 -0
- package/dist/cli/search-graph-enrichment.d.ts.map +1 -0
- package/dist/cli/search-graph-enrichment.js +428 -0
- package/dist/cli/search-graph-enrichment.js.map +1 -0
- package/dist/cli/system.d.ts +34 -0
- package/dist/cli/system.d.ts.map +1 -0
- package/dist/cli/system.js +89 -0
- package/dist/cli/system.js.map +1 -0
- package/dist/cli/vector-store-policy.d.ts +116 -0
- package/dist/cli/vector-store-policy.d.ts.map +1 -0
- package/dist/cli/vector-store-policy.js +160 -0
- package/dist/cli/vector-store-policy.js.map +1 -0
- package/dist/cli/version.d.ts +3 -0
- package/dist/cli/version.d.ts.map +1 -0
- package/dist/cli/version.js +3 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/cli/workspace.d.ts +105 -0
- package/dist/cli/workspace.d.ts.map +1 -0
- package/dist/cli/workspace.js +215 -0
- package/dist/cli/workspace.js.map +1 -0
- package/dist/commands/complexity.d.ts +72 -0
- package/dist/commands/complexity.d.ts.map +1 -0
- package/dist/commands/complexity.js +580 -0
- package/dist/commands/complexity.js.map +1 -0
- package/dist/commands/doctor.d.ts +66 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +764 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/doctor.languages.d.ts +37 -0
- package/dist/commands/doctor.languages.d.ts.map +1 -0
- package/dist/commands/doctor.languages.js +143 -0
- package/dist/commands/doctor.languages.js.map +1 -0
- package/dist/commands/doctor.storage.d.ts +17 -0
- package/dist/commands/doctor.storage.d.ts.map +1 -0
- package/dist/commands/doctor.storage.js +91 -0
- package/dist/commands/doctor.storage.js.map +1 -0
- package/dist/commands/extensions/add.d.ts +10 -0
- package/dist/commands/extensions/add.d.ts.map +1 -0
- package/dist/commands/extensions/add.js +213 -0
- package/dist/commands/extensions/add.js.map +1 -0
- package/dist/commands/extensions/configure.d.ts +5 -0
- package/dist/commands/extensions/configure.d.ts.map +1 -0
- package/dist/commands/extensions/configure.js +58 -0
- package/dist/commands/extensions/configure.js.map +1 -0
- package/dist/commands/extensions/container.d.ts +15 -0
- package/dist/commands/extensions/container.d.ts.map +1 -0
- package/dist/commands/extensions/container.js +135 -0
- package/dist/commands/extensions/container.js.map +1 -0
- package/dist/commands/extensions/context.d.ts +37 -0
- package/dist/commands/extensions/context.d.ts.map +1 -0
- package/dist/commands/extensions/context.js +72 -0
- package/dist/commands/extensions/context.js.map +1 -0
- package/dist/commands/extensions/enable.d.ts +6 -0
- package/dist/commands/extensions/enable.d.ts.map +1 -0
- package/dist/commands/extensions/enable.js +180 -0
- package/dist/commands/extensions/enable.js.map +1 -0
- package/dist/commands/extensions/environment.d.ts +74 -0
- package/dist/commands/extensions/environment.d.ts.map +1 -0
- package/dist/commands/extensions/environment.js +168 -0
- package/dist/commands/extensions/environment.js.map +1 -0
- package/dist/commands/extensions/feature-scan.d.ts +48 -0
- package/dist/commands/extensions/feature-scan.d.ts.map +1 -0
- package/dist/commands/extensions/feature-scan.js +156 -0
- package/dist/commands/extensions/feature-scan.js.map +1 -0
- package/dist/commands/extensions/invoke.d.ts +60 -0
- package/dist/commands/extensions/invoke.d.ts.map +1 -0
- package/dist/commands/extensions/invoke.js +275 -0
- package/dist/commands/extensions/invoke.js.map +1 -0
- package/dist/commands/extensions/list.d.ts +5 -0
- package/dist/commands/extensions/list.d.ts.map +1 -0
- package/dist/commands/extensions/list.js +125 -0
- package/dist/commands/extensions/list.js.map +1 -0
- package/dist/commands/extensions/logs.d.ts +5 -0
- package/dist/commands/extensions/logs.d.ts.map +1 -0
- package/dist/commands/extensions/logs.js +74 -0
- package/dist/commands/extensions/logs.js.map +1 -0
- package/dist/commands/extensions/provision.d.ts +36 -0
- package/dist/commands/extensions/provision.d.ts.map +1 -0
- package/dist/commands/extensions/provision.js +137 -0
- package/dist/commands/extensions/provision.js.map +1 -0
- package/dist/commands/extensions/remove.d.ts +5 -0
- package/dist/commands/extensions/remove.d.ts.map +1 -0
- package/dist/commands/extensions/remove.js +77 -0
- package/dist/commands/extensions/remove.js.map +1 -0
- package/dist/commands/extensions/render.d.ts +16 -0
- package/dist/commands/extensions/render.d.ts.map +1 -0
- package/dist/commands/extensions/render.js +25 -0
- package/dist/commands/extensions/render.js.map +1 -0
- package/dist/commands/extensions/run.d.ts +30 -0
- package/dist/commands/extensions/run.d.ts.map +1 -0
- package/dist/commands/extensions/run.js +292 -0
- package/dist/commands/extensions/run.js.map +1 -0
- package/dist/commands/extensions/secret-store.d.ts +15 -0
- package/dist/commands/extensions/secret-store.d.ts.map +1 -0
- package/dist/commands/extensions/secret-store.js +164 -0
- package/dist/commands/extensions/secret-store.js.map +1 -0
- package/dist/commands/extensions/setup.d.ts +17 -0
- package/dist/commands/extensions/setup.d.ts.map +1 -0
- package/dist/commands/extensions/setup.js +94 -0
- package/dist/commands/extensions/setup.js.map +1 -0
- package/dist/commands/extensions/source.d.ts +47 -0
- package/dist/commands/extensions/source.d.ts.map +1 -0
- package/dist/commands/extensions/source.js +142 -0
- package/dist/commands/extensions/source.js.map +1 -0
- package/dist/commands/extensions/state.d.ts +62 -0
- package/dist/commands/extensions/state.d.ts.map +1 -0
- package/dist/commands/extensions/state.js +177 -0
- package/dist/commands/extensions/state.js.map +1 -0
- package/dist/commands/extensions/status.d.ts +9 -0
- package/dist/commands/extensions/status.d.ts.map +1 -0
- package/dist/commands/extensions/status.js +239 -0
- package/dist/commands/extensions/status.js.map +1 -0
- package/dist/commands/extensions.d.ts +3 -0
- package/dist/commands/extensions.d.ts.map +1 -0
- package/dist/commands/extensions.js +223 -0
- package/dist/commands/extensions.js.map +1 -0
- package/dist/commands/flow/index.d.ts +3 -0
- package/dist/commands/flow/index.d.ts.map +1 -0
- package/dist/commands/flow/index.js +295 -0
- package/dist/commands/flow/index.js.map +1 -0
- package/dist/commands/flow/limits.d.ts +12 -0
- package/dist/commands/flow/limits.d.ts.map +1 -0
- package/dist/commands/flow/limits.js +13 -0
- package/dist/commands/flow/limits.js.map +1 -0
- package/dist/commands/flow/output.d.ts +8 -0
- package/dist/commands/flow/output.d.ts.map +1 -0
- package/dist/commands/flow/output.js +11 -0
- package/dist/commands/flow/output.js.map +1 -0
- package/dist/commands/flow/render.d.ts +51 -0
- package/dist/commands/flow/render.d.ts.map +1 -0
- package/dist/commands/flow/render.js +220 -0
- package/dist/commands/flow/render.js.map +1 -0
- package/dist/commands/flow/select.d.ts +31 -0
- package/dist/commands/flow/select.d.ts.map +1 -0
- package/dist/commands/flow/select.js +62 -0
- package/dist/commands/flow/select.js.map +1 -0
- package/dist/commands/graph/boundaries-input.d.ts +26 -0
- package/dist/commands/graph/boundaries-input.d.ts.map +1 -0
- package/dist/commands/graph/boundaries-input.js +54 -0
- package/dist/commands/graph/boundaries-input.js.map +1 -0
- package/dist/commands/graph/boundaries.d.ts +4 -0
- package/dist/commands/graph/boundaries.d.ts.map +1 -0
- package/dist/commands/graph/boundaries.js +141 -0
- package/dist/commands/graph/boundaries.js.map +1 -0
- package/dist/commands/graph/bounds.d.ts +16 -0
- package/dist/commands/graph/bounds.d.ts.map +1 -0
- package/dist/commands/graph/bounds.js +22 -0
- package/dist/commands/graph/bounds.js.map +1 -0
- package/dist/commands/graph/category-clusters.d.ts +20 -0
- package/dist/commands/graph/category-clusters.d.ts.map +1 -0
- package/dist/commands/graph/category-clusters.js +158 -0
- package/dist/commands/graph/category-clusters.js.map +1 -0
- package/dist/commands/graph/feature-3d.d.ts +22 -0
- package/dist/commands/graph/feature-3d.d.ts.map +1 -0
- package/dist/commands/graph/feature-3d.js +114 -0
- package/dist/commands/graph/feature-3d.js.map +1 -0
- package/dist/commands/graph/feature-clusters.d.ts +17 -0
- package/dist/commands/graph/feature-clusters.d.ts.map +1 -0
- package/dist/commands/graph/feature-clusters.js +94 -0
- package/dist/commands/graph/feature-clusters.js.map +1 -0
- package/dist/commands/graph/feature-html.d.ts +26 -0
- package/dist/commands/graph/feature-html.d.ts.map +1 -0
- package/dist/commands/graph/feature-html.js +314 -0
- package/dist/commands/graph/feature-html.js.map +1 -0
- package/dist/commands/graph/feature-map.d.ts +31 -0
- package/dist/commands/graph/feature-map.d.ts.map +1 -0
- package/dist/commands/graph/feature-map.js +217 -0
- package/dist/commands/graph/feature-map.js.map +1 -0
- package/dist/commands/graph/feature-model.d.ts +55 -0
- package/dist/commands/graph/feature-model.d.ts.map +1 -0
- package/dist/commands/graph/feature-model.js +167 -0
- package/dist/commands/graph/feature-model.js.map +1 -0
- package/dist/commands/graph/feature-untangle-motion.d.ts +33 -0
- package/dist/commands/graph/feature-untangle-motion.d.ts.map +1 -0
- package/dist/commands/graph/feature-untangle-motion.js +155 -0
- package/dist/commands/graph/feature-untangle-motion.js.map +1 -0
- package/dist/commands/graph/index.d.ts +3 -0
- package/dist/commands/graph/index.d.ts.map +1 -0
- package/dist/commands/graph/index.js +414 -0
- package/dist/commands/graph/index.js.map +1 -0
- package/dist/commands/graph/render.d.ts +63 -0
- package/dist/commands/graph/render.d.ts.map +1 -0
- package/dist/commands/graph/render.js +352 -0
- package/dist/commands/graph/render.js.map +1 -0
- package/dist/commands/graph/select.d.ts +34 -0
- package/dist/commands/graph/select.d.ts.map +1 -0
- package/dist/commands/graph/select.js +55 -0
- package/dist/commands/graph/select.js.map +1 -0
- package/dist/commands/index/index.d.ts +6 -0
- package/dist/commands/index/index.d.ts.map +1 -0
- package/dist/commands/index/index.js +461 -0
- package/dist/commands/index/index.js.map +1 -0
- package/dist/commands/index/render.d.ts +53 -0
- package/dist/commands/index/render.d.ts.map +1 -0
- package/dist/commands/index/render.js +205 -0
- package/dist/commands/index/render.js.map +1 -0
- package/dist/commands/index/target.d.ts +34 -0
- package/dist/commands/index/target.d.ts.map +1 -0
- package/dist/commands/index/target.js +97 -0
- package/dist/commands/index/target.js.map +1 -0
- package/dist/commands/index-watch.d.ts +30 -0
- package/dist/commands/index-watch.d.ts.map +1 -0
- package/dist/commands/index-watch.js +138 -0
- package/dist/commands/index-watch.js.map +1 -0
- package/dist/commands/init/command.d.ts +25 -0
- package/dist/commands/init/command.d.ts.map +1 -0
- package/dist/commands/init/command.js +198 -0
- package/dist/commands/init/command.js.map +1 -0
- package/dist/commands/init/config-draft.d.ts +48 -0
- package/dist/commands/init/config-draft.d.ts.map +1 -0
- package/dist/commands/init/config-draft.js +201 -0
- package/dist/commands/init/config-draft.js.map +1 -0
- package/dist/commands/init/diff.d.ts +33 -0
- package/dist/commands/init/diff.d.ts.map +1 -0
- package/dist/commands/init/diff.js +109 -0
- package/dist/commands/init/diff.js.map +1 -0
- package/dist/commands/init/http-probe.d.ts +26 -0
- package/dist/commands/init/http-probe.d.ts.map +1 -0
- package/dist/commands/init/http-probe.js +144 -0
- package/dist/commands/init/http-probe.js.map +1 -0
- package/dist/commands/init/ignore-rules.d.ts +70 -0
- package/dist/commands/init/ignore-rules.d.ts.map +1 -0
- package/dist/commands/init/ignore-rules.js +146 -0
- package/dist/commands/init/ignore-rules.js.map +1 -0
- package/dist/commands/init/index.d.ts +33 -0
- package/dist/commands/init/index.d.ts.map +1 -0
- package/dist/commands/init/index.js +32 -0
- package/dist/commands/init/index.js.map +1 -0
- package/dist/commands/init/integrations-apply.d.ts +50 -0
- package/dist/commands/init/integrations-apply.d.ts.map +1 -0
- package/dist/commands/init/integrations-apply.js +452 -0
- package/dist/commands/init/integrations-apply.js.map +1 -0
- package/dist/commands/init/integrations-plan.d.ts +68 -0
- package/dist/commands/init/integrations-plan.d.ts.map +1 -0
- package/dist/commands/init/integrations-plan.js +515 -0
- package/dist/commands/init/integrations-plan.js.map +1 -0
- package/dist/commands/init/integrations.d.ts +5 -0
- package/dist/commands/init/integrations.d.ts.map +1 -0
- package/dist/commands/init/integrations.js +4 -0
- package/dist/commands/init/integrations.js.map +1 -0
- package/dist/commands/init/languages.d.ts +55 -0
- package/dist/commands/init/languages.d.ts.map +1 -0
- package/dist/commands/init/languages.js +245 -0
- package/dist/commands/init/languages.js.map +1 -0
- package/dist/commands/init/product-context.d.ts +63 -0
- package/dist/commands/init/product-context.d.ts.map +1 -0
- package/dist/commands/init/product-context.js +390 -0
- package/dist/commands/init/product-context.js.map +1 -0
- package/dist/commands/init/render.d.ts +38 -0
- package/dist/commands/init/render.d.ts.map +1 -0
- package/dist/commands/init/render.js +501 -0
- package/dist/commands/init/render.js.map +1 -0
- package/dist/commands/init/report.d.ts +24 -0
- package/dist/commands/init/report.d.ts.map +1 -0
- package/dist/commands/init/report.js +163 -0
- package/dist/commands/init/report.js.map +1 -0
- package/dist/commands/init/run.d.ts +71 -0
- package/dist/commands/init/run.d.ts.map +1 -0
- package/dist/commands/init/run.js +253 -0
- package/dist/commands/init/run.js.map +1 -0
- package/dist/commands/init/services.d.ts +82 -0
- package/dist/commands/init/services.d.ts.map +1 -0
- package/dist/commands/init/services.js +209 -0
- package/dist/commands/init/services.js.map +1 -0
- package/dist/commands/init/storage.d.ts +8 -0
- package/dist/commands/init/storage.d.ts.map +1 -0
- package/dist/commands/init/storage.js +102 -0
- package/dist/commands/init/storage.js.map +1 -0
- package/dist/commands/init/toml.d.ts +65 -0
- package/dist/commands/init/toml.d.ts.map +1 -0
- package/dist/commands/init/toml.js +159 -0
- package/dist/commands/init/toml.js.map +1 -0
- package/dist/commands/init/topology.d.ts +54 -0
- package/dist/commands/init/topology.d.ts.map +1 -0
- package/dist/commands/init/topology.js +146 -0
- package/dist/commands/init/topology.js.map +1 -0
- package/dist/commands/init/types.d.ts +334 -0
- package/dist/commands/init/types.d.ts.map +1 -0
- package/dist/commands/init/types.js +31 -0
- package/dist/commands/init/types.js.map +1 -0
- package/dist/commands/init/wizard-terminal.d.ts +36 -0
- package/dist/commands/init/wizard-terminal.d.ts.map +1 -0
- package/dist/commands/init/wizard-terminal.js +163 -0
- package/dist/commands/init/wizard-terminal.js.map +1 -0
- package/dist/commands/init/wizard.d.ts +25 -0
- package/dist/commands/init/wizard.d.ts.map +1 -0
- package/dist/commands/init/wizard.js +358 -0
- package/dist/commands/init/wizard.js.map +1 -0
- package/dist/commands/mcp.d.ts +4 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +111 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/product-test-runner.d.ts +4 -0
- package/dist/commands/product-test-runner.d.ts.map +1 -0
- package/dist/commands/product-test-runner.js +85 -0
- package/dist/commands/product-test-runner.js.map +1 -0
- package/dist/commands/product.d.ts +16 -0
- package/dist/commands/product.d.ts.map +1 -0
- package/dist/commands/product.js +262 -0
- package/dist/commands/product.js.map +1 -0
- package/dist/commands/query.d.ts +114 -0
- package/dist/commands/query.d.ts.map +1 -0
- package/dist/commands/query.js +783 -0
- package/dist/commands/query.js.map +1 -0
- package/dist/commands/scan.d.ts +10 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +302 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/sdd.d.ts +24 -0
- package/dist/commands/sdd.d.ts.map +1 -0
- package/dist/commands/sdd.js +195 -0
- package/dist/commands/sdd.js.map +1 -0
- package/dist/commands/unavailable.d.ts +40 -0
- package/dist/commands/unavailable.d.ts.map +1 -0
- package/dist/commands/unavailable.js +73 -0
- package/dist/commands/unavailable.js.map +1 -0
- package/dist/commands/watch/analyze.d.ts +69 -0
- package/dist/commands/watch/analyze.d.ts.map +1 -0
- package/dist/commands/watch/analyze.js +402 -0
- package/dist/commands/watch/analyze.js.map +1 -0
- package/dist/commands/watch/cli.d.ts +8 -0
- package/dist/commands/watch/cli.d.ts.map +1 -0
- package/dist/commands/watch/cli.js +97 -0
- package/dist/commands/watch/cli.js.map +1 -0
- package/dist/commands/watch/delta.d.ts +46 -0
- package/dist/commands/watch/delta.d.ts.map +1 -0
- package/dist/commands/watch/delta.js +170 -0
- package/dist/commands/watch/delta.js.map +1 -0
- package/dist/commands/watch/events.d.ts +214 -0
- package/dist/commands/watch/events.d.ts.map +1 -0
- package/dist/commands/watch/events.js +13 -0
- package/dist/commands/watch/events.js.map +1 -0
- package/dist/commands/watch/index.d.ts +19 -0
- package/dist/commands/watch/index.d.ts.map +1 -0
- package/dist/commands/watch/index.js +15 -0
- package/dist/commands/watch/index.js.map +1 -0
- package/dist/commands/watch/options.d.ts +43 -0
- package/dist/commands/watch/options.d.ts.map +1 -0
- package/dist/commands/watch/options.js +193 -0
- package/dist/commands/watch/options.js.map +1 -0
- package/dist/commands/watch/render.d.ts +26 -0
- package/dist/commands/watch/render.d.ts.map +1 -0
- package/dist/commands/watch/render.js +175 -0
- package/dist/commands/watch/render.js.map +1 -0
- package/dist/commands/watch/run.d.ts +14 -0
- package/dist/commands/watch/run.d.ts.map +1 -0
- package/dist/commands/watch/run.js +460 -0
- package/dist/commands/watch/run.js.map +1 -0
- package/dist/commands/watch/runtime.d.ts +67 -0
- package/dist/commands/watch/runtime.d.ts.map +1 -0
- package/dist/commands/watch/runtime.js +149 -0
- package/dist/commands/watch/runtime.js.map +1 -0
- package/dist/commands/watch-command.d.ts +3 -0
- package/dist/commands/watch-command.d.ts.map +1 -0
- package/dist/commands/watch-command.js +273 -0
- package/dist/commands/watch-command.js.map +1 -0
- package/dist/entry-point.d.ts +11 -0
- package/dist/entry-point.d.ts.map +1 -0
- package/dist/entry-point.js +65 -0
- package/dist/entry-point.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +245 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/boundaries-schema.d.ts +262 -0
- package/dist/mcp/boundaries-schema.d.ts.map +1 -0
- package/dist/mcp/boundaries-schema.js +183 -0
- package/dist/mcp/boundaries-schema.js.map +1 -0
- package/dist/mcp/default-runtime.d.ts +16 -0
- package/dist/mcp/default-runtime.d.ts.map +1 -0
- package/dist/mcp/default-runtime.js +718 -0
- package/dist/mcp/default-runtime.js.map +1 -0
- package/dist/mcp/envelope.d.ts +13 -0
- package/dist/mcp/envelope.d.ts.map +1 -0
- package/dist/mcp/envelope.js +29 -0
- package/dist/mcp/envelope.js.map +1 -0
- package/dist/mcp/index.d.ts +8 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +8 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/output-schemas.d.ts +5928 -0
- package/dist/mcp/output-schemas.d.ts.map +1 -0
- package/dist/mcp/output-schemas.js +2814 -0
- package/dist/mcp/output-schemas.js.map +1 -0
- package/dist/mcp/path-sandbox.d.ts +35 -0
- package/dist/mcp/path-sandbox.d.ts.map +1 -0
- package/dist/mcp/path-sandbox.js +128 -0
- package/dist/mcp/path-sandbox.js.map +1 -0
- package/dist/mcp/server.d.ts +155 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +257 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/stdio.d.ts +20 -0
- package/dist/mcp/stdio.d.ts.map +1 -0
- package/dist/mcp/stdio.js +71 -0
- package/dist/mcp/stdio.js.map +1 -0
- package/dist/mcp/tools.d.ts +355 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +319 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/types.d.ts +15 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +45 -0
- package/dist/mcp/types.js.map +1 -0
- package/package.json +99 -3
- package/src/cli/args.ts +231 -0
- package/src/cli/command.ts +146 -0
- package/src/cli/deadline.ts +56 -0
- package/src/cli/embedder-deadline.ts +187 -0
- package/src/cli/exit.ts +94 -0
- package/src/cli/graphs.ts +191 -0
- package/src/cli/index-freshness.ts +303 -0
- package/src/cli/index-refresh.ts +125 -0
- package/src/cli/index-state.ts +1217 -0
- package/src/cli/io.ts +56 -0
- package/src/cli/language-support.ts +203 -0
- package/src/cli/renewing-lease.ts +121 -0
- package/src/cli/search-graph-enrichment.ts +639 -0
- package/src/cli/system.ts +94 -0
- package/src/cli/vector-store-policy.ts +213 -0
- package/src/cli/version.ts +2 -0
- package/src/cli/workspace.ts +324 -0
- package/src/commands/complexity.ts +776 -0
- package/src/commands/doctor.languages.ts +187 -0
- package/src/commands/doctor.storage.ts +124 -0
- package/src/commands/doctor.ts +946 -0
- package/src/commands/extensions/add.ts +312 -0
- package/src/commands/extensions/configure.ts +82 -0
- package/src/commands/extensions/container.ts +209 -0
- package/src/commands/extensions/context.ts +109 -0
- package/src/commands/extensions/enable.ts +237 -0
- package/src/commands/extensions/environment.ts +218 -0
- package/src/commands/extensions/feature-scan.ts +232 -0
- package/src/commands/extensions/invoke.ts +368 -0
- package/src/commands/extensions/list.ts +158 -0
- package/src/commands/extensions/logs.ts +104 -0
- package/src/commands/extensions/provision.ts +206 -0
- package/src/commands/extensions/remove.ts +110 -0
- package/src/commands/extensions/render.ts +32 -0
- package/src/commands/extensions/run.ts +386 -0
- package/src/commands/extensions/secret-store.ts +223 -0
- package/src/commands/extensions/setup.ts +140 -0
- package/src/commands/extensions/source.ts +189 -0
- package/src/commands/extensions/state.ts +252 -0
- package/src/commands/extensions/status.ts +320 -0
- package/src/commands/extensions.ts +280 -0
- package/src/commands/flow/index.ts +402 -0
- package/src/commands/flow/limits.ts +14 -0
- package/src/commands/flow/output.ts +16 -0
- package/src/commands/flow/render.ts +318 -0
- package/src/commands/flow/select.ts +101 -0
- package/src/commands/graph/boundaries-input.ts +63 -0
- package/src/commands/graph/boundaries.ts +182 -0
- package/src/commands/graph/bounds.ts +25 -0
- package/src/commands/graph/category-clusters.ts +194 -0
- package/src/commands/graph/feature-3d.ts +141 -0
- package/src/commands/graph/feature-clusters.ts +125 -0
- package/src/commands/graph/feature-html.ts +336 -0
- package/src/commands/graph/feature-map.ts +270 -0
- package/src/commands/graph/feature-model.ts +234 -0
- package/src/commands/graph/feature-untangle-motion.ts +192 -0
- package/src/commands/graph/index.ts +562 -0
- package/src/commands/graph/render.ts +503 -0
- package/src/commands/graph/select.ts +77 -0
- package/src/commands/index/index.ts +595 -0
- package/src/commands/index/render.ts +325 -0
- package/src/commands/index/target.ts +136 -0
- package/src/commands/index-watch.ts +206 -0
- package/src/commands/init/command.ts +238 -0
- package/src/commands/init/config-draft.ts +235 -0
- package/src/commands/init/diff.ts +117 -0
- package/src/commands/init/http-probe.ts +150 -0
- package/src/commands/init/ignore-rules.ts +170 -0
- package/src/commands/init/index.ts +63 -0
- package/src/commands/init/integrations-apply.ts +618 -0
- package/src/commands/init/integrations-plan.ts +634 -0
- package/src/commands/init/integrations.ts +8 -0
- package/src/commands/init/languages.ts +320 -0
- package/src/commands/init/product-context.ts +576 -0
- package/src/commands/init/render.ts +598 -0
- package/src/commands/init/report.ts +204 -0
- package/src/commands/init/run.ts +349 -0
- package/src/commands/init/services.ts +271 -0
- package/src/commands/init/storage.ts +136 -0
- package/src/commands/init/toml.ts +174 -0
- package/src/commands/init/topology.ts +192 -0
- package/src/commands/init/types.ts +366 -0
- package/src/commands/init/wizard-terminal.ts +206 -0
- package/src/commands/init/wizard.ts +450 -0
- package/src/commands/mcp.ts +123 -0
- package/src/commands/product-test-runner.ts +80 -0
- package/src/commands/product.ts +331 -0
- package/src/commands/query.ts +1032 -0
- package/src/commands/scan.ts +360 -0
- package/src/commands/sdd.ts +243 -0
- package/src/commands/unavailable.ts +92 -0
- package/src/commands/watch/README.md +160 -0
- package/src/commands/watch/analyze.ts +600 -0
- package/src/commands/watch/cli.ts +108 -0
- package/src/commands/watch/delta.ts +186 -0
- package/src/commands/watch/events.ts +235 -0
- package/src/commands/watch/index.ts +53 -0
- package/src/commands/watch/options.ts +234 -0
- package/src/commands/watch/render.ts +240 -0
- package/src/commands/watch/run.ts +553 -0
- package/src/commands/watch/runtime.ts +167 -0
- package/src/commands/watch-command.ts +294 -0
- package/src/entry-point.ts +67 -0
- package/src/index.ts +291 -0
- package/src/mcp/boundaries-schema.ts +193 -0
- package/src/mcp/default-runtime.ts +1034 -0
- package/src/mcp/envelope.ts +57 -0
- package/src/mcp/index.ts +28 -0
- package/src/mcp/output-schemas.ts +3071 -0
- package/src/mcp/path-sandbox.ts +156 -0
- package/src/mcp/server.ts +358 -0
- package/src/mcp/stdio.ts +92 -0
- package/src/mcp/tools.ts +563 -0
- package/src/mcp/types.ts +66 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `untangle complexity` — die einzige Analyse, die HEUTE vollstaendig laeuft.
|
|
3
|
+
*
|
|
4
|
+
* Sie braucht keinen Index und keinen Dienst: der Scanner findet die Dateien,
|
|
5
|
+
* die parser-registry parst sie, @untangle-code/complexity rechnet. Alles im
|
|
6
|
+
* Prozess, alles deterministisch.
|
|
7
|
+
*
|
|
8
|
+
* ZWEI ENTSCHEIDUNGEN, DIE MAN KENNEN MUSS:
|
|
9
|
+
*
|
|
10
|
+
* 1. Eine Datei mit beschaedigtem Syntaxbaum (`parseQuality !== "complete"`)
|
|
11
|
+
* geht in KEINE Zahl ein. Ein kaputter Baum liefert falsche Scope-Grenzen,
|
|
12
|
+
* und eine falsche Hotspot-Liste ist schlimmer als eine kurze: nach ihr
|
|
13
|
+
* wird priorisiert. Die Datei steht dafuer im Skip-Ledger.
|
|
14
|
+
* 2. Die Summen sind die FUNKTIONS-LESART: aeusserste Ausfuehrungseinheiten
|
|
15
|
+
* gehen mit ihrem INKLUSIVEN Wert ein.
|
|
16
|
+
* Innere Funktionen sind darin enthalten; Scopes ausserhalb einer
|
|
17
|
+
* Ausfuehrungseinheit tragen nur ihren Eigenanteil bei (execution_unit).
|
|
18
|
+
*
|
|
19
|
+
* 3. PROSA WIRD NICHT MIT CODE VERRECHNET (WP-217, vision.md §1c). Ein
|
|
20
|
+
* Markdown-Dokument hat keine Entscheidungspunkte und keine
|
|
21
|
+
* Ausfuehrungseinheiten; zyklomatische Komplexitaet darueber ist keine
|
|
22
|
+
* schlechte Zahl, sondern gar keine. Prosa bekommt deshalb eine EIGENE
|
|
23
|
+
* Auswertung mit eigenen Massen (Struktur- und Verweislast) und eine
|
|
24
|
+
* eigene Liste. Die beiden Summen beruehren einander nie — die
|
|
25
|
+
* Prosa-Messwerte sind `ProseNumberV1`-Objekte und passen gar nicht in
|
|
26
|
+
* eine Code-Summe.
|
|
27
|
+
* 4. WAS UEBERSPRUNGEN WIRD, BEKOMMT DEN RICHTIGEN GRUND. Eine
|
|
28
|
+
* `untangle.toml` ist nicht "unsupported_language" — sie ist verstanden
|
|
29
|
+
* (Stufe `text`), es ist nur keine Komplexitaetsmetrik dafuer definiert:
|
|
30
|
+
* `no_metric_defined`. Eine `pnpm-lock.yaml` ist `generated_content`.
|
|
31
|
+
* Ein falscher Grund ist ein stiller Datenverlust mit Etikett.
|
|
32
|
+
*
|
|
33
|
+
* Fuer „continuous complexity monitoring": `--max-cognitive` und
|
|
34
|
+
* `--max-cyclomatic` machen daraus ein Gate mit Exit-Code 5.
|
|
35
|
+
*/
|
|
36
|
+
import { type ProseMetricsV1, type SkipLedgerEntryV1 } from "@untangle-code/domain";
|
|
37
|
+
import type { Command } from "../cli/command.js";
|
|
38
|
+
interface SymbolEntry {
|
|
39
|
+
readonly filePath: string;
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly kind: string;
|
|
42
|
+
readonly line: number;
|
|
43
|
+
readonly executionUnit: boolean;
|
|
44
|
+
readonly cognitive: number;
|
|
45
|
+
readonly cyclomatic: number;
|
|
46
|
+
readonly sloc: number;
|
|
47
|
+
}
|
|
48
|
+
export interface AnalysisResult {
|
|
49
|
+
readonly root: string;
|
|
50
|
+
readonly filesDiscovered: number;
|
|
51
|
+
readonly filesAnalyzed: number;
|
|
52
|
+
/** Dokumente mit Prosa-Metriken; getrennt gezaehlt, weil getrennt gemessen. */
|
|
53
|
+
readonly proseAnalyzed: number;
|
|
54
|
+
readonly symbols: readonly SymbolEntry[];
|
|
55
|
+
/** Prosa-Dokumente mit ihrer eigenen Metrikfamilie; NIE Teil von `totals`. */
|
|
56
|
+
readonly prose: readonly ProseMetricsV1[];
|
|
57
|
+
readonly skipped: readonly SkipLedgerEntryV1[];
|
|
58
|
+
readonly totalsReading: "execution_unit";
|
|
59
|
+
readonly totals: {
|
|
60
|
+
/** All function-like scopes, including nested functions shown as hotspots. */
|
|
61
|
+
readonly executionUnits: number;
|
|
62
|
+
/** Outermost execution units that contribute inclusive values to totals. */
|
|
63
|
+
readonly executionUnitRoots: number;
|
|
64
|
+
readonly cognitive: number;
|
|
65
|
+
readonly cyclomatic: number;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export declare const complexityCommand: Command;
|
|
69
|
+
/** Shared local analysis for complexity and scan; every excluded file has a ledger entry. */
|
|
70
|
+
export declare function analyze(root: string, signal: AbortSignal): Promise<AnalysisResult>;
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=complexity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complexity.d.ts","sourceRoot":"","sources":["../../src/commands/complexity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAiBH,OAAO,EAUL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAEvB,MAAM,uBAAuB,CAAC;AAa/B,OAAO,KAAK,EAAE,OAAO,EAAkB,MAAM,mBAAmB,CAAC;AAYjE,UAAU,WAAW;IACnB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,+EAA+E;IAC/E,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC/C,QAAQ,CAAC,aAAa,EAAE,gBAAgB,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE;QACf,8EAA8E;QAC9E,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC,4EAA4E;QAC5E,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;QACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAyCD,eAAO,MAAM,iBAAiB,EAAE,OA0H/B,CAAC;AA8JF,6FAA6F;AAC7F,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CA8OxF"}
|
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `untangle complexity` — die einzige Analyse, die HEUTE vollstaendig laeuft.
|
|
3
|
+
*
|
|
4
|
+
* Sie braucht keinen Index und keinen Dienst: der Scanner findet die Dateien,
|
|
5
|
+
* die parser-registry parst sie, @untangle-code/complexity rechnet. Alles im
|
|
6
|
+
* Prozess, alles deterministisch.
|
|
7
|
+
*
|
|
8
|
+
* ZWEI ENTSCHEIDUNGEN, DIE MAN KENNEN MUSS:
|
|
9
|
+
*
|
|
10
|
+
* 1. Eine Datei mit beschaedigtem Syntaxbaum (`parseQuality !== "complete"`)
|
|
11
|
+
* geht in KEINE Zahl ein. Ein kaputter Baum liefert falsche Scope-Grenzen,
|
|
12
|
+
* und eine falsche Hotspot-Liste ist schlimmer als eine kurze: nach ihr
|
|
13
|
+
* wird priorisiert. Die Datei steht dafuer im Skip-Ledger.
|
|
14
|
+
* 2. Die Summen sind die FUNKTIONS-LESART: aeusserste Ausfuehrungseinheiten
|
|
15
|
+
* gehen mit ihrem INKLUSIVEN Wert ein.
|
|
16
|
+
* Innere Funktionen sind darin enthalten; Scopes ausserhalb einer
|
|
17
|
+
* Ausfuehrungseinheit tragen nur ihren Eigenanteil bei (execution_unit).
|
|
18
|
+
*
|
|
19
|
+
* 3. PROSA WIRD NICHT MIT CODE VERRECHNET (WP-217, vision.md §1c). Ein
|
|
20
|
+
* Markdown-Dokument hat keine Entscheidungspunkte und keine
|
|
21
|
+
* Ausfuehrungseinheiten; zyklomatische Komplexitaet darueber ist keine
|
|
22
|
+
* schlechte Zahl, sondern gar keine. Prosa bekommt deshalb eine EIGENE
|
|
23
|
+
* Auswertung mit eigenen Massen (Struktur- und Verweislast) und eine
|
|
24
|
+
* eigene Liste. Die beiden Summen beruehren einander nie — die
|
|
25
|
+
* Prosa-Messwerte sind `ProseNumberV1`-Objekte und passen gar nicht in
|
|
26
|
+
* eine Code-Summe.
|
|
27
|
+
* 4. WAS UEBERSPRUNGEN WIRD, BEKOMMT DEN RICHTIGEN GRUND. Eine
|
|
28
|
+
* `untangle.toml` ist nicht "unsupported_language" — sie ist verstanden
|
|
29
|
+
* (Stufe `text`), es ist nur keine Komplexitaetsmetrik dafuer definiert:
|
|
30
|
+
* `no_metric_defined`. Eine `pnpm-lock.yaml` ist `generated_content`.
|
|
31
|
+
* Ein falscher Grund ist ein stiller Datenverlust mit Etikett.
|
|
32
|
+
*
|
|
33
|
+
* Fuer „continuous complexity monitoring": `--max-cognitive` und
|
|
34
|
+
* `--max-cyclomatic` machen daraus ein Gate mit Exit-Code 5.
|
|
35
|
+
*/
|
|
36
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
37
|
+
import path from "node:path";
|
|
38
|
+
import { aggregateScopeTree, buildSymbolIR, compareProseByStructureLoad, computeCognitive, computeCyclomatic, computeProseMetrics, containsRange, selectSymbolFacts, withUniqueScopeIds, } from "@untangle-code/complexity";
|
|
39
|
+
import { COGNITIVE_ALGORITHM_ID, METRICS_VERSION, buildSkipLedgerEntry, classifyAdapterFailure, classifyTextFormat, compareCodepoints, formatProseNumber, } from "@untangle-code/domain";
|
|
40
|
+
import { createParserRegistry } from "@untangle-code/parser-registry";
|
|
41
|
+
import { discoverFiles } from "@untangle-code/scanner";
|
|
42
|
+
import { NodeFileSystem } from "@untangle-code/scanner/node-fs";
|
|
43
|
+
import { enumFlag, integerFlag, numberFlag, stringFlag, } from "../cli/args.js";
|
|
44
|
+
import { EXIT, OperationalError } from "../cli/exit.js";
|
|
45
|
+
import { line, note } from "../cli/io.js";
|
|
46
|
+
import { errorMessage } from "../cli/workspace.js";
|
|
47
|
+
/**
|
|
48
|
+
* Scope-Arten, die eine eigene Ausfuehrungseinheit sind. `kind` ist ein
|
|
49
|
+
* adapterspezifischer String; @untangle-code/complexity dokumentiert bewusst
|
|
50
|
+
* keine Sprach-Taxonomie, also steht die Zuordnung hier.
|
|
51
|
+
*/
|
|
52
|
+
const EXECUTION_UNIT_KINDS = new Set(["function", "method", "constructor", "lambda"]);
|
|
53
|
+
const FLAGS = {
|
|
54
|
+
root: {
|
|
55
|
+
kind: "string",
|
|
56
|
+
placeholder: "PATH",
|
|
57
|
+
describe: "Directory to analyze.",
|
|
58
|
+
defaultLabel: "current directory",
|
|
59
|
+
},
|
|
60
|
+
top: {
|
|
61
|
+
kind: "number",
|
|
62
|
+
placeholder: "N",
|
|
63
|
+
describe: "Maximum hotspot entries.",
|
|
64
|
+
defaultLabel: "20",
|
|
65
|
+
},
|
|
66
|
+
format: {
|
|
67
|
+
kind: "string",
|
|
68
|
+
placeholder: "text|json|jsonl",
|
|
69
|
+
describe: "Output format.",
|
|
70
|
+
defaultLabel: "text",
|
|
71
|
+
},
|
|
72
|
+
"max-cognitive": {
|
|
73
|
+
kind: "number",
|
|
74
|
+
placeholder: "N",
|
|
75
|
+
describe: "Gate: no symbol may exceed this cognitive value.",
|
|
76
|
+
},
|
|
77
|
+
"max-cyclomatic": {
|
|
78
|
+
kind: "number",
|
|
79
|
+
placeholder: "N",
|
|
80
|
+
describe: "Gate: no symbol may exceed this cyclomatic value.",
|
|
81
|
+
},
|
|
82
|
+
"include-nested": {
|
|
83
|
+
kind: "boolean",
|
|
84
|
+
describe: "Also show scopes that are not separate execution units.",
|
|
85
|
+
},
|
|
86
|
+
prose: {
|
|
87
|
+
kind: "boolean",
|
|
88
|
+
describe: "Show only prose analysis (documents instead of symbols).",
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
export const complexityCommand = {
|
|
92
|
+
spec: {
|
|
93
|
+
name: "complexity",
|
|
94
|
+
implementedBy: "commands/complexity.js",
|
|
95
|
+
summary: "Measure complexity without an index or services",
|
|
96
|
+
usage: "untangle complexity [--root=<PATH>] [--top=<N>] [--max-cognitive=<N>]",
|
|
97
|
+
details: [
|
|
98
|
+
"Reads files directly, parses them with real language adapters and computes cognitive and cyclomatic complexity per symbol. No index, Qdrant or Ollama is required.",
|
|
99
|
+
"Totals use execution_unit: outermost functions contribute inclusive values; outside them, only self contributions count. Nested functions are not added twice. executionUnits counts all functions; executionUnitRoots counts only outermost functions. Individual hotspots remain visible.",
|
|
100
|
+
"Files with damaged syntax trees contribute to no measurement and appear in the skip ledger. This prevents an incorrect hotspot ranking from appearing valid.",
|
|
101
|
+
"--max-cognitive and --max-cyclomatic turn the run into a gate, producing exit code 5 on a violation for monitoring loops or CI.",
|
|
102
|
+
],
|
|
103
|
+
flags: FLAGS,
|
|
104
|
+
examples: [
|
|
105
|
+
"untangle complexity",
|
|
106
|
+
"untangle complexity --top=5 --format=json",
|
|
107
|
+
"untangle complexity --max-cognitive=25",
|
|
108
|
+
],
|
|
109
|
+
exitCodes: [
|
|
110
|
+
[EXIT.ok, "Analysis completed without a gate violation."],
|
|
111
|
+
[EXIT.operational, "Unreadable directory or no built language adapter."],
|
|
112
|
+
[EXIT.usage, "Invalid arguments."],
|
|
113
|
+
[EXIT.gate, "A threshold was exceeded; analysis itself completed."],
|
|
114
|
+
[EXIT.cancelled, "Cancelled."],
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
async run(ctx, args) {
|
|
118
|
+
const format = enumFlag(args, "format", ["text", "json", "jsonl"], "text");
|
|
119
|
+
const top = integerFlag(args, "top", 20);
|
|
120
|
+
const includeNested = args.flags["include-nested"] === true;
|
|
121
|
+
const root = path.resolve(ctx.cwd, stringFlag(args, "root") ?? ".");
|
|
122
|
+
const maxCognitive = numberFlag(args, "max-cognitive");
|
|
123
|
+
const maxCyclomatic = numberFlag(args, "max-cyclomatic");
|
|
124
|
+
const result = await analyze(root, ctx.signal);
|
|
125
|
+
ctx.signal.throwIfAborted();
|
|
126
|
+
const shown = includeNested ? result.symbols : result.symbols.filter((s) => s.executionUnit);
|
|
127
|
+
const hotspots = [...shown]
|
|
128
|
+
.sort((a, b) => b.cognitive - a.cognitive ||
|
|
129
|
+
b.cyclomatic - a.cyclomatic ||
|
|
130
|
+
compareCodepoints(a.filePath, b.filePath) ||
|
|
131
|
+
a.line - b.line)
|
|
132
|
+
.slice(0, top);
|
|
133
|
+
const violations = collectViolations(shown, maxCognitive, maxCyclomatic);
|
|
134
|
+
// Eigene Ordnung, eigene Liste: Prosa steht nie in derselben Rangfolge
|
|
135
|
+
// wie Code, weil die Zahlen nicht dieselbe Bedeutung haben.
|
|
136
|
+
const proseRanked = [...result.prose].sort(compareProseByStructureLoad).slice(0, top);
|
|
137
|
+
const proseOnly = args.flags["prose"] === true;
|
|
138
|
+
if (format === "json") {
|
|
139
|
+
line(ctx.io, JSON.stringify({
|
|
140
|
+
schemaVersion: 1,
|
|
141
|
+
root: result.root,
|
|
142
|
+
filesDiscovered: result.filesDiscovered,
|
|
143
|
+
filesAnalyzed: result.filesAnalyzed,
|
|
144
|
+
filesProse: result.proseAnalyzed,
|
|
145
|
+
totalsReading: result.totalsReading,
|
|
146
|
+
totals: result.totals,
|
|
147
|
+
hotspots,
|
|
148
|
+
violations,
|
|
149
|
+
// Getrenntes Feld, getrennte Familie: die Werte sind Objekte mit
|
|
150
|
+
// Einheit (`ProseNumberV1`), keine blanken Zahlen — sie lassen
|
|
151
|
+
// sich gar nicht versehentlich zu `totals` addieren.
|
|
152
|
+
prose: proseRanked.map(proseSummary),
|
|
153
|
+
skipped: result.skipped,
|
|
154
|
+
}, null, 2));
|
|
155
|
+
}
|
|
156
|
+
else if (format === "jsonl") {
|
|
157
|
+
line(ctx.io, JSON.stringify({
|
|
158
|
+
schemaVersion: 1,
|
|
159
|
+
kind: "header",
|
|
160
|
+
root: result.root,
|
|
161
|
+
filesDiscovered: result.filesDiscovered,
|
|
162
|
+
filesAnalyzed: result.filesAnalyzed,
|
|
163
|
+
totalsReading: result.totalsReading,
|
|
164
|
+
totals: result.totals,
|
|
165
|
+
filesProse: result.proseAnalyzed,
|
|
166
|
+
skippedCount: result.skipped.length,
|
|
167
|
+
}));
|
|
168
|
+
// `record` steht vorn, `kind` des Symbols bleibt erhalten — zwei
|
|
169
|
+
// verschiedene Begriffe, also zwei verschiedene Feldnamen.
|
|
170
|
+
for (const entry of hotspots)
|
|
171
|
+
line(ctx.io, JSON.stringify({ record: "symbol", ...entry }));
|
|
172
|
+
for (const entry of violations)
|
|
173
|
+
line(ctx.io, JSON.stringify({ record: "violation", ...entry }));
|
|
174
|
+
for (const entry of proseRanked)
|
|
175
|
+
line(ctx.io, JSON.stringify({ record: "document", ...proseSummary(entry) }));
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
renderText(ctx, result, hotspots, includeNested, proseRanked, proseOnly);
|
|
179
|
+
}
|
|
180
|
+
if (violations.length > 0) {
|
|
181
|
+
note(ctx.io, "");
|
|
182
|
+
note(ctx.io, `${String(violations.length)} threshold violation(s):`);
|
|
183
|
+
for (const violation of violations) {
|
|
184
|
+
note(ctx.io, ` ${violation.filePath}:${String(violation.line)} ${violation.name} ` +
|
|
185
|
+
`${violation.metric}=${String(violation.value)} > ${String(violation.threshold)}`);
|
|
186
|
+
}
|
|
187
|
+
note(ctx.io, "");
|
|
188
|
+
note(ctx.io, "Next step: `untangle complexity --top=5` shows the largest hotspots first.");
|
|
189
|
+
return EXIT.gate;
|
|
190
|
+
}
|
|
191
|
+
return EXIT.ok;
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
function collectViolations(symbols, maxCognitive, maxCyclomatic) {
|
|
195
|
+
const out = [];
|
|
196
|
+
for (const symbol of symbols) {
|
|
197
|
+
if (maxCognitive !== undefined && symbol.cognitive > maxCognitive) {
|
|
198
|
+
out.push({
|
|
199
|
+
filePath: symbol.filePath,
|
|
200
|
+
line: symbol.line,
|
|
201
|
+
name: symbol.name,
|
|
202
|
+
metric: "cognitive",
|
|
203
|
+
value: symbol.cognitive,
|
|
204
|
+
threshold: maxCognitive,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
if (maxCyclomatic !== undefined && symbol.cyclomatic > maxCyclomatic) {
|
|
208
|
+
out.push({
|
|
209
|
+
filePath: symbol.filePath,
|
|
210
|
+
line: symbol.line,
|
|
211
|
+
name: symbol.name,
|
|
212
|
+
metric: "cyclomatic",
|
|
213
|
+
value: symbol.cyclomatic,
|
|
214
|
+
threshold: maxCyclomatic,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return out.sort((a, b) => b.value - a.value ||
|
|
219
|
+
compareCodepoints(a.filePath, b.filePath) ||
|
|
220
|
+
a.line - b.line ||
|
|
221
|
+
compareCodepoints(a.metric, b.metric));
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Die serialisierbare Kurzform eines Prosa-Ergebnisses.
|
|
225
|
+
*
|
|
226
|
+
* Die Belegfelder (`sections`, `links`) bleiben absichtlich draussen: sie
|
|
227
|
+
* sind bei `spec.md` vierstellig lang und wuerden die Ausgabe unbrauchbar
|
|
228
|
+
* machen. Was hier steht, sind die Messwerte selbst — als Objekte mit
|
|
229
|
+
* Einheit, damit auch im JSON sichtbar bleibt, dass es eine ANDERE Familie
|
|
230
|
+
* ist als `totals`.
|
|
231
|
+
*/
|
|
232
|
+
function proseSummary(metrics) {
|
|
233
|
+
return {
|
|
234
|
+
path: metrics.path,
|
|
235
|
+
metricsVersion: metrics.metricsVersion,
|
|
236
|
+
structureLoad: metrics.structureLoad,
|
|
237
|
+
sectionCount: metrics.sectionCount,
|
|
238
|
+
sectionDepth: metrics.sectionDepth,
|
|
239
|
+
maxSectionLines: metrics.maxSectionLines,
|
|
240
|
+
linkDensity: metrics.linkDensity,
|
|
241
|
+
unresolvedLinkRatio: metrics.unresolvedLinkRatio,
|
|
242
|
+
repetitionRatio: metrics.repetitionRatio,
|
|
243
|
+
contentLines: metrics.contentLines,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function renderText(ctx, result, hotspots, includeNested, prose, proseOnly) {
|
|
247
|
+
line(ctx.io, `Root: ${result.root}`);
|
|
248
|
+
line(ctx.io, `Files discovered: ${String(result.filesDiscovered)}`);
|
|
249
|
+
line(ctx.io, `Files measured: ${String(result.filesAnalyzed)} (Code)`);
|
|
250
|
+
line(ctx.io, `Documents: ${String(result.proseAnalyzed)} (prose)`);
|
|
251
|
+
line(ctx.io, `Skipped: ${String(result.skipped.length)} (with reasons; see --format=json)`);
|
|
252
|
+
if (!proseOnly) {
|
|
253
|
+
line(ctx.io, "");
|
|
254
|
+
line(ctx.io, `Execution units: ${String(result.totals.executionUnits)}` +
|
|
255
|
+
` Cognitive total: ${String(result.totals.cognitive)}` +
|
|
256
|
+
` Cyclomatic total: ${String(result.totals.cyclomatic)}`);
|
|
257
|
+
line(ctx.io, "");
|
|
258
|
+
line(ctx.io, `Totals: execution_unit; ${String(result.totals.executionUnitRoots)} outermost units; nested functions are not added twice.`);
|
|
259
|
+
line(ctx.io, `HOTSPOTS (${includeNested ? "all scopes" : "execution units only"})`);
|
|
260
|
+
if (hotspots.length === 0) {
|
|
261
|
+
line(ctx.io, " (none)");
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
line(ctx.io, " cognitive cyclomatic sloc location");
|
|
265
|
+
for (const entry of hotspots) {
|
|
266
|
+
line(ctx.io, ` ${String(entry.cognitive).padStart(9)} ${String(entry.cyclomatic).padStart(10)} ` +
|
|
267
|
+
`${String(entry.sloc).padStart(4)} ${entry.filePath}:${String(entry.line)} ${entry.name}`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
renderProse(ctx, prose);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Die Prosa-Tafel. Sie steht bewusst UNTER einer eigenen Ueberschrift und
|
|
275
|
+
* mit eigenen Spaltennamen: kein Wert aus dieser Tabelle darf mit einem Wert
|
|
276
|
+
* aus der Hotspot-Tabelle verglichen oder addiert werden, und die Ausgabe
|
|
277
|
+
* soll das auch optisch klarmachen.
|
|
278
|
+
*/
|
|
279
|
+
function renderProse(ctx, prose) {
|
|
280
|
+
line(ctx.io, "");
|
|
281
|
+
line(ctx.io, "PROSE (separate metric family; never combined with code metrics)");
|
|
282
|
+
if (prose.length === 0) {
|
|
283
|
+
line(ctx.io, " (no documents)");
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
line(ctx.io, " Structural load = sum of all section heading levels.");
|
|
287
|
+
line(ctx.io, "");
|
|
288
|
+
line(ctx.io, " load sectns depth max-lines links/100 unresolved repeats document");
|
|
289
|
+
for (const entry of prose) {
|
|
290
|
+
line(ctx.io, ` ${String(entry.structureLoad.value).padStart(5)}` +
|
|
291
|
+
` ${String(entry.sectionCount.value).padStart(6)}` +
|
|
292
|
+
` ${String(entry.sectionDepth.value).padStart(5)}` +
|
|
293
|
+
` ${String(entry.maxSectionLines.value).padStart(9)}` +
|
|
294
|
+
` ${entry.linkDensity.value.toFixed(1).padStart(12)}` +
|
|
295
|
+
` ${(entry.unresolvedLinkRatio === null
|
|
296
|
+
? "n/a"
|
|
297
|
+
: formatProseNumber(entry.unresolvedLinkRatio)).padStart(7)}` +
|
|
298
|
+
` ${formatProseNumber(entry.repetitionRatio).padStart(7)}` +
|
|
299
|
+
` ${entry.path}`);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/* --------------------------------------------------------------------- */
|
|
303
|
+
/** Shared local analysis for complexity and scan; every excluded file has a ledger entry. */
|
|
304
|
+
export async function analyze(root, signal) {
|
|
305
|
+
const registry = createParserRegistry();
|
|
306
|
+
const fs = new NodeFileSystem();
|
|
307
|
+
if ((await fs.stat(root))?.kind !== "directory") {
|
|
308
|
+
throw new OperationalError(`Directory "${root}" does not exist or is not a directory.`, "Check --root and read permissions.");
|
|
309
|
+
}
|
|
310
|
+
const totals = { executionUnits: 0, executionUnitRoots: 0, cognitive: 0, cyclomatic: 0 };
|
|
311
|
+
const skipped = [];
|
|
312
|
+
const symbols = [];
|
|
313
|
+
const prose = [];
|
|
314
|
+
let filesDiscovered = 0;
|
|
315
|
+
let filesAnalyzed = 0;
|
|
316
|
+
let proseAnalyzed = 0;
|
|
317
|
+
/**
|
|
318
|
+
* Aufloeser fuer relative Dateiverweise in Prosa. Er sieht auf die Platte —
|
|
319
|
+
* deshalb steht er HIER und nicht in @untangle-code/complexity, das
|
|
320
|
+
* I/O-frei bleibt. Ohne ihn bliebe `unresolvedLinkRatio` `null`, und das
|
|
321
|
+
* waere ein Zustandsvermerk statt eines Messwerts (vision.md §1d).
|
|
322
|
+
*/
|
|
323
|
+
const resolveLink = (documentPath, targetFilePath) => {
|
|
324
|
+
const base = path.dirname(path.resolve(root, documentPath));
|
|
325
|
+
return existsSync(path.resolve(base, targetFilePath));
|
|
326
|
+
};
|
|
327
|
+
const stream = discoverFiles({
|
|
328
|
+
fs,
|
|
329
|
+
roots: [root],
|
|
330
|
+
repoRoot: root,
|
|
331
|
+
onSkip: (skip) => {
|
|
332
|
+
skipped.push(buildSkipLedgerEntry({
|
|
333
|
+
stage: "scan",
|
|
334
|
+
subjectKind: "file",
|
|
335
|
+
path: skip.relativePath,
|
|
336
|
+
reason: scannerSkipReason(skip.reason),
|
|
337
|
+
detail: `Excluded by the scanner (${skip.reason})` +
|
|
338
|
+
(skip.detail === undefined ? "." : `: ${skip.detail}`),
|
|
339
|
+
recoverable: skip.reason === "unreadable",
|
|
340
|
+
}));
|
|
341
|
+
},
|
|
342
|
+
});
|
|
343
|
+
try {
|
|
344
|
+
for await (const file of stream) {
|
|
345
|
+
// Ein Abbruch ist kein erfolgreiches Teilergebnis. Insbesondere MCP
|
|
346
|
+
// muss CANCELLED statt `ok: true` mit einer zufaelligen Praefixmenge
|
|
347
|
+
// erhalten.
|
|
348
|
+
signal.throwIfAborted();
|
|
349
|
+
filesDiscovered++;
|
|
350
|
+
// Maschinell erzeugte Dateien werden VOR der Adapterfrage aussortiert:
|
|
351
|
+
// eine `pnpm-lock.yaml` ist gueltiges YAML, aber niemandes Text. Der
|
|
352
|
+
// Grund gehoert deshalb an den Inhalt, nicht an die Sprache.
|
|
353
|
+
if (classifyTextFormat(file.relativePath) === "generated") {
|
|
354
|
+
skipped.push(buildSkipLedgerEntry({
|
|
355
|
+
stage: "parse",
|
|
356
|
+
subjectKind: "file",
|
|
357
|
+
path: file.relativePath,
|
|
358
|
+
reason: "generated_content",
|
|
359
|
+
detail: "Generated file (such as a lockfile). It contains no authored " +
|
|
360
|
+
"statement to measure and contributes to no measurement.",
|
|
361
|
+
recoverable: false,
|
|
362
|
+
}));
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
const adapter = registry.getAdapterForPath(file.relativePath);
|
|
366
|
+
if (adapter === null) {
|
|
367
|
+
skipped.push(buildSkipLedgerEntry({
|
|
368
|
+
stage: "parse",
|
|
369
|
+
subjectKind: "file",
|
|
370
|
+
path: file.relativePath,
|
|
371
|
+
reason: "unsupported_language",
|
|
372
|
+
detail: `No language adapter for "${file.languageId}"; this file contributes to no measurement.`,
|
|
373
|
+
recoverable: false,
|
|
374
|
+
}));
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
let content;
|
|
378
|
+
try {
|
|
379
|
+
content = readFileSync(file.absolutePath, "utf8");
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
skipped.push(buildSkipLedgerEntry({
|
|
383
|
+
stage: "scan",
|
|
384
|
+
subjectKind: "file",
|
|
385
|
+
path: file.relativePath,
|
|
386
|
+
reason: "provider_unavailable",
|
|
387
|
+
detail: `Cannot read file: ${errorMessage(error)}`,
|
|
388
|
+
recoverable: true,
|
|
389
|
+
}));
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
// WP-217: Stufe `text` heisst NICHT "weniger Code", sondern "kein
|
|
393
|
+
// Code". Der Weg trennt sich hier, damit nie eine Prosa-Zahl in eine
|
|
394
|
+
// Code-Summe und nie eine Code-Metrik auf ein Dokument geraet.
|
|
395
|
+
if (adapter.supportLevel === "text") {
|
|
396
|
+
if (classifyTextFormat(file.relativePath) === "prose") {
|
|
397
|
+
prose.push(computeProseMetrics(file.relativePath, content, { resolveLink }));
|
|
398
|
+
proseAnalyzed++;
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
skipped.push(buildSkipLedgerEntry({
|
|
402
|
+
stage: "parse",
|
|
403
|
+
subjectKind: "file",
|
|
404
|
+
path: file.relativePath,
|
|
405
|
+
reason: "no_metric_defined",
|
|
406
|
+
detail: `Format "${file.languageId}" is supported (tier "text": chunks and search ` +
|
|
407
|
+
"work), but structured configuration has no control flow or " +
|
|
408
|
+
"section structure; neither a code metric nor a prose metric is " +
|
|
409
|
+
"defined for it.",
|
|
410
|
+
recoverable: false,
|
|
411
|
+
}));
|
|
412
|
+
}
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
let parsed;
|
|
416
|
+
try {
|
|
417
|
+
parsed = adapter.parse({
|
|
418
|
+
fileId: file.relativePath,
|
|
419
|
+
repoId: "cli",
|
|
420
|
+
refId: "cli:working-tree",
|
|
421
|
+
path: file.relativePath,
|
|
422
|
+
languageId: file.languageId,
|
|
423
|
+
content,
|
|
424
|
+
contentHash: file.contentHash,
|
|
425
|
+
sizeBytes: file.sizeBytes,
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
catch (error) {
|
|
429
|
+
// WP-216: NIE `errorMessage(error)` als Grund durchreichen. "Invalid
|
|
430
|
+
// argument" ist keine Diagnose — `classifyAdapterFailure` bildet jede
|
|
431
|
+
// Adapterausnahme auf einen BENANNTEN Grund samt Messwerten ab, der
|
|
432
|
+
// Rohtext ueberlebt nur als Anhang im Detail (E4).
|
|
433
|
+
const failure = classifyAdapterFailure(error, { sizeBytes: file.sizeBytes });
|
|
434
|
+
skipped.push(buildSkipLedgerEntry({
|
|
435
|
+
stage: "parse",
|
|
436
|
+
subjectKind: "file",
|
|
437
|
+
path: file.relativePath,
|
|
438
|
+
reason: failure.reason,
|
|
439
|
+
detail: failure.detail,
|
|
440
|
+
recoverable: failure.recoverable,
|
|
441
|
+
}));
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
if (parsed.ast === null || parsed.parseQuality !== "complete") {
|
|
445
|
+
skipped.push(buildSkipLedgerEntry({
|
|
446
|
+
stage: "parse",
|
|
447
|
+
subjectKind: "file",
|
|
448
|
+
path: file.relativePath,
|
|
449
|
+
reason: "parse_failed",
|
|
450
|
+
detail: `parseQuality="${parsed.parseQuality}"; scope boundaries and decision points ` +
|
|
451
|
+
"are therefore unreliable, so this file contributes to no measurement.",
|
|
452
|
+
recoverable: true,
|
|
453
|
+
}));
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
for (const diagnostic of parsed.diagnostics) {
|
|
457
|
+
if (diagnostic.code !== "analysis_scope_limited" || diagnostic.range === undefined)
|
|
458
|
+
continue;
|
|
459
|
+
skipped.push(buildSkipLedgerEntry({
|
|
460
|
+
stage: "parse",
|
|
461
|
+
subjectKind: "range",
|
|
462
|
+
path: file.relativePath,
|
|
463
|
+
range: diagnostic.range,
|
|
464
|
+
reason: "no_metric_defined",
|
|
465
|
+
detail: diagnostic.message,
|
|
466
|
+
recoverable: false,
|
|
467
|
+
}));
|
|
468
|
+
}
|
|
469
|
+
filesAnalyzed++;
|
|
470
|
+
const measured = symbolsOfFile(adapter, parsed.ast, file.relativePath);
|
|
471
|
+
symbols.push(...measured.symbols);
|
|
472
|
+
totals.executionUnits += measured.symbols.filter((entry) => entry.executionUnit).length;
|
|
473
|
+
totals.executionUnitRoots += measured.executionUnitRoots;
|
|
474
|
+
totals.cognitive += measured.cognitive;
|
|
475
|
+
totals.cyclomatic += measured.cyclomatic;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
catch (error) {
|
|
479
|
+
signal.throwIfAborted();
|
|
480
|
+
throw new OperationalError(`Directory "${root}" could not be read completely: ${errorMessage(error)}`, "Check the path and read permissions, or select another directory with --root.", { cause: error });
|
|
481
|
+
}
|
|
482
|
+
signal.throwIfAborted();
|
|
483
|
+
symbols.sort((a, b) => compareCodepoints(a.filePath, b.filePath) ||
|
|
484
|
+
a.line - b.line ||
|
|
485
|
+
compareCodepoints(a.name, b.name));
|
|
486
|
+
skipped.sort((a, b) => compareCodepoints(a.path ?? "", b.path ?? "") || compareCodepoints(a.reason, b.reason));
|
|
487
|
+
prose.sort((a, b) => compareCodepoints(a.path, b.path));
|
|
488
|
+
return {
|
|
489
|
+
root,
|
|
490
|
+
filesDiscovered,
|
|
491
|
+
filesAnalyzed,
|
|
492
|
+
proseAnalyzed,
|
|
493
|
+
symbols,
|
|
494
|
+
prose,
|
|
495
|
+
skipped,
|
|
496
|
+
totalsReading: "execution_unit",
|
|
497
|
+
totals,
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Metriken je Scope einer Datei.
|
|
502
|
+
*
|
|
503
|
+
* Der INKLUSIVE Wert wird berichtet: der Wert eines Symbols einschliesslich
|
|
504
|
+
* seiner verschachtelten Scopes. Das ist die Zahl, die zur Frage „wie schwer
|
|
505
|
+
* ist diese Funktion zu lesen?" passt — der Leser liest die inneren Scopes ja
|
|
506
|
+
* mit. Fuer cyclomatic wird die erweiterte Variante genommen (spec.md §16.3).
|
|
507
|
+
*/
|
|
508
|
+
function symbolsOfFile(adapter, ast, relativePath) {
|
|
509
|
+
const repaired = withUniqueScopeIds(adapter.computeComplexity(ast), adapter.extractCalls(ast), relativePath);
|
|
510
|
+
const facts = repaired.facts;
|
|
511
|
+
const calls = repaired.calls;
|
|
512
|
+
const out = [];
|
|
513
|
+
const cognitive = [];
|
|
514
|
+
const cyclomatic = [];
|
|
515
|
+
for (const scope of facts.symbolScopes) {
|
|
516
|
+
const id = scope.symbolScopeId;
|
|
517
|
+
const inclusiveIr = buildSymbolIR(facts, id, { calls });
|
|
518
|
+
const subtreeFacts = {
|
|
519
|
+
...facts,
|
|
520
|
+
decisions: facts.decisions.filter((decision) => containsRange(scope.range, decision.range)),
|
|
521
|
+
};
|
|
522
|
+
const ownFacts = selectSymbolFacts(facts, id);
|
|
523
|
+
const ownIr = buildSymbolIR(ownFacts, id, { calls });
|
|
524
|
+
const shared = {
|
|
525
|
+
metricsScopeId: id,
|
|
526
|
+
executionUnit: EXECUTION_UNIT_KINDS.has(scope.kind),
|
|
527
|
+
...(scope.parentScopeId === undefined ? {} : { parentScopeId: scope.parentScopeId }),
|
|
528
|
+
};
|
|
529
|
+
const inclusiveCognitive = inclusiveIr === undefined ? 0 : computeCognitive(inclusiveIr, COGNITIVE_ALGORITHM_ID).value;
|
|
530
|
+
const inclusiveCyclomatic = computeCyclomatic(subtreeFacts, scope.range.startLine, METRICS_VERSION).extended;
|
|
531
|
+
cognitive.push({
|
|
532
|
+
...shared,
|
|
533
|
+
inclusiveValue: inclusiveCognitive,
|
|
534
|
+
selfValue: ownIr === undefined ? 0 : computeCognitive(ownIr, COGNITIVE_ALGORITHM_ID).value,
|
|
535
|
+
});
|
|
536
|
+
cyclomatic.push({
|
|
537
|
+
...shared,
|
|
538
|
+
inclusiveValue: inclusiveCyclomatic,
|
|
539
|
+
selfValue: computeCyclomatic(ownFacts, scope.range.startLine, METRICS_VERSION).extended,
|
|
540
|
+
});
|
|
541
|
+
out.push({
|
|
542
|
+
filePath: relativePath,
|
|
543
|
+
name: scope.qualifiedName || scope.name || `(${scope.kind})`,
|
|
544
|
+
kind: scope.kind,
|
|
545
|
+
line: scope.range.startLine,
|
|
546
|
+
executionUnit: EXECUTION_UNIT_KINDS.has(scope.kind),
|
|
547
|
+
cognitive: inclusiveCognitive,
|
|
548
|
+
cyclomatic: inclusiveCyclomatic,
|
|
549
|
+
sloc: Math.max(1, scope.range.endLine - scope.range.startLine + 1),
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
const cognitiveTotals = aggregateScopeTree(cognitive);
|
|
553
|
+
const cyclomaticTotals = aggregateScopeTree(cyclomatic, { perScopeBase: 1 });
|
|
554
|
+
return {
|
|
555
|
+
symbols: out,
|
|
556
|
+
executionUnitRoots: cognitiveTotals.executionUnitRootCount,
|
|
557
|
+
cognitive: cognitiveTotals.executionUnitSum,
|
|
558
|
+
cyclomatic: cyclomaticTotals.executionUnitSum,
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Der Scanner kennt eigene Ausschlussgruende; der Ledger kennt seine eigenen.
|
|
563
|
+
* Diese Abbildung ist die Uebersetzung — sie wirft nichts weg, sie benennt es
|
|
564
|
+
* nur in der Sprache des Ledgers.
|
|
565
|
+
*/
|
|
566
|
+
function scannerSkipReason(reason) {
|
|
567
|
+
switch (reason) {
|
|
568
|
+
case "binary":
|
|
569
|
+
return "binary_content";
|
|
570
|
+
case "size-limit":
|
|
571
|
+
return "file_too_large";
|
|
572
|
+
case "unreadable":
|
|
573
|
+
return "provider_unavailable";
|
|
574
|
+
default:
|
|
575
|
+
// config-exclude, untangleignore, gitignore, default-exclude, security,
|
|
576
|
+
// symlink-cycle, symlink-escape
|
|
577
|
+
return "excluded_by_configuration";
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
//# sourceMappingURL=complexity.js.map
|