waterplane 0.1.24 → 0.1.26
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 +49 -0
- package/SECURITY.md +25 -5
- package/node_modules/@waterplane/shared/dist/agentseries/compare.d.ts +8 -0
- package/node_modules/@waterplane/shared/dist/agentseries/compare.js +103 -0
- package/node_modules/@waterplane/shared/dist/agentseries/compare.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/agentseries/markers.d.ts +17 -0
- package/node_modules/@waterplane/shared/dist/agentseries/markers.js +125 -0
- package/node_modules/@waterplane/shared/dist/agentseries/markers.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/agentseries/series.d.ts +16 -0
- package/node_modules/@waterplane/shared/dist/agentseries/series.js +93 -0
- package/node_modules/@waterplane/shared/dist/agentseries/series.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/agentseries/stats.d.ts +8 -0
- package/node_modules/@waterplane/shared/dist/agentseries/stats.js +33 -0
- package/node_modules/@waterplane/shared/dist/agentseries/stats.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/agentseries/types.d.ts +103 -0
- package/node_modules/@waterplane/shared/dist/agentseries/types.js +11 -0
- package/node_modules/@waterplane/shared/dist/agentseries/types.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/agentseries.d.ts +10 -0
- package/node_modules/@waterplane/shared/dist/agentseries.js +11 -0
- package/node_modules/@waterplane/shared/dist/agentseries.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/calday.d.ts +5 -0
- package/node_modules/@waterplane/shared/dist/calday.js +10 -0
- package/node_modules/@waterplane/shared/dist/calday.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/clihealth/healthfixture.d.ts +13 -1
- package/node_modules/@waterplane/shared/dist/clihealth/healthfixture.js +22 -4
- package/node_modules/@waterplane/shared/dist/clihealth/healthfixture.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/clihealth.d.ts +1 -1
- package/node_modules/@waterplane/shared/dist/clihealth.js +1 -1
- package/node_modules/@waterplane/shared/dist/clihealth.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/dictate.d.ts +6 -0
- package/node_modules/@waterplane/shared/dist/dictate.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/dictatemodels.d.ts +23 -0
- package/node_modules/@waterplane/shared/dist/dictatemodels.js +31 -0
- package/node_modules/@waterplane/shared/dist/dictatemodels.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/healthindex/commits.d.ts +1 -1
- package/node_modules/@waterplane/shared/dist/healthindex/commits.js +2 -2
- package/node_modules/@waterplane/shared/dist/healthindex/commits.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthindex/coverage.d.ts +128 -0
- package/node_modules/@waterplane/shared/dist/healthindex/coverage.js +343 -0
- package/node_modules/@waterplane/shared/dist/healthindex/coverage.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/healthindex/readings.d.ts +9 -1
- package/node_modules/@waterplane/shared/dist/healthindex/readings.js +122 -4
- package/node_modules/@waterplane/shared/dist/healthindex/readings.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthindex/repoindex.d.ts +5 -0
- package/node_modules/@waterplane/shared/dist/healthindex/repoindex.js +2 -0
- package/node_modules/@waterplane/shared/dist/healthindex/repoindex.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthindex/score.d.ts +3 -0
- package/node_modules/@waterplane/shared/dist/healthindex/score.js +52 -16
- package/node_modules/@waterplane/shared/dist/healthindex/score.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthindex/types.d.ts +82 -6
- package/node_modules/@waterplane/shared/dist/healthindex/types.js +35 -2
- package/node_modules/@waterplane/shared/dist/healthindex/types.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthindex/words.js +65 -6
- package/node_modules/@waterplane/shared/dist/healthindex/words.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthindex.d.ts +21 -7
- package/node_modules/@waterplane/shared/dist/healthindex.js +20 -7
- package/node_modules/@waterplane/shared/dist/healthindex.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthindexresponse.js +3 -2
- package/node_modules/@waterplane/shared/dist/healthindexresponse.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthspend.d.ts +23 -0
- package/node_modules/@waterplane/shared/dist/healthspend.js +32 -1
- package/node_modules/@waterplane/shared/dist/healthspend.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/hints.js +9 -0
- package/node_modules/@waterplane/shared/dist/hints.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/index.d.ts +9 -0
- package/node_modules/@waterplane/shared/dist/index.js +9 -0
- package/node_modules/@waterplane/shared/dist/index.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/installrow.js +10 -0
- package/node_modules/@waterplane/shared/dist/installrow.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/intent/kind.d.ts +45 -1
- package/node_modules/@waterplane/shared/dist/intent/kind.js +60 -2
- package/node_modules/@waterplane/shared/dist/intent/kind.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/intent.d.ts +1 -1
- package/node_modules/@waterplane/shared/dist/intent.js +1 -1
- package/node_modules/@waterplane/shared/dist/intent.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/itempaths.d.ts +23 -0
- package/node_modules/@waterplane/shared/dist/itempaths.js +38 -0
- package/node_modules/@waterplane/shared/dist/itempaths.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/pluginlaunch.d.ts +3 -2
- package/node_modules/@waterplane/shared/dist/pluginlaunch.js +1 -1
- package/node_modules/@waterplane/shared/dist/pluginlaunch.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/pricelist.d.ts +57 -0
- package/node_modules/@waterplane/shared/dist/pricelist.js +128 -0
- package/node_modules/@waterplane/shared/dist/pricelist.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/pricing.d.ts +86 -9
- package/node_modules/@waterplane/shared/dist/pricing.js +140 -20
- package/node_modules/@waterplane/shared/dist/pricing.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/queue/queuelanestate.d.ts +14 -0
- package/node_modules/@waterplane/shared/dist/queue/queuelanestate.js +25 -0
- package/node_modules/@waterplane/shared/dist/queue/queuelanestate.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/queue/queueplan.d.ts +4 -0
- package/node_modules/@waterplane/shared/dist/queue/queueplan.js +21 -0
- package/node_modules/@waterplane/shared/dist/queue/queueplan.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/queue/queuewords.js +2 -1
- package/node_modules/@waterplane/shared/dist/queue/queuewords.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/queue.d.ts +2 -0
- package/node_modules/@waterplane/shared/dist/queue.js +1 -0
- package/node_modules/@waterplane/shared/dist/queue.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/repohealth.d.ts +178 -0
- package/node_modules/@waterplane/shared/dist/repohealth.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/repohealthhabits.d.ts +15 -0
- package/node_modules/@waterplane/shared/dist/repohealthhabits.js +117 -0
- package/node_modules/@waterplane/shared/dist/repohealthhabits.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/repohealthnative.d.ts +10 -0
- package/node_modules/@waterplane/shared/dist/repohealthnative.js +94 -0
- package/node_modules/@waterplane/shared/dist/repohealthnative.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/repohealthread.js +23 -1
- package/node_modules/@waterplane/shared/dist/repohealthread.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/skillstate.d.ts +51 -0
- package/node_modules/@waterplane/shared/dist/skillstate.js +176 -0
- package/node_modules/@waterplane/shared/dist/skillstate.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/skillwords.d.ts +10 -0
- package/node_modules/@waterplane/shared/dist/skillwords.js +18 -0
- package/node_modules/@waterplane/shared/dist/skillwords.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/wire/agentreadings.d.ts +248 -0
- package/node_modules/@waterplane/shared/dist/wire/agentreadings.js +36 -0
- package/node_modules/@waterplane/shared/dist/wire/agentreadings.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/wire/backend.d.ts +2 -0
- package/node_modules/@waterplane/shared/dist/wire/costwindow.d.ts +4 -0
- package/node_modules/@waterplane/shared/dist/wire/dictatesetup.d.ts +42 -0
- package/node_modules/@waterplane/shared/dist/wire/dictatesetup.js +9 -0
- package/node_modules/@waterplane/shared/dist/wire/dictatesetup.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/wire/messages/hostcore.d.ts +22 -1
- package/node_modules/@waterplane/shared/dist/wire/notify.d.ts +6 -1
- package/node_modules/@waterplane/shared/dist/wire/notify.js +6 -1
- package/node_modules/@waterplane/shared/dist/wire/notify.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/wire/repo.d.ts +1 -1
- package/node_modules/@waterplane/shared/dist/wire/skills.d.ts +142 -0
- package/node_modules/@waterplane/shared/dist/wire/skills.js +6 -0
- package/node_modules/@waterplane/shared/dist/wire/skills.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/wire/sysstat.d.ts +17 -0
- package/node_modules/@waterplane/shared/dist/wire/telemetry.d.ts +4 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/packages/extensions/diskspace/waterplane-plugin.json +16 -0
- package/packages/extensions/links/waterplane-plugin.json +18 -0
- package/packages/host/dist/agentclass.d.ts +116 -0
- package/packages/host/dist/agentclass.js +339 -0
- package/packages/host/dist/agentclass.js.map +1 -0
- package/packages/host/dist/agentintents.d.ts +18 -0
- package/packages/host/dist/agentintents.js +40 -7
- package/packages/host/dist/agentintents.js.map +1 -1
- package/packages/host/dist/agentmarkers.d.ts +49 -0
- package/packages/host/dist/agentmarkers.js +255 -0
- package/packages/host/dist/agentmarkers.js.map +1 -0
- package/packages/host/dist/agentreadings.d.ts +68 -0
- package/packages/host/dist/agentreadings.js +336 -0
- package/packages/host/dist/agentreadings.js.map +1 -0
- package/packages/host/dist/agentscan.d.ts +8 -0
- package/packages/host/dist/agentscan.js +427 -0
- package/packages/host/dist/agentscan.js.map +1 -0
- package/packages/host/dist/archive.js +9 -3
- package/packages/host/dist/archive.js.map +1 -1
- package/packages/host/dist/artifacts.js +4 -7
- package/packages/host/dist/artifacts.js.map +1 -1
- package/packages/host/dist/askrules.js +12 -4
- package/packages/host/dist/askrules.js.map +1 -1
- package/packages/host/dist/auth.d.ts +1 -0
- package/packages/host/dist/auth.js +5 -3
- package/packages/host/dist/auth.js.map +1 -1
- package/packages/host/dist/autopull.js +4 -8
- package/packages/host/dist/autopull.js.map +1 -1
- package/packages/host/dist/backends/claude.js +1 -0
- package/packages/host/dist/backends/claude.js.map +1 -1
- package/packages/host/dist/backends/derive.js +3 -1
- package/packages/host/dist/backends/derive.js.map +1 -1
- package/packages/host/dist/binguard.js +19 -2
- package/packages/host/dist/binguard.js.map +1 -1
- package/packages/host/dist/capture.js +7 -10
- package/packages/host/dist/capture.js.map +1 -1
- package/packages/host/dist/clifixtures.d.ts +24 -4
- package/packages/host/dist/clifixtures.js +50 -10
- package/packages/host/dist/clifixtures.js.map +1 -1
- package/packages/host/dist/clihealth.d.ts +8 -2
- package/packages/host/dist/clihealth.js +11 -3
- package/packages/host/dist/clihealth.js.map +1 -1
- package/packages/host/dist/costwindow.js +4 -2
- package/packages/host/dist/costwindow.js.map +1 -1
- package/packages/host/dist/ctxlog/ctxagents.d.ts +2 -0
- package/packages/host/dist/ctxlog/ctxagents.js +5 -5
- package/packages/host/dist/ctxlog/ctxagents.js.map +1 -1
- package/packages/host/dist/ctxlog/ctxcursor.d.ts +2 -0
- package/packages/host/dist/ctxlog/ctxcursor.js +2 -2
- package/packages/host/dist/ctxlog/ctxcursor.js.map +1 -1
- package/packages/host/dist/ctxlog/ctxupdate.js +11 -6
- package/packages/host/dist/ctxlog/ctxupdate.js.map +1 -1
- package/packages/host/dist/deliver/deliverknobs.d.ts +0 -2
- package/packages/host/dist/deliver/deliverknobs.js +0 -2
- package/packages/host/dist/deliver/deliverknobs.js.map +1 -1
- package/packages/host/dist/deliver/deliverproof.d.ts +3 -2
- package/packages/host/dist/deliver/deliverproof.js +9 -8
- package/packages/host/dist/deliver/deliverproof.js.map +1 -1
- package/packages/host/dist/deliver/deliverreturn.d.ts +3 -2
- package/packages/host/dist/deliver/deliverreturn.js +13 -12
- package/packages/host/dist/deliver/deliverreturn.js.map +1 -1
- package/packages/host/dist/deliver/deliverrun.js +20 -18
- package/packages/host/dist/deliver/deliverrun.js.map +1 -1
- package/packages/host/dist/deliver/deliverscreen.d.ts +2 -1
- package/packages/host/dist/deliver/deliverscreen.js +9 -8
- package/packages/host/dist/deliver/deliverscreen.js.map +1 -1
- package/packages/host/dist/deliver/delivertypes.d.ts +4 -0
- package/packages/host/dist/deliver.js +2 -1
- package/packages/host/dist/deliver.js.map +1 -1
- package/packages/host/dist/dictate.d.ts +11 -0
- package/packages/host/dist/dictate.js +20 -10
- package/packages/host/dist/dictate.js.map +1 -1
- package/packages/host/dist/dictatesetup.d.ts +54 -0
- package/packages/host/dist/dictatesetup.js +261 -0
- package/packages/host/dist/dictatesetup.js.map +1 -0
- package/packages/host/dist/doctor.js +1 -1
- package/packages/host/dist/doctor.js.map +1 -1
- package/packages/host/dist/exposure.d.ts +10 -0
- package/packages/host/dist/exposure.js +25 -0
- package/packages/host/dist/exposure.js.map +1 -1
- package/packages/host/dist/exposurepush.js +2 -2
- package/packages/host/dist/exposurepush.js.map +1 -1
- package/packages/host/dist/extensions/diskspace/host/candidates.d.mts +180 -0
- package/packages/host/dist/extensions/diskspace/host/candidates.mjs +716 -0
- package/packages/host/dist/extensions/diskspace/host/candidates.mjs.map +1 -0
- package/packages/host/dist/extensions/diskspace/host/engine.d.mts +21 -0
- package/packages/host/dist/extensions/diskspace/host/engine.mjs +498 -0
- package/packages/host/dist/extensions/diskspace/host/engine.mjs.map +1 -0
- package/packages/host/dist/extensions/diskspace/host/index.d.mts +25 -0
- package/packages/host/dist/extensions/diskspace/host/index.mjs +135 -0
- package/packages/host/dist/extensions/diskspace/host/index.mjs.map +1 -0
- package/packages/host/dist/extensions/diskspace/host/large.d.mts +11 -0
- package/packages/host/dist/extensions/diskspace/host/large.mjs +56 -0
- package/packages/host/dist/extensions/diskspace/host/large.mjs.map +1 -0
- package/packages/host/dist/extensions/diskspace/host/run.d.mts +94 -0
- package/packages/host/dist/extensions/diskspace/host/run.mjs +200 -0
- package/packages/host/dist/extensions/diskspace/host/run.mjs.map +1 -0
- package/packages/host/dist/extensions/diskspace/shared/wire.d.mts +197 -0
- package/packages/host/dist/extensions/diskspace/shared/wire.mjs +23 -0
- package/packages/host/dist/extensions/diskspace/shared/wire.mjs.map +1 -0
- package/packages/host/dist/extensions/links/host/engine.d.mts +39 -0
- package/packages/host/dist/extensions/links/host/engine.mjs +285 -0
- package/packages/host/dist/extensions/links/host/engine.mjs.map +1 -0
- package/packages/host/dist/extensions/links/host/index.d.mts +10 -0
- package/packages/host/dist/extensions/links/host/index.mjs +72 -0
- package/packages/host/dist/extensions/links/host/index.mjs.map +1 -0
- package/packages/host/dist/extensions/links/host/parse.d.mts +61 -0
- package/packages/host/dist/extensions/links/host/parse.mjs +225 -0
- package/packages/host/dist/extensions/links/host/parse.mjs.map +1 -0
- package/packages/host/dist/extensions/links/host/run.d.mts +15 -0
- package/packages/host/dist/extensions/links/host/run.mjs +32 -0
- package/packages/host/dist/extensions/links/host/run.mjs.map +1 -0
- package/packages/host/dist/extensions/links/host/store.d.mts +11 -0
- package/packages/host/dist/extensions/links/host/store.mjs +76 -0
- package/packages/host/dist/extensions/links/host/store.mjs.map +1 -0
- package/packages/host/dist/extensions/links/shared/wire.d.mts +141 -0
- package/packages/host/dist/extensions/links/shared/wire.mjs +20 -0
- package/packages/host/dist/extensions/links/shared/wire.mjs.map +1 -0
- package/packages/host/dist/git.d.ts +5 -3
- package/packages/host/dist/git.js +16 -28
- package/packages/host/dist/git.js.map +1 -1
- package/packages/host/dist/halt.js +16 -3
- package/packages/host/dist/halt.js.map +1 -1
- package/packages/host/dist/jsonstore.d.ts +16 -4
- package/packages/host/dist/jsonstore.js +32 -8
- package/packages/host/dist/jsonstore.js.map +1 -1
- package/packages/host/dist/landedbase.d.ts +41 -0
- package/packages/host/dist/landedbase.js +59 -0
- package/packages/host/dist/landedbase.js.map +1 -0
- package/packages/host/dist/lantls.js +2 -2
- package/packages/host/dist/lantls.js.map +1 -1
- package/packages/host/dist/limitretry.js +2 -3
- package/packages/host/dist/limitretry.js.map +1 -1
- package/packages/host/dist/localledger.js +9 -12
- package/packages/host/dist/localledger.js.map +1 -1
- package/packages/host/dist/main.js +2 -0
- package/packages/host/dist/main.js.map +1 -1
- package/packages/host/dist/opendeliveries.d.ts +4 -0
- package/packages/host/dist/opendeliveries.js +27 -1
- package/packages/host/dist/opendeliveries.js.map +1 -1
- package/packages/host/dist/plugins/setupcontrib.js +3 -2
- package/packages/host/dist/plugins/setupcontrib.js.map +1 -1
- package/packages/host/dist/pricefetch.d.ts +80 -0
- package/packages/host/dist/pricefetch.js +289 -0
- package/packages/host/dist/pricefetch.js.map +1 -0
- package/packages/host/dist/pricegap.d.ts +11 -0
- package/packages/host/dist/pricegap.js +30 -0
- package/packages/host/dist/pricegap.js.map +1 -0
- package/packages/host/dist/repohealthscopes.js +16 -24
- package/packages/host/dist/repohealthscopes.js.map +1 -1
- package/packages/host/dist/repos.d.ts +4 -0
- package/packages/host/dist/repos.js +1 -1
- package/packages/host/dist/repos.js.map +1 -1
- package/packages/host/dist/reposkilltext.d.ts +2 -0
- package/packages/host/dist/reposkilltext.js +8 -2
- package/packages/host/dist/reposkilltext.js.map +1 -1
- package/packages/host/dist/routes/apiagentpoints.d.ts +5 -0
- package/packages/host/dist/routes/apiagentpoints.js +48 -0
- package/packages/host/dist/routes/apiagentpoints.js.map +1 -0
- package/packages/host/dist/routes/apidictate.d.ts +2 -0
- package/packages/host/dist/routes/apidictate.js +27 -0
- package/packages/host/dist/routes/apidictate.js.map +1 -0
- package/packages/host/dist/routes/apihost.js +3 -2
- package/packages/host/dist/routes/apihost.js.map +1 -1
- package/packages/host/dist/routes/apirepofiles.js +3 -1
- package/packages/host/dist/routes/apirepofiles.js.map +1 -1
- package/packages/host/dist/routes/apirepowork.js +14 -0
- package/packages/host/dist/routes/apirepowork.js.map +1 -1
- package/packages/host/dist/routes/apiroutes.js +4 -1
- package/packages/host/dist/routes/apiroutes.js.map +1 -1
- package/packages/host/dist/routes/apiskills.d.ts +3 -0
- package/packages/host/dist/routes/apiskills.js +81 -0
- package/packages/host/dist/routes/apiskills.js.map +1 -0
- package/packages/host/dist/routes/apistats.js +2 -2
- package/packages/host/dist/routes/apistats.js.map +1 -1
- package/packages/host/dist/routes/apisystem.js +3 -1
- package/packages/host/dist/routes/apisystem.js.map +1 -1
- package/packages/host/dist/routes/apitable.d.ts +2 -0
- package/packages/host/dist/routes/apitable.js.map +1 -1
- package/packages/host/dist/server/billingwire.js +5 -0
- package/packages/host/dist/server/billingwire.js.map +1 -1
- package/packages/host/dist/server/deliveries.d.ts +4 -1
- package/packages/host/dist/server/deliveries.js +38 -6
- package/packages/host/dist/server/deliveries.js.map +1 -1
- package/packages/host/dist/server/http.js +1 -1
- package/packages/host/dist/server/http.js.map +1 -1
- package/packages/host/dist/server/intentDeps.js +20 -6
- package/packages/host/dist/server/intentDeps.js.map +1 -1
- package/packages/host/dist/server/wsops.js +2 -1
- package/packages/host/dist/server/wsops.js.map +1 -1
- package/packages/host/dist/sessions/core.d.ts +1 -0
- package/packages/host/dist/sessions/ctxseries.js +7 -5
- package/packages/host/dist/sessions/ctxseries.js.map +1 -1
- package/packages/host/dist/sessions/drive.d.ts +6 -1
- package/packages/host/dist/sessions/drive.js +13 -10
- package/packages/host/dist/sessions/drive.js.map +1 -1
- package/packages/host/dist/sessions/record.js +16 -17
- package/packages/host/dist/sessions/record.js.map +1 -1
- package/packages/host/dist/sessions/sidechannel.js +1 -1
- package/packages/host/dist/sessions/sidechannel.js.map +1 -1
- package/packages/host/dist/sessions/tmux.js +6 -1
- package/packages/host/dist/sessions/tmux.js.map +1 -1
- package/packages/host/dist/sessions/turn.js +5 -0
- package/packages/host/dist/sessions/turn.js.map +1 -1
- package/packages/host/dist/sessions.d.ts +2 -1
- package/packages/host/dist/sessions.js +1 -1
- package/packages/host/dist/sessions.js.map +1 -1
- package/packages/host/dist/settle.d.ts +3 -2
- package/packages/host/dist/settle.js +13 -13
- package/packages/host/dist/settle.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/skills/skillinventory.d.ts +23 -0
- package/packages/host/dist/skills/skillinventory.js +275 -0
- package/packages/host/dist/skills/skillinventory.js.map +1 -0
- package/packages/host/dist/skills/skilllayers.d.ts +28 -0
- package/packages/host/dist/skills/skilllayers.js +73 -0
- package/packages/host/dist/skills/skilllayers.js.map +1 -0
- package/packages/host/dist/skills/skillrecommend.d.ts +42 -0
- package/packages/host/dist/skills/skillrecommend.js +171 -0
- package/packages/host/dist/skills/skillrecommend.js.map +1 -0
- package/packages/host/dist/skills/skillrefs.d.ts +2 -0
- package/packages/host/dist/skills/skillrefs.js +50 -0
- package/packages/host/dist/skills/skillrefs.js.map +1 -0
- package/packages/host/dist/skills/skilluse.d.ts +57 -0
- package/packages/host/dist/skills/skilluse.js +242 -0
- package/packages/host/dist/skills/skilluse.js.map +1 -0
- package/packages/host/dist/skills/skillweight.d.ts +18 -0
- package/packages/host/dist/skills/skillweight.js +69 -0
- package/packages/host/dist/skills/skillweight.js.map +1 -0
- package/packages/host/dist/skills/skillwrite.d.ts +56 -0
- package/packages/host/dist/skills/skillwrite.js +183 -0
- package/packages/host/dist/skills/skillwrite.js.map +1 -0
- package/packages/host/dist/sysstat.d.ts +34 -1
- package/packages/host/dist/sysstat.js +82 -14
- package/packages/host/dist/sysstat.js.map +1 -1
- package/packages/host/dist/tokenscan.js +5 -2
- package/packages/host/dist/tokenscan.js.map +1 -1
- package/packages/host/dist/tokenstats.js +7 -4
- package/packages/host/dist/tokenstats.js.map +1 -1
- package/packages/host/dist/transcript/transcriptparse.js +2 -2
- package/packages/host/dist/transcript/transcriptparse.js.map +1 -1
- package/packages/host/dist/waitclock.d.ts +12 -0
- package/packages/host/dist/waitclock.js +23 -0
- package/packages/host/dist/waitclock.js.map +1 -0
- package/packages/host/dist/weekburn.js +7 -5
- package/packages/host/dist/weekburn.js.map +1 -1
- package/packages/host/dist/worktreeleftover.js +13 -15
- package/packages/host/dist/worktreeleftover.js.map +1 -1
- package/packages/web/dist/assets/demo-DHkwSmU5.js +26 -0
- package/packages/web/dist/assets/{icons-D8RlmSLR.js → icons-5lVTFNUU.js} +1 -1
- package/packages/web/dist/assets/index-Bh4cH6X8.js +170 -0
- package/packages/web/dist/assets/index-F7VHtsLI.css +1 -0
- package/packages/web/dist/assets/shared-BvQMg9ra.js +51 -0
- package/packages/web/dist/assets/sheets-Cwi72V02.js +257 -0
- package/packages/web/dist/assets/sheets-DjU2XiUd.css +1 -0
- package/packages/web/dist/build-id.txt +1 -1
- package/packages/web/dist/buildstamp.json +1 -1
- package/packages/web/dist/index.html +7 -7
- package/packages/web/dist/sw.js +2 -2
- package/release.json +11 -3
- package/tools/repohealth/constants.mjs +34 -1
- package/tools/repohealth/fixture.json +5374 -38
- package/tools/repohealth/git.mjs +77 -0
- package/tools/repohealth/lang/dart-analyze.mjs +181 -0
- package/tools/repohealth/lang/dart-lex.mjs +494 -0
- package/tools/repohealth/lang/dart-resolve.mjs +95 -0
- package/tools/repohealth/lang/python-ast.mjs +602 -0
- package/tools/repohealth/lang/python-resolve.mjs +228 -0
- package/tools/repohealth/metrics/habits.mjs +286 -0
- package/tools/repohealth/metrics/native.mjs +542 -0
- package/tools/repohealth/metrics/untested.mjs +20 -8
- package/tools/repohealth/metrics/workspace.mjs +256 -0
- package/tools/repohealth/own.mjs +67 -5
- package/tools/repohealth/packs/dart.mjs +153 -85
- package/tools/repohealth/packs/python.mjs +51 -14
- package/tools/repohealth/plot.mjs +143 -1
- package/tools/repohealth/reach.mjs +98 -0
- package/tools/repohealth/scope.mjs +14 -1
- package/tools/repohealth/series.mjs +5 -0
- package/tools/repohealth/types.mjs +4 -0
- package/tools/repohealth.mjs +39 -5
- package/packages/web/dist/assets/demo-ad3g3HDa.js +0 -26
- package/packages/web/dist/assets/index-Csb7jynu.js +0 -170
- package/packages/web/dist/assets/index-Cz9Haocy.css +0 -1
- package/packages/web/dist/assets/shared-DBaaGttP.js +0 -51
- package/packages/web/dist/assets/sheets-CqsP9w1V.js +0 -256
- package/packages/web/dist/assets/sheets-DoUhPGK0.css +0 -1
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python source read into the products a clone detector, an orphan detector
|
|
3
|
+
* and an import graph are computed from: the names a blob writes, the
|
|
4
|
+
* top-level names it offers, its blocks with a minhash signature each, and the
|
|
5
|
+
* import statements it runs.
|
|
6
|
+
*
|
|
7
|
+
* The sibling of `typescript-ast.mjs`, and shaped like it on purpose:
|
|
8
|
+
* `identsOf` / `signedBlocks` return what `metrics/dups.mjs` and
|
|
9
|
+
* `deadexports.mjs` already read from the TypeScript pack, memoised by blob oid.
|
|
10
|
+
*
|
|
11
|
+
* ── Why a lexer and not `python3 -I -c "import ast"` ────────────────────────
|
|
12
|
+
*
|
|
13
|
+
* The engine walks hundreds of commits and reads every Python blob at each.
|
|
14
|
+
* A spawned interpreter is absent on some machines (the host this runs on is
|
|
15
|
+
* also a phone's desktop, and a Windows peer), costs a process per batch, and
|
|
16
|
+
* would have to be bounded in time and fall back to "absent". Python's lexical
|
|
17
|
+
* grammar is small enough to read exactly: strings (prefixes, triple quotes,
|
|
18
|
+
* escapes), comments, brackets that suspend the line end, backslash
|
|
19
|
+
* continuations and indentation. The syntax above that is read off logical
|
|
20
|
+
* lines, which is all a `def`, a `class`, an `import` or a top-level name
|
|
21
|
+
* needs. What this does NOT do is parse expressions, so it never claims to know
|
|
22
|
+
* what a name refers to — it only reports which names were WRITTEN.
|
|
23
|
+
*
|
|
24
|
+
* ── Where it gives up, and says so ─────────────────────────────────────────
|
|
25
|
+
*
|
|
26
|
+
* A string that never closes on its line, or a bracket still open at the end of
|
|
27
|
+
* the file, makes the lexer unsure of everything after it. Such a blob yields
|
|
28
|
+
* NO identifiers and NO exports and no blocks (`dups` and `deadExports` then
|
|
29
|
+
* see an empty file, the direction that adds no "dead" line), and `importsOf`
|
|
30
|
+
* returns `null` so the graph reports the reading absent rather than a tree
|
|
31
|
+
* with a lost edge. Identical to the TypeScript analyzer's rule.
|
|
32
|
+
*
|
|
33
|
+
* ── Dead-export caution (Python resolves names late) ───────────────────────
|
|
34
|
+
*
|
|
35
|
+
* A top-level `def` or `class` is an export unless something outside the
|
|
36
|
+
* source text can reach it by a name nobody writes:
|
|
37
|
+
*
|
|
38
|
+
* - Underscore names are private, and `test_*` / `Test*` are found by a runner.
|
|
39
|
+
* - A decorated function is registered by its decorator (`@app.get`,
|
|
40
|
+
* `@click.command`, `@pytest.fixture`, `@celery.task`). Only decorators
|
|
41
|
+
* that change nothing about reachability (`dataclass`, `lru_cache`,
|
|
42
|
+
* `contextmanager`, ...) leave a name an export.
|
|
43
|
+
* - A module-level `__getattr__` makes every name lazy: the file offers none.
|
|
44
|
+
* - Names in `__all__` are the file's declared API: not offered as dead.
|
|
45
|
+
* - `main`, `app`, `handler`, `upgrade`/`downgrade` and friends are entry
|
|
46
|
+
* points a framework or a console script names in a config file.
|
|
47
|
+
* - Scripts and framework roots (`setup.py`, `manage.py`, `conftest.py`,
|
|
48
|
+
* `wsgi.py`, `__main__.py`, ...) offer nothing.
|
|
49
|
+
*
|
|
50
|
+
* Every string that is shaped like a name (or a dotted path) contributes its
|
|
51
|
+
* names, and every word inside an f-string, so `getattr(m, "run")` and
|
|
52
|
+
* `f"{render(x)}"` both count as uses. Over-inclusive on purpose: a false
|
|
53
|
+
* "still used" costs nothing, a false "dead" sends somebody to delete live
|
|
54
|
+
* code.
|
|
55
|
+
*
|
|
56
|
+
* Nothing here may call a model, touch the network, run a process or read a file.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
const KEYWORDS = new Set([
|
|
60
|
+
"False", "None", "True", "and", "as", "assert", "async", "await", "break", "class", "continue", "def", "del",
|
|
61
|
+
"elif", "else", "except", "finally", "for", "from", "global", "if", "import", "in", "is", "lambda", "nonlocal",
|
|
62
|
+
"not", "or", "pass", "raise", "return", "try", "while", "with", "yield",
|
|
63
|
+
]);
|
|
64
|
+
|
|
65
|
+
const STRING_PREFIX = /^[rRbBuUfF]{1,2}$/;
|
|
66
|
+
const NAME_RE = /[\p{L}_][\p{L}\p{N}_]*/uy;
|
|
67
|
+
const NUMBER_RE = /(?:0[xX][0-9a-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+|(?:\d[\d_]*\.?[\d_]*|\.\d[\d_]*)(?:[eE][+-]?\d+)?[jJ]?)/y;
|
|
68
|
+
const OP_RE = /\*\*=|\/\/=|>>=|<<=|\.\.\.|->|:=|==|!=|<=|>=|\*\*|\/\/|>>|<<|[-+*/%&|^@]=|[\s\S]/y;
|
|
69
|
+
const IDENT_SHAPED = /^[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*$/;
|
|
70
|
+
const WORD = /[A-Za-z_][A-Za-z0-9_]*/g;
|
|
71
|
+
|
|
72
|
+
const T_STRING = "\u0002str";
|
|
73
|
+
const T_NUMBER = "\u0002num";
|
|
74
|
+
const T_NEWLINE = "\u0002nl";
|
|
75
|
+
const T_INDENT = "\u0002in";
|
|
76
|
+
const T_DEDENT = "\u0002de";
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @typedef {{k: "n" | "s" | "d" | "o", v: string, line: number, p: number, e: number, f?: boolean}} Tok
|
|
80
|
+
* @typedef {{indent: number, toks: Tok[], line: number, endLine: number}} LLine
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Text -> logical lines, or `null` when the lexer cannot tell where it is.
|
|
85
|
+
* @param {string} text
|
|
86
|
+
* @returns {LLine[] | null}
|
|
87
|
+
*/
|
|
88
|
+
export function lex(text) {
|
|
89
|
+
const n = text.length;
|
|
90
|
+
let i = 0;
|
|
91
|
+
let line = 1;
|
|
92
|
+
let depth = 0;
|
|
93
|
+
/** @type {LLine[]} */
|
|
94
|
+
const lines = [];
|
|
95
|
+
/** @type {LLine | null} */
|
|
96
|
+
let cur = null;
|
|
97
|
+
let atStart = true;
|
|
98
|
+
|
|
99
|
+
const skipComment = () => {
|
|
100
|
+
while (i < n && text[i] !== "\n" && text[i] !== "\r") i++;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
while (i < n) {
|
|
104
|
+
if (atStart && depth === 0) {
|
|
105
|
+
let col = 0;
|
|
106
|
+
let j = i;
|
|
107
|
+
while (j < n) {
|
|
108
|
+
const c = text[j];
|
|
109
|
+
if (c === " ") col++;
|
|
110
|
+
else if (c === "\t") col = (Math.floor(col / 8) + 1) * 8;
|
|
111
|
+
else if (c === "\f") col = 0;
|
|
112
|
+
else break;
|
|
113
|
+
j++;
|
|
114
|
+
}
|
|
115
|
+
if (j >= n) break;
|
|
116
|
+
const c = text[j];
|
|
117
|
+
if (c === "\n") {
|
|
118
|
+
line++;
|
|
119
|
+
i = j + 1;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (c === "\r") {
|
|
123
|
+
i = j + 1;
|
|
124
|
+
if (text[i] === "\n") i++;
|
|
125
|
+
line++;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (c === "#") {
|
|
129
|
+
i = j;
|
|
130
|
+
skipComment();
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
cur = { indent: col, toks: [], line, endLine: line };
|
|
134
|
+
atStart = false;
|
|
135
|
+
i = j;
|
|
136
|
+
}
|
|
137
|
+
const c = text[i];
|
|
138
|
+
if (c === " " || c === "\t" || c === "\f") {
|
|
139
|
+
i++;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (c === "\r" || c === "\n") {
|
|
143
|
+
if (c === "\r" && text[i + 1] === "\n") i++;
|
|
144
|
+
i++;
|
|
145
|
+
line++;
|
|
146
|
+
if (depth === 0) {
|
|
147
|
+
if (cur) lines.push(cur);
|
|
148
|
+
cur = null;
|
|
149
|
+
atStart = true;
|
|
150
|
+
}
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (c === "\\" && (text[i + 1] === "\n" || text[i + 1] === "\r")) {
|
|
154
|
+
i += text[i + 1] === "\r" && text[i + 2] === "\n" ? 3 : 2;
|
|
155
|
+
line++;
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (c === "#") {
|
|
159
|
+
skipComment();
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (!cur) return null;
|
|
163
|
+
|
|
164
|
+
const quoteAt = (j) => text[j] === '"' || text[j] === "'";
|
|
165
|
+
let name = null;
|
|
166
|
+
if (/[\p{L}_]/u.test(c)) {
|
|
167
|
+
NAME_RE.lastIndex = i;
|
|
168
|
+
name = NAME_RE.exec(text)[0];
|
|
169
|
+
}
|
|
170
|
+
if (quoteAt(i) || (name && name.length <= 2 && STRING_PREFIX.test(name) && quoteAt(i + name.length))) {
|
|
171
|
+
const prefix = name && !quoteAt(i) ? name : "";
|
|
172
|
+
const start = i;
|
|
173
|
+
let k = i + prefix.length;
|
|
174
|
+
const q = text[k];
|
|
175
|
+
const triple = text[k + 1] === q && text[k + 2] === q;
|
|
176
|
+
k += triple ? 3 : 1;
|
|
177
|
+
const bodyStart = k;
|
|
178
|
+
let closed = false;
|
|
179
|
+
while (k < n) {
|
|
180
|
+
const ch = text[k];
|
|
181
|
+
if (ch === "\\") {
|
|
182
|
+
if (text[k + 1] === "\n") line++;
|
|
183
|
+
k += 2;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if (ch === "\n") {
|
|
187
|
+
if (!triple) return null;
|
|
188
|
+
line++;
|
|
189
|
+
} else if (ch === q && (!triple || (text[k + 1] === q && text[k + 2] === q))) {
|
|
190
|
+
closed = true;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
k++;
|
|
194
|
+
}
|
|
195
|
+
if (!closed) return null;
|
|
196
|
+
const body = text.slice(bodyStart, k);
|
|
197
|
+
const endPos = k + (triple ? 3 : 1);
|
|
198
|
+
cur.toks.push({ k: "s", v: body, line, p: start, e: endPos, f: /[fF]/.test(prefix) });
|
|
199
|
+
cur.endLine = line;
|
|
200
|
+
i = endPos;
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
if (name) {
|
|
204
|
+
cur.toks.push({ k: "n", v: name, line, p: i, e: i + name.length });
|
|
205
|
+
cur.endLine = line;
|
|
206
|
+
i += name.length;
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if ((c >= "0" && c <= "9") || (c === "." && text[i + 1] >= "0" && text[i + 1] <= "9")) {
|
|
210
|
+
NUMBER_RE.lastIndex = i;
|
|
211
|
+
const m = NUMBER_RE.exec(text);
|
|
212
|
+
const len = m && m[0].length ? m[0].length : 1;
|
|
213
|
+
cur.toks.push({ k: "d", v: text.slice(i, i + len), line, p: i, e: i + len });
|
|
214
|
+
cur.endLine = line;
|
|
215
|
+
i += len;
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
OP_RE.lastIndex = i;
|
|
219
|
+
const op = OP_RE.exec(text)[0];
|
|
220
|
+
if (op === "(" || op === "[" || op === "{") depth++;
|
|
221
|
+
else if (op === ")" || op === "]" || op === "}") depth = Math.max(0, depth - 1);
|
|
222
|
+
cur.toks.push({ k: "o", v: op, line, p: i, e: i + op.length });
|
|
223
|
+
cur.endLine = line;
|
|
224
|
+
i += op.length;
|
|
225
|
+
}
|
|
226
|
+
if (depth > 0) return null;
|
|
227
|
+
if (cur && cur.toks.length) lines.push(cur);
|
|
228
|
+
return lines;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** Split a logical line on top-level `;` into statements (token arrays). */
|
|
232
|
+
function statements(toks) {
|
|
233
|
+
if (!toks.some((t) => t.k === "o" && t.v === ";")) return [toks];
|
|
234
|
+
const out = [];
|
|
235
|
+
let from = 0;
|
|
236
|
+
for (let i = 0; i < toks.length; i++) {
|
|
237
|
+
if (toks[i].k === "o" && toks[i].v === ";") {
|
|
238
|
+
if (i > from) out.push(toks.slice(from, i));
|
|
239
|
+
from = i + 1;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (from < toks.length) out.push(toks.slice(from));
|
|
243
|
+
return out;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** `[a, ., b]`-style dotted run starting at `i`: `{names, next}`. */
|
|
247
|
+
function dotted(toks, i) {
|
|
248
|
+
const names = [];
|
|
249
|
+
while (i < toks.length && toks[i].k === "n" && !KEYWORDS.has(toks[i].v)) {
|
|
250
|
+
names.push(toks[i].v);
|
|
251
|
+
if (toks[i + 1] && toks[i + 1].k === "o" && toks[i + 1].v === "." && toks[i + 2] && toks[i + 2].k === "n") i += 2;
|
|
252
|
+
else {
|
|
253
|
+
i++;
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return { names, next: i };
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* One `import` / `from` statement as a record, or null.
|
|
262
|
+
* `tc` is set for a statement under `if TYPE_CHECKING:`, which never runs.
|
|
263
|
+
*/
|
|
264
|
+
function importRecord(toks, tc, line) {
|
|
265
|
+
if (!toks.length || toks[0].k !== "n") return null;
|
|
266
|
+
if (toks[0].v === "import") {
|
|
267
|
+
const modules = [];
|
|
268
|
+
let i = 1;
|
|
269
|
+
for (;;) {
|
|
270
|
+
const d = dotted(toks, i);
|
|
271
|
+
if (!d.names.length) break;
|
|
272
|
+
modules.push(d.names);
|
|
273
|
+
i = d.next;
|
|
274
|
+
if (toks[i] && toks[i].v === "as") i += 2;
|
|
275
|
+
if (toks[i] && toks[i].k === "o" && toks[i].v === ",") i++;
|
|
276
|
+
else break;
|
|
277
|
+
}
|
|
278
|
+
return modules.length ? { from: false, dots: 0, module: [], modules, names: [], tc, line } : null;
|
|
279
|
+
}
|
|
280
|
+
if (toks[0].v === "from") {
|
|
281
|
+
let i = 1;
|
|
282
|
+
let dots = 0;
|
|
283
|
+
while (toks[i] && toks[i].k === "o" && (toks[i].v === "." || toks[i].v === "...")) {
|
|
284
|
+
dots += toks[i].v.length;
|
|
285
|
+
i++;
|
|
286
|
+
}
|
|
287
|
+
const d = dotted(toks, i);
|
|
288
|
+
i = d.next;
|
|
289
|
+
if (!toks[i] || toks[i].v !== "import") return null;
|
|
290
|
+
i++;
|
|
291
|
+
const names = [];
|
|
292
|
+
for (; i < toks.length; i++) {
|
|
293
|
+
const t = toks[i];
|
|
294
|
+
if (t.k === "o" && t.v === "*") names.push("*");
|
|
295
|
+
else if (t.k === "n" && t.v !== "as" && !KEYWORDS.has(t.v)) {
|
|
296
|
+
names.push(t.v);
|
|
297
|
+
if (toks[i + 1] && toks[i + 1].v === "as") i += 2;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (dots === 0 && d.names.length === 0) return null;
|
|
301
|
+
return { from: true, dots, module: d.names, modules: [], names, tc, line };
|
|
302
|
+
}
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const SAFE_DECORATORS = new Set([
|
|
307
|
+
"dataclass", "dataclasses.dataclass", "lru_cache", "functools.lru_cache", "cache", "functools.cache",
|
|
308
|
+
"contextmanager", "contextlib.contextmanager", "asynccontextmanager", "contextlib.asynccontextmanager",
|
|
309
|
+
"final", "typing.final", "total_ordering", "functools.total_ordering", "staticmethod", "classmethod",
|
|
310
|
+
"runtime_checkable", "typing.runtime_checkable", "unique", "enum.unique",
|
|
311
|
+
]);
|
|
312
|
+
|
|
313
|
+
const ENTRY_NAMES = new Set([
|
|
314
|
+
"main", "app", "application", "handler", "lambda_handler", "create_app", "make_app", "cli", "upgrade", "downgrade",
|
|
315
|
+
"setup", "teardown", "pytest_configure", "pytest_addoption", "load_tests",
|
|
316
|
+
]);
|
|
317
|
+
|
|
318
|
+
const ROOT_FILES = /(?:^|\/)(?:setup|manage|conftest|wsgi|asgi|__main__|noxfile|fabfile|tasks|alembic\/env|env)\.py$/;
|
|
319
|
+
|
|
320
|
+
/** Decorator text of a line starting with `@`: `a.b.c` before any `(`. */
|
|
321
|
+
function decoratorName(toks) {
|
|
322
|
+
const d = dotted(toks, 1);
|
|
323
|
+
return d.names.join(".");
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* One blob, read once. `params` null skips the token stream.
|
|
328
|
+
* @returns {{ok: boolean, identifiers: Set<string>, exports: string[], imports: object[], blocks: object[], stream: string[] | null}}
|
|
329
|
+
*/
|
|
330
|
+
function analyzeBlob(path, text, params) {
|
|
331
|
+
const identifiers = new Set();
|
|
332
|
+
const lines = lex(text);
|
|
333
|
+
if (!lines) return { ok: false, identifiers, exports: [], imports: [], blocks: [], stream: null };
|
|
334
|
+
|
|
335
|
+
const stream = params ? [] : null;
|
|
336
|
+
const lineStart = [];
|
|
337
|
+
const imports = [];
|
|
338
|
+
const reserved = new Set(); // names in __all__
|
|
339
|
+
const defs = []; // top-level candidate exports
|
|
340
|
+
const blocks = [];
|
|
341
|
+
let hasModuleGetattr = false;
|
|
342
|
+
|
|
343
|
+
// Pass 1: names, strings, the token stream.
|
|
344
|
+
let prevIndent = 0;
|
|
345
|
+
const indents = [0];
|
|
346
|
+
for (const ln of lines) {
|
|
347
|
+
lineStart.push(stream ? stream.length : 0);
|
|
348
|
+
if (stream) {
|
|
349
|
+
if (ln.indent > indents[indents.length - 1]) {
|
|
350
|
+
indents.push(ln.indent);
|
|
351
|
+
stream.push(T_INDENT);
|
|
352
|
+
} else {
|
|
353
|
+
while (ln.indent < indents[indents.length - 1]) {
|
|
354
|
+
indents.pop();
|
|
355
|
+
stream.push(T_DEDENT);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
prevIndent = ln.indent;
|
|
359
|
+
}
|
|
360
|
+
for (const t of ln.toks) {
|
|
361
|
+
switch (t.k) {
|
|
362
|
+
case "n":
|
|
363
|
+
if (!KEYWORDS.has(t.v)) identifiers.add(t.v);
|
|
364
|
+
if (stream) stream.push(t.v);
|
|
365
|
+
break;
|
|
366
|
+
case "s":
|
|
367
|
+
if (IDENT_SHAPED.test(t.v)) for (const w of t.v.match(WORD)) identifiers.add(w);
|
|
368
|
+
else if (t.f) for (const w of t.v.match(WORD) ?? []) identifiers.add(w);
|
|
369
|
+
if (stream) stream.push(T_STRING);
|
|
370
|
+
break;
|
|
371
|
+
case "d":
|
|
372
|
+
if (stream) stream.push(T_NUMBER);
|
|
373
|
+
break;
|
|
374
|
+
default:
|
|
375
|
+
if (stream) stream.push(t.v);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (stream) stream.push(T_NEWLINE);
|
|
379
|
+
}
|
|
380
|
+
void prevIndent;
|
|
381
|
+
|
|
382
|
+
// Pass 2: structure.
|
|
383
|
+
let tcIndent = null;
|
|
384
|
+
/** @type {{indent: number, name: string, kind: "def" | "class"}[]} */
|
|
385
|
+
const scope = [];
|
|
386
|
+
let decorators = [];
|
|
387
|
+
const L = lines.length;
|
|
388
|
+
const endOf = (k) => {
|
|
389
|
+
let j = k + 1;
|
|
390
|
+
while (j < L && lines[j].indent > lines[k].indent) j++;
|
|
391
|
+
return j - 1;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
for (let k = 0; k < L; k++) {
|
|
395
|
+
const ln = lines[k];
|
|
396
|
+
const toks = ln.toks;
|
|
397
|
+
while (scope.length && scope[scope.length - 1].indent >= ln.indent) scope.pop();
|
|
398
|
+
if (tcIndent !== null && ln.indent <= tcIndent) tcIndent = null;
|
|
399
|
+
const inTC = tcIndent !== null;
|
|
400
|
+
const first = toks[0];
|
|
401
|
+
|
|
402
|
+
if (first.k === "n" && first.v === "if") {
|
|
403
|
+
// `if TYPE_CHECKING:` / `if typing.TYPE_CHECKING:`
|
|
404
|
+
const rest = toks.slice(1, -1).map((t) => t.v).join("");
|
|
405
|
+
if (/^(?:typing\.|t\.)?TYPE_CHECKING$/.test(rest) && toks[toks.length - 1].v === ":") tcIndent = ln.indent;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
for (const st of statements(toks)) {
|
|
409
|
+
if (st[0].k === "n" && (st[0].v === "import" || st[0].v === "from")) {
|
|
410
|
+
const r = importRecord(st, inTC, ln.line);
|
|
411
|
+
if (r) {
|
|
412
|
+
r.deferred = scope.some((s) => s.kind === "def");
|
|
413
|
+
imports.push(r);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
if (first.k === "o" && first.v === "@") {
|
|
419
|
+
decorators.push(decoratorName(toks));
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
let defAt = -1;
|
|
424
|
+
if (first.k === "n" && first.v === "def") defAt = 0;
|
|
425
|
+
else if (first.k === "n" && first.v === "async" && toks[1] && toks[1].v === "def") defAt = 1;
|
|
426
|
+
const isClass = first.k === "n" && first.v === "class";
|
|
427
|
+
|
|
428
|
+
if ((defAt >= 0 || isClass) && toks[defAt >= 0 ? defAt + 1 : 1] && toks[defAt >= 0 ? defAt + 1 : 1].k === "n") {
|
|
429
|
+
const name = toks[defAt >= 0 ? defAt + 1 : 1].v;
|
|
430
|
+
if (ln.indent === 0) {
|
|
431
|
+
if (defAt >= 0 && name === "__getattr__") hasModuleGetattr = true;
|
|
432
|
+
defs.push({ name, decorators });
|
|
433
|
+
}
|
|
434
|
+
const inDef = scope.some((s) => s.kind === "def");
|
|
435
|
+
const dotName = [...scope.map((s) => s.name), name].join(".");
|
|
436
|
+
if (defAt >= 0 && params && (params.nested || !inDef)) {
|
|
437
|
+
const endIdx = endOf(k);
|
|
438
|
+
const lines_ = lines[endIdx].endLine - ln.line + 1;
|
|
439
|
+
if (lines_ >= params.minLines) {
|
|
440
|
+
blocks.push({
|
|
441
|
+
name: dotName,
|
|
442
|
+
line: ln.line,
|
|
443
|
+
lines: lines_,
|
|
444
|
+
start: toks[0].p,
|
|
445
|
+
end: lines[endIdx].toks[lines[endIdx].toks.length - 1].e,
|
|
446
|
+
tokStart: lineStart[k],
|
|
447
|
+
tokEnd: endIdx + 1 < L ? lineStart[endIdx + 1] : stream.length,
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
scope.push({ indent: ln.indent, name, kind: defAt >= 0 ? "def" : "class" });
|
|
452
|
+
decorators = [];
|
|
453
|
+
continue;
|
|
454
|
+
}
|
|
455
|
+
decorators = [];
|
|
456
|
+
|
|
457
|
+
// `__all__ = [...]`, `__all__ += [...]`
|
|
458
|
+
if (ln.indent === 0 && first.k === "n" && first.v === "__all__") {
|
|
459
|
+
for (const t of toks) if (t.k === "s") reserved.add(t.v);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// A multi-line module- or class-level assignment is a block too: a data
|
|
463
|
+
// table copied between two files is a clone.
|
|
464
|
+
if (params && first.k === "n" && !KEYWORDS.has(first.v) && first.v !== "__all__" && toks[1] && toks[1].k === "o" && (toks[1].v === "=" || toks[1].v === ":")) {
|
|
465
|
+
const top = scope[scope.length - 1];
|
|
466
|
+
if (!top || (top.kind === "class" && !scope.some((s) => s.kind === "def"))) {
|
|
467
|
+
const lines_ = ln.endLine - ln.line + 1;
|
|
468
|
+
if (lines_ >= params.minLines) {
|
|
469
|
+
blocks.push({
|
|
470
|
+
name: [...scope.map((s) => s.name), first.v].join("."),
|
|
471
|
+
line: ln.line,
|
|
472
|
+
lines: lines_,
|
|
473
|
+
start: toks[0].p,
|
|
474
|
+
end: toks[toks.length - 1].e,
|
|
475
|
+
tokStart: lineStart[k],
|
|
476
|
+
tokEnd: k + 1 < L ? lineStart[k + 1] : stream.length,
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
const rootFile = ROOT_FILES.test(path);
|
|
484
|
+
const exports = [];
|
|
485
|
+
if (!hasModuleGetattr && !rootFile) {
|
|
486
|
+
for (const d of defs) {
|
|
487
|
+
const n = d.name;
|
|
488
|
+
if (n.startsWith("_") || n.startsWith("test_") || /^Test[A-Z_]/.test(n) || ENTRY_NAMES.has(n) || /^(?:get|build|make|create)_app$/.test(n) || reserved.has(n)) continue;
|
|
489
|
+
if (d.decorators.some((dn) => !SAFE_DECORATORS.has(dn))) continue;
|
|
490
|
+
exports.push(n);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return { ok: true, identifiers, exports, imports, blocks, stream };
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/** A content key for blobs that arrive without an oid (same FNV-1a as the TS analyzer). */
|
|
497
|
+
export function contentKey(text) {
|
|
498
|
+
let h = 0x811c9dc5;
|
|
499
|
+
for (let i = 0; i < text.length; i++) {
|
|
500
|
+
h ^= text.charCodeAt(i);
|
|
501
|
+
h = Math.imul(h, 0x01000193);
|
|
502
|
+
}
|
|
503
|
+
return `c${(h >>> 0).toString(36)}:${text.length}`;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// ── minhash (same seed and mixing as typescript-ast.mjs) ────────────────────
|
|
507
|
+
|
|
508
|
+
const COEFF_CACHE = new Map();
|
|
509
|
+
function coefficients(n) {
|
|
510
|
+
const hit = COEFF_CACHE.get(n);
|
|
511
|
+
if (hit) return hit;
|
|
512
|
+
const a = new Int32Array(n);
|
|
513
|
+
const b = new Int32Array(n);
|
|
514
|
+
let x = 0x9e3779b9;
|
|
515
|
+
const next = () => (x = (Math.imul(x, 1664525) + 1013904223) >>> 0);
|
|
516
|
+
for (let i = 0; i < n; i++) {
|
|
517
|
+
a[i] = next() | 1;
|
|
518
|
+
b[i] = next();
|
|
519
|
+
}
|
|
520
|
+
const c = { a, b };
|
|
521
|
+
COEFF_CACHE.set(n, c);
|
|
522
|
+
return c;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
function signature(tokens, from, to, shingle, hashes) {
|
|
526
|
+
if (to - from < shingle) return null;
|
|
527
|
+
const { a, b } = coefficients(hashes);
|
|
528
|
+
const sig = new Int32Array(hashes).fill(-1);
|
|
529
|
+
let any = false;
|
|
530
|
+
for (let i = from; i + shingle <= to; i++) {
|
|
531
|
+
let h = 0x811c9dc5;
|
|
532
|
+
for (let j = 0; j < shingle; j++) {
|
|
533
|
+
const t = tokens[i + j];
|
|
534
|
+
for (let k = 0; k < t.length; k++) {
|
|
535
|
+
h ^= t.charCodeAt(k);
|
|
536
|
+
h = Math.imul(h, 0x01000193);
|
|
537
|
+
}
|
|
538
|
+
h ^= 0x2f;
|
|
539
|
+
h = Math.imul(h, 0x01000193);
|
|
540
|
+
}
|
|
541
|
+
h >>>= 0;
|
|
542
|
+
any = true;
|
|
543
|
+
for (let k = 0; k < hashes; k++) {
|
|
544
|
+
const v = (Math.imul(a[k], h) + b[k]) >>> 0;
|
|
545
|
+
if (v < (sig[k] >>> 0)) sig[k] = v | 0;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
return any ? sig : null;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// ── per-blob caches, keyed by oid (or content hash) ─────────────────────────
|
|
552
|
+
|
|
553
|
+
/** key -> `{identifiers, exports, imports | null}`. */
|
|
554
|
+
const IDENT_CACHE = new Map();
|
|
555
|
+
const BLOCK_CACHE = new Map();
|
|
556
|
+
|
|
557
|
+
export function clearPythonCaches() {
|
|
558
|
+
IDENT_CACHE.clear();
|
|
559
|
+
BLOCK_CACHE.clear();
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function remember(key, a) {
|
|
563
|
+
const hit = { identifiers: a.identifiers, exports: a.exports, imports: a.ok ? a.imports : null };
|
|
564
|
+
IDENT_CACHE.set(key, hit);
|
|
565
|
+
return hit;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
function identEntry(key, path, text) {
|
|
569
|
+
const k = `${key}|${ROOT_FILES.test(path) ? 1 : 0}`;
|
|
570
|
+
return IDENT_CACHE.get(k) ?? remember(k, analyzeBlob(path, text, null));
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/** `{identifiers, exports}` for one blob. */
|
|
574
|
+
export function identsOf(key, path, text) {
|
|
575
|
+
const { identifiers, exports } = identEntry(key, path, text);
|
|
576
|
+
return { identifiers, exports };
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/** The import statements one blob runs, or `null` when the lexer lost its place. */
|
|
580
|
+
export function importsOf(key, path, text) {
|
|
581
|
+
return identEntry(key, path, text).imports;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/** Signed blocks of one blob: `{name, line, lines, start, end, sig}`. */
|
|
585
|
+
export function signedBlocks(oid, path, text, params) {
|
|
586
|
+
const key = `${oid}|${params.minLines},${params.shingle},${params.hashes},${params.nested ? 1 : 0}`;
|
|
587
|
+
const hit = BLOCK_CACHE.get(key);
|
|
588
|
+
if (hit) return hit;
|
|
589
|
+
const out = [];
|
|
590
|
+
const a = analyzeBlob(path, text, params);
|
|
591
|
+
const ik = `${oid}|${ROOT_FILES.test(path) ? 1 : 0}`;
|
|
592
|
+
if (!IDENT_CACHE.has(ik)) remember(ik, a);
|
|
593
|
+
if (a.ok) {
|
|
594
|
+
for (const b of a.blocks) {
|
|
595
|
+
const sig = signature(a.stream, b.tokStart, b.tokEnd, params.shingle, params.hashes);
|
|
596
|
+
if (!sig) continue;
|
|
597
|
+
out.push({ name: b.name, line: b.line, lines: b.lines, start: b.start, end: b.end, sig });
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
BLOCK_CACHE.set(key, out);
|
|
601
|
+
return out;
|
|
602
|
+
}
|