waterplane 0.1.6 → 0.1.14
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/CHANGELOG.md +146 -1
- package/README.md +47 -24
- package/SECURITY.md +11 -3
- package/deploy/node-version +1 -1
- package/node_modules/@waterplane/shared/dist/agentfiles.d.ts +17 -0
- package/node_modules/@waterplane/shared/dist/agentfiles.js +60 -5
- package/node_modules/@waterplane/shared/dist/agentfiles.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/alwaysonwords.d.ts +83 -0
- package/node_modules/@waterplane/shared/dist/alwaysonwords.js +215 -0
- package/node_modules/@waterplane/shared/dist/alwaysonwords.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/assess/sasswords.js +4 -0
- package/node_modules/@waterplane/shared/dist/assess/sasswords.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/autocompact.js +3 -2
- package/node_modules/@waterplane/shared/dist/autocompact.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/backendsources.d.ts +11 -1
- package/node_modules/@waterplane/shared/dist/backendsources.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/branchmode.d.ts +33 -0
- package/node_modules/@waterplane/shared/dist/branchmode.js +88 -0
- package/node_modules/@waterplane/shared/dist/branchmode.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/budget.d.ts +7 -1
- package/node_modules/@waterplane/shared/dist/budget.js +11 -3
- package/node_modules/@waterplane/shared/dist/budget.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/buildstamp.d.ts +37 -0
- package/node_modules/@waterplane/shared/dist/buildstamp.js +95 -0
- package/node_modules/@waterplane/shared/dist/buildstamp.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/burn.d.ts +16 -1
- package/node_modules/@waterplane/shared/dist/burn.js +30 -0
- package/node_modules/@waterplane/shared/dist/burn.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/calday.d.ts +4 -0
- package/node_modules/@waterplane/shared/dist/calday.js +25 -0
- package/node_modules/@waterplane/shared/dist/calday.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/changebrief.d.ts +77 -0
- package/node_modules/@waterplane/shared/dist/changebrief.js +70 -0
- package/node_modules/@waterplane/shared/dist/changebrief.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/clihealth/healthrecord.js +1 -0
- package/node_modules/@waterplane/shared/dist/clihealth/healthrecord.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/costwindow.d.ts +24 -5
- package/node_modules/@waterplane/shared/dist/costwindow.js +35 -15
- package/node_modules/@waterplane/shared/dist/costwindow.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/desktopfiles.d.ts +100 -0
- package/node_modules/@waterplane/shared/dist/desktopfiles.js +192 -0
- package/node_modules/@waterplane/shared/dist/desktopfiles.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/exposure.d.ts +175 -0
- package/node_modules/@waterplane/shared/dist/exposure.js +357 -0
- package/node_modules/@waterplane/shared/dist/exposure.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/exposurepush.d.ts +60 -0
- package/node_modules/@waterplane/shared/dist/exposurepush.js +103 -0
- package/node_modules/@waterplane/shared/dist/exposurepush.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/healthindex/commits.d.ts +26 -0
- package/node_modules/@waterplane/shared/dist/healthindex/commits.js +57 -0
- package/node_modules/@waterplane/shared/dist/healthindex/commits.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/healthindex/move.d.ts +25 -0
- package/node_modules/@waterplane/shared/dist/healthindex/move.js +79 -0
- package/node_modules/@waterplane/shared/dist/healthindex/move.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/healthindex/readings.d.ts +53 -0
- package/node_modules/@waterplane/shared/dist/healthindex/readings.js +154 -0
- package/node_modules/@waterplane/shared/dist/healthindex/readings.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/healthindex/repoindex.d.ts +41 -0
- package/node_modules/@waterplane/shared/dist/healthindex/repoindex.js +19 -0
- package/node_modules/@waterplane/shared/dist/healthindex/repoindex.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/healthindex/score.d.ts +26 -0
- package/node_modules/@waterplane/shared/dist/healthindex/score.js +156 -0
- package/node_modules/@waterplane/shared/dist/healthindex/score.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/healthindex/types.d.ts +206 -0
- package/node_modules/@waterplane/shared/dist/healthindex/types.js +58 -0
- package/node_modules/@waterplane/shared/dist/healthindex/types.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/healthindex/vs.d.ts +26 -0
- package/node_modules/@waterplane/shared/dist/healthindex/vs.js +38 -0
- package/node_modules/@waterplane/shared/dist/healthindex/vs.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/healthindex/words.d.ts +28 -0
- package/node_modules/@waterplane/shared/dist/healthindex/words.js +124 -0
- package/node_modules/@waterplane/shared/dist/healthindex/words.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/healthindex.d.ts +15 -411
- package/node_modules/@waterplane/shared/dist/healthindex.js +8 -602
- package/node_modules/@waterplane/shared/dist/healthindex.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/hints.js +15 -0
- package/node_modules/@waterplane/shared/dist/hints.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/index.d.ts +37 -0
- package/node_modules/@waterplane/shared/dist/index.js +37 -0
- package/node_modules/@waterplane/shared/dist/index.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/intent/clean.d.ts +87 -0
- package/node_modules/@waterplane/shared/dist/intent/clean.js +51 -3
- package/node_modules/@waterplane/shared/dist/intent/clean.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/intent/kind.d.ts +40 -1
- package/node_modules/@waterplane/shared/dist/intent/kind.js +36 -3
- package/node_modules/@waterplane/shared/dist/intent/kind.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/intent/types.d.ts +13 -0
- package/node_modules/@waterplane/shared/dist/intent/types.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/intent/verdict.js +9 -16
- package/node_modules/@waterplane/shared/dist/intent/verdict.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/intent/words.js +5 -0
- package/node_modules/@waterplane/shared/dist/intent/words.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/intent.d.ts +2 -2
- package/node_modules/@waterplane/shared/dist/intent.js +2 -2
- package/node_modules/@waterplane/shared/dist/intent.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/launchmodes.d.ts +2 -0
- package/node_modules/@waterplane/shared/dist/launchmodes.js +12 -0
- package/node_modules/@waterplane/shared/dist/launchmodes.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/ledgerspan.d.ts +106 -0
- package/node_modules/@waterplane/shared/dist/ledgerspan.js +196 -0
- package/node_modules/@waterplane/shared/dist/ledgerspan.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/naming.d.ts +3 -1
- package/node_modules/@waterplane/shared/dist/naming.js +6 -2
- package/node_modules/@waterplane/shared/dist/naming.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/netfuse.d.ts +5 -0
- package/node_modules/@waterplane/shared/dist/netfuse.js +6 -1
- package/node_modules/@waterplane/shared/dist/netfuse.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/netretry.d.ts +78 -0
- package/node_modules/@waterplane/shared/dist/netretry.js +85 -0
- package/node_modules/@waterplane/shared/dist/netretry.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/netretrycfg.d.ts +12 -0
- package/node_modules/@waterplane/shared/dist/netretrycfg.js +27 -0
- package/node_modules/@waterplane/shared/dist/netretrycfg.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/nodemin.d.ts +6 -4
- package/node_modules/@waterplane/shared/dist/nodemin.js +6 -4
- package/node_modules/@waterplane/shared/dist/nodemin.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/optins.d.ts +35 -1
- package/node_modules/@waterplane/shared/dist/optins.js +39 -1
- package/node_modules/@waterplane/shared/dist/optins.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/pairing.js +4 -0
- package/node_modules/@waterplane/shared/dist/pairing.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/passive.js +3 -0
- package/node_modules/@waterplane/shared/dist/passive.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/plugin/api.d.ts +394 -0
- package/node_modules/@waterplane/shared/dist/plugin/api.js +2 -0
- package/node_modules/@waterplane/shared/dist/plugin/api.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/plugin/backend.d.ts +197 -0
- package/node_modules/@waterplane/shared/dist/plugin/backend.js +9 -0
- package/node_modules/@waterplane/shared/dist/plugin/backend.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/plugin/manifest.d.ts +160 -0
- package/node_modules/@waterplane/shared/dist/plugin/manifest.js +98 -0
- package/node_modules/@waterplane/shared/dist/plugin/manifest.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/plugin/module.d.ts +98 -0
- package/node_modules/@waterplane/shared/dist/plugin/module.js +13 -0
- package/node_modules/@waterplane/shared/dist/plugin/module.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/plugin/version.d.ts +66 -0
- package/node_modules/@waterplane/shared/dist/plugin/version.js +86 -0
- package/node_modules/@waterplane/shared/dist/plugin/version.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/plugin.d.ts +5 -867
- package/node_modules/@waterplane/shared/dist/plugin.js +27 -186
- package/node_modules/@waterplane/shared/dist/plugin.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/pluginlaunch.d.ts +7 -0
- package/node_modules/@waterplane/shared/dist/prview.d.ts +23 -0
- package/node_modules/@waterplane/shared/dist/prview.js +107 -0
- package/node_modules/@waterplane/shared/dist/prview.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/queue/queueserial.d.ts +11 -2
- package/node_modules/@waterplane/shared/dist/queue/queueserial.js +13 -4
- package/node_modules/@waterplane/shared/dist/queue/queueserial.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/queue/queuewords.js +1 -0
- package/node_modules/@waterplane/shared/dist/queue/queuewords.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/repohealth.d.ts +4 -0
- package/node_modules/@waterplane/shared/dist/repohealth.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/repotwins.d.ts +31 -0
- package/node_modules/@waterplane/shared/dist/repotwins.js +52 -0
- package/node_modules/@waterplane/shared/dist/repotwins.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/requirements.js +4 -1
- package/node_modules/@waterplane/shared/dist/requirements.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/schedule/schedaction.d.ts +29 -0
- package/node_modules/@waterplane/shared/dist/schedule/schedaction.js +22 -0
- package/node_modules/@waterplane/shared/dist/schedule/schedaction.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/schedule/schedclean.js +26 -0
- package/node_modules/@waterplane/shared/dist/schedule/schedclean.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/schedule/schedhorizon.d.ts +1 -0
- package/node_modules/@waterplane/shared/dist/schedule/schedhorizon.js +1 -0
- package/node_modules/@waterplane/shared/dist/schedule/schedhorizon.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/schedule.d.ts +1 -1
- package/node_modules/@waterplane/shared/dist/schedule.js +1 -1
- package/node_modules/@waterplane/shared/dist/schedule.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/sessionbudget.d.ts +34 -7
- package/node_modules/@waterplane/shared/dist/sessionbudget.js +59 -21
- package/node_modules/@waterplane/shared/dist/sessionbudget.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/sweep.d.ts +2 -1
- package/node_modules/@waterplane/shared/dist/sweep.js +2 -1
- package/node_modules/@waterplane/shared/dist/sweep.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/tokens.d.ts +4 -3
- package/node_modules/@waterplane/shared/dist/tokens.js +9 -7
- package/node_modules/@waterplane/shared/dist/tokens.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/weekburn.d.ts +144 -0
- package/node_modules/@waterplane/shared/dist/weekburn.js +250 -0
- package/node_modules/@waterplane/shared/dist/weekburn.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/wire/alwayson.d.ts +64 -0
- package/node_modules/@waterplane/shared/dist/wire/alwayson.js +7 -0
- package/node_modules/@waterplane/shared/dist/wire/alwayson.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/wire/backend.d.ts +4 -0
- package/node_modules/@waterplane/shared/dist/wire/backendtokens.d.ts +6 -0
- package/node_modules/@waterplane/shared/dist/wire/backendtokens.js +0 -9
- package/node_modules/@waterplane/shared/dist/wire/backendtokens.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/wire/costwindow.d.ts +25 -0
- package/node_modules/@waterplane/shared/dist/wire/messages/clienthost.d.ts +15 -1
- package/node_modules/@waterplane/shared/dist/wire/messages/clientsession.d.ts +24 -0
- package/node_modules/@waterplane/shared/dist/wire/messages/hosttools.d.ts +12 -2
- package/node_modules/@waterplane/shared/dist/wire/notify.d.ts +194 -1
- package/node_modules/@waterplane/shared/dist/wire/notify.js +139 -1
- package/node_modules/@waterplane/shared/dist/wire/notify.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/wire/pullrequest.d.ts +42 -0
- package/node_modules/@waterplane/shared/dist/wire/pullrequest.js +2 -0
- package/node_modules/@waterplane/shared/dist/wire/pullrequest.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/wire/repo.d.ts +131 -0
- package/node_modules/@waterplane/shared/dist/wire/repo.js +8 -3
- package/node_modules/@waterplane/shared/dist/wire/repo.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/wire/sent.d.ts +3 -1
- package/node_modules/@waterplane/shared/dist/wire/session/contextspark.d.ts +7 -0
- package/node_modules/@waterplane/shared/dist/wire/session/info.d.ts +4 -1
- package/node_modules/@waterplane/shared/dist/wire/session/launch.d.ts +36 -0
- package/node_modules/@waterplane/shared/dist/wire/session.d.ts +1 -1
- package/node_modules/@waterplane/shared/dist/wire/telemetry.d.ts +30 -0
- package/node_modules/@waterplane/shared/dist/wire/work.d.ts +13 -0
- package/node_modules/@waterplane/shared/dist/wire/work.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/wordof.d.ts +11 -0
- package/node_modules/@waterplane/shared/dist/wordof.js +14 -0
- package/node_modules/@waterplane/shared/dist/wordof.js.map +1 -0
- package/npm-shrinkwrap.json +3 -3
- package/package.json +2 -2
- package/packages/extensions/scorecard/waterplane-plugin.json +10 -0
- package/packages/host/dist/agentexposure.d.ts +13 -0
- package/packages/host/dist/agentexposure.js +90 -0
- package/packages/host/dist/agentexposure.js.map +1 -0
- package/packages/host/dist/agentintents.js +7 -8
- package/packages/host/dist/agentintents.js.map +1 -1
- package/packages/host/dist/agentwatch.d.ts +3 -7
- package/packages/host/dist/agentwatch.js.map +1 -1
- package/packages/host/dist/alwayson.d.ts +18 -0
- package/packages/host/dist/alwayson.js +159 -0
- package/packages/host/dist/alwayson.js.map +1 -0
- package/packages/host/dist/answergate.d.ts +3 -7
- package/packages/host/dist/answergate.js.map +1 -1
- package/packages/host/dist/attentionstore.d.ts +94 -0
- package/packages/host/dist/attentionstore.js +232 -0
- package/packages/host/dist/attentionstore.js.map +1 -0
- package/packages/host/dist/backends/claude-sources.d.ts +2 -0
- package/packages/host/dist/backends/claude-sources.js +12 -0
- package/packages/host/dist/backends/claude-sources.js.map +1 -1
- package/packages/host/dist/backends/claude.js +3 -2
- package/packages/host/dist/backends/claude.js.map +1 -1
- package/packages/host/dist/backends/derive.js +1 -0
- package/packages/host/dist/backends/derive.js.map +1 -1
- package/packages/host/dist/backends/overhead.d.ts +7 -5
- package/packages/host/dist/backends/overhead.js +15 -13
- package/packages/host/dist/backends/overhead.js.map +1 -1
- package/packages/host/dist/backends/registry.js +4 -1
- package/packages/host/dist/backends/registry.js.map +1 -1
- package/packages/host/dist/backends/types.d.ts +2 -0
- package/packages/host/dist/besidespend.d.ts +22 -0
- package/packages/host/dist/besidespend.js +65 -0
- package/packages/host/dist/besidespend.js.map +1 -0
- package/packages/host/dist/boxkit.d.ts +19 -0
- package/packages/host/dist/boxkit.js +38 -0
- package/packages/host/dist/boxkit.js.map +1 -0
- package/packages/host/dist/branchrules.d.ts +14 -0
- package/packages/host/dist/branchrules.js +47 -0
- package/packages/host/dist/branchrules.js.map +1 -0
- package/packages/host/dist/budget.d.ts +3 -2
- package/packages/host/dist/budget.js +5 -3
- package/packages/host/dist/budget.js.map +1 -1
- package/packages/host/dist/builds.d.ts +31 -1
- package/packages/host/dist/builds.js +55 -3
- package/packages/host/dist/builds.js.map +1 -1
- package/packages/host/dist/buildversions.d.ts +2 -0
- package/packages/host/dist/buildversions.js +36 -0
- package/packages/host/dist/buildversions.js.map +1 -0
- package/packages/host/dist/burnwatch.d.ts +23 -11
- package/packages/host/dist/burnwatch.js +57 -3
- package/packages/host/dist/burnwatch.js.map +1 -1
- package/packages/host/dist/changebrief.d.ts +37 -0
- package/packages/host/dist/changebrief.js +157 -0
- package/packages/host/dist/changebrief.js.map +1 -0
- package/packages/host/dist/cli/index.js +1 -1
- package/packages/host/dist/cli/index.js.map +1 -1
- package/packages/host/dist/clihealth.d.ts +2 -0
- package/packages/host/dist/clihealth.js +11 -2
- package/packages/host/dist/clihealth.js.map +1 -1
- package/packages/host/dist/compliance.d.ts +5 -1
- package/packages/host/dist/compliance.js +70 -31
- package/packages/host/dist/compliance.js.map +1 -1
- package/packages/host/dist/composer.d.ts +3 -1
- package/packages/host/dist/composer.js +3 -1
- package/packages/host/dist/composer.js.map +1 -1
- package/packages/host/dist/context.js +29 -4
- package/packages/host/dist/context.js.map +1 -1
- package/packages/host/dist/convlog.d.ts +1 -1
- package/packages/host/dist/convlog.js +1 -1
- package/packages/host/dist/costwindow.d.ts +25 -0
- package/packages/host/dist/costwindow.js +63 -1
- package/packages/host/dist/costwindow.js.map +1 -1
- package/packages/host/dist/ctxlog/ctxagents.js +16 -25
- package/packages/host/dist/ctxlog/ctxagents.js.map +1 -1
- package/packages/host/dist/ctxlog/ctxcursor.d.ts +36 -1
- package/packages/host/dist/ctxlog/ctxcursor.js +96 -2
- package/packages/host/dist/ctxlog/ctxcursor.js.map +1 -1
- package/packages/host/dist/ctxlog/ctxproject.js +2 -1
- package/packages/host/dist/ctxlog/ctxproject.js.map +1 -1
- package/packages/host/dist/ctxlog/ctxupdate.js +30 -24
- package/packages/host/dist/ctxlog/ctxupdate.js.map +1 -1
- package/packages/host/dist/ctxlog/usagerecord.d.ts +28 -0
- package/packages/host/dist/ctxlog/usagerecord.js +81 -0
- package/packages/host/dist/ctxlog/usagerecord.js.map +1 -0
- package/packages/host/dist/diskwatch.d.ts +4 -6
- package/packages/host/dist/diskwatch.js +3 -1
- package/packages/host/dist/diskwatch.js.map +1 -1
- package/packages/host/dist/eraseen.d.ts +6 -0
- package/packages/host/dist/eraseen.js +100 -0
- package/packages/host/dist/eraseen.js.map +1 -0
- package/packages/host/dist/explainjob.d.ts +24 -0
- package/packages/host/dist/explainjob.js +80 -0
- package/packages/host/dist/explainjob.js.map +1 -0
- package/packages/host/dist/exposure.d.ts +56 -0
- package/packages/host/dist/exposure.js +371 -0
- package/packages/host/dist/exposure.js.map +1 -0
- package/packages/host/dist/exposurepush.d.ts +28 -0
- package/packages/host/dist/exposurepush.js +136 -0
- package/packages/host/dist/exposurepush.js.map +1 -0
- package/packages/host/dist/exposurerun.d.ts +18 -0
- package/packages/host/dist/exposurerun.js +126 -0
- package/packages/host/dist/exposurerun.js.map +1 -0
- package/packages/host/dist/exposurewatch.d.ts +29 -0
- package/packages/host/dist/exposurewatch.js +127 -0
- package/packages/host/dist/exposurewatch.js.map +1 -0
- package/packages/host/dist/extensions/scorecard/host/engine.d.mts +54 -0
- package/packages/host/dist/extensions/scorecard/host/engine.mjs +303 -0
- package/packages/host/dist/extensions/scorecard/host/engine.mjs.map +1 -0
- package/packages/host/dist/extensions/scorecard/host/gitslug.d.mts +5 -0
- package/packages/host/dist/extensions/scorecard/host/gitslug.mjs +45 -0
- package/packages/host/dist/extensions/scorecard/host/gitslug.mjs.map +1 -0
- package/packages/host/dist/extensions/scorecard/host/index.d.mts +15 -0
- package/packages/host/dist/extensions/scorecard/host/index.mjs +47 -0
- package/packages/host/dist/extensions/scorecard/host/index.mjs.map +1 -0
- package/packages/host/dist/extensions/scorecard/host/store.d.mts +12 -0
- package/packages/host/dist/extensions/scorecard/host/store.mjs +91 -0
- package/packages/host/dist/extensions/scorecard/host/store.mjs.map +1 -0
- package/packages/host/dist/extensions/scorecard/shared/logic.d.mts +42 -0
- package/packages/host/dist/extensions/scorecard/shared/logic.mjs +170 -0
- package/packages/host/dist/extensions/scorecard/shared/logic.mjs.map +1 -0
- package/packages/host/dist/extensions/scorecard/shared/wire.d.mts +140 -0
- package/packages/host/dist/extensions/scorecard/shared/wire.mjs +29 -0
- package/packages/host/dist/extensions/scorecard/shared/wire.mjs.map +1 -0
- package/packages/host/dist/files.d.ts +14 -12
- package/packages/host/dist/files.js +64 -94
- package/packages/host/dist/files.js.map +1 -1
- package/packages/host/dist/forge/github.d.ts +3 -0
- package/packages/host/dist/forge/github.js +96 -0
- package/packages/host/dist/forge/github.js.map +1 -0
- package/packages/host/dist/forge/index.d.ts +14 -0
- package/packages/host/dist/forge/index.js +32 -0
- package/packages/host/dist/forge/index.js.map +1 -0
- package/packages/host/dist/forge/types.d.ts +58 -0
- package/packages/host/dist/forge/types.js +2 -0
- package/packages/host/dist/forge/types.js.map +1 -0
- package/packages/host/dist/git.d.ts +41 -16
- package/packages/host/dist/git.js +162 -101
- package/packages/host/dist/git.js.map +1 -1
- package/packages/host/dist/gitnotify.d.ts +54 -0
- package/packages/host/dist/gitnotify.js +167 -0
- package/packages/host/dist/gitnotify.js.map +1 -0
- package/packages/host/dist/healthwatch.d.ts +2 -1
- package/packages/host/dist/healthwatch.js +4 -2
- package/packages/host/dist/healthwatch.js.map +1 -1
- package/packages/host/dist/hoststore.js +2 -2
- package/packages/host/dist/hoststore.js.map +1 -1
- package/packages/host/dist/intents/adapters.js +68 -19
- package/packages/host/dist/intents/adapters.js.map +1 -1
- package/packages/host/dist/intents/clock.d.ts +6 -3
- package/packages/host/dist/intents/clock.js +19 -5
- package/packages/host/dist/intents/clock.js.map +1 -1
- package/packages/host/dist/intents/contract.d.ts +15 -5
- package/packages/host/dist/intents/contract.js.map +1 -1
- package/packages/host/dist/intents/disk.d.ts +16 -0
- package/packages/host/dist/intents/disk.js +26 -1
- package/packages/host/dist/intents/disk.js.map +1 -1
- package/packages/host/dist/intents/fire.js +7 -1
- package/packages/host/dist/intents/fire.js.map +1 -1
- package/packages/host/dist/intents/ladder.js +3 -1
- package/packages/host/dist/intents/ladder.js.map +1 -1
- package/packages/host/dist/intents/manager.d.ts +3 -3
- package/packages/host/dist/intents/manager.js +2 -2
- package/packages/host/dist/intents/manager.js.map +1 -1
- package/packages/host/dist/intents/watch.d.ts +27 -3
- package/packages/host/dist/intents/watch.js +70 -9
- package/packages/host/dist/intents/watch.js.map +1 -1
- package/packages/host/dist/intents/write.d.ts +28 -1
- package/packages/host/dist/intents/write.js +87 -2
- package/packages/host/dist/intents/write.js.map +1 -1
- package/packages/host/dist/localcistatus.d.ts +22 -0
- package/packages/host/dist/localcistatus.js +105 -0
- package/packages/host/dist/localcistatus.js.map +1 -0
- package/packages/host/dist/main.js +45 -12
- package/packages/host/dist/main.js.map +1 -1
- package/packages/host/dist/net.d.ts +2 -0
- package/packages/host/dist/net.js +11 -2
- package/packages/host/dist/net.js.map +1 -1
- package/packages/host/dist/netlog.d.ts +40 -0
- package/packages/host/dist/netlog.js +165 -0
- package/packages/host/dist/netlog.js.map +1 -0
- package/packages/host/dist/netretrycfg.d.ts +7 -0
- package/packages/host/dist/netretrycfg.js +51 -0
- package/packages/host/dist/netretrycfg.js.map +1 -0
- package/packages/host/dist/notifyprefs.d.ts +6 -2
- package/packages/host/dist/notifyprefs.js +20 -5
- package/packages/host/dist/notifyprefs.js.map +1 -1
- package/packages/host/dist/notifytypes.d.ts +63 -0
- package/packages/host/dist/notifytypes.js +2 -0
- package/packages/host/dist/notifytypes.js.map +1 -0
- package/packages/host/dist/opendeliveries.js +24 -0
- package/packages/host/dist/opendeliveries.js.map +1 -1
- package/packages/host/dist/optins.d.ts +28 -1
- package/packages/host/dist/optins.js +96 -4
- package/packages/host/dist/optins.js.map +1 -1
- package/packages/host/dist/peers/agentpeer.js +1 -1
- package/packages/host/dist/peers/agentpeer.js.map +1 -1
- package/packages/host/dist/peers/jobs.d.ts +2 -4
- package/packages/host/dist/peers/jobs.js +6 -1
- package/packages/host/dist/peers/jobs.js.map +1 -1
- package/packages/host/dist/periodspend.d.ts +22 -3
- package/packages/host/dist/periodspend.js +44 -4
- package/packages/host/dist/periodspend.js.map +1 -1
- package/packages/host/dist/plugins/pluginapi.js +40 -10
- package/packages/host/dist/plugins/pluginapi.js.map +1 -1
- package/packages/host/dist/plugins/pluginregistry.d.ts +3 -8
- package/packages/host/dist/plugins/pluginregistry.js +1 -1
- package/packages/host/dist/plugins/pluginregistry.js.map +1 -1
- package/packages/host/dist/plugins/plugintoolkit/sessionof.d.ts +47 -0
- package/packages/host/dist/plugins/plugintoolkit/sessionof.js +136 -0
- package/packages/host/dist/plugins/plugintoolkit/sessionof.js.map +1 -0
- package/packages/host/dist/prmergestore.d.ts +31 -0
- package/packages/host/dist/prmergestore.js +106 -0
- package/packages/host/dist/prmergestore.js.map +1 -0
- package/packages/host/dist/protectmain.d.ts +35 -0
- package/packages/host/dist/protectmain.js +73 -0
- package/packages/host/dist/protectmain.js.map +1 -0
- package/packages/host/dist/prpush.d.ts +38 -0
- package/packages/host/dist/prpush.js +351 -0
- package/packages/host/dist/prpush.js.map +1 -0
- package/packages/host/dist/prs.d.ts +118 -0
- package/packages/host/dist/prs.js +681 -0
- package/packages/host/dist/prs.js.map +1 -0
- package/packages/host/dist/push.d.ts +85 -1
- package/packages/host/dist/push.js +238 -8
- package/packages/host/dist/push.js.map +1 -1
- package/packages/host/dist/pushlanded.d.ts +29 -0
- package/packages/host/dist/pushlanded.js +61 -0
- package/packages/host/dist/pushlanded.js.map +1 -0
- package/packages/host/dist/pushreach.d.ts +9 -0
- package/packages/host/dist/pushreach.js +102 -0
- package/packages/host/dist/pushreach.js.map +1 -0
- package/packages/host/dist/pushverdict.d.ts +42 -0
- package/packages/host/dist/pushverdict.js +110 -0
- package/packages/host/dist/pushverdict.js.map +1 -0
- package/packages/host/dist/render.d.ts +57 -0
- package/packages/host/dist/render.js +57 -39
- package/packages/host/dist/render.js.map +1 -1
- package/packages/host/dist/repohealth.js +5 -2
- package/packages/host/dist/repohealth.js.map +1 -1
- package/packages/host/dist/repohealthapproval.d.ts +3 -0
- package/packages/host/dist/repohealthapproval.js +92 -2
- package/packages/host/dist/repohealthapproval.js.map +1 -1
- package/packages/host/dist/repos.d.ts +7 -1
- package/packages/host/dist/repos.js +30 -3
- package/packages/host/dist/repos.js.map +1 -1
- package/packages/host/dist/reposkill.d.ts +8 -5
- package/packages/host/dist/reposkill.js +16 -11
- package/packages/host/dist/reposkill.js.map +1 -1
- package/packages/host/dist/reposkilltext.d.ts +8 -1
- package/packages/host/dist/reposkilltext.js +85 -12
- package/packages/host/dist/reposkilltext.js.map +1 -1
- package/packages/host/dist/routes/apigitspend.d.ts +2 -0
- package/packages/host/dist/routes/apigitspend.js +40 -0
- package/packages/host/dist/routes/apigitspend.js.map +1 -0
- package/packages/host/dist/routes/apihost.js +17 -0
- package/packages/host/dist/routes/apihost.js.map +1 -1
- package/packages/host/dist/routes/apiprs.d.ts +2 -0
- package/packages/host/dist/routes/apiprs.js +47 -0
- package/packages/host/dist/routes/apiprs.js.map +1 -0
- package/packages/host/dist/routes/apirepofiles.js +13 -1
- package/packages/host/dist/routes/apirepofiles.js.map +1 -1
- package/packages/host/dist/routes/apirepowork.d.ts +6 -0
- package/packages/host/dist/routes/apirepowork.js +42 -33
- package/packages/host/dist/routes/apirepowork.js.map +1 -1
- package/packages/host/dist/routes/apiroutes.js +2 -1
- package/packages/host/dist/routes/apiroutes.js.map +1 -1
- package/packages/host/dist/routes/apisession.js +24 -0
- package/packages/host/dist/routes/apisession.js.map +1 -1
- package/packages/host/dist/routes/apistats.js +12 -7
- package/packages/host/dist/routes/apistats.js.map +1 -1
- package/packages/host/dist/routes/apisystem.js +23 -1
- package/packages/host/dist/routes/apisystem.js.map +1 -1
- package/packages/host/dist/routes/apitable.d.ts +10 -0
- package/packages/host/dist/routes/apitable.js.map +1 -1
- package/packages/host/dist/routes/apiweekburn.d.ts +2 -0
- package/packages/host/dist/routes/apiweekburn.js +30 -0
- package/packages/host/dist/routes/apiweekburn.js.map +1 -0
- package/packages/host/dist/routes/session.js +10 -0
- package/packages/host/dist/routes/session.js.map +1 -1
- package/packages/host/dist/routes/system.js +34 -6
- package/packages/host/dist/routes/system.js.map +1 -1
- package/packages/host/dist/routes/types.d.ts +29 -21
- package/packages/host/dist/routes/work/workbuild.js +3 -2
- package/packages/host/dist/routes/work/workbuild.js.map +1 -1
- package/packages/host/dist/routes/work/workintent.js +6 -2
- package/packages/host/dist/routes/work/workintent.js.map +1 -1
- package/packages/host/dist/routes/work/workschedule.js +33 -3
- package/packages/host/dist/routes/work/workschedule.js.map +1 -1
- package/packages/host/dist/screenlog.d.ts +20 -0
- package/packages/host/dist/screenlog.js +40 -0
- package/packages/host/dist/screenlog.js.map +1 -1
- package/packages/host/dist/server/billingwire.d.ts +3 -1
- package/packages/host/dist/server/billingwire.js +4 -2
- package/packages/host/dist/server/billingwire.js.map +1 -1
- package/packages/host/dist/server/clients.d.ts +14 -24
- package/packages/host/dist/server/clients.js +81 -11
- package/packages/host/dist/server/clients.js.map +1 -1
- package/packages/host/dist/server/ctx.d.ts +2 -0
- package/packages/host/dist/server/ctxseal.d.ts +1 -1
- package/packages/host/dist/server/ctxseal.js +6 -6
- package/packages/host/dist/server/ctxseal.js.map +1 -1
- package/packages/host/dist/server/deliveries.js +4 -2
- package/packages/host/dist/server/deliveries.js.map +1 -1
- package/packages/host/dist/server/http.js +2 -2
- package/packages/host/dist/server/http.js.map +1 -1
- package/packages/host/dist/server/intentDeps.js +13 -6
- package/packages/host/dist/server/intentDeps.js.map +1 -1
- package/packages/host/dist/server/intentEvents.js +9 -4
- package/packages/host/dist/server/intentEvents.js.map +1 -1
- package/packages/host/dist/server/scan.js +23 -1
- package/packages/host/dist/server/scan.js.map +1 -1
- package/packages/host/dist/server/sessionEvents.js +40 -15
- package/packages/host/dist/server/sessionEvents.js.map +1 -1
- package/packages/host/dist/server/shutdown.d.ts +3 -1
- package/packages/host/dist/server/shutdown.js +9 -1
- package/packages/host/dist/server/shutdown.js.map +1 -1
- package/packages/host/dist/sessionbudget.d.ts +2 -0
- package/packages/host/dist/sessionbudget.js +17 -6
- package/packages/host/dist/sessionbudget.js.map +1 -1
- package/packages/host/dist/sessions/agentpoll.d.ts +42 -0
- package/packages/host/dist/sessions/agentpoll.js +193 -0
- package/packages/host/dist/sessions/agentpoll.js.map +1 -0
- package/packages/host/dist/sessions/apiretry.d.ts +106 -0
- package/packages/host/dist/sessions/apiretry.js +387 -0
- package/packages/host/dist/sessions/apiretry.js.map +1 -0
- package/packages/host/dist/sessions/askwatch.d.ts +62 -0
- package/packages/host/dist/sessions/askwatch.js +169 -0
- package/packages/host/dist/sessions/askwatch.js.map +1 -0
- package/packages/host/dist/sessions/boxes.d.ts +2 -23
- package/packages/host/dist/sessions/boxes.js +10 -664
- package/packages/host/dist/sessions/boxes.js.map +1 -1
- package/packages/host/dist/sessions/boxread.d.ts +47 -0
- package/packages/host/dist/sessions/boxread.js +628 -0
- package/packages/host/dist/sessions/boxread.js.map +1 -0
- package/packages/host/dist/sessions/core.d.ts +22 -1
- package/packages/host/dist/sessions/ctxseries.js +3 -0
- package/packages/host/dist/sessions/ctxseries.js.map +1 -1
- package/packages/host/dist/sessions/drive.d.ts +20 -6
- package/packages/host/dist/sessions/drive.js +45 -12
- package/packages/host/dist/sessions/drive.js.map +1 -1
- package/packages/host/dist/sessions/endsession.d.ts +11 -0
- package/packages/host/dist/sessions/endsession.js +71 -0
- package/packages/host/dist/sessions/endsession.js.map +1 -0
- package/packages/host/dist/sessions/haltall.d.ts +14 -0
- package/packages/host/dist/sessions/haltall.js +32 -1
- package/packages/host/dist/sessions/haltall.js.map +1 -1
- package/packages/host/dist/sessions/knobs.d.ts +11 -0
- package/packages/host/dist/sessions/knobs.js +12 -0
- package/packages/host/dist/sessions/knobs.js.map +1 -1
- package/packages/host/dist/sessions/record.js +7 -2
- package/packages/host/dist/sessions/record.js.map +1 -1
- package/packages/host/dist/sessions/resume.d.ts +17 -0
- package/packages/host/dist/sessions/resume.js +65 -11
- package/packages/host/dist/sessions/resume.js.map +1 -1
- package/packages/host/dist/sessions/roster.js +3 -0
- package/packages/host/dist/sessions/roster.js.map +1 -1
- package/packages/host/dist/sessions/sidechannel.d.ts +1 -1
- package/packages/host/dist/sessions/sidechannel.js +2 -2
- package/packages/host/dist/sessions/tmux.js +21 -2
- package/packages/host/dist/sessions/tmux.js.map +1 -1
- package/packages/host/dist/sessions/turn.d.ts +15 -58
- package/packages/host/dist/sessions/turn.js +19 -358
- package/packages/host/dist/sessions/turn.js.map +1 -1
- package/packages/host/dist/sessions.d.ts +10 -7
- package/packages/host/dist/sessions.js +31 -79
- package/packages/host/dist/sessions.js.map +1 -1
- package/packages/host/dist/settle.d.ts +30 -2
- package/packages/host/dist/settle.js +94 -49
- package/packages/host/dist/settle.js.map +1 -1
- package/packages/host/dist/setupprefs.d.ts +26 -1
- package/packages/host/dist/setupprefs.js +49 -1
- package/packages/host/dist/setupprefs.js.map +1 -1
- package/packages/host/dist/setupwatch.d.ts +10 -8
- package/packages/host/dist/setupwatch.js +19 -16
- package/packages/host/dist/setupwatch.js.map +1 -1
- package/packages/host/dist/sidecar/sidecarname.d.ts +2 -0
- package/packages/host/dist/sidecar/sidecarname.js +5 -1
- package/packages/host/dist/sidecar/sidecarname.js.map +1 -1
- package/packages/host/dist/sidecar/sidecarroute.d.ts +1 -1
- package/packages/host/dist/sidecar/sidecarroute.js +5 -0
- package/packages/host/dist/sidecar/sidecarroute.js.map +1 -1
- package/packages/host/dist/sidecar.d.ts +1 -1
- package/packages/host/dist/sidecar.js +1 -1
- package/packages/host/dist/sidecar.js.map +1 -1
- package/packages/host/dist/tokenscan.d.ts +4 -4
- package/packages/host/dist/tokenscan.js +18 -37
- package/packages/host/dist/tokenscan.js.map +1 -1
- package/packages/host/dist/tokenstats.js +16 -18
- package/packages/host/dist/tokenstats.js.map +1 -1
- package/packages/host/dist/transcript/transcriptparse.js +17 -26
- package/packages/host/dist/transcript/transcriptparse.js.map +1 -1
- package/packages/host/dist/transcript/transcriptturns.d.ts +29 -0
- package/packages/host/dist/transcript/transcriptturns.js +27 -0
- package/packages/host/dist/transcript/transcriptturns.js.map +1 -1
- package/packages/host/dist/transcript.d.ts +1 -1
- package/packages/host/dist/transcript.js +1 -1
- package/packages/host/dist/transcript.js.map +1 -1
- package/packages/host/dist/usagesources.d.ts +1 -1
- package/packages/host/dist/usagesources.js +7 -2
- package/packages/host/dist/usagesources.js.map +1 -1
- package/packages/host/dist/visualskill.js +2 -2
- package/packages/host/dist/weekburn.d.ts +79 -0
- package/packages/host/dist/weekburn.js +276 -0
- package/packages/host/dist/weekburn.js.map +1 -0
- package/packages/host/dist/worktreeleftover.d.ts +9 -0
- package/packages/host/dist/worktreeleftover.js +17 -1
- package/packages/host/dist/worktreeleftover.js.map +1 -1
- package/packages/web/dist/assets/demo-DsZGy-MC.js +24 -0
- package/packages/web/dist/assets/icons-eqlvjswV.js +1 -0
- package/packages/web/dist/assets/index-GHwJuQb3.js +169 -0
- package/packages/web/dist/assets/index-VzDSZwwH.css +1 -0
- package/packages/web/dist/assets/shared-BWk5jXWb.js +49 -0
- package/packages/web/dist/assets/sheets-Dj-0m0DB.js +232 -0
- package/packages/web/dist/assets/{sheets-Bjv2L-cG.css → sheets-DoUhPGK0.css} +1 -1
- package/packages/web/dist/build-id.txt +1 -1
- package/packages/web/dist/buildstamp.json +1 -0
- package/packages/web/dist/index.html +7 -7
- package/packages/web/dist/sw.js +18 -3
- package/release.json +7 -4
- package/scripts/windows/wsl-setup.sh +10 -1
- package/tools/repohealth/constants.mjs +21 -1
- package/tools/repohealth/fixture.json +493 -30
- package/tools/repohealth/lang/typescript-resolve.mjs +354 -0
- package/tools/repohealth/metrics/graph.mjs +258 -0
- package/tools/repohealth/metrics/size.mjs +1 -1
- package/tools/repohealth/own.mjs +4 -4
- package/tools/repohealth/packs/c.mjs +4 -0
- package/tools/repohealth/packs/common.mjs +4 -0
- package/tools/repohealth/packs/dart.mjs +4 -0
- package/tools/repohealth/packs/kotlin.mjs +8 -0
- package/tools/repohealth/packs/python.mjs +8 -0
- package/tools/repohealth/packs/shell.mjs +4 -0
- package/tools/repohealth/packs/typescript.mjs +278 -7
- package/tools/repohealth/readings.mjs +39 -0
- package/tools/repohealth/series.mjs +1 -0
- package/tools/repohealth/snapshot.mjs +14 -0
- package/tools/repohealth/types.mjs +12 -0
- package/tools/repohealth.mjs +2 -0
- package/packages/web/dist/assets/demo-CXlqlYE4.js +0 -23
- package/packages/web/dist/assets/icons-BbqDBVjw.js +0 -1
- package/packages/web/dist/assets/index-CgPoyb3Y.css +0 -1
- package/packages/web/dist/assets/index-D5JKj8DK.js +0 -169
- package/packages/web/dist/assets/shared-eyaskl5l.js +0 -47
- package/packages/web/dist/assets/sheets-BzzL2re1.js +0 -204
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a NON-relative import specifier points inside the tree, read from the
|
|
3
|
+
* files the family resolves it with: `tsconfig*.json` / `jsconfig*.json`
|
|
4
|
+
* (`compilerOptions.paths` and `baseUrl`) and every workspace `package.json`
|
|
5
|
+
* (its `name`, `exports`, `main`/`module`/`types`, and `imports` for `#x`).
|
|
6
|
+
*
|
|
7
|
+
* ── Why this exists ─────────────────────────────────────────────────────────
|
|
8
|
+
*
|
|
9
|
+
* `metrics/graph.mjs` reads the import graph between a tree's own files. The
|
|
10
|
+
* pack's `imports` follows relative specifiers only, and that is enough for
|
|
11
|
+
* `untested`, whose error runs the safe way (a missed edge leaves a module ON
|
|
12
|
+
* the list). For a graph it runs the dangerous way: a missed edge removes a
|
|
13
|
+
* cycle and lowers a fan-out, so a tree the reader could not follow reads as
|
|
14
|
+
* a CLEAN tree. And the trees this reading is for — a Vite or Next app whose
|
|
15
|
+
* every import is `@/components/x` — are exactly the ones a relative-only
|
|
16
|
+
* reader cannot follow. So the aliases are resolved, and what is still not
|
|
17
|
+
* resolved is COUNTED, so the metric can go absent instead of reporting less
|
|
18
|
+
* coupling than there is.
|
|
19
|
+
*
|
|
20
|
+
* ── What it returns: candidates, never a verdict ────────────────────────────
|
|
21
|
+
*
|
|
22
|
+
* `resolveSpecifier` answers with repo-relative candidate paths in the order
|
|
23
|
+
* the resolver would try them, and whether the specifier is INTERNAL — names
|
|
24
|
+
* this project's code, so a candidate that hits no file is a miss to count —
|
|
25
|
+
* or only possibly so (a `baseUrl` lookup, which is also how a bare `react`
|
|
26
|
+
* would be spelled). Which candidate exists is a question about the tree, and
|
|
27
|
+
* the metric asks it; nothing here reads a file.
|
|
28
|
+
*
|
|
29
|
+
* ── What it does not do ─────────────────────────────────────────────────────
|
|
30
|
+
*
|
|
31
|
+
* - **Bundler aliases.** `resolve.alias` in a `vite.config.*` or a webpack
|
|
32
|
+
* config is code, not data. A Vite app that declares `@` only there and
|
|
33
|
+
* not in `tsconfig` gets its `@/…` imports — and any bare import of a
|
|
34
|
+
* name no `package.json` in the tree declares, which is how an alias like
|
|
35
|
+
* `components/x` or `@ui/x` looks from here — counted as internal and
|
|
36
|
+
* unresolved, which is what drives the reading absent with the reason.
|
|
37
|
+
* - **`extends` from a package** (`@tsconfig/node18`). Only a relative
|
|
38
|
+
* `extends` inside the tree is followed; a published base config sets
|
|
39
|
+
* compiler flags, almost never `paths`.
|
|
40
|
+
* - **Conditions.** An `exports` condition object is read in a fixed order
|
|
41
|
+
* (`types`, `import`, `module`, `default`, `require`, `node`) and the first
|
|
42
|
+
* string wins: which one a bundler picks does not change WHICH module of
|
|
43
|
+
* this tree is named, only which emit of it.
|
|
44
|
+
*
|
|
45
|
+
* Nothing here may call a model, touch the network, or read a file.
|
|
46
|
+
*/
|
|
47
|
+
import { builtinModules } from "node:module";
|
|
48
|
+
|
|
49
|
+
/** `a/b/../c/./d` -> `a/c/d`; `null` when it climbs out of the tree. */
|
|
50
|
+
export function normalise(path) {
|
|
51
|
+
const out = [];
|
|
52
|
+
for (const seg of path.split("/")) {
|
|
53
|
+
if (seg === "" || seg === ".") continue;
|
|
54
|
+
if (seg === "..") {
|
|
55
|
+
if (out.length === 0) return null;
|
|
56
|
+
out.pop();
|
|
57
|
+
} else out.push(seg);
|
|
58
|
+
}
|
|
59
|
+
return out.join("/");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const dirOf = (path) => {
|
|
63
|
+
const slash = path.lastIndexOf("/");
|
|
64
|
+
return slash === -1 ? "" : path.slice(0, slash);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const join = (dir, rel) => normalise(dir ? `${dir}/${rel}` : rel);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* JSON with comments and trailing commas — what `tsconfig.json` is written
|
|
71
|
+
* in. Comments are stripped outside strings only, so a `"//"` inside a path
|
|
72
|
+
* pattern survives. `null` for anything that still does not parse: a config
|
|
73
|
+
* this reader cannot read declares no alias, and the imports it would have
|
|
74
|
+
* resolved are counted as misses rather than guessed.
|
|
75
|
+
*/
|
|
76
|
+
export function parseJsonc(text) {
|
|
77
|
+
let out = "";
|
|
78
|
+
let i = 0;
|
|
79
|
+
while (i < text.length) {
|
|
80
|
+
const ch = text[i];
|
|
81
|
+
if (ch === '"') {
|
|
82
|
+
let j = i + 1;
|
|
83
|
+
while (j < text.length && text[j] !== '"') j += text[j] === "\\" ? 2 : 1;
|
|
84
|
+
out += text.slice(i, j + 1);
|
|
85
|
+
i = j + 1;
|
|
86
|
+
} else if (ch === "/" && text[i + 1] === "/") {
|
|
87
|
+
while (i < text.length && text[i] !== "\n") i++;
|
|
88
|
+
} else if (ch === "/" && text[i + 1] === "*") {
|
|
89
|
+
const end = text.indexOf("*/", i + 2);
|
|
90
|
+
i = end === -1 ? text.length : end + 2;
|
|
91
|
+
} else {
|
|
92
|
+
out += ch;
|
|
93
|
+
i++;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
return JSON.parse(out.replace(/,(\s*[}\]])/g, "$1"));
|
|
98
|
+
} catch {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Which tree entries this resolver reads, as regex source. */
|
|
104
|
+
export const RESOLVE_CONFIG_PATH = "(?:^|/)(?:[tj]sconfig[\\w.-]*\\.json|package\\.json)$";
|
|
105
|
+
|
|
106
|
+
const TSCONFIG = /(?:^|\/)[tj]sconfig[\w.-]*\.json$/;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* A config's `compilerOptions` after its relative `extends` chain: `baseUrl`
|
|
110
|
+
* as a repo path, and `paths` with every target already a repo path. TS
|
|
111
|
+
* resolves `paths` against `baseUrl` when one is in effect and against the
|
|
112
|
+
* config that wrote them otherwise, and a child's own key replaces its
|
|
113
|
+
* parent's.
|
|
114
|
+
*/
|
|
115
|
+
function effectiveOptions(path, byPath, seen = new Set()) {
|
|
116
|
+
const json = byPath.get(path);
|
|
117
|
+
if (!json || seen.has(path)) return { baseUrl: null, paths: null };
|
|
118
|
+
seen.add(path);
|
|
119
|
+
const dir = dirOf(path);
|
|
120
|
+
let inherited = { baseUrl: null, paths: null };
|
|
121
|
+
const ext = json.extends;
|
|
122
|
+
for (const e of Array.isArray(ext) ? ext : typeof ext === "string" ? [ext] : []) {
|
|
123
|
+
if (typeof e !== "string" || !(e.startsWith("./") || e.startsWith("../"))) continue;
|
|
124
|
+
const target = join(dir, e.endsWith(".json") ? e : `${e}.json`);
|
|
125
|
+
if (target === null) continue;
|
|
126
|
+
const parent = effectiveOptions(target, byPath, seen);
|
|
127
|
+
inherited = { baseUrl: parent.baseUrl ?? inherited.baseUrl, paths: parent.paths ?? inherited.paths };
|
|
128
|
+
}
|
|
129
|
+
const co = json.compilerOptions && typeof json.compilerOptions === "object" ? json.compilerOptions : {};
|
|
130
|
+
const baseUrl = typeof co.baseUrl === "string" ? join(dir, co.baseUrl) : inherited.baseUrl;
|
|
131
|
+
let paths = inherited.paths;
|
|
132
|
+
if (co.paths && typeof co.paths === "object") {
|
|
133
|
+
const base = baseUrl ?? dir;
|
|
134
|
+
paths = [];
|
|
135
|
+
for (const [pattern, targets] of Object.entries(co.paths)) {
|
|
136
|
+
if (!Array.isArray(targets)) continue;
|
|
137
|
+
const star = pattern.indexOf("*");
|
|
138
|
+
const resolved = targets.filter((t) => typeof t === "string").map((t) => join(base ?? "", t)).filter((t) => t !== null);
|
|
139
|
+
paths.push({
|
|
140
|
+
pattern,
|
|
141
|
+
prefix: star === -1 ? pattern : pattern.slice(0, star),
|
|
142
|
+
suffix: star === -1 ? "" : pattern.slice(star + 1),
|
|
143
|
+
star: star !== -1,
|
|
144
|
+
targets: resolved,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return { baseUrl, paths };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Everything `resolveSpecifier` needs, from the config entries of one tree.
|
|
153
|
+
* Plain data, so a snapshot can carry it.
|
|
154
|
+
*
|
|
155
|
+
* Several configs in one directory (`tsconfig.json`, `tsconfig.app.json`,
|
|
156
|
+
* `tsconfig.node.json` — the Vite template) are one SCOPE: their aliases are
|
|
157
|
+
* unioned, because a file is compiled under one of them and this reader does
|
|
158
|
+
* not know which.
|
|
159
|
+
*
|
|
160
|
+
* @param {{path: string, oid: string}[]} entries
|
|
161
|
+
* @param {(entry: {path: string, oid: string}) => string} textOf
|
|
162
|
+
*/
|
|
163
|
+
export function buildResolveContext(entries, textOf) {
|
|
164
|
+
const configs = new Map();
|
|
165
|
+
const packages = [];
|
|
166
|
+
for (const e of entries) {
|
|
167
|
+
const json = parseJsonc(textOf(e));
|
|
168
|
+
if (!json || typeof json !== "object") continue;
|
|
169
|
+
if (TSCONFIG.test(e.path)) configs.set(e.path, json);
|
|
170
|
+
else packages.push({ dir: dirOf(e.path), json });
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** dir -> {baseUrls, aliases} */
|
|
174
|
+
const scopes = new Map();
|
|
175
|
+
for (const path of [...configs.keys()].sort()) {
|
|
176
|
+
const { baseUrl, paths } = effectiveOptions(path, configs);
|
|
177
|
+
if (baseUrl === null && !paths) continue;
|
|
178
|
+
const dir = dirOf(path);
|
|
179
|
+
const s = scopes.get(dir) ?? { dir, baseUrls: [], aliases: [] };
|
|
180
|
+
if (baseUrl !== null && !s.baseUrls.includes(baseUrl)) s.baseUrls.push(baseUrl);
|
|
181
|
+
for (const a of paths ?? []) if (!s.aliases.some((b) => b.pattern === a.pattern && b.targets.join() === a.targets.join())) s.aliases.push(a);
|
|
182
|
+
scopes.set(dir, s);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const workspaces = packages
|
|
186
|
+
.filter((p) => typeof p.json.name === "string" && p.json.name)
|
|
187
|
+
.map((p) => ({
|
|
188
|
+
name: p.json.name,
|
|
189
|
+
dir: p.dir,
|
|
190
|
+
exports: p.json.exports ?? null,
|
|
191
|
+
entry: ["types", "typings", "module", "main"].map((k) => p.json[k]).filter((v) => typeof v === "string"),
|
|
192
|
+
}))
|
|
193
|
+
// Longest name first, so `@a/b-extra` is never read as a subpath of `@a/b`.
|
|
194
|
+
.sort((a, b) => b.name.length - a.name.length || (a.name < b.name ? -1 : 1));
|
|
195
|
+
const imports = packages
|
|
196
|
+
.filter((p) => p.json.imports && typeof p.json.imports === "object")
|
|
197
|
+
.map((p) => ({ dir: p.dir, imports: p.json.imports }));
|
|
198
|
+
|
|
199
|
+
// Every package name any manifest in the tree declares. A bare import of a
|
|
200
|
+
// name in none of them is not a package this project installs — it is an
|
|
201
|
+
// alias this reader did not find (a bundler's `resolve.alias`), or a bug —
|
|
202
|
+
// and either way it is a miss to count, never an external edge to drop.
|
|
203
|
+
const deps = new Set(workspaces.map((w) => w.name));
|
|
204
|
+
for (const p of packages) {
|
|
205
|
+
for (const k of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) {
|
|
206
|
+
const d = p.json[k];
|
|
207
|
+
if (d && typeof d === "object") for (const name of Object.keys(d)) deps.add(name);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const byDepth = (a, b) => b.dir.split("/").length - a.dir.split("/").length || (a.dir < b.dir ? -1 : 1);
|
|
212
|
+
return {
|
|
213
|
+
scopes: [...scopes.values()].sort(byDepth),
|
|
214
|
+
workspaces,
|
|
215
|
+
imports: imports.sort(byDepth),
|
|
216
|
+
// `null` with no manifest at all: then nothing is known to be undeclared.
|
|
217
|
+
deps: packages.length ? [...deps].sort() : null,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** Is `dir` the directory of `path` or one above it? `""` is the root. */
|
|
222
|
+
const contains = (dir, path) => dir === "" || path === dir || path.startsWith(`${dir}/`);
|
|
223
|
+
|
|
224
|
+
const CONDITIONS = ["types", "import", "module", "default", "require", "node"];
|
|
225
|
+
|
|
226
|
+
/** The first string an `exports` / `imports` value leads to, condition order fixed. */
|
|
227
|
+
function targetOf(value) {
|
|
228
|
+
if (typeof value === "string") return value;
|
|
229
|
+
if (Array.isArray(value)) {
|
|
230
|
+
for (const v of value) {
|
|
231
|
+
const t = targetOf(v);
|
|
232
|
+
if (t) return t;
|
|
233
|
+
}
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
if (value && typeof value === "object") {
|
|
237
|
+
for (const c of CONDITIONS) if (c in value) {
|
|
238
|
+
const t = targetOf(value[c]);
|
|
239
|
+
if (t) return t;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** One key of an `exports`/`imports` map matched against `sub`, `*` patterns included. */
|
|
246
|
+
function lookupMap(map, sub) {
|
|
247
|
+
if (!map || typeof map !== "object") return null;
|
|
248
|
+
if (sub in map) return targetOf(map[sub]);
|
|
249
|
+
for (const [k, v] of Object.entries(map)) {
|
|
250
|
+
const star = k.indexOf("*");
|
|
251
|
+
if (star === -1) continue;
|
|
252
|
+
const pre = k.slice(0, star);
|
|
253
|
+
const post = k.slice(star + 1);
|
|
254
|
+
if (sub.startsWith(pre) && sub.endsWith(post) && sub.length >= pre.length + post.length) {
|
|
255
|
+
const t = targetOf(v);
|
|
256
|
+
if (t) return t.replace("*", sub.slice(pre.length, sub.length - post.length));
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Specifiers that are this project's code by the family's own conventions —
|
|
264
|
+
* `@/x` and `~/x` (the alias the Vite, Next and Nuxt templates write), a
|
|
265
|
+
* `#x` subpath import, and a `src/x` written against a `baseUrl` — and so a
|
|
266
|
+
* MISS when nothing above resolved them, never an external package.
|
|
267
|
+
*/
|
|
268
|
+
const LOOKS_INTERNAL = /^(?:@\/|~\/|#|src\/)/;
|
|
269
|
+
|
|
270
|
+
const BUILTINS = new Set(builtinModules);
|
|
271
|
+
const DEPS_MEMO = new WeakMap();
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* A bare specifier whose package no manifest in the tree declares. A `:` is a
|
|
275
|
+
* protocol or a bundler's virtual module (`node:fs`, `virtual:pwa-register`),
|
|
276
|
+
* never a package name, so it is not asked about.
|
|
277
|
+
*/
|
|
278
|
+
function undeclared(spec, ctx) {
|
|
279
|
+
if (!ctx?.deps || spec.includes(":") || spec.startsWith(".") || spec.startsWith("/")) return false;
|
|
280
|
+
const segs = spec.split("/");
|
|
281
|
+
const name = spec.startsWith("@") ? segs.slice(0, 2).join("/") : segs[0];
|
|
282
|
+
if (BUILTINS.has(name)) return false;
|
|
283
|
+
let deps = DEPS_MEMO.get(ctx);
|
|
284
|
+
if (!deps) DEPS_MEMO.set(ctx, (deps = new Set(ctx.deps)));
|
|
285
|
+
return !deps.has(name);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Where one non-relative specifier written in `fromPath` points.
|
|
290
|
+
*
|
|
291
|
+
* @param {string} spec
|
|
292
|
+
* @param {string} fromPath Repo-relative path of the importing file.
|
|
293
|
+
* @param {ReturnType<typeof buildResolveContext> | null} ctx
|
|
294
|
+
* @returns {{internal: boolean, candidates: string[]} | null}
|
|
295
|
+
* `null` for an external package: no edge, and no miss.
|
|
296
|
+
*/
|
|
297
|
+
export function resolveSpecifier(spec, fromPath, ctx) {
|
|
298
|
+
if (ctx && !spec.startsWith("node:")) {
|
|
299
|
+
// 1. `compilerOptions.paths` of the nearest scope that declares any. TS
|
|
300
|
+
// takes the matching pattern with the longest prefix; an exact pattern
|
|
301
|
+
// is the longest of all.
|
|
302
|
+
const scope = ctx.scopes.find((s) => contains(s.dir, fromPath));
|
|
303
|
+
if (scope) {
|
|
304
|
+
let best = null;
|
|
305
|
+
for (const a of scope.aliases) {
|
|
306
|
+
const hit = a.star
|
|
307
|
+
? spec.startsWith(a.prefix) && spec.endsWith(a.suffix) && spec.length >= a.prefix.length + a.suffix.length
|
|
308
|
+
: spec === a.pattern;
|
|
309
|
+
if (!hit) continue;
|
|
310
|
+
const weight = a.star ? a.prefix.length : Infinity;
|
|
311
|
+
if (!best || weight > best.weight) best = { a, weight };
|
|
312
|
+
}
|
|
313
|
+
if (best) {
|
|
314
|
+
const { a } = best;
|
|
315
|
+
const middle = a.star ? spec.slice(a.prefix.length, spec.length - a.suffix.length) : "";
|
|
316
|
+
const candidates = a.targets.map((t) => normalise(a.star ? t.replace("*", middle) : t)).filter((t) => t !== null);
|
|
317
|
+
return { internal: true, candidates };
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// 2. A workspace package by its manifest name, through its `exports` or
|
|
322
|
+
// its entry fields, with the source layout as the last resort.
|
|
323
|
+
for (const w of ctx.workspaces) {
|
|
324
|
+
if (spec !== w.name && !spec.startsWith(`${w.name}/`)) continue;
|
|
325
|
+
const rest = spec.slice(w.name.length + 1);
|
|
326
|
+
const sub = rest ? `./${rest}` : ".";
|
|
327
|
+
const out = [];
|
|
328
|
+
const mapped = typeof w.exports === "string" ? (sub === "." ? w.exports : null) : lookupMap(w.exports, sub);
|
|
329
|
+
if (mapped) out.push(mapped);
|
|
330
|
+
if (sub === ".") out.push(...w.entry, "src/index", "index");
|
|
331
|
+
else out.push(rest, `src/${rest}`);
|
|
332
|
+
return { internal: true, candidates: out.map((t) => join(w.dir, t)).filter((t) => t !== null) };
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// 3. `#x`: the `imports` map of the nearest manifest declaring one.
|
|
336
|
+
if (spec.startsWith("#")) {
|
|
337
|
+
const owner = ctx.imports.find((p) => contains(p.dir, fromPath));
|
|
338
|
+
const mapped = owner ? lookupMap(owner.imports, spec) : null;
|
|
339
|
+
if (mapped) return { internal: true, candidates: [join(owner.dir, mapped)].filter((t) => t !== null) };
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// 4. `baseUrl`: a bare specifier MAY be a path under it. Not internal on its
|
|
344
|
+
// own say-so — `react` is spelled the same way — so it counts only when a
|
|
345
|
+
// candidate turns out to be a file, unless it is spelled like ours or
|
|
346
|
+
// names a package no manifest declares.
|
|
347
|
+
const looksInternal = LOOKS_INTERNAL.test(spec) || undeclared(spec, ctx);
|
|
348
|
+
const scope = ctx?.scopes.find((s) => s.baseUrls.length && contains(s.dir, fromPath));
|
|
349
|
+
if (scope) {
|
|
350
|
+
const candidates = scope.baseUrls.map((b) => join(b, spec)).filter((t) => t !== null);
|
|
351
|
+
return { internal: looksInternal, candidates };
|
|
352
|
+
}
|
|
353
|
+
return looksInternal ? { internal: true, candidates: [] } : null;
|
|
354
|
+
}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The import graph between a tree's own modules: which files sit in an import
|
|
3
|
+
* cycle, and how many modules one file loads.
|
|
4
|
+
*
|
|
5
|
+
* ── The question this answers that the other readings cannot ───────────────
|
|
6
|
+
*
|
|
7
|
+
* Size reads one file at a time; co-change reads what commits touched
|
|
8
|
+
* together. Neither sees the STRUCTURE a change has to get through: a barrel
|
|
9
|
+
* re-exporting a folder that imports the barrel back, a component that loads
|
|
10
|
+
* sixty modules. Those are the shapes a codebase grown by accretion takes —
|
|
11
|
+
* every new feature is one more import of the nearest thing that works — and
|
|
12
|
+
* they are the shapes that make the next change expensive for a person and
|
|
13
|
+
* for an agent alike, because touching one file of a cycle means
|
|
14
|
+
* understanding all of it.
|
|
15
|
+
*
|
|
16
|
+
* Two readings, both from one pass, both language-neutral once a pack has
|
|
17
|
+
* said what a file imports:
|
|
18
|
+
*
|
|
19
|
+
* - **Cycles.** Strongly connected components of more than one module
|
|
20
|
+
* (Tarjan, iterative). `cycleFiles` is how many modules sit in one, and
|
|
21
|
+
* `cycles` lists the largest few with a sample of their members, so a
|
|
22
|
+
* number on the phone comes with the files to open. A self-import is not
|
|
23
|
+
* a cycle.
|
|
24
|
+
* - **Fan-out.** How many distinct modules of this tree each file imports;
|
|
25
|
+
* the nearest-rank p95 (`size.mjs`'s definition, imported, never a
|
|
26
|
+
* second one) and the max with its path. Packages from outside the tree
|
|
27
|
+
* are not edges: depending on `react` is not coupling between this
|
|
28
|
+
* project's files.
|
|
29
|
+
*
|
|
30
|
+
* ── Why the reading goes absent rather than low ────────────────────────────
|
|
31
|
+
*
|
|
32
|
+
* Every other metric here errs in a direction a reader can live with. This
|
|
33
|
+
* one would not: an import the reader could not follow is a DELETED edge, and
|
|
34
|
+
* a deleted edge removes cycles and lowers fan-outs — the tree a reader
|
|
35
|
+
* understood least would score cleanest. So the pack says, for every
|
|
36
|
+
* specifier, whether it names this project's code (`internal`), and the
|
|
37
|
+
* share of those that reached a module is carried on the row as
|
|
38
|
+
* `resolved`/`internal`. Below `PREREG.GRAPH_MIN_RESOLVED` the value is
|
|
39
|
+
* `null` and the reason names the specifiers that did not resolve, which is
|
|
40
|
+
* what a person needs to fix it (usually: declare the alias in `tsconfig`).
|
|
41
|
+
*
|
|
42
|
+
* The same holds for a file whose imports the pack could not read at all
|
|
43
|
+
* (`graphImports` returns `null` — the TypeScript lexer misread a spot it
|
|
44
|
+
* cannot recover from): counted as a module with fewer imports it would
|
|
45
|
+
* delete every edge after the spot, so one such file makes the reading
|
|
46
|
+
* absent, and the reason names the files.
|
|
47
|
+
*
|
|
48
|
+
* A language whose pack has no import-graph rule is skipped, never counted
|
|
49
|
+
* as a module with no imports; a tree where no pack has one is absent with
|
|
50
|
+
* the packs' names, as every other pack-dependent metric reports.
|
|
51
|
+
*
|
|
52
|
+
* ── What is deliberately not here ──────────────────────────────────────────
|
|
53
|
+
*
|
|
54
|
+
* No layer rules ("web may not import host"): they need a declaration, and
|
|
55
|
+
* this engine reads no repo's opinion of its own architecture. No reach or
|
|
56
|
+
* depth yet: the two readings above are the ones that point at a file to
|
|
57
|
+
* open. Dynamic `import()` IS an edge — it is how a lazy route loads a
|
|
58
|
+
* module, and a cycle through one is still a cycle a reader has to hold.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
import { packFor, packsWith, reasonFor } from "./route.mjs";
|
|
62
|
+
import { nearestRankP95 } from "./size.mjs";
|
|
63
|
+
|
|
64
|
+
/** How many cycles the row lists, and how many members of each. */
|
|
65
|
+
const CYCLES_LISTED = 5;
|
|
66
|
+
const MEMBERS_LISTED = 6;
|
|
67
|
+
/** How many unresolved specifiers an absence names. */
|
|
68
|
+
const MISSES_NAMED = 5;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Strongly connected components, iteratively — a recursive Tarjan overflows
|
|
72
|
+
* the stack on a long import chain, and a history backfill meets one.
|
|
73
|
+
*
|
|
74
|
+
* @param {number} n
|
|
75
|
+
* @param {number[][]} adj
|
|
76
|
+
* @returns {number[][]} components of more than one node
|
|
77
|
+
*/
|
|
78
|
+
export function cyclesOf(n, adj) {
|
|
79
|
+
const index = new Array(n).fill(-1);
|
|
80
|
+
const low = new Array(n).fill(0);
|
|
81
|
+
const onStack = new Array(n).fill(false);
|
|
82
|
+
const stack = [];
|
|
83
|
+
const out = [];
|
|
84
|
+
let next = 0;
|
|
85
|
+
for (let root = 0; root < n; root++) {
|
|
86
|
+
if (index[root] !== -1) continue;
|
|
87
|
+
const work = [[root, 0]];
|
|
88
|
+
index[root] = low[root] = next++;
|
|
89
|
+
stack.push(root);
|
|
90
|
+
onStack[root] = true;
|
|
91
|
+
while (work.length) {
|
|
92
|
+
const frame = work[work.length - 1];
|
|
93
|
+
const [v, i] = frame;
|
|
94
|
+
if (i < adj[v].length) {
|
|
95
|
+
frame[1]++;
|
|
96
|
+
const w = adj[v][i];
|
|
97
|
+
if (index[w] === -1) {
|
|
98
|
+
index[w] = low[w] = next++;
|
|
99
|
+
stack.push(w);
|
|
100
|
+
onStack[w] = true;
|
|
101
|
+
work.push([w, 0]);
|
|
102
|
+
} else if (onStack[w]) low[v] = Math.min(low[v], index[w]);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
work.pop();
|
|
106
|
+
if (work.length) {
|
|
107
|
+
const u = work[work.length - 1][0];
|
|
108
|
+
low[u] = Math.min(low[u], low[v]);
|
|
109
|
+
}
|
|
110
|
+
if (low[v] === index[v]) {
|
|
111
|
+
const comp = [];
|
|
112
|
+
let w;
|
|
113
|
+
do {
|
|
114
|
+
w = stack.pop();
|
|
115
|
+
onStack[w] = false;
|
|
116
|
+
comp.push(w);
|
|
117
|
+
} while (w !== v);
|
|
118
|
+
if (comp.length > 1) out.push(comp);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @param {import("../types.mjs").Snapshot} snapshot
|
|
127
|
+
* @param {import("../types.mjs").History} _history
|
|
128
|
+
* @param {number} _index
|
|
129
|
+
* @param {import("../types.mjs").EffectivePrereg} prereg
|
|
130
|
+
*/
|
|
131
|
+
export function measureGraph(snapshot, _history, _index, prereg) {
|
|
132
|
+
const files = snapshot.files ?? [];
|
|
133
|
+
if (files.length === 0) return { value: null, reason: "no source files in this tree" };
|
|
134
|
+
|
|
135
|
+
const rule = (pack) =>
|
|
136
|
+
typeof pack.graphImports === "function" && typeof pack.keysFor === "function" && typeof pack.graphKeysFor === "function";
|
|
137
|
+
const speakers = packsWith(prereg, "graphImports").filter((p) => rule(p.pack));
|
|
138
|
+
const noRule = (p) => (rule(p.pack) ? null : "no import-graph rule for this language");
|
|
139
|
+
if (speakers.length === 0) return { value: null, reason: reasonFor(prereg, noRule) };
|
|
140
|
+
const speaks = new Set(speakers.map((p) => p.name));
|
|
141
|
+
|
|
142
|
+
const readable = [];
|
|
143
|
+
for (const f of files) {
|
|
144
|
+
const owner = packFor(f.path, prereg);
|
|
145
|
+
if (owner && speaks.has(owner.name)) readable.push({ f, owner });
|
|
146
|
+
}
|
|
147
|
+
if (readable.length === 0) {
|
|
148
|
+
return { value: null, reason: reasonFor(prereg, noRule) || "no file in this tree belongs to a pack with an import-graph rule" };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// key -> every module answering to it. Two modules on one key (`x.ts` and
|
|
152
|
+
// `x.tsx`, which no build accepts) are both edges, as in `untested`.
|
|
153
|
+
// `byKey` holds every suffix a module answers to, for a relative import;
|
|
154
|
+
// `byPath` only its full path, for one the pack's resolver turned into a
|
|
155
|
+
// tree path — matched against suffixes, `src/lib/x` would also reach
|
|
156
|
+
// `vendor/src/lib/x.ts` and draw an edge nobody wrote.
|
|
157
|
+
const byKey = new Map();
|
|
158
|
+
const byPath = new Map();
|
|
159
|
+
const add = (map, k, i) => {
|
|
160
|
+
const list = map.get(k);
|
|
161
|
+
if (list) list.push(i);
|
|
162
|
+
else map.set(k, [i]);
|
|
163
|
+
};
|
|
164
|
+
readable.forEach((r, i) => {
|
|
165
|
+
for (const k of r.owner.pack.keysFor(r.f.path)) add(byKey, k, i);
|
|
166
|
+
for (const k of r.owner.pack.graphKeysFor(r.f.path)) add(byPath, k, i);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const contexts = snapshot.graphContexts ?? {};
|
|
170
|
+
const adj = readable.map(() => []);
|
|
171
|
+
let internal = 0;
|
|
172
|
+
let resolved = 0;
|
|
173
|
+
const misses = new Map();
|
|
174
|
+
const unread = [];
|
|
175
|
+
readable.forEach((r, i) => {
|
|
176
|
+
const out = new Set();
|
|
177
|
+
const imps = r.owner.pack.graphImports(r.f, contexts[r.owner.name] ?? null);
|
|
178
|
+
if (imps === null) {
|
|
179
|
+
unread.push(r.f.path);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
for (const imp of imps) {
|
|
183
|
+
let hit = null;
|
|
184
|
+
const keys = imp.relative ? byKey : byPath;
|
|
185
|
+
for (const key of imp.candidates) {
|
|
186
|
+
if (keys.has(key)) {
|
|
187
|
+
hit = keys.get(key);
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (hit) {
|
|
192
|
+
internal++;
|
|
193
|
+
resolved++;
|
|
194
|
+
for (const j of hit) if (j !== i) out.add(j);
|
|
195
|
+
} else if (imp.internal) {
|
|
196
|
+
internal++;
|
|
197
|
+
misses.set(imp.spec, (misses.get(imp.spec) ?? 0) + 1);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
adj[i] = [...out].sort((a, b) => a - b);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
if (unread.length) {
|
|
204
|
+
const named = unread
|
|
205
|
+
.sort()
|
|
206
|
+
.slice(0, MISSES_NAMED)
|
|
207
|
+
.map((p) => `\`${p}\``)
|
|
208
|
+
.join(", ");
|
|
209
|
+
const more = unread.length > MISSES_NAMED ? ` and ${unread.length - MISSES_NAMED} more` : "";
|
|
210
|
+
return {
|
|
211
|
+
value: null,
|
|
212
|
+
reason:
|
|
213
|
+
`the imports of ${unread.length} file${unread.length === 1 ? "" : "s"} could not be read: ${named}${more} — ` +
|
|
214
|
+
"a comment or template the reader saw opened and never closed; every edge after it is unknown",
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (internal > 0 && resolved / internal < prereg.GRAPH_MIN_RESOLVED) {
|
|
219
|
+
const named = [...misses.entries()]
|
|
220
|
+
.sort((a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : 1))
|
|
221
|
+
.slice(0, MISSES_NAMED)
|
|
222
|
+
.map(([spec, n]) => `\`${spec}\`${n > 1 ? ` ×${n}` : ""}`)
|
|
223
|
+
.join(", ");
|
|
224
|
+
return {
|
|
225
|
+
value: null,
|
|
226
|
+
reason:
|
|
227
|
+
`only ${resolved} of ${internal} imports of this tree's own code resolved to a module ` +
|
|
228
|
+
`(needs ${Math.round(prereg.GRAPH_MIN_RESOLVED * 100)}%); unresolved: ${named} — ` +
|
|
229
|
+
`an alias the bundler knows and tsconfig "paths" does not declare reads like this`,
|
|
230
|
+
internal,
|
|
231
|
+
resolved,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const comps = cyclesOf(readable.length, adj)
|
|
236
|
+
.map((c) => c.map((i) => readable[i].f.path).sort())
|
|
237
|
+
.sort((a, b) => b.length - a.length || (a[0] < b[0] ? -1 : 1));
|
|
238
|
+
const fan = adj.map((a) => a.length);
|
|
239
|
+
let maxAt = 0;
|
|
240
|
+
for (let i = 1; i < fan.length; i++) if (fan[i] > fan[maxAt]) maxAt = i;
|
|
241
|
+
const edges = fan.reduce((s, n) => s + n, 0);
|
|
242
|
+
|
|
243
|
+
return {
|
|
244
|
+
value: {
|
|
245
|
+
files: readable.length,
|
|
246
|
+
edges,
|
|
247
|
+
internal,
|
|
248
|
+
resolved,
|
|
249
|
+
cycleFiles: comps.reduce((s, c) => s + c.length, 0),
|
|
250
|
+
cycleCount: comps.length,
|
|
251
|
+
largestCycle: comps.length ? comps[0].length : 0,
|
|
252
|
+
cycles: comps.slice(0, CYCLES_LISTED).map((c) => ({ size: c.length, files: c.slice(0, MEMBERS_LISTED) })),
|
|
253
|
+
fanOutP95: nearestRankP95([...fan].sort((a, b) => a - b)),
|
|
254
|
+
fanOutMax: fan[maxAt],
|
|
255
|
+
fanOutMaxPath: readable[maxAt].f.path,
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
}
|
|
@@ -60,7 +60,7 @@ const APP_TSX = "packages/web/src/App.tsx";
|
|
|
60
60
|
*
|
|
61
61
|
* @param {number[]} ascending Sorted ascending. Not copied, not mutated.
|
|
62
62
|
*/
|
|
63
|
-
function nearestRankP95(ascending) {
|
|
63
|
+
export function nearestRankP95(ascending) {
|
|
64
64
|
const rank = Math.ceil(0.95 * ascending.length);
|
|
65
65
|
return ascending[Math.max(0, rank - 1)];
|
|
66
66
|
}
|
package/tools/repohealth/own.mjs
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* every tree, pre-registered in `constants.mjs`, pinned by `fixture.json`, and
|
|
9
9
|
* the only inputs the health index reads, so one repo's index can be put beside
|
|
10
10
|
* another's. A repo also knows things about itself no generic metric can — in
|
|
11
|
-
* waterplane, how many of the CLI screen readers
|
|
12
|
-
*
|
|
11
|
+
* waterplane, how many of the CLI screen readers have no proof on the
|
|
12
|
+
* installed `claude`. Those are declared by the repo, in a COMMITTED
|
|
13
13
|
* file, and they ride in the series row under `own`, a key no metric, no
|
|
14
14
|
* reading in `readings.mjs` and no index entry ever reads. They change no
|
|
15
15
|
* definition, so `PREREG_VERSION` and the pack hash do not move.
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
* desktop's own things. Read out of the COMMIT (`git.readFileAt`), never off the
|
|
22
22
|
* disk: only a declaration somebody committed runs.
|
|
23
23
|
*
|
|
24
|
-
* { "readings": [ { "key": "
|
|
25
|
-
* "better": "
|
|
24
|
+
* { "readings": [ { "key": "screenNoProof", "name": "…", "means": "…",
|
|
25
|
+
* "better": "lower", "unit": "signals",
|
|
26
26
|
* "run": ["node", "tools/screenfixtures.mjs", "--reading"] } ] }
|
|
27
27
|
*
|
|
28
28
|
* The same file's `central` object re-tunes waterplane's OWN readings — one
|
|
@@ -109,6 +109,10 @@ export default Object.freeze({
|
|
|
109
109
|
mentions: null,
|
|
110
110
|
keysFor: null,
|
|
111
111
|
imports: null,
|
|
112
|
+
graphConfigPath: null,
|
|
113
|
+
graphContext: null,
|
|
114
|
+
graphImports: null,
|
|
115
|
+
graphKeysFor: null,
|
|
112
116
|
|
|
113
117
|
/**
|
|
114
118
|
* No parser, and a sentence rather than a silence: `metrics/route.mjs` puts
|
|
@@ -103,6 +103,10 @@ export default Object.freeze({
|
|
|
103
103
|
mentions: null,
|
|
104
104
|
keysFor: null,
|
|
105
105
|
imports: null,
|
|
106
|
+
graphConfigPath: null,
|
|
107
|
+
graphContext: null,
|
|
108
|
+
graphImports: null,
|
|
109
|
+
graphKeysFor: null,
|
|
106
110
|
|
|
107
111
|
/**
|
|
108
112
|
* No parser, and a sentence rather than a silence: `metrics/route.mjs` puts
|