@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,553 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `untangle watch` — der laufende Strom.
|
|
3
|
+
*
|
|
4
|
+
* Hier laufen fuenf Pakete zu EINEM Waechter zusammen:
|
|
5
|
+
*
|
|
6
|
+
* scanner Grundmessung: welche Dateien gehoeren ueberhaupt dazu
|
|
7
|
+
* watcher `RepoWatcher`: native Ereignisse, Entprellung,
|
|
8
|
+
* periodischer Abgleich, Ref-Lock
|
|
9
|
+
* jobs `BoundedQueue`: Rueckstau zwischen Watcher und Messung,
|
|
10
|
+
* mit sichtbarem Speicherbudget (architecture.md §13.2)
|
|
11
|
+
* parser-registry Sprachadapter
|
|
12
|
+
* chunker semantische Ladung
|
|
13
|
+
* complexity die drei Scope-Metriken und ihre Aggregation
|
|
14
|
+
*
|
|
15
|
+
* ## Warum eine Queue zwischen Watcher und Messung
|
|
16
|
+
*
|
|
17
|
+
* Die Messung einer Datei ist um Groessenordnungen teurer als das Ereignis,
|
|
18
|
+
* das sie ausloest. Ohne Grenze wuerde ein `git checkout` mit tausend
|
|
19
|
+
* geaenderten Dateien tausend Syntaxbaeume gleichzeitig in den Speicher
|
|
20
|
+
* ziehen. `BoundedQueue` laesst den Watcher stattdessen WARTEN, sobald das
|
|
21
|
+
* Budget erreicht ist — genau der Rueckstau, fuer den das Paket gebaut ist.
|
|
22
|
+
* Der Waechter benutzt hier bewusst NUR diese Mechanik von `jobs` und nicht
|
|
23
|
+
* `IndexJobRunner`: der Runner verlangt Embedding- und Speicherstufen
|
|
24
|
+
* (Ollama, Qdrant), die ein reiner Komplexitaetswaechter nicht braucht und
|
|
25
|
+
* ohne die er `completed` nie erreichen koennte.
|
|
26
|
+
*
|
|
27
|
+
* ## Sauberes Beenden
|
|
28
|
+
*
|
|
29
|
+
* SIGINT/SIGTERM loesen genau eine Abbaufolge aus: Signalgriff abmelden (ein
|
|
30
|
+
* zweites Strg-C beendet dann hart), Watcher stoppen, Queue schliessen und
|
|
31
|
+
* leerlaufen lassen, Lock-Zustand PRUEFEN statt behaupten, Abschlussereignis
|
|
32
|
+
* schreiben, Mitschrift schliessen. Der Lock wird von `RepoWatcher.stop()`
|
|
33
|
+
* freigegeben; dass er wirklich weg ist, steht anschliessend im
|
|
34
|
+
* Abschlussereignis — nachgesehen, nicht angenommen.
|
|
35
|
+
*/
|
|
36
|
+
import path from "node:path";
|
|
37
|
+
|
|
38
|
+
import { aggregate, type AggregationEntry } from "@untangle-code/complexity";
|
|
39
|
+
import {
|
|
40
|
+
compareCodepoints,
|
|
41
|
+
buildSkipLedgerEntry,
|
|
42
|
+
type Clock,
|
|
43
|
+
type Random,
|
|
44
|
+
type SkipLedgerEntryV1,
|
|
45
|
+
} from "@untangle-code/domain";
|
|
46
|
+
import { BoundedQueue } from "@untangle-code/jobs";
|
|
47
|
+
import { createParserRegistry } from "@untangle-code/parser-registry";
|
|
48
|
+
import { discoverFiles, hashBytes, type ScanSkipV1 } from "@untangle-code/scanner";
|
|
49
|
+
import { NodeFileSystem } from "@untangle-code/scanner/node-fs";
|
|
50
|
+
import {
|
|
51
|
+
buildStateDirLayout,
|
|
52
|
+
ensureStateDirLayout,
|
|
53
|
+
FileLockProvider,
|
|
54
|
+
LocalFileSystem,
|
|
55
|
+
} from "@untangle-code/storage-local";
|
|
56
|
+
import {
|
|
57
|
+
buildWatchLockKey,
|
|
58
|
+
NodeNativeWatcher,
|
|
59
|
+
NodeScheduler,
|
|
60
|
+
RepoWatcher,
|
|
61
|
+
type WatchedFileSnapshotV1,
|
|
62
|
+
type WatcherEventV1,
|
|
63
|
+
} from "@untangle-code/watcher";
|
|
64
|
+
|
|
65
|
+
import { createFileAnalyzer, type FileReadingV1 } from "./analyze.js";
|
|
66
|
+
import { addMetricValues, metricDeltas, netDirectionOf, scopeDeltas, verdictOf } from "./delta.js";
|
|
67
|
+
import {
|
|
68
|
+
zeroMetricValues,
|
|
69
|
+
type MetricValues,
|
|
70
|
+
type WatchStreamEventDraftV1,
|
|
71
|
+
type WatchStreamEventV1,
|
|
72
|
+
} from "./events.js";
|
|
73
|
+
import type { WatchOptionsV1 } from "./options.js";
|
|
74
|
+
import { renderJson, renderText } from "./render.js";
|
|
75
|
+
import { createIgnorePredicate, createStreamSink, STATE_DIR_NAME } from "./runtime.js";
|
|
76
|
+
|
|
77
|
+
export interface RunWatchDeps {
|
|
78
|
+
clock: Clock;
|
|
79
|
+
random: Random;
|
|
80
|
+
stdout: (chunk: string) => void;
|
|
81
|
+
stderr: (chunk: string) => void;
|
|
82
|
+
/** Meldet einen Signalgriff an und liefert dessen Abmeldung zurueck. */
|
|
83
|
+
installSignalHandler: (handler: (signal: string) => void) => () => void;
|
|
84
|
+
/** Rechnername fuer den Lock-Datensatz. */
|
|
85
|
+
host: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Ein Element der Rueckstau-Queue: ein Watcher-Ereignis, das noch zu messen ist. */
|
|
89
|
+
interface PendingChange {
|
|
90
|
+
event: WatcherEventV1;
|
|
91
|
+
/** Grobe Kostenschaetzung fuer das Byte-Budget der Queue. */
|
|
92
|
+
bytes: number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const QUEUE_CAPACITY = 512;
|
|
96
|
+
const QUEUE_BUDGET_BYTES = 32 * 1024 * 1024;
|
|
97
|
+
|
|
98
|
+
export async function runWatch(options: WatchOptionsV1, deps: RunWatchDeps): Promise<number> {
|
|
99
|
+
const startedAtMs = deps.clock.nowEpochMs();
|
|
100
|
+
const sink = createStreamSink({ stdout: deps.stdout, outPath: options.outPath });
|
|
101
|
+
let sequence = 0;
|
|
102
|
+
|
|
103
|
+
const emit = (event: WatchStreamEventDraftV1): void => {
|
|
104
|
+
const full = { ...event, sequence: sequence++, at: deps.clock.nowIso() } as WatchStreamEventV1;
|
|
105
|
+
sink.write(
|
|
106
|
+
options.format === "json" ? renderJson(full) : renderText(full, { color: options.color }),
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const readings = new Map<string, FileReadingV1>();
|
|
111
|
+
let unanalyzedCount = 0;
|
|
112
|
+
const emitUnanalyzed = (origin: "baseline" | "change", entry: SkipLedgerEntryV1): void => {
|
|
113
|
+
unanalyzedCount++;
|
|
114
|
+
emit({ kind: "unanalyzed", origin, entry });
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const nodeFs = new NodeFileSystem();
|
|
118
|
+
const stateRoot = path.join(options.root, STATE_DIR_NAME);
|
|
119
|
+
const localFs = new LocalFileSystem([stateRoot]);
|
|
120
|
+
const layout = buildStateDirLayout(stateRoot);
|
|
121
|
+
await ensureStateDirLayout(localFs, layout);
|
|
122
|
+
const lockProvider = new FileLockProvider(
|
|
123
|
+
localFs,
|
|
124
|
+
layout.locks,
|
|
125
|
+
deps.clock,
|
|
126
|
+
deps.random,
|
|
127
|
+
deps.host,
|
|
128
|
+
);
|
|
129
|
+
const lockKey = buildWatchLockKey(options.repoId, options.refId);
|
|
130
|
+
|
|
131
|
+
emit({
|
|
132
|
+
kind: "started",
|
|
133
|
+
root: options.root,
|
|
134
|
+
repoId: options.repoId,
|
|
135
|
+
refId: options.refId,
|
|
136
|
+
lockKey,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const analyze = createFileAnalyzer({
|
|
140
|
+
registry: createParserRegistry(),
|
|
141
|
+
repoId: options.repoId,
|
|
142
|
+
refId: options.refId,
|
|
143
|
+
workspaceId: `ws-${options.repoId}`,
|
|
144
|
+
refName: options.refId,
|
|
145
|
+
repoLabel: options.repoId,
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// ---------------------------------------------------------------------
|
|
149
|
+
// Grundmessung. Ohne sie waere jedes spaetere Delta gegen Nichts gemessen
|
|
150
|
+
// und damit wertlos.
|
|
151
|
+
// ---------------------------------------------------------------------
|
|
152
|
+
const baselineStartMs = deps.clock.nowEpochMs();
|
|
153
|
+
const snapshots: WatchedFileSnapshotV1[] = [];
|
|
154
|
+
const scannerSkips: ScanSkipV1[] = [];
|
|
155
|
+
let excludedByRules = 0;
|
|
156
|
+
let scopeIdCollisions = 0;
|
|
157
|
+
let nodeKindFallbacks = 0;
|
|
158
|
+
|
|
159
|
+
for await (const file of discoverFiles({
|
|
160
|
+
fs: nodeFs,
|
|
161
|
+
roots: [options.root],
|
|
162
|
+
repoRoot: options.root,
|
|
163
|
+
maxFileSizeBytes: options.maxFileBytes,
|
|
164
|
+
onSkip: (skip) => {
|
|
165
|
+
if (isRuleExclusion(skip.reason)) {
|
|
166
|
+
excludedByRules++;
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
scannerSkips.push(skip);
|
|
170
|
+
},
|
|
171
|
+
})) {
|
|
172
|
+
snapshots.push({
|
|
173
|
+
relativePath: file.relativePath,
|
|
174
|
+
sizeBytes: file.sizeBytes,
|
|
175
|
+
mtimeEpochMs: file.mtimeEpochMs,
|
|
176
|
+
contentHash: file.contentHash,
|
|
177
|
+
});
|
|
178
|
+
let content: string;
|
|
179
|
+
try {
|
|
180
|
+
content = await nodeFs.readTextFile(file.absolutePath);
|
|
181
|
+
} catch (error) {
|
|
182
|
+
emitUnanalyzed(
|
|
183
|
+
"baseline",
|
|
184
|
+
buildSkipLedgerEntry({
|
|
185
|
+
stage: "scan",
|
|
186
|
+
subjectKind: "file",
|
|
187
|
+
path: file.relativePath,
|
|
188
|
+
reason: "provider_unavailable",
|
|
189
|
+
detail: `Cannot read file: ${error instanceof Error ? error.message : String(error)}`,
|
|
190
|
+
recoverable: true,
|
|
191
|
+
}),
|
|
192
|
+
);
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
const outcome = analyze(file.relativePath, content);
|
|
196
|
+
if (!outcome.ok) {
|
|
197
|
+
emitUnanalyzed("baseline", outcome.entry);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
readings.set(file.relativePath, outcome.reading);
|
|
201
|
+
scopeIdCollisions += outcome.reading.scopeIdCollisions;
|
|
202
|
+
nodeKindFallbacks += outcome.reading.nodeKindFallbacks;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Dateien, die der SCANNER ausgeschlossen hat (binaer, zu gross, unlesbar),
|
|
206
|
+
// gehen in keine Zahl ein — der WATCHER beobachtet sie aber weiter, weil
|
|
207
|
+
// sein Ignorier-Praedikat inhaltsunabhaengig ist. Ohne einen Schnappschuss
|
|
208
|
+
// meldete der erste Abgleichlauf sie deshalb als frisch hinzugekommen, und
|
|
209
|
+
// der Nutzer saehe dieselbe Datei zweimal: einmal vom Scanner, einmal vom
|
|
210
|
+
// Watcher. Der Schnappschuss verhindert genau diese Doppelmeldung, ohne die
|
|
211
|
+
// Datei aus der Beobachtung zu nehmen: aendert sie sich WIRKLICH, meldet der
|
|
212
|
+
// Watcher sie — und die Messung sagt dann erneut, warum sie nicht geht.
|
|
213
|
+
for (const skip of scannerSkips) {
|
|
214
|
+
const absolute = path.join(options.root, skip.relativePath);
|
|
215
|
+
const stat = await nodeFs.stat(absolute);
|
|
216
|
+
if (stat === null || stat.kind !== "file") continue;
|
|
217
|
+
try {
|
|
218
|
+
const bytes = await nodeFs.readFile(absolute);
|
|
219
|
+
snapshots.push({
|
|
220
|
+
relativePath: skip.relativePath,
|
|
221
|
+
sizeBytes: stat.sizeBytes,
|
|
222
|
+
mtimeEpochMs: stat.mtimeEpochMs,
|
|
223
|
+
contentHash: hashBytes(bytes),
|
|
224
|
+
});
|
|
225
|
+
} catch {
|
|
226
|
+
// Unlesbar — dann gibt es auch keinen Schnappschuss. Der Grund steht
|
|
227
|
+
// ohnehin gleich als Ledger-Eintrag im Strom.
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
for (const skip of scannerSkips) {
|
|
232
|
+
emitUnanalyzed(
|
|
233
|
+
"baseline",
|
|
234
|
+
buildSkipLedgerEntry({
|
|
235
|
+
stage: "scan",
|
|
236
|
+
subjectKind: "file",
|
|
237
|
+
path: skip.relativePath,
|
|
238
|
+
reason: scannerReason(skip.reason),
|
|
239
|
+
detail:
|
|
240
|
+
`Excluded by the scanner (${skip.reason})` +
|
|
241
|
+
(skip.detail === undefined ? "." : `: ${skip.detail}`) +
|
|
242
|
+
" This file contributes to no measurement and its change produces no delta.",
|
|
243
|
+
recoverable: skip.reason === "unreadable",
|
|
244
|
+
}),
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const totals = totalsOf(readings);
|
|
249
|
+
emit({
|
|
250
|
+
kind: "baseline",
|
|
251
|
+
filesAnalyzed: readings.size,
|
|
252
|
+
filesUnanalyzed: unanalyzedCount,
|
|
253
|
+
filesExcludedByRules: excludedByRules,
|
|
254
|
+
totals,
|
|
255
|
+
scopeCount: [...readings.values()].reduce((sum, reading) => sum + reading.scopeCount, 0),
|
|
256
|
+
scopeIdCollisions,
|
|
257
|
+
nodeKindFallbacks,
|
|
258
|
+
durationMs: deps.clock.nowEpochMs() - baselineStartMs,
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
// ---------------------------------------------------------------------
|
|
262
|
+
// Der laufende Strom.
|
|
263
|
+
// ---------------------------------------------------------------------
|
|
264
|
+
const queue = new BoundedQueue<PendingChange>({
|
|
265
|
+
capacity: QUEUE_CAPACITY,
|
|
266
|
+
maxBytes: QUEUE_BUDGET_BYTES,
|
|
267
|
+
sizeOf: (item) => item.bytes,
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
let changesObserved = 0;
|
|
271
|
+
let net: MetricValues = zeroMetricValues();
|
|
272
|
+
let stopping = false;
|
|
273
|
+
let stopReason: "signal" | "limit" | "baseline" | "error" = "signal";
|
|
274
|
+
let stopSignal: string | null = null;
|
|
275
|
+
let stopResolve: (() => void) | null = null;
|
|
276
|
+
const stopped = new Promise<void>((resolve) => {
|
|
277
|
+
stopResolve = resolve;
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
const requestStop = (
|
|
281
|
+
reason: "signal" | "limit" | "baseline" | "error",
|
|
282
|
+
signal: string | null,
|
|
283
|
+
): void => {
|
|
284
|
+
if (stopping) return;
|
|
285
|
+
stopping = true;
|
|
286
|
+
stopReason = reason;
|
|
287
|
+
stopSignal = signal;
|
|
288
|
+
stopResolve?.();
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
const watcher = new RepoWatcher({
|
|
292
|
+
repoId: options.repoId,
|
|
293
|
+
refId: options.refId,
|
|
294
|
+
rootPath: options.root,
|
|
295
|
+
fs: nodeFs,
|
|
296
|
+
nativeWatcher: new NodeNativeWatcher(),
|
|
297
|
+
scheduler: new NodeScheduler(),
|
|
298
|
+
clock: deps.clock,
|
|
299
|
+
lockProvider,
|
|
300
|
+
ignore: createIgnorePredicate(options.root),
|
|
301
|
+
initialSnapshots: snapshots,
|
|
302
|
+
debounceMs: options.debounceMs,
|
|
303
|
+
reconciliationIntervalMs: options.reconciliationIntervalMs,
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
watcher.onStatusChange((status) => {
|
|
307
|
+
emit({
|
|
308
|
+
kind: "status",
|
|
309
|
+
status: status.status,
|
|
310
|
+
detail: status.error === undefined ? null : `${status.error.code}: ${status.error.message}`,
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
watcher.onChange(async (events) => {
|
|
315
|
+
for (const event of events) {
|
|
316
|
+
if (stopping) return;
|
|
317
|
+
await queue.push({ event, bytes: estimateBytes(event) });
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
const worker = (async (): Promise<void> => {
|
|
322
|
+
for (;;) {
|
|
323
|
+
const pulled = await queue.pull();
|
|
324
|
+
if (pulled.done) return;
|
|
325
|
+
await handleChange(pulled.value.event);
|
|
326
|
+
if (options.exitAfterChanges !== null && changesObserved >= options.exitAfterChanges) {
|
|
327
|
+
requestStop("limit", null);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
})();
|
|
332
|
+
|
|
333
|
+
async function handleChange(event: WatcherEventV1): Promise<void> {
|
|
334
|
+
const analysisStartMs = deps.clock.nowEpochMs();
|
|
335
|
+
const previous = readings.get(event.relativePath);
|
|
336
|
+
|
|
337
|
+
if (event.changeKind === "deleted") {
|
|
338
|
+
readings.delete(event.relativePath);
|
|
339
|
+
const deltas = metricDeltas(previous, undefined);
|
|
340
|
+
changesObserved++;
|
|
341
|
+
net = addMetricValues(net, deltas);
|
|
342
|
+
emit({
|
|
343
|
+
kind: "change",
|
|
344
|
+
changeKind: "deleted",
|
|
345
|
+
path: event.relativePath,
|
|
346
|
+
languageId: previous?.languageId ?? null,
|
|
347
|
+
contentHash: null,
|
|
348
|
+
metrics: deltas,
|
|
349
|
+
scopes: scopeDeltas(previous, undefined, options.scopeLimit),
|
|
350
|
+
verdict: verdictOf(deltas),
|
|
351
|
+
notes:
|
|
352
|
+
previous === undefined
|
|
353
|
+
? [
|
|
354
|
+
"This file contributed to no measurement (no language adapter or not " +
|
|
355
|
+
"analyzable); its removal does not change the overall measurements.",
|
|
356
|
+
]
|
|
357
|
+
: [],
|
|
358
|
+
analysisMs: deps.clock.nowEpochMs() - analysisStartMs,
|
|
359
|
+
});
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (event.sizeBytes > options.maxFileBytes) {
|
|
364
|
+
emitUnanalyzed(
|
|
365
|
+
"change",
|
|
366
|
+
buildSkipLedgerEntry({
|
|
367
|
+
stage: "scan",
|
|
368
|
+
subjectKind: "file",
|
|
369
|
+
path: event.relativePath,
|
|
370
|
+
reason: "file_too_large",
|
|
371
|
+
detail:
|
|
372
|
+
`${String(event.sizeBytes)} bytes exceed the limit of ` +
|
|
373
|
+
`${String(options.maxFileBytes)} bytes (--max-file-bytes). This file's previous measurement ` +
|
|
374
|
+
`is retained as its last known state.`,
|
|
375
|
+
recoverable: true,
|
|
376
|
+
}),
|
|
377
|
+
);
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
let content: string;
|
|
382
|
+
try {
|
|
383
|
+
content = await nodeFs.readTextFile(path.join(options.root, event.relativePath));
|
|
384
|
+
} catch (error) {
|
|
385
|
+
emitUnanalyzed(
|
|
386
|
+
"change",
|
|
387
|
+
buildSkipLedgerEntry({
|
|
388
|
+
stage: "scan",
|
|
389
|
+
subjectKind: "file",
|
|
390
|
+
path: event.relativePath,
|
|
391
|
+
reason: "provider_unavailable",
|
|
392
|
+
detail:
|
|
393
|
+
`Cannot read file after the change event: ` +
|
|
394
|
+
`${error instanceof Error ? error.message : String(error)}`,
|
|
395
|
+
recoverable: true,
|
|
396
|
+
}),
|
|
397
|
+
);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
const outcome = analyze(event.relativePath, content);
|
|
402
|
+
if (!outcome.ok) {
|
|
403
|
+
// BEWUSST: der letzte gute Messwert bleibt stehen. Wer eine Datei
|
|
404
|
+
// gerade halbfertig speichert, will beim naechsten gelungenen Parse
|
|
405
|
+
// das Delta gegen den letzten MESSBAREN Stand sehen, nicht gegen
|
|
406
|
+
// Nichts. Dass zwischenzeitlich nicht gemessen werden konnte, sagt
|
|
407
|
+
// dieses Ereignis.
|
|
408
|
+
emitUnanalyzed("change", outcome.entry);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
if (previous !== undefined && previous.contentHash === outcome.reading.contentHash) {
|
|
413
|
+
// Inhaltsgleich: der Watcher hat eine Beruehrung gemeldet, keine
|
|
414
|
+
// Aenderung. Kein Delta-Ereignis, aber auch kein Schweigen ueber eine
|
|
415
|
+
// echte Aenderung — der Hash ist die Autoritaet (spec.md §12.1).
|
|
416
|
+
readings.set(event.relativePath, outcome.reading);
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
readings.set(event.relativePath, outcome.reading);
|
|
421
|
+
const deltas = metricDeltas(previous, outcome.reading);
|
|
422
|
+
changesObserved++;
|
|
423
|
+
net = addMetricValues(net, deltas);
|
|
424
|
+
emit({
|
|
425
|
+
kind: "change",
|
|
426
|
+
changeKind: event.changeKind,
|
|
427
|
+
path: event.relativePath,
|
|
428
|
+
languageId: outcome.reading.languageId,
|
|
429
|
+
contentHash: outcome.reading.contentHash,
|
|
430
|
+
metrics: deltas,
|
|
431
|
+
scopes: scopeDeltas(previous, outcome.reading, options.scopeLimit),
|
|
432
|
+
verdict: verdictOf(deltas),
|
|
433
|
+
notes: outcome.reading.notes,
|
|
434
|
+
analysisMs: deps.clock.nowEpochMs() - analysisStartMs,
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
const uninstall = deps.installSignalHandler((signal) => {
|
|
439
|
+
requestStop("signal", signal);
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
let exitCode = 0;
|
|
443
|
+
try {
|
|
444
|
+
await watcher.start();
|
|
445
|
+
if (options.baselineOnly) {
|
|
446
|
+
requestStop("baseline", null);
|
|
447
|
+
}
|
|
448
|
+
await stopped;
|
|
449
|
+
} catch (error) {
|
|
450
|
+
exitCode = 1;
|
|
451
|
+
stopReason = "error";
|
|
452
|
+
deps.stderr(`untangle watch: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
453
|
+
} finally {
|
|
454
|
+
uninstall();
|
|
455
|
+
await watcher.stop();
|
|
456
|
+
queue.close();
|
|
457
|
+
await worker.catch(() => {
|
|
458
|
+
// Die Queue wurde geschlossen, waehrend ein Push wartete — kein Fehler:
|
|
459
|
+
// der Abbau laeuft ohnehin gerade.
|
|
460
|
+
});
|
|
461
|
+
const held = await lockProvider.inspect(lockKey);
|
|
462
|
+
const queueStats = queue.stats();
|
|
463
|
+
emit({
|
|
464
|
+
kind: "stopped",
|
|
465
|
+
reason: stopReason,
|
|
466
|
+
signal: stopSignal,
|
|
467
|
+
changesObserved,
|
|
468
|
+
filesUnanalyzed: unanalyzedCount,
|
|
469
|
+
net,
|
|
470
|
+
netDirection: netDirectionOf(net),
|
|
471
|
+
queue: {
|
|
472
|
+
maxDepthObserved: queueStats.maxDepthObserved,
|
|
473
|
+
maxBytesObserved: queueStats.maxBytesObserved,
|
|
474
|
+
overBudgetAdmissions: queueStats.overBudgetAdmissions,
|
|
475
|
+
},
|
|
476
|
+
lockReleased: held === null,
|
|
477
|
+
durationMs: deps.clock.nowEpochMs() - startedAtMs,
|
|
478
|
+
});
|
|
479
|
+
await sink.close();
|
|
480
|
+
}
|
|
481
|
+
return exitCode;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Summe der vier Metriken ueber alle gemessenen Dateien.
|
|
486
|
+
*
|
|
487
|
+
* Die drei Scope-Metriken werden ueber `aggregate()` gefuehrt, also ueber
|
|
488
|
+
* `metrics_scope_id` dedupliziert (spec.md §16.10) — dieselbe Scope-Id kann
|
|
489
|
+
* nicht zweimal in die Summe eingehen, auch wenn zwei Dateien sie melden
|
|
490
|
+
* sollten. Die semantische Ladung ist eine Datei-Groesse und wird schlicht
|
|
491
|
+
* addiert.
|
|
492
|
+
*/
|
|
493
|
+
function totalsOf(readings: ReadonlyMap<string, FileReadingV1>): MetricValues {
|
|
494
|
+
const paths = [...readings.keys()].sort(compareCodepoints);
|
|
495
|
+
const entriesPerMetric: Record<"structural" | "cyclomatic" | "cognitive", AggregationEntry[]> = {
|
|
496
|
+
structural: [],
|
|
497
|
+
cyclomatic: [],
|
|
498
|
+
cognitive: [],
|
|
499
|
+
};
|
|
500
|
+
let semantic = 0;
|
|
501
|
+
for (const filePath of paths) {
|
|
502
|
+
const reading = readings.get(filePath) as FileReadingV1;
|
|
503
|
+
semantic += reading.totals.semantic;
|
|
504
|
+
for (const scope of reading.scopes) {
|
|
505
|
+
if (!scope.selected) continue;
|
|
506
|
+
for (const metric of ["structural", "cyclomatic", "cognitive"] as const) {
|
|
507
|
+
entriesPerMetric[metric].push({
|
|
508
|
+
metricsScopeId: `${filePath}${scope.metricsScopeId}`,
|
|
509
|
+
value: scope.values[metric],
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
return {
|
|
515
|
+
structural: aggregate(entriesPerMetric.structural).sum,
|
|
516
|
+
semantic,
|
|
517
|
+
cyclomatic: aggregate(entriesPerMetric.cyclomatic).sum,
|
|
518
|
+
cognitive: aggregate(entriesPerMetric.cognitive).sum,
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/** Grobe Kostenschaetzung eines wartenden Ereignisses fuer das Byte-Budget. */
|
|
523
|
+
function estimateBytes(event: WatcherEventV1): number {
|
|
524
|
+
if (event.changeKind === "deleted") return 256;
|
|
525
|
+
// Der Syntaxbaum einer Datei kostet ein Vielfaches ihres Textes; Faktor 8
|
|
526
|
+
// ist eine bewusst konservative, dokumentierte Schaetzung, kein Messwert.
|
|
527
|
+
return 256 + event.sizeBytes * 8;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/** Ausschluesse, die auf einer Ignorierregel beruhen (siehe `WatchBaselineEventV1`). */
|
|
531
|
+
function isRuleExclusion(reason: ScanSkipV1["reason"]): boolean {
|
|
532
|
+
return (
|
|
533
|
+
reason === "config-exclude" ||
|
|
534
|
+
reason === "untangleignore" ||
|
|
535
|
+
reason === "gitignore" ||
|
|
536
|
+
reason === "default-exclude" ||
|
|
537
|
+
reason === "security"
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/** Bildet die Scanner-Ausschlussgruende auf die geschlossene `SKIP_REASONS`-Menge ab. */
|
|
542
|
+
function scannerReason(reason: ScanSkipV1["reason"]): SkipLedgerEntryV1["reason"] {
|
|
543
|
+
switch (reason) {
|
|
544
|
+
case "binary":
|
|
545
|
+
return "binary_content";
|
|
546
|
+
case "size-limit":
|
|
547
|
+
return "file_too_large";
|
|
548
|
+
case "unreadable":
|
|
549
|
+
return "provider_unavailable";
|
|
550
|
+
default:
|
|
551
|
+
return "excluded_by_configuration";
|
|
552
|
+
}
|
|
553
|
+
}
|