ontrackd 0.0.1 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +14 -0
- package/README.md +133 -2
- package/dist/cli/build.d.ts +1 -0
- package/dist/cli/build.js +172 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/cloud.d.ts +20 -0
- package/dist/cli/cloud.js +395 -0
- package/dist/cli/cloud.js.map +1 -0
- package/dist/cli/feedback.d.ts +4 -0
- package/dist/cli/feedback.js +90 -0
- package/dist/cli/feedback.js.map +1 -0
- package/dist/cli/hugo.d.ts +1 -0
- package/dist/cli/hugo.js +396 -0
- package/dist/cli/hugo.js.map +1 -0
- package/dist/cli/init.d.ts +8 -0
- package/dist/cli/init.js +346 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/invite.d.ts +2 -0
- package/dist/cli/invite.js +65 -0
- package/dist/cli/invite.js.map +1 -0
- package/dist/cli/link.d.ts +20 -0
- package/dist/cli/link.js +287 -0
- package/dist/cli/link.js.map +1 -0
- package/dist/cli/pull.d.ts +31 -0
- package/dist/cli/pull.js +273 -0
- package/dist/cli/pull.js.map +1 -0
- package/dist/cli/push.d.ts +9 -0
- package/dist/cli/push.js +57 -0
- package/dist/cli/push.js.map +1 -0
- package/dist/cli/remote.d.ts +1 -0
- package/dist/cli/remote.js +114 -0
- package/dist/cli/remote.js.map +1 -0
- package/dist/cli/serve.d.ts +1 -0
- package/dist/cli/serve.js +178 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/sidecar.d.ts +9 -0
- package/dist/cli/sidecar.js +23 -0
- package/dist/cli/sidecar.js.map +1 -0
- package/dist/core/anchorId.d.ts +42 -0
- package/dist/core/anchorId.js +50 -0
- package/dist/core/anchorId.js.map +1 -0
- package/dist/core/apiKind.d.ts +42 -0
- package/dist/core/apiKind.js +83 -0
- package/dist/core/apiKind.js.map +1 -0
- package/dist/core/astroAnchors.d.ts +39 -0
- package/dist/core/astroAnchors.js +217 -0
- package/dist/core/astroAnchors.js.map +1 -0
- package/dist/core/attachmentTypes.d.ts +74 -0
- package/dist/core/attachmentTypes.js +199 -0
- package/dist/core/attachmentTypes.js.map +1 -0
- package/dist/core/elementHints.d.ts +40 -0
- package/dist/core/elementHints.js +116 -0
- package/dist/core/elementHints.js.map +1 -0
- package/dist/core/exportTaskDoc.d.ts +81 -0
- package/dist/core/exportTaskDoc.js +828 -0
- package/dist/core/exportTaskDoc.js.map +1 -0
- package/dist/core/feedbackTypes.d.ts +241 -0
- package/dist/core/feedbackTypes.js +2 -0
- package/dist/core/feedbackTypes.js.map +1 -0
- package/dist/core/fingerprint.d.ts +12 -0
- package/dist/core/fingerprint.js +24 -0
- package/dist/core/fingerprint.js.map +1 -0
- package/dist/core/htmlAnchors.d.ts +18 -0
- package/dist/core/htmlAnchors.js +157 -0
- package/dist/core/htmlAnchors.js.map +1 -0
- package/dist/core/imageSniff.d.ts +7 -0
- package/dist/core/imageSniff.js +12 -0
- package/dist/core/imageSniff.js.map +1 -0
- package/dist/core/ordering.d.ts +16 -0
- package/dist/core/ordering.js +10 -0
- package/dist/core/ordering.js.map +1 -0
- package/dist/core/oxcAst.d.ts +39 -0
- package/dist/core/oxcAst.js +147 -0
- package/dist/core/oxcAst.js.map +1 -0
- package/dist/core/pageUrl.d.ts +10 -0
- package/dist/core/pageUrl.js +27 -0
- package/dist/core/pageUrl.js.map +1 -0
- package/dist/core/participants.d.ts +14 -0
- package/dist/core/participants.js +38 -0
- package/dist/core/participants.js.map +1 -0
- package/dist/core/ports.d.ts +86 -0
- package/dist/core/ports.js +2 -0
- package/dist/core/ports.js.map +1 -0
- package/dist/core/projectSecret.d.ts +9 -0
- package/dist/core/projectSecret.js +57 -0
- package/dist/core/projectSecret.js.map +1 -0
- package/dist/core/recipe.d.ts +117 -0
- package/dist/core/recipe.js +181 -0
- package/dist/core/recipe.js.map +1 -0
- package/dist/core/recordingSummary.d.ts +12 -0
- package/dist/core/recordingSummary.js +150 -0
- package/dist/core/recordingSummary.js.map +1 -0
- package/dist/core/resolveAnchors.d.ts +70 -0
- package/dist/core/resolveAnchors.js +101 -0
- package/dist/core/resolveAnchors.js.map +1 -0
- package/dist/core/scriptImport.d.ts +10 -0
- package/dist/core/scriptImport.js +18 -0
- package/dist/core/scriptImport.js.map +1 -0
- package/dist/core/sourceAnchors.d.ts +62 -0
- package/dist/core/sourceAnchors.js +82 -0
- package/dist/core/sourceAnchors.js.map +1 -0
- package/dist/core/sourceContext.d.ts +62 -0
- package/dist/core/sourceContext.js +182 -0
- package/dist/core/sourceContext.js.map +1 -0
- package/dist/core/sourcePath.d.ts +2 -0
- package/dist/core/sourcePath.js +11 -0
- package/dist/core/sourcePath.js.map +1 -0
- package/dist/core/staleness.d.ts +118 -0
- package/dist/core/staleness.js +155 -0
- package/dist/core/staleness.js.map +1 -0
- package/dist/core/styleOrigin.d.ts +98 -0
- package/dist/core/styleOrigin.js +142 -0
- package/dist/core/styleOrigin.js.map +1 -0
- package/dist/core/svelteAnchors.d.ts +18 -0
- package/dist/core/svelteAnchors.js +125 -0
- package/dist/core/svelteAnchors.js.map +1 -0
- package/dist/core/taskFiles.d.ts +31 -0
- package/dist/core/taskFiles.js +55 -0
- package/dist/core/taskFiles.js.map +1 -0
- package/dist/core/untrusted.d.ts +57 -0
- package/dist/core/untrusted.js +268 -0
- package/dist/core/untrusted.js.map +1 -0
- package/dist/core/vueAnchors.d.ts +21 -0
- package/dist/core/vueAnchors.js +130 -0
- package/dist/core/vueAnchors.js.map +1 -0
- package/dist/expo/app/Avatar.d.ts +6 -0
- package/dist/expo/app/Avatar.js +12 -0
- package/dist/expo/app/Avatar.js.map +1 -0
- package/dist/expo/app/Bars.d.ts +9 -0
- package/dist/expo/app/Bars.js +38 -0
- package/dist/expo/app/Bars.js.map +1 -0
- package/dist/expo/app/CommentThreadSheet.d.ts +35 -0
- package/dist/expo/app/CommentThreadSheet.js +200 -0
- package/dist/expo/app/CommentThreadSheet.js.map +1 -0
- package/dist/expo/app/CommentsSheet.d.ts +22 -0
- package/dist/expo/app/CommentsSheet.js +76 -0
- package/dist/expo/app/CommentsSheet.js.map +1 -0
- package/dist/expo/app/Files.d.ts +16 -0
- package/dist/expo/app/Files.js +62 -0
- package/dist/expo/app/Files.js.map +1 -0
- package/dist/expo/app/Highlight.d.ts +5 -0
- package/dist/expo/app/Highlight.js +12 -0
- package/dist/expo/app/Highlight.js.map +1 -0
- package/dist/expo/app/Icon.d.ts +9 -0
- package/dist/expo/app/Icon.js +22 -0
- package/dist/expo/app/Icon.js.map +1 -0
- package/dist/expo/app/MarkerPins.d.ts +10 -0
- package/dist/expo/app/MarkerPins.js +70 -0
- package/dist/expo/app/MarkerPins.js.map +1 -0
- package/dist/expo/app/Provider.d.ts +13 -0
- package/dist/expo/app/Provider.js +597 -0
- package/dist/expo/app/Provider.js.map +1 -0
- package/dist/expo/app/Sheet.d.ts +53 -0
- package/dist/expo/app/Sheet.js +106 -0
- package/dist/expo/app/Sheet.js.map +1 -0
- package/dist/expo/app/Toolbar.d.ts +26 -0
- package/dist/expo/app/Toolbar.js +71 -0
- package/dist/expo/app/Toolbar.js.map +1 -0
- package/dist/expo/app/adapter.d.ts +55 -0
- package/dist/expo/app/adapter.js +145 -0
- package/dist/expo/app/adapter.js.map +1 -0
- package/dist/expo/app/api.d.ts +68 -0
- package/dist/expo/app/api.js +86 -0
- package/dist/expo/app/api.js.map +1 -0
- package/dist/expo/app/assets/attach.png +0 -0
- package/dist/expo/app/assets/close.png +0 -0
- package/dist/expo/app/assets/comment.png +0 -0
- package/dist/expo/app/assets/edit.png +0 -0
- package/dist/expo/app/assets/file.png +0 -0
- package/dist/expo/app/assets/narrow.png +0 -0
- package/dist/expo/app/assets/panel.png +0 -0
- package/dist/expo/app/assets/pins.png +0 -0
- package/dist/expo/app/assets/pinsOff.png +0 -0
- package/dist/expo/app/assets/remove.png +0 -0
- package/dist/expo/app/assets/reopen.png +0 -0
- package/dist/expo/app/assets/resolve.png +0 -0
- package/dist/expo/app/assets/send.png +0 -0
- package/dist/expo/app/assets/widen.png +0 -0
- package/dist/expo/app/attachments.d.ts +93 -0
- package/dist/expo/app/attachments.js +181 -0
- package/dist/expo/app/attachments.js.map +1 -0
- package/dist/expo/app/cloudApi.d.ts +63 -0
- package/dist/expo/app/cloudApi.js +330 -0
- package/dist/expo/app/cloudApi.js.map +1 -0
- package/dist/expo/app/cloudAuth.d.ts +20 -0
- package/dist/expo/app/cloudAuth.js +71 -0
- package/dist/expo/app/cloudAuth.js.map +1 -0
- package/dist/expo/app/cloudHttp.d.ts +20 -0
- package/dist/expo/app/cloudHttp.js +46 -0
- package/dist/expo/app/cloudHttp.js.map +1 -0
- package/dist/expo/app/cloudSession.d.ts +30 -0
- package/dist/expo/app/cloudSession.js +72 -0
- package/dist/expo/app/cloudSession.js.map +1 -0
- package/dist/expo/app/comments.d.ts +20 -0
- package/dist/expo/app/comments.js +131 -0
- package/dist/expo/app/comments.js.map +1 -0
- package/dist/expo/app/devMenuNone.d.ts +5 -0
- package/dist/expo/app/devMenuNone.js +3 -0
- package/dist/expo/app/devMenuNone.js.map +1 -0
- package/dist/expo/app/devServerNone.d.ts +4 -0
- package/dist/expo/app/devServerNone.js +4 -0
- package/dist/expo/app/devServerNone.js.map +1 -0
- package/dist/expo/app/embeddedConfig.d.ts +1 -0
- package/dist/expo/app/embeddedConfig.js +12 -0
- package/dist/expo/app/embeddedConfig.js.map +1 -0
- package/dist/expo/app/embeddedConfigCloud.d.ts +2 -0
- package/dist/expo/app/embeddedConfigCloud.js +8 -0
- package/dist/expo/app/embeddedConfigCloud.js.map +1 -0
- package/dist/expo/app/embeddedConfigNone.d.ts +2 -0
- package/dist/expo/app/embeddedConfigNone.js +3 -0
- package/dist/expo/app/embeddedConfigNone.js.map +1 -0
- package/dist/expo/app/expo.d.ts +4 -0
- package/dist/expo/app/expo.js +35 -0
- package/dist/expo/app/expo.js.map +1 -0
- package/dist/expo/app/expoGo.d.ts +4 -0
- package/dist/expo/app/expoGo.js +33 -0
- package/dist/expo/app/expoGo.js.map +1 -0
- package/dist/expo/app/expoPickers.d.ts +11 -0
- package/dist/expo/app/expoPickers.js +91 -0
- package/dist/expo/app/expoPickers.js.map +1 -0
- package/dist/expo/app/expoRandom.d.ts +6 -0
- package/dist/expo/app/expoRandom.js +21 -0
- package/dist/expo/app/expoRandom.js.map +1 -0
- package/dist/expo/app/idle.d.ts +4 -0
- package/dist/expo/app/idle.js +7 -0
- package/dist/expo/app/idle.js.map +1 -0
- package/dist/expo/app/index.d.ts +3 -0
- package/dist/expo/app/index.js +3 -0
- package/dist/expo/app/index.js.map +1 -0
- package/dist/expo/app/interactions.d.ts +38 -0
- package/dist/expo/app/interactions.js +40 -0
- package/dist/expo/app/interactions.js.map +1 -0
- package/dist/expo/app/markers.d.ts +28 -0
- package/dist/expo/app/markers.js +187 -0
- package/dist/expo/app/markers.js.map +1 -0
- package/dist/expo/app/movedAnchors.d.ts +46 -0
- package/dist/expo/app/movedAnchors.js +39 -0
- package/dist/expo/app/movedAnchors.js.map +1 -0
- package/dist/expo/app/native.d.ts +12 -0
- package/dist/expo/app/native.js +78 -0
- package/dist/expo/app/native.js.map +1 -0
- package/dist/expo/app/panel.d.ts +27 -0
- package/dist/expo/app/panel.js +37 -0
- package/dist/expo/app/panel.js.map +1 -0
- package/dist/expo/app/payload.d.ts +43 -0
- package/dist/expo/app/payload.js +22 -0
- package/dist/expo/app/payload.js.map +1 -0
- package/dist/expo/app/pick.d.ts +14 -0
- package/dist/expo/app/pick.js +124 -0
- package/dist/expo/app/pick.js.map +1 -0
- package/dist/expo/app/pickerNone.d.ts +1 -0
- package/dist/expo/app/pickerNone.js +2 -0
- package/dist/expo/app/pickerNone.js.map +1 -0
- package/dist/expo/app/placement.d.ts +53 -0
- package/dist/expo/app/placement.js +100 -0
- package/dist/expo/app/placement.js.map +1 -0
- package/dist/expo/app/random.d.ts +13 -0
- package/dist/expo/app/random.js +56 -0
- package/dist/expo/app/random.js.map +1 -0
- package/dist/expo/app/reactNative.d.ts +2 -0
- package/dist/expo/app/reactNative.js +3 -0
- package/dist/expo/app/reactNative.js.map +1 -0
- package/dist/expo/app/runtimeConfig.d.ts +30 -0
- package/dist/expo/app/runtimeConfig.js +104 -0
- package/dist/expo/app/runtimeConfig.js.map +1 -0
- package/dist/expo/app/sheetMotion.d.ts +22 -0
- package/dist/expo/app/sheetMotion.js +39 -0
- package/dist/expo/app/sheetMotion.js.map +1 -0
- package/dist/expo/app/signIn.d.ts +32 -0
- package/dist/expo/app/signIn.js +28 -0
- package/dist/expo/app/signIn.js.map +1 -0
- package/dist/expo/app/state.d.ts +45 -0
- package/dist/expo/app/state.js +32 -0
- package/dist/expo/app/state.js.map +1 -0
- package/dist/expo/app/theme.d.ts +15 -0
- package/dist/expo/app/theme.js +9 -0
- package/dist/expo/app/theme.js.map +1 -0
- package/dist/expo/app/types.d.ts +87 -0
- package/dist/expo/app/types.js +2 -0
- package/dist/expo/app/types.js.map +1 -0
- package/dist/expo/app/useCloudReviewer.d.ts +75 -0
- package/dist/expo/app/useCloudReviewer.js +211 -0
- package/dist/expo/app/useCloudReviewer.js.map +1 -0
- package/dist/expo/app/useComments.d.ts +64 -0
- package/dist/expo/app/useComments.js +156 -0
- package/dist/expo/app/useComments.js.map +1 -0
- package/dist/expo/app/useUploads.d.ts +32 -0
- package/dist/expo/app/useUploads.js +106 -0
- package/dist/expo/app/useUploads.js.map +1 -0
- package/dist/expo/expoGoMetro.cjs +83 -0
- package/dist/expo/expoMetro.cjs +86 -0
- package/dist/expo/metro.cjs +304 -0
- package/dist/expo/metroBuild.d.ts +22 -0
- package/dist/expo/metroBuild.js +169 -0
- package/dist/expo/metroBuild.js.map +1 -0
- package/dist/expo/middleware.d.ts +11 -0
- package/dist/expo/middleware.js +26 -0
- package/dist/expo/middleware.js.map +1 -0
- package/dist/expo/mode.d.ts +20 -0
- package/dist/expo/mode.js +37 -0
- package/dist/expo/mode.js.map +1 -0
- package/dist/expo/publicConfig.d.ts +37 -0
- package/dist/expo/publicConfig.js +87 -0
- package/dist/expo/publicConfig.js.map +1 -0
- package/dist/expo/transform.d.ts +22 -0
- package/dist/expo/transform.js +38 -0
- package/dist/expo/transform.js.map +1 -0
- package/dist/expo/transformer.cjs +73 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/integration/apiRoutes.d.ts +2 -0
- package/dist/integration/apiRoutes.js +3 -0
- package/dist/integration/apiRoutes.js.map +1 -0
- package/dist/integration/buildCredentials.d.ts +12 -0
- package/dist/integration/buildCredentials.js +97 -0
- package/dist/integration/buildCredentials.js.map +1 -0
- package/dist/integration/buildSession.d.ts +8 -0
- package/dist/integration/buildSession.js +96 -0
- package/dist/integration/buildSession.js.map +1 -0
- package/dist/integration/bundleCheck.d.ts +43 -0
- package/dist/integration/bundleCheck.js +111 -0
- package/dist/integration/bundleCheck.js.map +1 -0
- package/dist/integration/commentPull.d.ts +134 -0
- package/dist/integration/commentPull.js +260 -0
- package/dist/integration/commentPull.js.map +1 -0
- package/dist/integration/configuredApi.d.ts +7 -0
- package/dist/integration/configuredApi.js +24 -0
- package/dist/integration/configuredApi.js.map +1 -0
- package/dist/integration/devCloud.d.ts +27 -0
- package/dist/integration/devCloud.js +56 -0
- package/dist/integration/devCloud.js.map +1 -0
- package/dist/integration/devReviewLinks.d.ts +2 -0
- package/dist/integration/devReviewLinks.js +10 -0
- package/dist/integration/devReviewLinks.js.map +1 -0
- package/dist/integration/gitBranch.d.ts +19 -0
- package/dist/integration/gitBranch.js +56 -0
- package/dist/integration/gitBranch.js.map +1 -0
- package/dist/integration/importPlan.d.ts +19 -0
- package/dist/integration/importPlan.js +90 -0
- package/dist/integration/importPlan.js.map +1 -0
- package/dist/integration/index.d.ts +14 -0
- package/dist/integration/index.js +13 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/integration/manifest.d.ts +120 -0
- package/dist/integration/manifest.js +147 -0
- package/dist/integration/manifest.js.map +1 -0
- package/dist/integration/manifestParts.d.ts +29 -0
- package/dist/integration/manifestParts.js +65 -0
- package/dist/integration/manifestParts.js.map +1 -0
- package/dist/integration/manifestSink.d.ts +75 -0
- package/dist/integration/manifestSink.js +157 -0
- package/dist/integration/manifestSink.js.map +1 -0
- package/dist/integration/manifestUpload.d.ts +64 -0
- package/dist/integration/manifestUpload.js +177 -0
- package/dist/integration/manifestUpload.js.map +1 -0
- package/dist/integration/middleware.d.ts +55 -0
- package/dist/integration/middleware.js +379 -0
- package/dist/integration/middleware.js.map +1 -0
- package/dist/integration/nextStyles.d.ts +4 -0
- package/dist/integration/nextStyles.js +121 -0
- package/dist/integration/nextStyles.js.map +1 -0
- package/dist/integration/requestGuards.d.ts +71 -0
- package/dist/integration/requestGuards.js +255 -0
- package/dist/integration/requestGuards.js.map +1 -0
- package/dist/integration/sharedBuild.d.ts +71 -0
- package/dist/integration/sharedBuild.js +105 -0
- package/dist/integration/sharedBuild.js.map +1 -0
- package/dist/integration/sharedInject.d.ts +88 -0
- package/dist/integration/sharedInject.js +164 -0
- package/dist/integration/sharedInject.js.map +1 -0
- package/dist/integration/sidecarProcess.d.ts +26 -0
- package/dist/integration/sidecarProcess.js +137 -0
- package/dist/integration/sidecarProcess.js.map +1 -0
- package/dist/integration/styleCollector.d.ts +49 -0
- package/dist/integration/styleCollector.js +220 -0
- package/dist/integration/styleCollector.js.map +1 -0
- package/dist/integration/transform.d.ts +24 -0
- package/dist/integration/transform.js +36 -0
- package/dist/integration/transform.js.map +1 -0
- package/dist/integration/tunnelClient.d.ts +44 -0
- package/dist/integration/tunnelClient.js +148 -0
- package/dist/integration/tunnelClient.js.map +1 -0
- package/dist/integration/tunnelProtocol.d.ts +152 -0
- package/dist/integration/tunnelProtocol.js +110 -0
- package/dist/integration/tunnelProtocol.js.map +1 -0
- package/dist/mcp/cli.d.ts +2 -0
- package/dist/mcp/cli.js +327 -0
- package/dist/mcp/cli.js.map +1 -0
- package/dist/mcp/cloudRefresh.d.ts +36 -0
- package/dist/mcp/cloudRefresh.js +52 -0
- package/dist/mcp/cloudRefresh.js.map +1 -0
- package/dist/mcp/context.d.ts +7 -0
- package/dist/mcp/context.js +18 -0
- package/dist/mcp/context.js.map +1 -0
- package/dist/mcp/files.d.ts +66 -0
- package/dist/mcp/files.js +157 -0
- package/dist/mcp/files.js.map +1 -0
- package/dist/mcp/search.d.ts +3 -0
- package/dist/mcp/search.js +9 -0
- package/dist/mcp/search.js.map +1 -0
- package/dist/mcp/server.d.ts +50 -0
- package/dist/mcp/server.js +555 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/overlay/anchors.d.ts +130 -0
- package/dist/overlay/anchors.js +365 -0
- package/dist/overlay/anchors.js.map +1 -0
- package/dist/overlay/api.d.ts +150 -0
- package/dist/overlay/api.js +259 -0
- package/dist/overlay/api.js.map +1 -0
- package/dist/overlay/attachments.d.ts +60 -0
- package/dist/overlay/attachments.js +163 -0
- package/dist/overlay/attachments.js.map +1 -0
- package/dist/overlay/browser.d.ts +1 -0
- package/dist/overlay/browser.js +203 -0
- package/dist/overlay/browser.js.map +1 -0
- package/dist/overlay/chip.d.ts +27 -0
- package/dist/overlay/chip.js +31 -0
- package/dist/overlay/chip.js.map +1 -0
- package/dist/overlay/compact.d.ts +11 -0
- package/dist/overlay/compact.js +21 -0
- package/dist/overlay/compact.js.map +1 -0
- package/dist/overlay/cssScope.d.ts +46 -0
- package/dist/overlay/cssScope.js +180 -0
- package/dist/overlay/cssScope.js.map +1 -0
- package/dist/overlay/cursor.d.ts +2 -0
- package/dist/overlay/cursor.js +68 -0
- package/dist/overlay/cursor.js.map +1 -0
- package/dist/overlay/devBrowser.d.ts +1 -0
- package/dist/overlay/devBrowser.js +18 -0
- package/dist/overlay/devBrowser.js.map +1 -0
- package/dist/overlay/devReview.d.ts +4 -0
- package/dist/overlay/devReview.js +18 -0
- package/dist/overlay/devReview.js.map +1 -0
- package/dist/overlay/directReviewer.d.ts +149 -0
- package/dist/overlay/directReviewer.js +448 -0
- package/dist/overlay/directReviewer.js.map +1 -0
- package/dist/overlay/elementDescription.d.ts +10 -0
- package/dist/overlay/elementDescription.js +251 -0
- package/dist/overlay/elementDescription.js.map +1 -0
- package/dist/overlay/icons.d.ts +8 -0
- package/dist/overlay/icons.js +36 -0
- package/dist/overlay/icons.js.map +1 -0
- package/dist/overlay/identity.d.ts +48 -0
- package/dist/overlay/identity.js +125 -0
- package/dist/overlay/identity.js.map +1 -0
- package/dist/overlay/localMachine.d.ts +23 -0
- package/dist/overlay/localMachine.js +40 -0
- package/dist/overlay/localMachine.js.map +1 -0
- package/dist/overlay/magicLink.d.ts +10 -0
- package/dist/overlay/magicLink.js +87 -0
- package/dist/overlay/magicLink.js.map +1 -0
- package/dist/overlay/modern-screenshot.js +1676 -0
- package/dist/overlay/movedAnchors.d.ts +30 -0
- package/dist/overlay/movedAnchors.js +128 -0
- package/dist/overlay/movedAnchors.js.map +1 -0
- package/dist/overlay/notificationGroups.d.ts +2 -0
- package/dist/overlay/notificationGroups.js +41 -0
- package/dist/overlay/notificationGroups.js.map +1 -0
- package/dist/overlay/permissions.d.ts +10 -0
- package/dist/overlay/permissions.js +9 -0
- package/dist/overlay/permissions.js.map +1 -0
- package/dist/overlay/pinGroups.d.ts +16 -0
- package/dist/overlay/pinGroups.js +17 -0
- package/dist/overlay/pinGroups.js.map +1 -0
- package/dist/overlay/presence.d.ts +50 -0
- package/dist/overlay/presence.js +258 -0
- package/dist/overlay/presence.js.map +1 -0
- package/dist/overlay/projectChannel.d.ts +11 -0
- package/dist/overlay/projectChannel.js +111 -0
- package/dist/overlay/projectChannel.js.map +1 -0
- package/dist/overlay/recorder.d.ts +56 -0
- package/dist/overlay/recorder.js +130 -0
- package/dist/overlay/recorder.js.map +1 -0
- package/dist/overlay/reviewMode.d.ts +21 -0
- package/dist/overlay/reviewMode.js +59 -0
- package/dist/overlay/reviewMode.js.map +1 -0
- package/dist/overlay/reviewerAuth.d.ts +131 -0
- package/dist/overlay/reviewerAuth.js +279 -0
- package/dist/overlay/reviewerAuth.js.map +1 -0
- package/dist/overlay/route.d.ts +18 -0
- package/dist/overlay/route.js +56 -0
- package/dist/overlay/route.js.map +1 -0
- package/dist/overlay/rrweb-record.js +63 -0
- package/dist/overlay/runtime.d.ts +1 -0
- package/dist/overlay/runtime.js +4857 -0
- package/dist/overlay/runtime.js.map +1 -0
- package/dist/overlay/session.d.ts +32 -0
- package/dist/overlay/session.js +76 -0
- package/dist/overlay/session.js.map +1 -0
- package/dist/overlay/sharedMode.d.ts +38 -0
- package/dist/overlay/sharedMode.js +37 -0
- package/dist/overlay/sharedMode.js.map +1 -0
- package/dist/overlay/sheet.d.ts +73 -0
- package/dist/overlay/sheet.js +278 -0
- package/dist/overlay/sheet.js.map +1 -0
- package/dist/overlay/snapshot.d.ts +26 -0
- package/dist/overlay/snapshot.js +185 -0
- package/dist/overlay/snapshot.js.map +1 -0
- package/dist/overlay/state.d.ts +63 -0
- package/dist/overlay/state.js +241 -0
- package/dist/overlay/state.js.map +1 -0
- package/dist/overlay/steps.d.ts +22 -0
- package/dist/overlay/steps.js +34 -0
- package/dist/overlay/steps.js.map +1 -0
- package/dist/overlay/styles.d.ts +7 -0
- package/dist/overlay/styles.js +1449 -0
- package/dist/overlay/styles.js.map +1 -0
- package/dist/overlay/trace.d.ts +19 -0
- package/dist/overlay/trace.js +29 -0
- package/dist/overlay/trace.js.map +1 -0
- package/dist/overlay/upload.d.ts +35 -0
- package/dist/overlay/upload.js +99 -0
- package/dist/overlay/upload.js.map +1 -0
- package/dist/plugin/astro.d.ts +31 -0
- package/dist/plugin/astro.js +22 -0
- package/dist/plugin/astro.js.map +1 -0
- package/dist/plugin/eleventy.d.ts +44 -0
- package/dist/plugin/eleventy.js +186 -0
- package/dist/plugin/eleventy.js.map +1 -0
- package/dist/plugin/next-loader.cjs +11 -0
- package/dist/plugin/next.d.ts +29 -0
- package/dist/plugin/next.js +176 -0
- package/dist/plugin/next.js.map +1 -0
- package/dist/plugin/nextOverlay.d.ts +2 -0
- package/dist/plugin/nextOverlay.js +22 -0
- package/dist/plugin/nextOverlay.js.map +1 -0
- package/dist/plugin/nextTransform.d.ts +19 -0
- package/dist/plugin/nextTransform.js +29 -0
- package/dist/plugin/nextTransform.js.map +1 -0
- package/dist/plugin/rsbuild.d.ts +25 -0
- package/dist/plugin/rsbuild.js +56 -0
- package/dist/plugin/rsbuild.js.map +1 -0
- package/dist/plugin/vite.d.ts +40 -0
- package/dist/plugin/vite.js +585 -0
- package/dist/plugin/vite.js.map +1 -0
- package/dist/plugin/webpack.d.ts +69 -0
- package/dist/plugin/webpack.js +192 -0
- package/dist/plugin/webpack.js.map +1 -0
- package/dist/remote/account.d.ts +41 -0
- package/dist/remote/account.js +177 -0
- package/dist/remote/account.js.map +1 -0
- package/dist/remote/base64url.d.ts +14 -0
- package/dist/remote/base64url.js +71 -0
- package/dist/remote/base64url.js.map +1 -0
- package/dist/remote/branchLabel.d.ts +12 -0
- package/dist/remote/branchLabel.js +20 -0
- package/dist/remote/branchLabel.js.map +1 -0
- package/dist/remote/client.d.ts +340 -0
- package/dist/remote/client.js +424 -0
- package/dist/remote/client.js.map +1 -0
- package/dist/remote/cloudApi.d.ts +72 -0
- package/dist/remote/cloudApi.js +72 -0
- package/dist/remote/cloudApi.js.map +1 -0
- package/dist/remote/codec.d.ts +54 -0
- package/dist/remote/codec.js +62 -0
- package/dist/remote/codec.js.map +1 -0
- package/dist/remote/config.d.ts +30 -0
- package/dist/remote/config.js +112 -0
- package/dist/remote/config.js.map +1 -0
- package/dist/remote/content-schema.d.ts +428 -0
- package/dist/remote/content-schema.js +209 -0
- package/dist/remote/content-schema.js.map +1 -0
- package/dist/remote/content.d.ts +44 -0
- package/dist/remote/content.js +75 -0
- package/dist/remote/content.js.map +1 -0
- package/dist/remote/envelope.d.ts +76 -0
- package/dist/remote/envelope.js +109 -0
- package/dist/remote/envelope.js.map +1 -0
- package/dist/remote/errors.d.ts +55 -0
- package/dist/remote/errors.js +63 -0
- package/dist/remote/errors.js.map +1 -0
- package/dist/remote/ids.d.ts +8 -0
- package/dist/remote/ids.js +25 -0
- package/dist/remote/ids.js.map +1 -0
- package/dist/remote/index.d.ts +7 -0
- package/dist/remote/index.js +8 -0
- package/dist/remote/index.js.map +1 -0
- package/dist/remote/keys.d.ts +62 -0
- package/dist/remote/keys.js +162 -0
- package/dist/remote/keys.js.map +1 -0
- package/dist/remote/localAnchors.d.ts +4 -0
- package/dist/remote/localAnchors.js +23 -0
- package/dist/remote/localAnchors.js.map +1 -0
- package/dist/remote/mapping.d.ts +11 -0
- package/dist/remote/mapping.js +22 -0
- package/dist/remote/mapping.js.map +1 -0
- package/dist/remote/presence.d.ts +63 -0
- package/dist/remote/presence.js +143 -0
- package/dist/remote/presence.js.map +1 -0
- package/dist/remote/realtime.d.ts +142 -0
- package/dist/remote/realtime.js +326 -0
- package/dist/remote/realtime.js.map +1 -0
- package/dist/remote/store.d.ts +183 -0
- package/dist/remote/store.js +907 -0
- package/dist/remote/store.js.map +1 -0
- package/dist/remote/sync.d.ts +113 -0
- package/dist/remote/sync.js +370 -0
- package/dist/remote/sync.js.map +1 -0
- package/dist/remote/types.d.ts +99 -0
- package/dist/remote/types.js +6 -0
- package/dist/remote/types.js.map +1 -0
- package/dist/setup/agents.d.ts +23 -0
- package/dist/setup/agents.js +80 -0
- package/dist/setup/agents.js.map +1 -0
- package/dist/setup/configure.d.ts +27 -0
- package/dist/setup/configure.js +201 -0
- package/dist/setup/configure.js.map +1 -0
- package/dist/setup/connect.d.ts +60 -0
- package/dist/setup/connect.js +244 -0
- package/dist/setup/connect.js.map +1 -0
- package/dist/setup/detect.d.ts +67 -0
- package/dist/setup/detect.js +168 -0
- package/dist/setup/detect.js.map +1 -0
- package/dist/setup/frameworks.d.ts +41 -0
- package/dist/setup/frameworks.js +81 -0
- package/dist/setup/frameworks.js.map +1 -0
- package/dist/sidecar/cli.d.ts +1 -0
- package/dist/sidecar/cli.js +70 -0
- package/dist/sidecar/cli.js.map +1 -0
- package/dist/sidecar/cloudSync.d.ts +33 -0
- package/dist/sidecar/cloudSync.js +139 -0
- package/dist/sidecar/cloudSync.js.map +1 -0
- package/dist/sidecar/commentFiles.d.ts +59 -0
- package/dist/sidecar/commentFiles.js +217 -0
- package/dist/sidecar/commentFiles.js.map +1 -0
- package/dist/sidecar/cssAttribution.d.ts +26 -0
- package/dist/sidecar/cssAttribution.js +114 -0
- package/dist/sidecar/cssAttribution.js.map +1 -0
- package/dist/sidecar/exportTasks.d.ts +38 -0
- package/dist/sidecar/exportTasks.js +249 -0
- package/dist/sidecar/exportTasks.js.map +1 -0
- package/dist/sidecar/http.d.ts +20 -0
- package/dist/sidecar/http.js +904 -0
- package/dist/sidecar/http.js.map +1 -0
- package/dist/sidecar/inviteTarget.d.ts +4 -0
- package/dist/sidecar/inviteTarget.js +32 -0
- package/dist/sidecar/inviteTarget.js.map +1 -0
- package/dist/sidecar/presence.d.ts +4 -0
- package/dist/sidecar/presence.js +92 -0
- package/dist/sidecar/presence.js.map +1 -0
- package/dist/storage/cliSession.d.ts +8 -0
- package/dist/storage/cliSession.js +41 -0
- package/dist/storage/cliSession.js.map +1 -0
- package/dist/storage/devStyleMap.d.ts +12 -0
- package/dist/storage/devStyleMap.js +31 -0
- package/dist/storage/devStyleMap.js.map +1 -0
- package/dist/storage/fileCache.d.ts +34 -0
- package/dist/storage/fileCache.js +122 -0
- package/dist/storage/fileCache.js.map +1 -0
- package/dist/storage/localAttachments.d.ts +82 -0
- package/dist/storage/localAttachments.js +276 -0
- package/dist/storage/localAttachments.js.map +1 -0
- package/dist/storage/localComments.d.ts +31 -0
- package/dist/storage/localComments.js +159 -0
- package/dist/storage/localComments.js.map +1 -0
- package/dist/storage/localCredentials.d.ts +74 -0
- package/dist/storage/localCredentials.js +210 -0
- package/dist/storage/localCredentials.js.map +1 -0
- package/dist/storage/localParticipants.d.ts +33 -0
- package/dist/storage/localParticipants.js +110 -0
- package/dist/storage/localParticipants.js.map +1 -0
- package/dist/storage/localRecipe.d.ts +22 -0
- package/dist/storage/localRecipe.js +46 -0
- package/dist/storage/localRecipe.js.map +1 -0
- package/dist/storage/localScreenshots.d.ts +23 -0
- package/dist/storage/localScreenshots.js +55 -0
- package/dist/storage/localScreenshots.js.map +1 -0
- package/dist/storage/localSource.d.ts +31 -0
- package/dist/storage/localSource.js +175 -0
- package/dist/storage/localSource.js.map +1 -0
- package/dist/storage/pulledComments.d.ts +81 -0
- package/dist/storage/pulledComments.js +107 -0
- package/dist/storage/pulledComments.js.map +1 -0
- package/dist/storage/remoteRecipe.d.ts +7 -0
- package/dist/storage/remoteRecipe.js +85 -0
- package/dist/storage/remoteRecipe.js.map +1 -0
- package/dist/storage/savedRemote.d.ts +2 -0
- package/dist/storage/savedRemote.js +22 -0
- package/dist/storage/savedRemote.js.map +1 -0
- package/dist/storage/sidecarAccess.d.ts +7 -0
- package/dist/storage/sidecarAccess.js +68 -0
- package/dist/storage/sidecarAccess.js.map +1 -0
- package/package.json +306 -4
|
@@ -0,0 +1,828 @@
|
|
|
1
|
+
import { cmsPlace, elementMarkup, elementSummary, elementWhere, isDescribedOnly, searchHints } from './elementHints.js';
|
|
2
|
+
import { freshnessNotice } from './staleness.js';
|
|
3
|
+
import { bundledRecipe, fill } from './recipe.js';
|
|
4
|
+
import { renderFiles } from './taskFiles.js';
|
|
5
|
+
import { fenced, inlineText, singleLine, untrustedComments, untrustedPreamble } from './untrusted.js';
|
|
6
|
+
/**
|
|
7
|
+
* Produces the work-order format validated by hand in `.feedback/tasks/` before any
|
|
8
|
+
* overlay code existed. Fields that cannot be derived mechanically (a rewritten
|
|
9
|
+
* instruction, task-specific acceptance criteria) are never invented here: the reviewer's
|
|
10
|
+
* words are passed through verbatim and the agent is told to interpret them.
|
|
11
|
+
*/
|
|
12
|
+
export async function exportTaskDoc(rawInput) {
|
|
13
|
+
// Every comment field is reviewer-controlled: normalised once here, before anything reads a
|
|
14
|
+
// file or prints a field (see `untrusted.ts`). Malformed records are dropped, unsafe paths
|
|
15
|
+
// become unlocated anchors, and single-line fields cannot break the Markdown around them.
|
|
16
|
+
const input = { ...rawInput, comments: untrustedComments(rawInput.comments),
|
|
17
|
+
route: rawInput.route === null ? null : singleLine(rawInput.route) };
|
|
18
|
+
const groups = groupByFile(input.comments);
|
|
19
|
+
const cssUnavailable = input.cssAttribution?.unavailable ?? null;
|
|
20
|
+
const freshness = input.freshness ?? {};
|
|
21
|
+
const recipe = input.recipe ?? bundledRecipe;
|
|
22
|
+
const sections = [];
|
|
23
|
+
const ranges = [];
|
|
24
|
+
let taskNumber = 0;
|
|
25
|
+
const checklist = [];
|
|
26
|
+
for (const group of groups) {
|
|
27
|
+
const tasks = [];
|
|
28
|
+
for (const comment of group.comments) {
|
|
29
|
+
taskNumber += 1;
|
|
30
|
+
// One record that still cannot be rendered costs its own task, never the whole work order.
|
|
31
|
+
const task = await renderTask(comment, taskNumber, input.readExcerpt, input.readContext, cssUnavailable, freshness[comment.id], input.files?.[comment.id]).catch(() => unrenderableTask(comment, taskNumber));
|
|
32
|
+
tasks.push(task.markdown);
|
|
33
|
+
checklist.push({ id: comment.id, title: task.title });
|
|
34
|
+
ranges.push(...task.ranges);
|
|
35
|
+
}
|
|
36
|
+
// A group with no file is the unresolved one. Naming it plainly beats an empty backtick
|
|
37
|
+
// pair, which reads as a rendering fault rather than as the state it actually is.
|
|
38
|
+
sections.push(group.file
|
|
39
|
+
? `## File: \`${group.file}\`\n\n${tasks.join('\n\n')}`
|
|
40
|
+
: group.described
|
|
41
|
+
// No file because there never was one: a site with no build, or an element no build
|
|
42
|
+
// stamped. Not the same state as an id that failed to resolve, and not the same advice.
|
|
43
|
+
? `## Comments found by description (no source file recorded)\n\n${tasks.join('\n\n')}`
|
|
44
|
+
: `## Comments that could not be located\n\n${tasks.join('\n\n')}`);
|
|
45
|
+
}
|
|
46
|
+
if (input.styleConfig) {
|
|
47
|
+
ranges.push({
|
|
48
|
+
file: input.styleConfig.file,
|
|
49
|
+
startLine: 1,
|
|
50
|
+
endLine: input.styleConfig.lineCount,
|
|
51
|
+
fileLineCount: input.styleConfig.lineCount,
|
|
52
|
+
kind: 'reference',
|
|
53
|
+
note: 'design tokens (colours, spacing, custom utilities)',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const surface = implementationSurfaceFiles(input.comments);
|
|
57
|
+
return [
|
|
58
|
+
renderHeader(input, groups.filter((group) => group.file).length, surface.length, recipe),
|
|
59
|
+
untrustedPreamble,
|
|
60
|
+
renderReadPlan(ranges, input.repository.appDirectory),
|
|
61
|
+
renderAgentInstructions(input.comments, cssUnavailable, freshness, recipe),
|
|
62
|
+
renderRepositoryContext(input.repository),
|
|
63
|
+
...sections,
|
|
64
|
+
renderChecklist(checklist),
|
|
65
|
+
].join('\n\n');
|
|
66
|
+
}
|
|
67
|
+
function renderHeader(input, fileCount, surfaceCount, recipe) {
|
|
68
|
+
const threads = input.comments.filter((comment) => comment.replies.length > 0).length;
|
|
69
|
+
const lines = [
|
|
70
|
+
`# Feedback Work Order - ${formatTimestamp(input.generatedAt)}`,
|
|
71
|
+
'',
|
|
72
|
+
`**Route:** ${input.route ? `\`${input.route}\`` : 'multiple routes'}`,
|
|
73
|
+
'**Source revision:** current workspace',
|
|
74
|
+
`**Selection:** ${countLabel(input.comments.length, 'comment')} anchored across ${countLabel(fileCount, 'file')}`,
|
|
75
|
+
`**Files involved:** ${countLabel(surfaceCount, 'file')}`,
|
|
76
|
+
/**
|
|
77
|
+
* Which wording produced this document.
|
|
78
|
+
*
|
|
79
|
+
* Metadata the agent ignores and the only thing that makes improvement measurable: without
|
|
80
|
+
* it, "the agent did better this week" cannot be attributed to a change rather than to
|
|
81
|
+
* chance, and iterating on the instructions becomes guesswork with extra steps.
|
|
82
|
+
*/
|
|
83
|
+
`**Format:** v${recipe.version}`,
|
|
84
|
+
];
|
|
85
|
+
if (threads > 0) {
|
|
86
|
+
lines.push(`**Threads:** ${countLabel(threads, 'item')} collapsed to ${threads === 1 ? 'its' : 'their'} latest state`);
|
|
87
|
+
}
|
|
88
|
+
return lines.join('\n');
|
|
89
|
+
}
|
|
90
|
+
/** Above this, reading a whole component costs about as much as reading the file. */
|
|
91
|
+
const wholeComponentLimit = 140;
|
|
92
|
+
/** Lines of the component head that carry props, state and handler declarations. */
|
|
93
|
+
const headLines = 30;
|
|
94
|
+
/** Context kept either side of the element being changed. */
|
|
95
|
+
const elementPadding = 6;
|
|
96
|
+
function planRanges(context) {
|
|
97
|
+
const component = context.component;
|
|
98
|
+
const size = component.endLine - component.startLine + 1;
|
|
99
|
+
if (size <= wholeComponentLimit || !context.element) {
|
|
100
|
+
return { wholeComponent: true, body: component, head: component };
|
|
101
|
+
}
|
|
102
|
+
const body = {
|
|
103
|
+
startLine: Math.max(component.startLine, context.element.startLine - elementPadding),
|
|
104
|
+
endLine: Math.min(component.endLine, context.element.endLine + elementPadding),
|
|
105
|
+
};
|
|
106
|
+
const head = {
|
|
107
|
+
startLine: component.startLine,
|
|
108
|
+
endLine: Math.min(component.startLine + headLines, component.endLine, body.startLine - 1),
|
|
109
|
+
};
|
|
110
|
+
// If the element sits near the top, the head and body overlap; keep one range.
|
|
111
|
+
if (head.endLine <= head.startLine) {
|
|
112
|
+
return { wholeComponent: true, body, head: body };
|
|
113
|
+
}
|
|
114
|
+
return { wholeComponent: false, body, head };
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The point of the whole format: tell the agent exactly which lines to open.
|
|
118
|
+
*
|
|
119
|
+
* Without this an agent reads whole files, or greps the repository, to find what a comment
|
|
120
|
+
* refers to. The anchor already names the file; this names the range, so the change can be
|
|
121
|
+
* made after reading a component instead of a codebase.
|
|
122
|
+
*/
|
|
123
|
+
function renderReadPlan(ranges, appDirectory = null) {
|
|
124
|
+
const change = mergeRanges(ranges.filter((range) => range.kind !== 'reference'));
|
|
125
|
+
const reference = mergeRanges(ranges.filter((range) => range.kind === 'reference')).filter((range) => !change.some((other) => other.file === range.file));
|
|
126
|
+
if (change.length === 0) {
|
|
127
|
+
return '## Read Plan\n\n- No source ranges could be resolved. Fall back to the anchors below.';
|
|
128
|
+
}
|
|
129
|
+
const count = (list) => list.reduce((total, range) => total + (range.endLine - range.startLine + 1), 0);
|
|
130
|
+
const lines = ['## Read Plan', '', 'Open only these ranges. They contain every line these tasks need.', ''];
|
|
131
|
+
// First, before any path, because this is where the agent starts opening files. In a monorepo
|
|
132
|
+
// it works from the repository root and every path below is relative to one app; the Repository
|
|
133
|
+
// Context section says so too, but it comes after this one, and an agent told to open these
|
|
134
|
+
// ranges directly opens them before reading on.
|
|
135
|
+
if (appDirectory) {
|
|
136
|
+
lines.push(`Every path below is relative to \`${appDirectory}/\`.`, '');
|
|
137
|
+
}
|
|
138
|
+
lines.push('**Change here:**');
|
|
139
|
+
for (const range of change) {
|
|
140
|
+
lines.push(`- \`${range.file}\` lines ${range.startLine}-${range.endLine}`);
|
|
141
|
+
}
|
|
142
|
+
if (reference.length > 0) {
|
|
143
|
+
lines.push('', '**Reference, do not edit** (the API and tokens these changes rely on):');
|
|
144
|
+
for (const range of reference) {
|
|
145
|
+
const note = range.note ? ` - ${range.note}` : '';
|
|
146
|
+
lines.push(`- \`${range.file}\` lines ${range.startLine}-${range.endLine}${note}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
lines.push('', `${count(change)} lines to change, ${count(reference)} lines of reference. Nothing else in the repository is involved.`);
|
|
150
|
+
return lines.join('\n');
|
|
151
|
+
}
|
|
152
|
+
/** Overlapping or adjacent ranges in the same file collapse into one. */
|
|
153
|
+
function mergeRanges(ranges) {
|
|
154
|
+
const byFile = new Map();
|
|
155
|
+
for (const range of ranges) {
|
|
156
|
+
const list = byFile.get(range.file);
|
|
157
|
+
if (list) {
|
|
158
|
+
list.push(range);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
byFile.set(range.file, [range]);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const merged = [];
|
|
165
|
+
for (const [file, list] of [...byFile.entries()].sort(([a], [b]) => a.localeCompare(b))) {
|
|
166
|
+
const sorted = [...list].sort((left, right) => left.startLine - right.startLine);
|
|
167
|
+
let current = { ...sorted[0] };
|
|
168
|
+
for (const range of sorted.slice(1)) {
|
|
169
|
+
if (range.startLine <= current.endLine + 3) {
|
|
170
|
+
current.endLine = Math.max(current.endLine, range.endLine);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
merged.push(current);
|
|
174
|
+
current = { ...range };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
merged.push(current);
|
|
178
|
+
void file;
|
|
179
|
+
}
|
|
180
|
+
return merged;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The facts about this set of comments that decide which instructions apply.
|
|
184
|
+
*
|
|
185
|
+
* Computed here and never sent anywhere: every one of them is derived from the comments and the
|
|
186
|
+
* working tree, which is why the conditions stay in the package while the wording does not.
|
|
187
|
+
*/
|
|
188
|
+
function factsFor(comments, cssUnavailable, freshness) {
|
|
189
|
+
const hasStyles = comments.some((comment) => (comment.cssScope?.rules.length ?? 0) > 0);
|
|
190
|
+
const placed = comments.some((comment) => comment.cssScope?.rules.some((rule) => rule.origin || rule.file));
|
|
191
|
+
const staleCount = comments.filter((comment) => freshness[comment.id]?.suspect).length;
|
|
192
|
+
return {
|
|
193
|
+
hasThreads: comments.some((comment) => comment.replies.length > 0),
|
|
194
|
+
hasLeafMismatch: comments.some((comment) => leafDiffersFromAnchor(comment)),
|
|
195
|
+
// Two facts rather than one flag with a negation, because a recipe keys on a fact being
|
|
196
|
+
// true. "Styles are present and traceable" and "styles are present and were not traced"
|
|
197
|
+
// are different instructions, and neither is the absence of the other.
|
|
198
|
+
// Both can hold at once now: rules the preview's build placed, beside a rule from a build
|
|
199
|
+
// that recorded no styles. Each instruction is about its own rules.
|
|
200
|
+
hasStyles: hasStyles && (placed || !cssUnavailable),
|
|
201
|
+
cssUnavailable: hasStyles && Boolean(cssUnavailable),
|
|
202
|
+
hasScopeDirection: comments.some((comment) => (comment.scope?.instancesOnPage ?? 1) > 1 && comment.scope?.choice !== 'all')
|
|
203
|
+
|| comments.some((comment) => (comment.scope?.siblingsSharingChain ?? 1) > 1),
|
|
204
|
+
staleCount,
|
|
205
|
+
taskWord: staleCount === 1 ? 'One task is' : `${staleCount} tasks are`,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function renderAgentInstructions(comments, cssUnavailable, freshness, recipe) {
|
|
209
|
+
const facts = factsFor(comments, cssUnavailable, freshness);
|
|
210
|
+
// Only the substitutable ones. A boolean in a sentence reads as "true", which is never what
|
|
211
|
+
// anyone meant to write.
|
|
212
|
+
const values = {
|
|
213
|
+
staleCount: facts.staleCount,
|
|
214
|
+
taskWord: facts.taskWord,
|
|
215
|
+
// The reason-specific CSS sentence, substituted wherever the recipe places `{cssNotice}`.
|
|
216
|
+
// Looked up rather than keyed on a boolean, because which reason it was changes the wording.
|
|
217
|
+
cssNotice: (cssUnavailable && recipe.notices.cssUnavailable[cssUnavailable]) || '',
|
|
218
|
+
};
|
|
219
|
+
const lines = ['## Agent Instructions', ''];
|
|
220
|
+
for (const line of recipe.instructions.always)
|
|
221
|
+
lines.push(`- ${fill(line, values)}`);
|
|
222
|
+
/**
|
|
223
|
+
* Order is the recipe's, not this function's.
|
|
224
|
+
*
|
|
225
|
+
* Iterating the object's own keys means reordering the instructions is something a recipe can
|
|
226
|
+
* do - which is half the point of having one. The old version hard-coded the sequence in a
|
|
227
|
+
* series of ifs, and changing it meant a release.
|
|
228
|
+
*/
|
|
229
|
+
for (const [fact, templates] of Object.entries(recipe.instructions.when)) {
|
|
230
|
+
const value = facts[fact];
|
|
231
|
+
const applies = typeof value === 'number' ? value > 0 : Boolean(value);
|
|
232
|
+
if (!applies)
|
|
233
|
+
continue;
|
|
234
|
+
for (const template of templates) {
|
|
235
|
+
const text = fill(template, values).trim();
|
|
236
|
+
// A template that substitutes to nothing emits nothing, rather than a bare bullet. That
|
|
237
|
+
// happens when a reason has no sentence for it, which a recipe is allowed to do.
|
|
238
|
+
if (text)
|
|
239
|
+
lines.push(`- ${text}`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return lines.join('\n');
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* What the anchor actually covers, in the reviewer's absence.
|
|
246
|
+
*
|
|
247
|
+
* The reviewer clicked one thing on screen and cannot know how many other elements the
|
|
248
|
+
* same source position renders. An agent handed a bare anchor cannot know either, and the
|
|
249
|
+
* failure is silent and one-directional: it edits a definition and changes things nobody
|
|
250
|
+
* asked about. Stating the count is what makes the doc safe to execute.
|
|
251
|
+
*/
|
|
252
|
+
/**
|
|
253
|
+
* Files rendering inside the element the reviewer selected.
|
|
254
|
+
*
|
|
255
|
+
* The chain is recorded innermost first, so everything before the chosen anchor is a
|
|
256
|
+
* descendant of it: the reviewer clicked something deeper and widened outward, and these
|
|
257
|
+
* are the components they widened past. Naming them is not an invitation to explore. It is
|
|
258
|
+
* the reviewer's own selection, read downward.
|
|
259
|
+
*
|
|
260
|
+
* This replaced a flat "do not edit files outside the named file". That instruction did not
|
|
261
|
+
* reduce blast radius, it displaced it: of 19 measured cases whose target lay in a child
|
|
262
|
+
* component, 5 agents refused outright and 14 produced a confident edit that stayed in the
|
|
263
|
+
* named file and hit every element passing through it.
|
|
264
|
+
*/
|
|
265
|
+
function filesInsideSelection(comment) {
|
|
266
|
+
// Captured from the selected element's subtree at click time. Present whether or not the
|
|
267
|
+
// reviewer widened, which the chain-derived fallback below is not.
|
|
268
|
+
if (comment.insideSelection && comment.insideSelection.length > 0) {
|
|
269
|
+
return comment.insideSelection.filter((file) => file !== comment.anchor.file);
|
|
270
|
+
}
|
|
271
|
+
const chain = comment.anchorChain;
|
|
272
|
+
if (!chain || chain.length === 0)
|
|
273
|
+
return [];
|
|
274
|
+
const at = chain.findIndex((a) => a.file === comment.anchor.file && a.line === comment.anchor.line && a.column === comment.anchor.column);
|
|
275
|
+
if (at <= 0)
|
|
276
|
+
return [];
|
|
277
|
+
const seen = new Set([comment.anchor.file]);
|
|
278
|
+
const files = [];
|
|
279
|
+
for (const anchor of chain.slice(0, at)) {
|
|
280
|
+
if (seen.has(anchor.file))
|
|
281
|
+
continue;
|
|
282
|
+
seen.add(anchor.file);
|
|
283
|
+
files.push(anchor.file);
|
|
284
|
+
}
|
|
285
|
+
return files;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Where the element's styling comes from, and whether changing it would do anything.
|
|
289
|
+
*
|
|
290
|
+
* A CSS class is shared by construction, usually more widely than a React component: 72% of
|
|
291
|
+
* the classes measured covered more than one element and 39% covered ten or more. So a rule
|
|
292
|
+
* is permitted on the same terms as a JSX call site - it is narrow enough to mean one thing -
|
|
293
|
+
* and the reviewer's one-vs-all answer governs the rest.
|
|
294
|
+
*/
|
|
295
|
+
/**
|
|
296
|
+
* The one sentence that stops a gap reading as a result.
|
|
297
|
+
*
|
|
298
|
+
* Each reason names what was not done and why, in terms of the situation rather than the
|
|
299
|
+
* mechanism: "the preview was not served by your dev server" is actionable, `/@fs returned
|
|
300
|
+
* 404` is not. None of them apologise or suggest a workaround, because there is not one yet.
|
|
301
|
+
*/
|
|
302
|
+
function unavailableNotice(reason) {
|
|
303
|
+
if (reason === 'no-app-origin') {
|
|
304
|
+
return '**CSS attribution is unavailable for comments from a deployed preview.** Stylesheets are read back through the running dev server, and a comment left on a preview never reaches it, so no selector below could be traced to a source file. This is a limitation of the tool, not a property of these selectors.';
|
|
305
|
+
}
|
|
306
|
+
if (reason === 'no-stylesheets-reachable') {
|
|
307
|
+
return '**CSS attribution is unavailable: no stylesheet could be read back.** The project has stylesheets, but none of them could be fetched from the app origin - which is what a deployed preview looks like from here, since the read depends on a dev-server route. No selector below could be traced to a source file, and that is a limitation of the tool rather than a property of these selectors.';
|
|
308
|
+
}
|
|
309
|
+
return '**CSS attribution is unavailable: no stylesheet files were found in this project.** There is nothing to trace these selectors against, so no source file is named below.';
|
|
310
|
+
}
|
|
311
|
+
function styleLines(comment, unavailable) {
|
|
312
|
+
const scope = comment.cssScope;
|
|
313
|
+
const inline = scope?.inlineProperties ?? [];
|
|
314
|
+
const hidden = scope?.unreadableSheets ?? [];
|
|
315
|
+
if (!scope || (scope.rules.length === 0 && inline.length === 0 && hidden.length === 0))
|
|
316
|
+
return [];
|
|
317
|
+
const kindOf = (rule) => rule.origin?.kind ?? (rule.file ? 'stylesheet' : null);
|
|
318
|
+
const unknown = scope.rules.filter((rule) => kindOf(rule) === null);
|
|
319
|
+
const lines = ['', '**Styles:**'];
|
|
320
|
+
// Named once, above the rules it explains, and only when some rule actually lacks an answer:
|
|
321
|
+
// a comment whose rules the preview's build already placed is not missing anything because
|
|
322
|
+
// no dev server happens to be running.
|
|
323
|
+
if (unavailable && unknown.length > 0) {
|
|
324
|
+
lines.push('', unavailableNotice(unavailable), '');
|
|
325
|
+
}
|
|
326
|
+
// Everything that is not a project stylesheet goes after the rules that are: those are the
|
|
327
|
+
// ones an agent edits, and the rest mostly say where not to.
|
|
328
|
+
const tail = [];
|
|
329
|
+
const listed = (rules) => {
|
|
330
|
+
const names = [...new Set(rules.map((rule) => rule.selector))];
|
|
331
|
+
const shown = names.slice(0, 6).map((name) => `\`${name}\``).join(', ');
|
|
332
|
+
return names.length > 6 ? `${shown} and ${names.length - 6} more` : shown;
|
|
333
|
+
};
|
|
334
|
+
const utilities = scope.rules.filter((rule) => rule.origin?.kind === 'utility');
|
|
335
|
+
if (utilities.length > 0) {
|
|
336
|
+
const framework = utilities[0].origin?.kind === 'utility' && utilities[0].origin.framework === 'unocss' ? 'UnoCSS' : 'Tailwind';
|
|
337
|
+
tail.push(`- ${listed(utilities)}: ${framework} utilities, generated from the element's class list. To change them, change the classes on the element at the anchor; the generated stylesheet is rebuilt from those and editing it does nothing lasting.`);
|
|
338
|
+
}
|
|
339
|
+
const byPackage = new Map();
|
|
340
|
+
for (const rule of scope.rules) {
|
|
341
|
+
if (rule.origin?.kind !== 'library')
|
|
342
|
+
continue;
|
|
343
|
+
byPackage.set(rule.origin.package, [...(byPackage.get(rule.origin.package) ?? []), rule]);
|
|
344
|
+
}
|
|
345
|
+
for (const [name, rules] of byPackage) {
|
|
346
|
+
tail.push(`- ${listed(rules)}: from the \`${name}\` package. Do not edit it: change which classes the element uses at the anchor, or override the rule in a project stylesheet.`);
|
|
347
|
+
}
|
|
348
|
+
const runtime = scope.rules.filter((rule) => rule.origin?.kind === 'runtime');
|
|
349
|
+
if (runtime.length > 0) {
|
|
350
|
+
tail.push(`- ${listed(runtime)}: injected at runtime by CSS-in-JS (styled-components, emotion or similar). These styles are written in JavaScript, most likely in the anchor's component or a styled component it renders. There is no stylesheet to edit.`);
|
|
351
|
+
}
|
|
352
|
+
for (const rule of scope.rules) {
|
|
353
|
+
if (rule.origin?.kind !== 'ambiguous')
|
|
354
|
+
continue;
|
|
355
|
+
tail.push(`- \`${rule.selector}\`: defined in ${rule.origin.files.map((file) => `\`${file}\``).join(' and ')}, and none of them pulls in the others. Do not guess which to edit; say which you would change and why.`);
|
|
356
|
+
}
|
|
357
|
+
if (unavailable && unknown.length > 0) {
|
|
358
|
+
for (const rule of unknown) {
|
|
359
|
+
const covers = rule.elementsMatching === 1
|
|
360
|
+
? 'matched only this element'
|
|
361
|
+
: `matched **${rule.elementsMatching} elements** on the page`;
|
|
362
|
+
tail.push(`- \`${rule.selector}\`: ${covers}. Source file unknown, for the reason above.`);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
if (inline.length > 0) {
|
|
366
|
+
tail.push(`- The element's own \`style\` attribute sets ${inline.slice(0, 6).map((name) => `\`${name}\``).join(', ')}. Inline styles beat every rule here, so change ${inline.length === 1 ? 'it' : 'them'} at the anchor.`);
|
|
367
|
+
}
|
|
368
|
+
if (hidden.length > 0) {
|
|
369
|
+
tail.push(`- The page also loads ${hidden.length === 1 ? 'a stylesheet' : 'stylesheets'} the browser would not let this tool read: ${hidden.slice(0, 3).map((href) => `\`${href}\``).join(', ')}. Rules from ${hidden.length === 1 ? 'it' : 'them'} may be styling this element and are not listed.`);
|
|
370
|
+
}
|
|
371
|
+
const project = scope.rules.filter((rule) => kindOf(rule) === 'stylesheet');
|
|
372
|
+
const fileOf = (rule) => (rule.origin?.kind === 'stylesheet' ? rule.origin.file : rule.file);
|
|
373
|
+
const overrides = (rule) => rule.origin?.kind === 'stylesheet' && rule.origin.library
|
|
374
|
+
? ` It overrides the same selector from \`${rule.origin.library}\`, so this file is the place to change it.`
|
|
375
|
+
: '';
|
|
376
|
+
const single = project.filter((rule) => rule.elementsMatching === 1);
|
|
377
|
+
const shared = project.filter((rule) => rule.elementsMatching > 1);
|
|
378
|
+
const unresolved = unavailable ? [] : unknown;
|
|
379
|
+
const annotate = (rule) => {
|
|
380
|
+
const notes = [];
|
|
381
|
+
if (rule.overriddenProperties?.length) {
|
|
382
|
+
notes.push(`\`${rule.overriddenProperties.slice(0, 4).join('\`, \`')}\` ${rule.overriddenProperties.length === 1 ? 'is' : 'are'} overridden here: something later in the cascade wins, so editing ${rule.overriddenProperties.length === 1 ? 'it' : 'them'} in this rule changes nothing visible`);
|
|
383
|
+
}
|
|
384
|
+
if (rule.unverifiedProperties?.length) {
|
|
385
|
+
notes.push(`\`${rule.unverifiedProperties.slice(0, 4).join('\`, \`')}\` could not be checked: ${rule.unverifiedProperties.length === 1 ? 'its value depends' : 'their values depend'} on surrounding layout, so whether this rule wins ${rule.unverifiedProperties.length === 1 ? 'it' : 'them'} is unknown`);
|
|
386
|
+
}
|
|
387
|
+
return notes;
|
|
388
|
+
};
|
|
389
|
+
for (const rule of single) {
|
|
390
|
+
lines.push(`- \`${rule.selector}\` in \`${fileOf(rule)}\`: matches only this element, so it is in scope.${overrides(rule)}`);
|
|
391
|
+
for (const note of annotate(rule))
|
|
392
|
+
lines.push(` - ${note}.`);
|
|
393
|
+
}
|
|
394
|
+
// The reviewer's one-vs-all answer governs shared rules exactly as it governs a shared JSX
|
|
395
|
+
// definition. Without this branch their answer was ignored on the side where sharing is the
|
|
396
|
+
// norm - 72% of classes cover more than one element against 11% of JSX anchors - so a
|
|
397
|
+
// reviewer could click one button, answer "just this one", and the doc would still leave a
|
|
398
|
+
// rule covering sixteen elements open for editing.
|
|
399
|
+
const choice = comment.scope?.choice;
|
|
400
|
+
for (const rule of shared) {
|
|
401
|
+
const covers = `matched **${rule.elementsMatching} elements** on the page`;
|
|
402
|
+
if (choice === 'all') {
|
|
403
|
+
lines.push(`- \`${rule.selector}\` in \`${fileOf(rule)}\`: ${covers}, and the reviewer asked for all of them. Editing it here is the right move.${overrides(rule)}`);
|
|
404
|
+
}
|
|
405
|
+
else if (choice === 'one') {
|
|
406
|
+
lines.push(`- \`${rule.selector}\` in \`${fileOf(rule)}\`: ${covers}. **Do not edit this rule:** the reviewer asked for the one element they clicked, and this would change all ${rule.elementsMatching}. Add a narrower rule or a modifier class for that element instead.`);
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
lines.push(`- \`${rule.selector}\` in \`${fileOf(rule)}\`: ${covers}. Editing it changes all of them, and the reviewer was not asked which they meant, so prefer the narrower change.${overrides(rule)}`);
|
|
410
|
+
}
|
|
411
|
+
for (const note of annotate(rule))
|
|
412
|
+
lines.push(` - ${note}.`);
|
|
413
|
+
}
|
|
414
|
+
for (const rule of unresolved) {
|
|
415
|
+
lines.push(`- \`${rule.selector}\`: could not be traced to one source file; do not guess at it.`);
|
|
416
|
+
}
|
|
417
|
+
lines.push(...tail);
|
|
418
|
+
if (scope.unresolvableClasses?.length) {
|
|
419
|
+
lines.push(`- \`${scope.unresolvableClasses.slice(0, 4).join('\`, \`')}\` ${scope.unresolvableClasses.length === 1 ? 'is a class' : 'are classes'} with no rule behind ${scope.unresolvableClasses.length === 1 ? 'it' : 'them'}: built at runtime, so there is no static target. Say so rather than inventing one.`);
|
|
420
|
+
}
|
|
421
|
+
return lines;
|
|
422
|
+
}
|
|
423
|
+
function scopeLines(comment) {
|
|
424
|
+
const scope = comment.scope;
|
|
425
|
+
if (!scope) {
|
|
426
|
+
return [
|
|
427
|
+
'- Not recorded. This comment predates scope capture, so the anchor may be shared. Check what else renders from it before editing.',
|
|
428
|
+
];
|
|
429
|
+
}
|
|
430
|
+
if (scope.instancesOnPage <= 1) {
|
|
431
|
+
return ['- The anchor rendered once on this page when the comment was left.'];
|
|
432
|
+
}
|
|
433
|
+
const count = `${scope.instancesOnPage} times on this page when the comment was left`;
|
|
434
|
+
// The reviewer was asked and said everything. No localisation instruction: measured
|
|
435
|
+
// agents already scoped too narrowly on 6 of 17 global intents, and telling them to
|
|
436
|
+
// localise here would make the more common half worse.
|
|
437
|
+
if (scope.choice === 'all') {
|
|
438
|
+
return [
|
|
439
|
+
`- The anchor rendered ${count}.`,
|
|
440
|
+
'- The reviewer was asked whether this applies to the one they clicked or to all of them, and answered **all of them**. Changing the shared definition is the right move here.',
|
|
441
|
+
];
|
|
442
|
+
}
|
|
443
|
+
if (scope.choice !== 'one') {
|
|
444
|
+
return [
|
|
445
|
+
`- The anchor rendered ${count}. Editing it changes all ${scope.instancesOnPage}.`,
|
|
446
|
+
'- The reviewer was not asked which they meant, so treat the scope as unknown and prefer the narrower change.',
|
|
447
|
+
];
|
|
448
|
+
}
|
|
449
|
+
// Said "just this one". The instruction depends on what actually names that instance.
|
|
450
|
+
const lines = [
|
|
451
|
+
`- The anchor rendered ${count}.`,
|
|
452
|
+
'- The reviewer was asked and answered **just this one**. Do not change the shared definition: that would change all ' +
|
|
453
|
+
`${scope.instancesOnPage}.`,
|
|
454
|
+
];
|
|
455
|
+
// A chain position rendered exactly once is the call site, and a location beats a warning.
|
|
456
|
+
const callSiteIndex = (scope.chainInstances ?? []).findIndex((n, i) => i > 0 && n === 1);
|
|
457
|
+
const callSite = callSiteIndex > 0 ? comment.anchorChain?.[callSiteIndex] : undefined;
|
|
458
|
+
if (callSite) {
|
|
459
|
+
lines.push(`- Make the change at \`${callSite.file}:${callSite.line}\`, which renders once on this page. Pass a prop from there if the shared component needs to behave differently for this one.`);
|
|
460
|
+
return lines;
|
|
461
|
+
}
|
|
462
|
+
// Nothing in the chain singles it out: every candidate position renders many times, which
|
|
463
|
+
// is what a `.map` over an array produces. Only the content distinguishes the instance.
|
|
464
|
+
const snippet = comment.anchor.textSnippet ?? comment.leafAnchor?.textSnippet;
|
|
465
|
+
if (snippet) {
|
|
466
|
+
lines.push(`- No position in the source names this instance alone: every one of them renders all ${scope.instancesOnPage}. The instance the reviewer clicked is the one showing \`${snippet.slice(0, 60)}\`.`, '- Make the change conditional on that, or on the data behind it. Do not edit the JSX unconditionally.');
|
|
467
|
+
return lines;
|
|
468
|
+
}
|
|
469
|
+
lines.push('- No position in the source names this instance alone, and it carries no text to key on. The change needs a prop or a data flag introduced for the purpose; say so rather than editing the definition.');
|
|
470
|
+
return lines;
|
|
471
|
+
}
|
|
472
|
+
function renderRepositoryContext(repository) {
|
|
473
|
+
const lines = ['## Repository Context', ''];
|
|
474
|
+
if (repository.appDirectory) {
|
|
475
|
+
lines.push(`- App lives in \`${repository.appDirectory}\`.`);
|
|
476
|
+
}
|
|
477
|
+
if (repository.stack.length > 0) {
|
|
478
|
+
lines.push(`- UI stack: ${repository.stack.join(' + ')}.`);
|
|
479
|
+
}
|
|
480
|
+
if (lines.length === 2) {
|
|
481
|
+
lines.push('- No repository conventions were detected reliably.');
|
|
482
|
+
}
|
|
483
|
+
return lines.join('\n');
|
|
484
|
+
}
|
|
485
|
+
async function renderTask(comment, taskNumber, readExcerpt, readContext, cssUnavailable, freshness, files) {
|
|
486
|
+
// No file, nothing to read: asking for one read '' from disk.
|
|
487
|
+
const context = readContext && comment.anchor.file ? await readContext(comment.anchor) : null;
|
|
488
|
+
const ranges = [];
|
|
489
|
+
const current = latestMessage(comment);
|
|
490
|
+
// History is everything before the live message, starting with the original comment.
|
|
491
|
+
// Gating on replies.length (not history.length) matters: with exactly one reply the
|
|
492
|
+
// earlier messages list is empty, and the original comment would drop out of the doc.
|
|
493
|
+
const hasHistory = comment.replies.length > 0;
|
|
494
|
+
const earlierReplies = comment.replies.slice(0, -1);
|
|
495
|
+
const surface = surfaceForComment(comment);
|
|
496
|
+
const title = titleFor(comment);
|
|
497
|
+
const lines = [`### Task ${taskNumber}: ${title}`, ''];
|
|
498
|
+
// Before the anchors and the excerpt, deliberately. An agent that reads the code first has
|
|
499
|
+
// already decided what the comment must mean by the time it reaches a warning about it.
|
|
500
|
+
const stale = freshness ? freshnessNotice(freshness) : null;
|
|
501
|
+
if (stale)
|
|
502
|
+
lines.push(stale, '');
|
|
503
|
+
lines.push('**Anchors:**');
|
|
504
|
+
lines.push(`- Current anchor: ${anchorLabel(comment.anchor)}`);
|
|
505
|
+
for (const related of relatedAnchors(comment)) {
|
|
506
|
+
lines.push(`- Related anchor: ${anchorLabel(related)}`);
|
|
507
|
+
}
|
|
508
|
+
if (leafDiffersFromAnchor(comment) && comment.leafAnchor) {
|
|
509
|
+
// The reviewer widened away from this element. Kept as provenance: it says what they
|
|
510
|
+
// pointed at, not where the change belongs. Where the change belongs is the anchor.
|
|
511
|
+
lines.push(`- Clicked leaf: ${anchorLabel(comment.leafAnchor)}`);
|
|
512
|
+
}
|
|
513
|
+
// What they were looking at, and what they attached, which the words alone often leave open:
|
|
514
|
+
// "this is too big" about a picture of a card that is plainly too big is a different task.
|
|
515
|
+
lines.push(...renderFiles(files ?? []));
|
|
516
|
+
const inside = filesInsideSelection(comment);
|
|
517
|
+
if (inside.length > 0) {
|
|
518
|
+
lines.push('', '**Inside the selection:**');
|
|
519
|
+
lines.push(...inside.map((file) => `- \`${file}\`: renders inside the element the reviewer pointed at, so it is in scope.`));
|
|
520
|
+
}
|
|
521
|
+
lines.push(...styleLines(comment, cssUnavailable));
|
|
522
|
+
lines.push('', '**Scope:**');
|
|
523
|
+
lines.push(...scopeLines(comment));
|
|
524
|
+
lines.push('', '**Where to change it:**');
|
|
525
|
+
/**
|
|
526
|
+
* An anchor that never resolved has no file, and must not be given one.
|
|
527
|
+
*
|
|
528
|
+
* This happens when the build a comment was left against has no manifest in the cloud - the
|
|
529
|
+
* upload never landed, or it was pruned - so the opaque id could not be turned back into a
|
|
530
|
+
* location. `pull` says so plainly. The work order did not: it printed ``File: ``` `` with an
|
|
531
|
+
* empty name, `Anchor line: 0`, and a "best-effort window around the last known location" of
|
|
532
|
+
* lines 1-15, which is a read plan pointing at a file that does not exist.
|
|
533
|
+
*
|
|
534
|
+
* The reviewer's words are still worth carrying - they are the thing this product promises
|
|
535
|
+
* not to lose - so the task stays. An unlocated task does not imply a place to change.
|
|
536
|
+
*/
|
|
537
|
+
if (isDescribedOnly(comment.anchor) && comment.anchor.element) {
|
|
538
|
+
const element = comment.anchor.element;
|
|
539
|
+
const where = elementWhere(element);
|
|
540
|
+
const hints = searchHints(element);
|
|
541
|
+
lines.push('- **No source file was recorded.** The page was not built by a bundler this tool stamps (a '
|
|
542
|
+
+ 'site installed with a script tag, a CMS, or an element a package rendered), so the element '
|
|
543
|
+
+ 'is identified by what it is instead:', `- Element: \`${elementMarkup(element)}\`${element.text ? `, text "${inlineText(element.text, 120)}"` : ''}`, ...(where || comment.context?.route ? [`- On the page: ${[where, comment.context?.route ? `route \`${comment.context.route}\`` : null].filter(Boolean).join(', ')}`] : []), ...(() => {
|
|
544
|
+
// A platform plugin said where it comes from: that beats any search.
|
|
545
|
+
const place = cmsPlace(element.cms);
|
|
546
|
+
if (place)
|
|
547
|
+
return [`- ${place.platform}: ${place.where}.${place.editPath ? ` Editor: \`${place.editPath}\` on the site.` : ''}`, `- ${place.advice}`];
|
|
548
|
+
return element.cms ? [`- Platform: \`${element.cms}\``] : [];
|
|
549
|
+
})(), ...(hints.length > 0 ? [`- Search the code for: ${hints.map((hint) => `\`${hint}\``).join(', ')}`] : []), '- Find the template that renders it from those, and if more than one place matches, say which '
|
|
550
|
+
+ 'you chose and why before changing it. If none does, the content may live in a CMS rather '
|
|
551
|
+
+ 'than in this repository: say so instead of guessing.');
|
|
552
|
+
}
|
|
553
|
+
else if (!comment.anchor.file) {
|
|
554
|
+
lines.push('- **This comment could not be located in the source.** Its build has no manifest, so the '
|
|
555
|
+
+ 'anchor id could not be resolved to a file and line.', '- Do not guess where it belongs. Read the request, and if the element it describes is '
|
|
556
|
+
+ 'obvious from the page it was left on, say which file you believe it is and make no '
|
|
557
|
+
+ 'change until that is confirmed.', '- To fix this properly: rebuild and redeploy the commit this comment was left against, so '
|
|
558
|
+
+ 'its manifest is uploaded, then pull again.');
|
|
559
|
+
}
|
|
560
|
+
else if (context?.component) {
|
|
561
|
+
lines.push(`- File: \`${surface.primary}\` (${context.fileLineCount} lines)`);
|
|
562
|
+
const name = context.component.name ? `\`${context.component.name}\`` : 'enclosing component';
|
|
563
|
+
const plan = planRanges({ ...context, component: context.component });
|
|
564
|
+
if (plan.wholeComponent) {
|
|
565
|
+
lines.push(`- Component: ${name}, lines ${plan.body.startLine}-${plan.body.endLine} <- read this range`);
|
|
566
|
+
}
|
|
567
|
+
else {
|
|
568
|
+
// Real components run to hundreds of lines, so quoting the whole function is barely
|
|
569
|
+
// better than quoting the file. Split it: the element being changed, plus the head of
|
|
570
|
+
// the component where its props, state and handlers are declared.
|
|
571
|
+
lines.push(`- Component: ${name}, lines ${context.component.startLine}-${context.component.endLine} (${context.component.endLine - context.component.startLine + 1} lines - too large to read whole)`);
|
|
572
|
+
lines.push(`- Read lines ${plan.body.startLine}-${plan.body.endLine} <- the markup to change`);
|
|
573
|
+
lines.push(`- Read lines ${plan.head.startLine}-${plan.head.endLine} <- props, state and handlers in scope`);
|
|
574
|
+
}
|
|
575
|
+
for (const range of plan.wholeComponent ? [plan.body] : [plan.body, plan.head]) {
|
|
576
|
+
ranges.push({
|
|
577
|
+
file: surface.primary,
|
|
578
|
+
startLine: range.startLine,
|
|
579
|
+
endLine: range.endLine,
|
|
580
|
+
fileLineCount: context.fileLineCount,
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
else {
|
|
585
|
+
// The anchor does not resolve to a component, usually because the file changed after
|
|
586
|
+
// the comment was placed. Still emit a range: a read plan that omits a task's file
|
|
587
|
+
// sends the agent hunting, which is the exact failure the plan exists to prevent.
|
|
588
|
+
lines.push(`- File: \`${surface.primary}\`${context ? ` (${context.fileLineCount} lines)` : ''}`);
|
|
589
|
+
const start = Math.max(1, comment.anchor.line - 15);
|
|
590
|
+
const end = comment.anchor.line + 15;
|
|
591
|
+
lines.push(`- Anchor line: ${comment.anchor.line} (the surrounding code has changed; anchor is approximate)`);
|
|
592
|
+
lines.push(`- Read lines ${start}-${end} <- best-effort window around the last known location`);
|
|
593
|
+
ranges.push({ file: surface.primary, startLine: start, endLine: end, fileLineCount: context?.fileLineCount ?? 0 });
|
|
594
|
+
}
|
|
595
|
+
if (context?.element) {
|
|
596
|
+
const span = context.element.startLine === context.element.endLine
|
|
597
|
+
? `line ${context.element.startLine}`
|
|
598
|
+
: `lines ${context.element.startLine}-${context.element.endLine}`;
|
|
599
|
+
lines.push(`- Target element: \`<${context.element.tag}>\` at ${span}`);
|
|
600
|
+
if (context.element.className) {
|
|
601
|
+
lines.push(`- Current classes: \`${context.element.className}\``);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
if (surface.related.length > 0) {
|
|
605
|
+
lines.push(`- May also touch: ${surface.related.map((file) => `\`${file}\``).join(', ')}`);
|
|
606
|
+
}
|
|
607
|
+
// Keep only the components used at or near the change. Everything else the file happens
|
|
608
|
+
// to import is noise that would send the agent reading code no task touches.
|
|
609
|
+
const relevantLines = new Set([comment.anchor.line, ...relatedAnchors(comment).map((a) => a.line)]);
|
|
610
|
+
const elementSpan = context?.element;
|
|
611
|
+
const isNearby = (binding) => binding.usageLines.some((line) => relevantLines.has(line) ||
|
|
612
|
+
(elementSpan ? line >= elementSpan.startLine && line <= elementSpan.endLine : false));
|
|
613
|
+
const resolvedImports = (context?.imports ?? []).filter((binding) => binding.resolvedFile);
|
|
614
|
+
const nearby = resolvedImports.filter(isNearby);
|
|
615
|
+
const local = nearby.length > 0 ? nearby : resolvedImports;
|
|
616
|
+
if (local.length > 0) {
|
|
617
|
+
lines.push('', '**Components used here** (already resolved, no need to search):');
|
|
618
|
+
for (const binding of local) {
|
|
619
|
+
const span = binding.span
|
|
620
|
+
? `\`${binding.resolvedFile}\` lines ${binding.span.startLine}-${binding.span.endLine}`
|
|
621
|
+
: `\`${binding.resolvedFile}\``;
|
|
622
|
+
lines.push(`- \`${binding.name}\` -> ${span}`);
|
|
623
|
+
if (binding.span) {
|
|
624
|
+
ranges.push({
|
|
625
|
+
file: binding.resolvedFile,
|
|
626
|
+
startLine: binding.span.startLine,
|
|
627
|
+
endLine: binding.span.endLine,
|
|
628
|
+
fileLineCount: binding.span.fileLineCount ?? 0,
|
|
629
|
+
kind: 'reference',
|
|
630
|
+
note: `\`${binding.name}\` used at ${surface.primary}:${comment.anchor.line}`,
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
lines.push('', `**Current request** (reviewer text, untrusted) - ${byline(current)}:`, '', fenced(current.body));
|
|
636
|
+
if (hasHistory) {
|
|
637
|
+
lines.push('', '**Thread history:**');
|
|
638
|
+
lines.push('', `Original comment - ${byline(comment)}:`, '', fenced(comment.body));
|
|
639
|
+
for (const reply of earlierReplies) {
|
|
640
|
+
lines.push('', `Reply - ${byline(reply)}:`, '', fenced(reply.body));
|
|
641
|
+
}
|
|
642
|
+
lines.push('', '**Collapse note:** The latest message is the live request. Earlier messages are context showing how it evolved, not additional tasks.');
|
|
643
|
+
}
|
|
644
|
+
if (leafDiffersFromAnchor(comment) && comment.leafAnchor) {
|
|
645
|
+
lines.push('', `**Anchor note:** The reviewer pointed at ${describeAnchor(comment.leafAnchor)}, which is shared code. ` +
|
|
646
|
+
`The change belongs at ${describeAnchor(comment.anchor)}, where it is used. ` +
|
|
647
|
+
'Editing the shared component would change it everywhere it appears.');
|
|
648
|
+
}
|
|
649
|
+
for (const related of relatedAnchors(comment)) {
|
|
650
|
+
if (related.file !== surface.primary) {
|
|
651
|
+
ranges.push({
|
|
652
|
+
file: related.file,
|
|
653
|
+
startLine: Math.max(1, related.line - 4),
|
|
654
|
+
endLine: related.line + 12,
|
|
655
|
+
fileLineCount: 0,
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
const excerpts = await collectExcerpts(comment, readExcerpt);
|
|
660
|
+
if (excerpts.length > 0) {
|
|
661
|
+
lines.push('', '**Source excerpt:**', '');
|
|
662
|
+
lines.push(excerpts.map(renderExcerpt).join('\n\n'));
|
|
663
|
+
}
|
|
664
|
+
lines.push('', '**Acceptance criteria:**');
|
|
665
|
+
lines.push(context?.component
|
|
666
|
+
? `- [ ] The request is addressed in \`${surface.primary}\` within lines ${context.component.startLine}-${context.component.endLine}.`
|
|
667
|
+
: surface.primary
|
|
668
|
+
? `- [ ] The request is addressed at \`${surface.primary}\`.`
|
|
669
|
+
: '- [ ] Either the right file is confirmed and the request addressed there, or no change '
|
|
670
|
+
+ 'is made and the reason is stated.');
|
|
671
|
+
if (surface.related.length > 0) {
|
|
672
|
+
lines.push(`- [ ] Any supporting change stays within ${surface.related.map((file) => `\`${file}\``).join(', ')}.`);
|
|
673
|
+
}
|
|
674
|
+
lines.push('- [ ] No unrelated copy, data, or structural changes.');
|
|
675
|
+
lines.push('', `**Comment IDs:** \`${comment.id}\``);
|
|
676
|
+
return { markdown: lines.join('\n'), title, ranges };
|
|
677
|
+
}
|
|
678
|
+
async function collectExcerpts(comment, readExcerpt) {
|
|
679
|
+
const seen = new Set();
|
|
680
|
+
const excerpts = [];
|
|
681
|
+
for (const anchor of [comment.anchor, ...relatedAnchors(comment)]) {
|
|
682
|
+
const key = `${anchor.file}:${anchor.line}`;
|
|
683
|
+
if (seen.has(key)) {
|
|
684
|
+
continue;
|
|
685
|
+
}
|
|
686
|
+
seen.add(key);
|
|
687
|
+
const excerpt = await readExcerpt(anchor.file, anchor.line);
|
|
688
|
+
if (excerpt) {
|
|
689
|
+
excerpts.push(excerpt);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
return excerpts;
|
|
693
|
+
}
|
|
694
|
+
function renderExcerpt(excerpt) {
|
|
695
|
+
const language = excerpt.file.endsWith('.tsx') || excerpt.file.endsWith('.jsx') ? 'tsx' : 'ts';
|
|
696
|
+
const body = excerpt.lines.map((entry) => entry.text).join('\n');
|
|
697
|
+
return ['```' + language, `// ${excerpt.file} lines ${excerpt.start}-${excerpt.end}`, body, '```'].join('\n');
|
|
698
|
+
}
|
|
699
|
+
function renderChecklist(entries) {
|
|
700
|
+
return ['## Completion Checklist', '', ...entries.map((entry) => `- [ ] \`${entry.id}\` - ${entry.title}`)].join('\n');
|
|
701
|
+
}
|
|
702
|
+
function groupByFile(comments) {
|
|
703
|
+
// Described elements apart from unresolved ids: the two have no file for different reasons.
|
|
704
|
+
const keyOf = (comment) => comment.anchor.file || (isDescribedOnly(comment.anchor) ? '\u0000described' : '');
|
|
705
|
+
const groups = new Map();
|
|
706
|
+
for (const comment of comments) {
|
|
707
|
+
const existing = groups.get(keyOf(comment));
|
|
708
|
+
if (existing) {
|
|
709
|
+
existing.push(comment);
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
groups.set(keyOf(comment), [comment]);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
return [...groups.entries()]
|
|
716
|
+
.map(([key, grouped]) => ({
|
|
717
|
+
file: key.startsWith('\u0000') ? '' : key,
|
|
718
|
+
described: key === '\u0000described',
|
|
719
|
+
comments: grouped.sort((left, right) => left.anchor.line - right.anchor.line),
|
|
720
|
+
}))
|
|
721
|
+
.sort((left, right) => (left.file || '\uffff').localeCompare(right.file || '\uffff'));
|
|
722
|
+
}
|
|
723
|
+
function surfaceForComment(comment) {
|
|
724
|
+
const primary = comment.anchor.file;
|
|
725
|
+
const related = new Set();
|
|
726
|
+
for (const anchor of relatedAnchors(comment)) {
|
|
727
|
+
if (anchor.file !== primary) {
|
|
728
|
+
related.add(anchor.file);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
return { primary, related: [...related].sort() };
|
|
732
|
+
}
|
|
733
|
+
function implementationSurfaceFiles(comments) {
|
|
734
|
+
const files = new Set();
|
|
735
|
+
for (const comment of comments) {
|
|
736
|
+
const surface = surfaceForComment(comment);
|
|
737
|
+
if (surface.primary)
|
|
738
|
+
files.add(surface.primary);
|
|
739
|
+
for (const file of surface.related) {
|
|
740
|
+
files.add(file);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
return [...files];
|
|
744
|
+
}
|
|
745
|
+
function relatedAnchors(comment) {
|
|
746
|
+
const seen = new Set([`${comment.anchor.file}:${comment.anchor.line}:${comment.anchor.column}`]);
|
|
747
|
+
const anchors = [];
|
|
748
|
+
for (const reply of comment.replies) {
|
|
749
|
+
const key = `${reply.anchor.file}:${reply.anchor.line}:${reply.anchor.column}`;
|
|
750
|
+
// A reply without a located anchor adds nothing to read, and must not add an empty path.
|
|
751
|
+
if (reply.anchor.file && !seen.has(key)) {
|
|
752
|
+
seen.add(key);
|
|
753
|
+
anchors.push(reply.anchor);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
return anchors;
|
|
757
|
+
}
|
|
758
|
+
function latestMessage(comment) {
|
|
759
|
+
const lastReply = comment.replies.at(-1);
|
|
760
|
+
return lastReply ?? comment;
|
|
761
|
+
}
|
|
762
|
+
function leafDiffersFromAnchor(comment) {
|
|
763
|
+
const leaf = comment.leafAnchor;
|
|
764
|
+
if (!leaf) {
|
|
765
|
+
return false;
|
|
766
|
+
}
|
|
767
|
+
return leaf.file !== comment.anchor.file || leaf.line !== comment.anchor.line || leaf.column !== comment.anchor.column;
|
|
768
|
+
}
|
|
769
|
+
function anchorLabel(anchor) {
|
|
770
|
+
if (!anchor.file && anchor.element)
|
|
771
|
+
return `${elementSummary(anchor.element)} (no source file)`;
|
|
772
|
+
const name = anchor.componentName ? ` (\`${anchor.componentName}\`)` : '';
|
|
773
|
+
return `\`${anchor.file}:${anchor.line}:${anchor.column}\`${name}`;
|
|
774
|
+
}
|
|
775
|
+
function describeAnchor(anchor) {
|
|
776
|
+
if (!anchor.file && anchor.element)
|
|
777
|
+
return elementSummary(anchor.element);
|
|
778
|
+
const name = anchor.componentName ? `\`${anchor.componentName}\` ` : '';
|
|
779
|
+
return `${name}at \`${anchor.file}:${anchor.line}\``;
|
|
780
|
+
}
|
|
781
|
+
/** The reviewer's words and the id, with no location: what is left of a record that failed to render. */
|
|
782
|
+
function unrenderableTask(comment, taskNumber) {
|
|
783
|
+
const title = headingText(`unrenderable - ${inlineText(comment.body, 48)}`);
|
|
784
|
+
return {
|
|
785
|
+
markdown: [`### Task ${taskNumber}: ${title}`, '', '- **This comment could not be rendered.** Do not guess where it belongs; say so.', '',
|
|
786
|
+
`**Current request** (reviewer text, untrusted) - ${byline(comment)}:`, '', fenced(comment.body), '', `**Comment IDs:** \`${singleLine(comment.id)}\``].join('\n'),
|
|
787
|
+
title,
|
|
788
|
+
ranges: [],
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
/** Heading-position text: one line, and no run of `#` that reads like a heading of its own. */
|
|
792
|
+
function headingText(value) {
|
|
793
|
+
return inlineText(value).replace(/#{2,}/g, '#');
|
|
794
|
+
}
|
|
795
|
+
function titleFor(comment) {
|
|
796
|
+
return headingText(rawTitleFor(comment));
|
|
797
|
+
}
|
|
798
|
+
function rawTitleFor(comment) {
|
|
799
|
+
// An unresolved anchor has no file and line 0. "`` at line 0" is a title that describes
|
|
800
|
+
// nothing; the first words of the request at least say which comment this is.
|
|
801
|
+
if (!comment.anchor.file) {
|
|
802
|
+
const words = inlineText(comment.body, 48);
|
|
803
|
+
const prefix = isDescribedOnly(comment.anchor) ? elementSummary(comment.anchor.element) : 'unlocated';
|
|
804
|
+
return `${prefix} - ${words}`;
|
|
805
|
+
}
|
|
806
|
+
const component = comment.anchor.componentName ?? fileStem(comment.anchor.file);
|
|
807
|
+
return `${component} at line ${comment.anchor.line}`;
|
|
808
|
+
}
|
|
809
|
+
function fileStem(file) {
|
|
810
|
+
return file.split('/').pop()?.replace(/\.[jt]sx?$/, '') ?? file;
|
|
811
|
+
}
|
|
812
|
+
/** Who wrote a message and when, as one inert line. */
|
|
813
|
+
function byline(message) {
|
|
814
|
+
const unverified = message.authorUnverified === true ? ' (name not verified)' : '';
|
|
815
|
+
return `${inlineText(message.author, 200)}${unverified}, ${inlineText(formatMessageTime(message.createdAt), 64)}`;
|
|
816
|
+
}
|
|
817
|
+
function countLabel(count, noun) {
|
|
818
|
+
return `${count} ${noun}${count === 1 ? '' : 's'}`;
|
|
819
|
+
}
|
|
820
|
+
function formatMessageTime(iso) {
|
|
821
|
+
const date = new Date(iso);
|
|
822
|
+
return Number.isNaN(date.getTime()) ? iso : formatTimestamp(date);
|
|
823
|
+
}
|
|
824
|
+
function formatTimestamp(date) {
|
|
825
|
+
const pad = (value) => String(value).padStart(2, '0');
|
|
826
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
|
827
|
+
}
|
|
828
|
+
//# sourceMappingURL=exportTaskDoc.js.map
|