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,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scorecard engine: slug → "is it public?" (GitHub) → the OpenSSF Scorecard reply, cached in
|
|
3
|
+
* memory, plus a person's accepts and "scored as" overrides. Everything outside the process (`fetch`,
|
|
4
|
+
* the clock, the state dir, the agent hand-off, the push) is injected so the tests run offline.
|
|
5
|
+
* Nothing polls: a read happens when the phone or the setup checklist asks.
|
|
6
|
+
*/
|
|
7
|
+
import { createHash } from "node:crypto";
|
|
8
|
+
import { readFileSync, realpathSync } from "node:fs";
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
import { BRAND } from "@waterplane/shared";
|
|
11
|
+
import { builtInAccept, checkViews, isFailing, isUsableSlug, openCount, own, parseReply, remedyPrompt, scoredDetail, viewerUrl } from "../shared/logic.mjs";
|
|
12
|
+
import { CHECK_ID, REASON_MAX, SCORE_FRESH_MS, VISIBILITY_FRESH_MS } from "../shared/wire.mjs";
|
|
13
|
+
import { commonGitDir, slugOfWorktree } from "./gitslug.mjs";
|
|
14
|
+
import { loadStore, saveStore, storeFile } from "./store.mjs";
|
|
15
|
+
/** Finished rows no longer answer a tap (requirements' ladder, `host/index.mts` there). */
|
|
16
|
+
const OVER = new Set(["done", "failed", "canceled", "cancelled", "dropped", "dismissed"]);
|
|
17
|
+
/** `plugin-scorecard-` is added by the host; its key rule allows 64 chars in all. */
|
|
18
|
+
const KEY_MAX = 64 - "plugin-scorecard-".length;
|
|
19
|
+
/** A short, valid backlog key for one (slug, check, score): a re-tap names the same row. */
|
|
20
|
+
export function remedyKey(slug, check, score, n = 0) {
|
|
21
|
+
const h = createHash("sha1").update(`${slug.toLowerCase()}\0${check}\0${score}`).digest("hex").slice(0, 16);
|
|
22
|
+
return (n <= 0 ? `sc-${h}` : `sc-${h}.${n}`).slice(0, KEY_MAX);
|
|
23
|
+
}
|
|
24
|
+
/** The repo's identity for "scored as": the realpath of its common git dir, so a linked worktree and the primary agree and two folders named alike do not. */
|
|
25
|
+
function repoKeyOf(worktree) {
|
|
26
|
+
const dir = commonGitDir(worktree) ?? worktree;
|
|
27
|
+
try {
|
|
28
|
+
return realpathSync(dir);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return dir;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Where the exposure collector writes a private repo's local reading: `<state dir>/scorecard/local/<owner>__<repo>.json` (the scorecard CLI's JSON, verbatim). */
|
|
35
|
+
export const localFile = (stateDir, slug) => join(stateDir, "scorecard", "local", `${slug.replace(/\//g, "__")}.json`);
|
|
36
|
+
const VIS_ERR_MS = 60 * 60_000;
|
|
37
|
+
const ERR_FRESH_MS = 10 * 60_000;
|
|
38
|
+
const SLUG_CACHE_MS = 30_000;
|
|
39
|
+
const HEADERS = { accept: "application/vnd.github+json", "user-agent": `${BRAND.slug}-scorecard` };
|
|
40
|
+
export function createEngine(roots, deps) {
|
|
41
|
+
const timeout = roots.timeoutMs ?? 10_000;
|
|
42
|
+
const file = storeFile(roots.stateDir);
|
|
43
|
+
const key = (slug) => slug.toLowerCase();
|
|
44
|
+
const entries = new Map();
|
|
45
|
+
const vis = new Map();
|
|
46
|
+
const inflight = new Map();
|
|
47
|
+
const slugCache = new Map();
|
|
48
|
+
const slugOf = (worktree) => {
|
|
49
|
+
const hit = slugCache.get(worktree);
|
|
50
|
+
if (hit && roots.now() - hit.at < SLUG_CACHE_MS)
|
|
51
|
+
return hit;
|
|
52
|
+
const set = own(loadStore(file).scoredAs, repoKeyOf(worktree));
|
|
53
|
+
const r = set ? { slug: set, from: "set" } : (() => { const s = slugOfWorktree(worktree); return { slug: s, from: s ? "remote" : null }; })();
|
|
54
|
+
slugCache.set(worktree, { at: roots.now(), ...r });
|
|
55
|
+
return r;
|
|
56
|
+
};
|
|
57
|
+
const fresh = (e) => roots.now() - e.tryAt < (e.transient ? ERR_FRESH_MS : SCORE_FRESH_MS);
|
|
58
|
+
async function isPublic(slug, force) {
|
|
59
|
+
const k = key(slug);
|
|
60
|
+
const c = vis.get(k);
|
|
61
|
+
if (c && !(force && c.pub !== true) && roots.now() - c.at < (c.pub === null ? VIS_ERR_MS : VISIBILITY_FRESH_MS))
|
|
62
|
+
return c;
|
|
63
|
+
let v;
|
|
64
|
+
try {
|
|
65
|
+
const r = await roots.fetch(`https://api.github.com/repos/${slug}`, { headers: HEADERS, signal: AbortSignal.timeout(timeout) });
|
|
66
|
+
if (r.status === 200) {
|
|
67
|
+
const j = (await r.json());
|
|
68
|
+
const now = typeof j?.full_name === "string" ? j.full_name : "";
|
|
69
|
+
if (now && now.toLowerCase() !== slug.toLowerCase() && j?.private === false)
|
|
70
|
+
v = { at: roots.now(), pub: false, movedTo: now };
|
|
71
|
+
else
|
|
72
|
+
v = j && j.private === false ? { at: roots.now(), pub: true } : { at: roots.now(), pub: false };
|
|
73
|
+
}
|
|
74
|
+
else if (r.status === 404)
|
|
75
|
+
v = { at: roots.now(), pub: false };
|
|
76
|
+
else
|
|
77
|
+
v = { at: roots.now(), pub: null, why: `GitHub answered ${r.status}` };
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
v = { at: roots.now(), pub: null, why: e.message || "no answer" };
|
|
81
|
+
}
|
|
82
|
+
vis.set(k, v);
|
|
83
|
+
return v;
|
|
84
|
+
}
|
|
85
|
+
/** The local reading of a private repo, or null (no file, unreadable, not a Scorecard reply: absent, never a guess). */
|
|
86
|
+
function readLocal(slug, at) {
|
|
87
|
+
for (const s of new Set([slug, slug.toLowerCase()])) {
|
|
88
|
+
let body;
|
|
89
|
+
try {
|
|
90
|
+
body = JSON.parse(readFileSync(localFile(roots.stateDir, s), "utf8"));
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const p = parseReply(body);
|
|
96
|
+
if (p.ok)
|
|
97
|
+
return { readAt: at, tryAt: at, pub: false, transient: false, parsed: p.value, local: true };
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
async function doRead(slug, force) {
|
|
102
|
+
const v = await isPublic(slug, force);
|
|
103
|
+
const at = roots.now();
|
|
104
|
+
if (v.pub === null)
|
|
105
|
+
return { readAt: at, tryAt: at, pub: null, transient: true, absent: `could not ask GitHub whether ${slug} is public: ${v.why}` };
|
|
106
|
+
if (v.movedTo)
|
|
107
|
+
return { readAt: at, tryAt: at, pub: false, transient: false, absent: `${slug} has moved on GitHub to ${v.movedTo} — set "scored as" to ${v.movedTo} (or update the remote)` };
|
|
108
|
+
if (!v.pub) {
|
|
109
|
+
const local = readLocal(slug, at);
|
|
110
|
+
if (local)
|
|
111
|
+
return local;
|
|
112
|
+
return { readAt: at, tryAt: at, pub: false, transient: false, absent: `${slug} is not public on GitHub (private, or no such repo) — Scorecard scores public repos only. A private repo gets a local reading when it is an exposure target: the daily exposure runner scores it with the scorecard CLI` };
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
const r = await roots.fetch(`https://api.securityscorecards.dev/projects/github.com/${slug}`, { headers: { accept: "application/json", "user-agent": HEADERS["user-agent"] }, signal: AbortSignal.timeout(timeout) });
|
|
116
|
+
if (r.status === 404)
|
|
117
|
+
return { readAt: at, tryAt: at, pub: true, transient: false, absent: `not scored yet — no Scorecard results published for github.com/${slug}; the ossf/scorecard-action workflow publishes them` };
|
|
118
|
+
if (r.status !== 200)
|
|
119
|
+
return { readAt: at, tryAt: at, pub: true, transient: true, absent: `the Scorecard API answered ${r.status} for github.com/${slug}` };
|
|
120
|
+
let body;
|
|
121
|
+
try {
|
|
122
|
+
body = await r.json();
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return { readAt: at, tryAt: at, pub: true, transient: true, absent: "the Scorecard API's reply was not JSON" };
|
|
126
|
+
}
|
|
127
|
+
const p = parseReply(body);
|
|
128
|
+
if (!p.ok)
|
|
129
|
+
return { readAt: at, tryAt: at, pub: true, transient: true, absent: p.reason };
|
|
130
|
+
return { readAt: at, tryAt: at, pub: true, transient: false, parsed: p.value };
|
|
131
|
+
}
|
|
132
|
+
catch (e) {
|
|
133
|
+
return { readAt: at, tryAt: at, pub: true, transient: true, absent: `could not reach the Scorecard API: ${e.message || "no answer"}` };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function kick(slug, force = false) {
|
|
137
|
+
const k = key(slug);
|
|
138
|
+
const have = inflight.get(k);
|
|
139
|
+
if (have)
|
|
140
|
+
return have;
|
|
141
|
+
const p = doRead(slug, force).catch((e) => ({ readAt: roots.now(), tryAt: roots.now(), pub: null, transient: true, absent: `the Scorecard read failed: ${e.message}` }))
|
|
142
|
+
.then((e) => {
|
|
143
|
+
// A blip (5xx, network, timeout, a bad body) never replaces a good reading: keep it, retry later.
|
|
144
|
+
const prev = entries.get(k);
|
|
145
|
+
entries.set(k, e.transient && prev?.parsed ? { ...prev, tryAt: e.tryAt, transient: true } : e);
|
|
146
|
+
inflight.delete(k);
|
|
147
|
+
deps.push({ at: roots.now(), slug });
|
|
148
|
+
});
|
|
149
|
+
inflight.set(k, p);
|
|
150
|
+
return p;
|
|
151
|
+
}
|
|
152
|
+
function view(scope) {
|
|
153
|
+
const { slug, from } = slugOf(scope.worktree);
|
|
154
|
+
const st = loadStore(file);
|
|
155
|
+
const base = { repo: scope.id, slug, slugFrom: from, score: null, checks: [], open: 0, readAt: null, ...(st.problem ? { problem: st.problem } : {}) };
|
|
156
|
+
if (!slug)
|
|
157
|
+
return { ...base, absent: "no GitHub remote — Scorecard reads github.com repos; set which public repo this one is scored as" };
|
|
158
|
+
const e = entries.get(key(slug));
|
|
159
|
+
if (!e)
|
|
160
|
+
return { ...base, absent: "not read yet" };
|
|
161
|
+
const v = { ...base, readAt: e.readAt };
|
|
162
|
+
if (!e.parsed)
|
|
163
|
+
return { ...v, absent: e.absent ?? "no reading" };
|
|
164
|
+
const checks = checkViews(e.parsed.checks, own(st.accepts, key(slug)));
|
|
165
|
+
v.score = e.parsed.score;
|
|
166
|
+
v.checks = checks;
|
|
167
|
+
v.open = openCount(checks);
|
|
168
|
+
if (e.local)
|
|
169
|
+
v.local = true;
|
|
170
|
+
else
|
|
171
|
+
v.viewerUrl = viewerUrl(slug);
|
|
172
|
+
if (e.parsed.date)
|
|
173
|
+
v.date = e.parsed.date;
|
|
174
|
+
if (e.parsed.commit)
|
|
175
|
+
v.commit = e.parsed.commit;
|
|
176
|
+
if (e.parsed.scorecardVersion)
|
|
177
|
+
v.scorecardVersion = e.parsed.scorecardVersion;
|
|
178
|
+
return v;
|
|
179
|
+
}
|
|
180
|
+
/** A scored slug and its entry, or throws a sentence saying why not. */
|
|
181
|
+
function scored(scope) {
|
|
182
|
+
const { slug } = slugOf(scope.worktree);
|
|
183
|
+
if (!slug)
|
|
184
|
+
throw new Error("this repo has no GitHub remote and no \"scored as\" repo — set one first");
|
|
185
|
+
const e = entries.get(key(slug));
|
|
186
|
+
if (!e?.parsed)
|
|
187
|
+
throw new Error(e?.absent ?? `${slug} has not been read yet — refresh first`);
|
|
188
|
+
return { slug, e: e };
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
slugOf,
|
|
192
|
+
read(scope) {
|
|
193
|
+
const { slug } = slugOf(scope.worktree);
|
|
194
|
+
if (slug) {
|
|
195
|
+
const e = entries.get(key(slug));
|
|
196
|
+
if (!e || !fresh(e))
|
|
197
|
+
void kick(slug);
|
|
198
|
+
}
|
|
199
|
+
return view(scope);
|
|
200
|
+
},
|
|
201
|
+
async refresh(scope) {
|
|
202
|
+
const { slug } = slugOf(scope.worktree);
|
|
203
|
+
if (slug)
|
|
204
|
+
await kick(slug, true);
|
|
205
|
+
return view(scope);
|
|
206
|
+
},
|
|
207
|
+
accept(scope, check, reasonIn) {
|
|
208
|
+
const reason = typeof reasonIn === "string" ? reasonIn.replace(/\s+/g, " ").trim() : "";
|
|
209
|
+
if (!reason)
|
|
210
|
+
throw new Error("say why in a sentence — an accept without a reason is not kept");
|
|
211
|
+
if (reason.length > REASON_MAX)
|
|
212
|
+
throw new Error(`keep the reason to ${REASON_MAX} characters (it is ${reason.length})`);
|
|
213
|
+
const { slug, e } = scored(scope);
|
|
214
|
+
const c = e.parsed.checks.find((x) => x.name === check);
|
|
215
|
+
if (!c)
|
|
216
|
+
throw new Error(`the reading has no check called "${String(check)}"`);
|
|
217
|
+
if (!isFailing(c.score))
|
|
218
|
+
throw new Error(`${c.name} is ${c.score < 0 ? "inconclusive" : "10/10"} — it is not failing, so there is nothing to accept`);
|
|
219
|
+
const built = builtInAccept(c.name);
|
|
220
|
+
if (built)
|
|
221
|
+
throw new Error(`${c.name} is already accepted built in: ${built}`);
|
|
222
|
+
const st = loadStore(file);
|
|
223
|
+
(st.accepts[key(slug)] ??= Object.create(null))[c.name] = { reason, at: new Date(roots.now()).toISOString(), score: c.score };
|
|
224
|
+
saveStore(file, st);
|
|
225
|
+
return view(scope);
|
|
226
|
+
},
|
|
227
|
+
unaccept(scope, check) {
|
|
228
|
+
const name = String(check);
|
|
229
|
+
const built = builtInAccept(name);
|
|
230
|
+
if (built)
|
|
231
|
+
throw new Error(`${name}'s accept ships with ${BRAND.displayName} (${built}) and cannot be withdrawn`);
|
|
232
|
+
const { slug } = slugOf(scope.worktree);
|
|
233
|
+
if (!slug)
|
|
234
|
+
throw new Error("this repo has no GitHub remote and no \"scored as\" repo");
|
|
235
|
+
const st = loadStore(file);
|
|
236
|
+
const per = own(st.accepts, key(slug));
|
|
237
|
+
if (!per || !own(per, name))
|
|
238
|
+
throw new Error(`no accept of ${name} is on file for ${slug} — nothing to withdraw`);
|
|
239
|
+
delete per[name];
|
|
240
|
+
if (!Object.keys(per).length)
|
|
241
|
+
delete st.accepts[key(slug)];
|
|
242
|
+
saveStore(file, st);
|
|
243
|
+
return view(scope);
|
|
244
|
+
},
|
|
245
|
+
scoredAs(scope, slugIn) {
|
|
246
|
+
if (slugIn === undefined)
|
|
247
|
+
throw new Error("which repo should this be scored as? the call gave no owner/name (null puts it back to the git remote)");
|
|
248
|
+
const st = loadStore(file);
|
|
249
|
+
const rk = repoKeyOf(scope.worktree);
|
|
250
|
+
if (slugIn === null)
|
|
251
|
+
delete st.scoredAs[rk];
|
|
252
|
+
else {
|
|
253
|
+
const s = typeof slugIn === "string" ? slugIn.trim() : "";
|
|
254
|
+
if (!isUsableSlug(s))
|
|
255
|
+
throw new Error("that is not a GitHub owner/name (letters, digits, dashes; one slash)");
|
|
256
|
+
st.scoredAs[rk] = s;
|
|
257
|
+
}
|
|
258
|
+
saveStore(file, st);
|
|
259
|
+
slugCache.clear();
|
|
260
|
+
return this.read(scope);
|
|
261
|
+
},
|
|
262
|
+
async remedy(scope, check) {
|
|
263
|
+
const { slug, e } = scored(scope);
|
|
264
|
+
const c = e.parsed.checks.find((x) => x.name === check);
|
|
265
|
+
if (!c)
|
|
266
|
+
throw new Error(`the reading has no check called "${String(check)}"`);
|
|
267
|
+
if (!isFailing(c.score))
|
|
268
|
+
throw new Error(`${c.name} is not failing (${c.score < 0 ? "inconclusive" : "10/10"}) — there is nothing to fix`);
|
|
269
|
+
const prompt = remedyPrompt(slug, c);
|
|
270
|
+
// One waiting item per (check, score). A row that is OVER (done/failed/dropped) must not answer every
|
|
271
|
+
// later tap while the score has not moved: the next key (`.1`, `.2`, …) makes a new item.
|
|
272
|
+
for (let n = 0; n < 50; n++) {
|
|
273
|
+
const r = await deps.handToAgent(scope.id, prompt, { label: `Scorecard: ${c.name}`, key: remedyKey(slug, c.name, c.score, n) });
|
|
274
|
+
if (!r.ok)
|
|
275
|
+
throw new Error(r.reason);
|
|
276
|
+
if (r.existing && r.state && OVER.has(r.state))
|
|
277
|
+
continue;
|
|
278
|
+
return { intentId: r.intentId, existing: r.existing === true, ...(r.state ? { state: r.state } : {}) };
|
|
279
|
+
}
|
|
280
|
+
throw new Error(`fifty finished fixes for ${c.name} are already filed at ${c.score}/10 — look at them in the backlog first`);
|
|
281
|
+
},
|
|
282
|
+
/** The setup row. Synchronous, cache only; a missing or stale reading starts one in the background. */
|
|
283
|
+
row(worktree) {
|
|
284
|
+
const { slug } = slugOf(worktree);
|
|
285
|
+
if (!slug)
|
|
286
|
+
return null;
|
|
287
|
+
const e = entries.get(key(slug));
|
|
288
|
+
if (!e || !fresh(e))
|
|
289
|
+
void kick(slug);
|
|
290
|
+
// A private repo has a row only when it has a LOCAL reading (the exposure runner's); never "not public" noise.
|
|
291
|
+
if (!e || (e.pub !== true && !e.local))
|
|
292
|
+
return null;
|
|
293
|
+
const mk = (status, detail) => ({ id: CHECK_ID, label: e.local ? "OpenSSF Scorecard (scored locally)" : "OpenSSF Scorecard", status, detail, fix: null, watch: true, ...(status === "pass" ? {} : { advisory: true }) });
|
|
294
|
+
if (!e.parsed)
|
|
295
|
+
return e.transient ? null : mk("warn", e.absent ?? "no Scorecard reading");
|
|
296
|
+
const st = loadStore(file);
|
|
297
|
+
const checks = checkViews(e.parsed.checks, own(st.accepts, key(slug)));
|
|
298
|
+
const note = st.problem ? ` — ${st.problem}` : "";
|
|
299
|
+
return mk(openCount(checks) ? "warn" : "pass", scoredDetail(e.parsed.score, checks) + note);
|
|
300
|
+
},
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
//# sourceMappingURL=engine.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.mjs","sourceRoot":"","sources":["../../../../../extensions/scorecard/host/engine.mts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAwB,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAC;AACzK,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,mBAAmB,EAAoC,MAAM,oBAAoB,CAAC;AACjI,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAkB9D,2FAA2F;AAC3F,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;AAC1F,qFAAqF;AACrF,MAAM,OAAO,GAAG,EAAE,GAAG,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,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAClD,OAAO,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QAC9F,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The directory that holds `config` for this worktree, or null when it is not a git checkout. */
|
|
2
|
+
export declare function commonGitDir(worktree: string): string | null;
|
|
3
|
+
export declare function slugOfWorktree(worktree: string): string | null;
|
|
4
|
+
/** The repo's name as the host names it: the primary checkout's folder (a linked worktree shares it). */
|
|
5
|
+
export declare function repoNameOfWorktree(worktree: string): string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A worktree's GitHub slug, read straight off its git config (no subprocess: the setup check is
|
|
3
|
+
* synchronous and asked per repo). A linked worktree's `.git` is a FILE (`gitdir: <path>`) whose dir
|
|
4
|
+
* holds a `commondir` file; the config (and the remotes) live in the common dir.
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
7
|
+
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
8
|
+
import { slugFromConfig } from "../shared/logic.mjs";
|
|
9
|
+
const read = (p) => { try {
|
|
10
|
+
return readFileSync(p, "utf8");
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return null;
|
|
14
|
+
} };
|
|
15
|
+
/** The directory that holds `config` for this worktree, or null when it is not a git checkout. */
|
|
16
|
+
export function commonGitDir(worktree) {
|
|
17
|
+
const dotGit = join(worktree, ".git");
|
|
18
|
+
let st;
|
|
19
|
+
try {
|
|
20
|
+
st = statSync(dotGit);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
if (st.isDirectory())
|
|
26
|
+
return dotGit;
|
|
27
|
+
const m = /^gitdir:\s*(.+)$/m.exec(read(dotGit) ?? "");
|
|
28
|
+
if (!m)
|
|
29
|
+
return null;
|
|
30
|
+
const gitdir = isAbsolute(m[1].trim()) ? m[1].trim() : resolve(worktree, m[1].trim());
|
|
31
|
+
const common = read(join(gitdir, "commondir"))?.trim();
|
|
32
|
+
const dir = common ? (isAbsolute(common) ? common : resolve(gitdir, common)) : gitdir;
|
|
33
|
+
return existsSync(dir) ? dir : null;
|
|
34
|
+
}
|
|
35
|
+
export function slugOfWorktree(worktree) {
|
|
36
|
+
const dir = commonGitDir(worktree);
|
|
37
|
+
const cfg = dir ? read(join(dir, "config")) : null;
|
|
38
|
+
return cfg ? slugFromConfig(cfg) : null;
|
|
39
|
+
}
|
|
40
|
+
/** The repo's name as the host names it: the primary checkout's folder (a linked worktree shares it). */
|
|
41
|
+
export function repoNameOfWorktree(worktree) {
|
|
42
|
+
const dir = commonGitDir(worktree);
|
|
43
|
+
return dir && basename(dir) === ".git" ? basename(dirname(dir)) : basename(worktree);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=gitslug.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitslug.mjs","sourceRoot":"","sources":["../../../../../extensions/scorecard/host/gitslug.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,IAAI,GAAG,CAAC,CAAS,EAAiB,EAAE,GAAG,IAAI,CAAC;IAAC,OAAO,YAAY,CAAC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,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,MAAM,GAAG,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACnC,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnD,OAAO,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1C,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,MAAM,GAAG,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACnC,OAAO,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scorecard extension's host half: reads the public OpenSSF Scorecard for a repo's GitHub
|
|
3
|
+
* remote (`shared/wire.mts`) over the engine (`engine.mts`). No credential, no model call, no
|
|
4
|
+
* poller — a read happens when the phone or the setup checklist asks. Contributed through the same
|
|
5
|
+
* `HostPluginApi` an external plugin gets.
|
|
6
|
+
*/
|
|
7
|
+
import { type HostPluginApi } from "@waterplane/shared";
|
|
8
|
+
import { type Engine } from "./engine.mjs";
|
|
9
|
+
export { createEngine } from "./engine.mjs";
|
|
10
|
+
export type { Roots } from "./engine.mjs";
|
|
11
|
+
type Api = Pick<HostPluginApi, "handle" | "repo">;
|
|
12
|
+
/** Wire an engine to `api`'s methods. Exported so the tests drive the real handlers. */
|
|
13
|
+
export declare function serve(api: Api, engine: Engine): () => void;
|
|
14
|
+
export declare function activate(api: HostPluginApi): void;
|
|
15
|
+
export declare function deactivate(): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scorecard extension's host half: reads the public OpenSSF Scorecard for a repo's GitHub
|
|
3
|
+
* remote (`shared/wire.mts`) over the engine (`engine.mts`). No credential, no model call, no
|
|
4
|
+
* poller — a read happens when the phone or the setup checklist asks. Contributed through the same
|
|
5
|
+
* `HostPluginApi` an external plugin gets.
|
|
6
|
+
*/
|
|
7
|
+
import { handleAll } from "@waterplane/shared";
|
|
8
|
+
import { PUSH_CHANGED } from "../shared/wire.mjs";
|
|
9
|
+
import { createEngine } from "./engine.mjs";
|
|
10
|
+
export { createEngine } from "./engine.mjs";
|
|
11
|
+
/** Wire an engine to `api`'s methods. Exported so the tests drive the real handlers. */
|
|
12
|
+
export function serve(api, engine) {
|
|
13
|
+
// Args arrive unchecked from the wire: every method names its repo or says it was not told one.
|
|
14
|
+
const scope = async (a) => {
|
|
15
|
+
const id = a?.repo;
|
|
16
|
+
if (typeof id !== "string" || !id)
|
|
17
|
+
throw new Error("which repo? the call named none");
|
|
18
|
+
const s = await api.repo(id);
|
|
19
|
+
if (!s)
|
|
20
|
+
throw new Error(`no repo "${id}" under this host's root`);
|
|
21
|
+
return s;
|
|
22
|
+
};
|
|
23
|
+
const arg = (a, k) => a?.[k];
|
|
24
|
+
return handleAll(api, {
|
|
25
|
+
read: async (a) => engine.read(await scope(a)),
|
|
26
|
+
refresh: async (a) => engine.refresh(await scope(a)),
|
|
27
|
+
accept: async (a) => engine.accept(await scope(a), arg(a, "check"), arg(a, "reason")),
|
|
28
|
+
unaccept: async (a) => engine.unaccept(await scope(a), arg(a, "check")),
|
|
29
|
+
scoredAs: async (a) => engine.scoredAs(await scope(a), arg(a, "slug")),
|
|
30
|
+
remedy: async (a) => engine.remedy(await scope(a), arg(a, "check")),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
let off = [];
|
|
34
|
+
export function activate(api) {
|
|
35
|
+
const roots = { stateDir: api.stateDir, fetch: globalThis.fetch, now: () => Date.now() };
|
|
36
|
+
const engine = createEngine(roots, {
|
|
37
|
+
push: (d) => { api.push(PUSH_CHANGED, d); },
|
|
38
|
+
handToAgent: (id, prompt, o) => api.handToAgent(id, prompt, o), // no `fire`: it waits for a tap
|
|
39
|
+
});
|
|
40
|
+
off = [api.setupCheck(({ worktree }) => engine.row(worktree)), serve(api, engine)];
|
|
41
|
+
}
|
|
42
|
+
export function deactivate() {
|
|
43
|
+
for (const f of off)
|
|
44
|
+
f();
|
|
45
|
+
off = [];
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../../extensions/scorecard/host/index.mts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAA4C,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,YAAY,EAAyB,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,YAAY,EAA2B,MAAM,cAAc,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAK5C,wFAAwF;AACxF,MAAM,UAAU,KAAK,CAAC,GAAQ,EAAE,MAAc;IAC5C,gGAAgG;IAChG,MAAM,KAAK,GAAG,KAAK,EAAE,CAAU,EAA4B,EAAE;QAC3D,MAAM,EAAE,GAAI,CAA+B,EAAE,IAAI,CAAC;QAClD,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACtF,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC7B,IAAI,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,YAAY,EAAE,0BAA0B,CAAC,CAAC;QAClE,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;IACF,MAAM,GAAG,GAAG,CAAC,CAAU,EAAE,CAA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,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IAChG,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,EAAE;QACjC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,gCAAgC;KACjG,CAAC,CAAC;IACH,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;AACrF,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,KAAK,MAAM,CAAC,IAAI,GAAG;QAAE,CAAC,EAAE,CAAC;IACzB,GAAG,GAAG,EAAE,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ScoreAccept } from "../shared/wire.mjs";
|
|
2
|
+
export interface Stored {
|
|
3
|
+
accepts: Record<string, Record<string, ScoreAccept>>;
|
|
4
|
+
scoredAs: Record<string, string>;
|
|
5
|
+
/** A sentence when the file exists but cannot be used; writes refuse while it is set. */
|
|
6
|
+
problem?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const storeFile: (stateDir: string) => string;
|
|
9
|
+
/** Read the file, re-parsing only when its mtime / size / inode changed (the setup row asks per repo). */
|
|
10
|
+
export declare function loadStore(file: string): Stored;
|
|
11
|
+
/** Write atomically (tmp + rename). Throws a sentence when the file on disk is not ours to overwrite. */
|
|
12
|
+
export declare function saveStore(file: string, s: Stored): void;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a person told the scorecard, on disk: `<state dir>/scorecard/accepted.json`
|
|
3
|
+
* { "accepts": { "<slug>": { "<check>": { reason, at, score } } }, "scoredAs": { "<realpath of the repo's common git dir>": "<slug>" } }
|
|
4
|
+
* A file that does not parse is NEVER written over: reads see nothing, writes refuse in words naming it.
|
|
5
|
+
*/
|
|
6
|
+
import { mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { dirname, join } from "node:path";
|
|
8
|
+
import { isUsableSlug } from "../shared/logic.mjs";
|
|
9
|
+
import { REASON_MAX } from "../shared/wire.mjs";
|
|
10
|
+
export const storeFile = (stateDir) => join(stateDir, "scorecard", "accepted.json");
|
|
11
|
+
const cache = new Map();
|
|
12
|
+
/** A copy a caller may mutate: per-slug records have no prototype, so a check named `__proto__` is just a key. */
|
|
13
|
+
function copy(s) {
|
|
14
|
+
const accepts = {};
|
|
15
|
+
for (const [slug, per] of Object.entries(s.accepts)) {
|
|
16
|
+
const c = Object.create(null);
|
|
17
|
+
for (const [n, a] of Object.entries(per))
|
|
18
|
+
c[n] = { ...a };
|
|
19
|
+
accepts[slug] = c;
|
|
20
|
+
}
|
|
21
|
+
return { accepts, scoredAs: { ...s.scoredAs }, ...(s.problem ? { problem: s.problem } : {}) };
|
|
22
|
+
}
|
|
23
|
+
/** Read the file, re-parsing only when its mtime / size / inode changed (the setup row asks per repo). */
|
|
24
|
+
export function loadStore(file) {
|
|
25
|
+
let sig;
|
|
26
|
+
try {
|
|
27
|
+
const st = statSync(file);
|
|
28
|
+
sig = `${st.mtimeMs}:${st.ctimeMs}:${st.size}:${st.ino}`;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
cache.delete(file);
|
|
32
|
+
return parse(file);
|
|
33
|
+
}
|
|
34
|
+
const hit = cache.get(file);
|
|
35
|
+
if (hit && hit.sig === sig)
|
|
36
|
+
return copy(hit.stored);
|
|
37
|
+
const stored = parse(file);
|
|
38
|
+
cache.set(file, { sig, stored });
|
|
39
|
+
return copy(stored);
|
|
40
|
+
}
|
|
41
|
+
function parse(file) {
|
|
42
|
+
let text;
|
|
43
|
+
try {
|
|
44
|
+
text = readFileSync(file, "utf8");
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
if (e.code === "ENOENT")
|
|
48
|
+
return { accepts: {}, scoredAs: {} };
|
|
49
|
+
return { accepts: {}, scoredAs: {}, problem: `${file} could not be read (${e.message}) — nothing is written over it.` };
|
|
50
|
+
}
|
|
51
|
+
let d;
|
|
52
|
+
try {
|
|
53
|
+
d = JSON.parse(text);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return { accepts: {}, scoredAs: {}, problem: `${file} is not valid JSON — your accepts are not counted and none can be saved; nothing is written over it until it parses (fix or move it).` };
|
|
57
|
+
}
|
|
58
|
+
const o = d;
|
|
59
|
+
if (!o || typeof o !== "object" || Array.isArray(o))
|
|
60
|
+
return { accepts: {}, scoredAs: {}, problem: `${file} is not a JSON object — nothing is written over it until it is.` };
|
|
61
|
+
const accepts = {};
|
|
62
|
+
if (o.accepts && typeof o.accepts === "object") {
|
|
63
|
+
for (const [slug, per] of Object.entries(o.accepts)) {
|
|
64
|
+
if (!per || typeof per !== "object")
|
|
65
|
+
continue;
|
|
66
|
+
for (const [name, a] of Object.entries(per)) {
|
|
67
|
+
const r = a;
|
|
68
|
+
if (!r || typeof r.reason !== "string" || !r.reason.trim())
|
|
69
|
+
continue;
|
|
70
|
+
(accepts[slug] ??= Object.create(null))[name] = { reason: r.reason.slice(0, REASON_MAX), ...(typeof r.at === "string" ? { at: r.at } : {}), ...(typeof r.score === "number" ? { score: r.score } : {}) };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const scoredAs = {};
|
|
75
|
+
if (o.scoredAs && typeof o.scoredAs === "object") {
|
|
76
|
+
for (const [k, v] of Object.entries(o.scoredAs))
|
|
77
|
+
if (typeof v === "string" && isUsableSlug(v))
|
|
78
|
+
scoredAs[k] = v;
|
|
79
|
+
}
|
|
80
|
+
return { accepts, scoredAs };
|
|
81
|
+
}
|
|
82
|
+
/** Write atomically (tmp + rename). Throws a sentence when the file on disk is not ours to overwrite. */
|
|
83
|
+
export function saveStore(file, s) {
|
|
84
|
+
if (s.problem)
|
|
85
|
+
throw new Error(s.problem);
|
|
86
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
87
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
88
|
+
writeFileSync(tmp, JSON.stringify({ accepts: s.accepts, scoredAs: s.scoredAs }, null, 2) + "\n", { mode: 0o600 });
|
|
89
|
+
renameSync(tmp, file);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=store.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.mjs","sourceRoot":"","sources":["../../../../../extensions/scorecard/host/store.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAoB,MAAM,oBAAoB,CAAC;AASlE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAU,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC;AAEpG,MAAM,KAAK,GAAG,IAAI,GAAG,EAA2C,CAAC;AAEjE,kHAAkH;AAClH,SAAS,IAAI,CAAC,CAAS;IACrB,MAAM,OAAO,GAAsB,EAAE,CAAC;IACtC,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;QACpD,MAAM,CAAC,GAAgC,MAAM,C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EAAE,QAAQ,EAAE,CAAC;AAC/B,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,CAAS;IAC/C,IAAI,CAAC,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC1C,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,MAAM,CAAC;IACzC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAClH,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scorecard's pure logic, shared by the host half and (for the remedy prompt) the phone:
|
|
3
|
+
* GitHub remote → slug, the API reply → checks, failing / accepted, the words of the setup row and
|
|
4
|
+
* the remedy prompt. No node imports.
|
|
5
|
+
*/
|
|
6
|
+
import { type CheckView, type ScoreAccept, type ScoreCheck } from "./wire.mjs";
|
|
7
|
+
/** GitHub `owner/name` of a remote URL (https, scp-style, ssh://, git://), or null for any other host. */
|
|
8
|
+
export declare function githubSlug(url: string): string | null;
|
|
9
|
+
/** SLUG_RE plus the two names GitHub's regex shape admits but no repo can have ("." and ".."). */
|
|
10
|
+
export declare function isUsableSlug(s: string): boolean;
|
|
11
|
+
/** Check names come off the network: only OWN keys count, so `constructor` / `__proto__` are ordinary names. */
|
|
12
|
+
export declare const own: <T>(o: Readonly<Record<string, T>> | null | undefined, k: string) => T | undefined;
|
|
13
|
+
export declare const builtInAccept: (name: string) => string | undefined;
|
|
14
|
+
/** The slug a git `config` text names: remote `origin` if it is GitHub, else the first GitHub remote. */
|
|
15
|
+
export declare function slugFromConfig(text: string): string | null;
|
|
16
|
+
/** Failing = it loses points: 0 <= score < 10. -1 (inconclusive) never fails. */
|
|
17
|
+
export declare const isFailing: (score: number) => boolean;
|
|
18
|
+
export declare const viewerUrl: (slug: string) => string;
|
|
19
|
+
export interface Parsed {
|
|
20
|
+
score: number;
|
|
21
|
+
date?: string;
|
|
22
|
+
commit?: string;
|
|
23
|
+
scorecardVersion?: string;
|
|
24
|
+
checks: ScoreCheck[];
|
|
25
|
+
}
|
|
26
|
+
/** The API reply, defensively. A wrong shape is `{ ok:false, reason }` — never an invented number. */
|
|
27
|
+
export declare function parseReply(d: unknown): {
|
|
28
|
+
ok: true;
|
|
29
|
+
value: Parsed;
|
|
30
|
+
} | {
|
|
31
|
+
ok: false;
|
|
32
|
+
reason: string;
|
|
33
|
+
};
|
|
34
|
+
/** A person's accept holds while the check's score has not fallen below the score it was accepted at. */
|
|
35
|
+
export declare const acceptHolds: (a: ScoreAccept, score: number) => boolean;
|
|
36
|
+
/** The sheet's checks: each with `failing` and its accept (built-in first, else the person's, unless lapsed). */
|
|
37
|
+
export declare function checkViews(checks: readonly ScoreCheck[], person?: Readonly<Record<string, ScoreAccept>>): CheckView[];
|
|
38
|
+
export declare const openCount: (checks: readonly CheckView[]) => number;
|
|
39
|
+
/** The setup row's detail for a scored repo, e.g. "6/10 — 3 failing checks (A, B, C); 3 accepted". */
|
|
40
|
+
export declare function scoredDetail(score: number, checks: readonly CheckView[]): string;
|
|
41
|
+
/** The prompt a person taps to send the agent after one failing check. Pure; the phone may quote it. */
|
|
42
|
+
export declare function remedyPrompt(slug: string, c: ScoreCheck): string;
|