ontrackd 0.0.1 → 0.11.0
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 +126 -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 +39 -0
- package/dist/plugin/vite.js +582 -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,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `feedback push` — send manifests this machine still owes the cloud.
|
|
4
|
+
*
|
|
5
|
+
* This exists because a warning told developers to run it. A tool that instructs someone to
|
|
6
|
+
* run a command that does not exist has spent their trust on its first real failure, which is
|
|
7
|
+
* exactly the moment it can least afford to.
|
|
8
|
+
*/
|
|
9
|
+
export declare function push(argv?: string[], env?: NodeJS.ProcessEnv): Promise<number>;
|
package/dist/cli/push.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { pendingManifests, pushPendingManifests } from '../integration/manifestSink.js';
|
|
4
|
+
import { resolveSecret } from '../storage/localCredentials.js';
|
|
5
|
+
import { configuredApi } from '../integration/configuredApi.js';
|
|
6
|
+
/**
|
|
7
|
+
* `feedback push` — send manifests this machine still owes the cloud.
|
|
8
|
+
*
|
|
9
|
+
* This exists because a warning told developers to run it. A tool that instructs someone to
|
|
10
|
+
* run a command that does not exist has spent their trust on its first real failure, which is
|
|
11
|
+
* exactly the moment it can least afford to.
|
|
12
|
+
*/
|
|
13
|
+
export async function push(argv = [], env = process.env) {
|
|
14
|
+
const projectRoot = path.resolve(argv[0] ?? env.FEEDBACK_PROJECT_ROOT ?? process.cwd());
|
|
15
|
+
const pending = await pendingManifests(projectRoot);
|
|
16
|
+
if (pending.length === 0) {
|
|
17
|
+
process.stdout.write('feedback: nothing to push, every manifest has been delivered.\n');
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
20
|
+
const { projectId, secret } = await resolveSecret(projectRoot, env);
|
|
21
|
+
if (!projectId || !secret) {
|
|
22
|
+
process.stderr.write(`feedback: ${pending.length} manifest(s) are waiting, but this project is not linked.\n` +
|
|
23
|
+
' The manifests are signed with the project secret, which this machine does not have.\n' +
|
|
24
|
+
' Run `feedback link` (or set FEEDBACK_SECRET, which carries the project id), and run this again.\n');
|
|
25
|
+
return 1;
|
|
26
|
+
}
|
|
27
|
+
let apiBase;
|
|
28
|
+
try {
|
|
29
|
+
apiBase = await configuredApi(projectRoot, env);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
33
|
+
return 1;
|
|
34
|
+
}
|
|
35
|
+
process.stdout.write(`feedback: pushing ${pending.length} manifest(s)…\n`);
|
|
36
|
+
const outcomes = await pushPendingManifests(projectRoot, { apiBase, projectId, secret });
|
|
37
|
+
let failed = 0;
|
|
38
|
+
for (const outcome of outcomes) {
|
|
39
|
+
if (outcome.ok) {
|
|
40
|
+
process.stdout.write(` delivered ${outcome.buildId}\n`);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
failed += 1;
|
|
44
|
+
process.stderr.write(` ${outcome.buildId}: ${outcome.reason ?? 'unknown failure'}\n`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Non-zero only when something is still owed, so this composes in a script.
|
|
48
|
+
return failed > 0 ? 1 : 0;
|
|
49
|
+
}
|
|
50
|
+
const invokedDirectly = process.argv[1] && import.meta.url === `file://${path.resolve(process.argv[1])}`;
|
|
51
|
+
if (invokedDirectly) {
|
|
52
|
+
push(process.argv.slice(2)).then((code) => process.exit(code), (error) => {
|
|
53
|
+
process.stderr.write(`feedback: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=push.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../src/cli/push.ts"],"names":[],"mappings":";AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAiB,EAAE,EAAE,MAAyB,OAAO,CAAC,GAAG;IAClF,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,qBAAqB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACxF,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAEpD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAC;QACxF,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IACpE,IAAI,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AAC,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACzG,IAAI,eAAe,EAAE,CAAC;IACpB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAC9B,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAC5B,CAAC,KAAK,EAAE,EAAE;QACR,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function remote(argv: string[]): Promise<number>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { readSidecarAuthorization } from '../storage/sidecarAccess.js';
|
|
3
|
+
import { unlink } from 'node:fs/promises';
|
|
4
|
+
import { FeedbackClient, ProjectKey } from '../remote/index.js';
|
|
5
|
+
import { ensureRemoteGitignored, readJsonFile, readRemoteConfig, saveRemoteConfig, writePrivateJson } from '../remote/config.js';
|
|
6
|
+
import { cloud, cloudStatusLines } from './cloud.js';
|
|
7
|
+
export async function remote(argv) {
|
|
8
|
+
const [command, ...args] = argv;
|
|
9
|
+
// Cloud sign-in and linking live in their own module; Standalone below is unchanged.
|
|
10
|
+
if (command === 'login' || command === 'logout' || command === 'whoami' || command === 'source-excerpts' || (command === 'init' && args.includes('--cloud'))) {
|
|
11
|
+
return cloud(command, args);
|
|
12
|
+
}
|
|
13
|
+
const options = new Map();
|
|
14
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
15
|
+
if (args[i] === '--retry-all') {
|
|
16
|
+
options.set('--retry-all', 'true');
|
|
17
|
+
i--;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (!['--api', '--root', '--key-file', '--session', '--discard', '--rebase', '--retry', '--port'].includes(args[i]) || !args[i + 1])
|
|
21
|
+
throw new Error('Invalid remote option');
|
|
22
|
+
options.set(args[i], args[i + 1]);
|
|
23
|
+
}
|
|
24
|
+
const root = path.resolve(options.get('--root') ?? process.cwd());
|
|
25
|
+
if (command === 'status') {
|
|
26
|
+
const config = await readRemoteConfig(root);
|
|
27
|
+
if (!config) {
|
|
28
|
+
console.log('Remote feedback: disabled (local only)');
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
const state = await readJsonFile(path.join(root, '.feedback', 'remote-sync.json'));
|
|
32
|
+
const blocked = state?.queue.find((op) => op.blocked);
|
|
33
|
+
const cloudLines = await cloudStatusLines(root);
|
|
34
|
+
if (cloudLines)
|
|
35
|
+
console.log(cloudLines);
|
|
36
|
+
console.log(`Remote feedback: ${config.apiUrl}\nProject: ${config.projectId}\nBranch: ${config.branchId}\nSession: ${config.sessionId}\nRevision: ${state?.revision ?? 0}\nPending operations: ${state?.queue.length ?? 0}\nSync: ${blocked?.blocked ?? state?.error ?? 'configured'}${blocked ? `\nBlocked head: ${blocked.idempotencyKey} (${blocked.blocked})` : ''}`);
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
if (command === 'queue') {
|
|
40
|
+
if (['--discard', '--rebase', '--retry', '--retry-all'].filter((flag) => options.has(flag)).length > 1)
|
|
41
|
+
throw new Error('Choose one queue recovery action');
|
|
42
|
+
if (!await readRemoteConfig(root))
|
|
43
|
+
throw new Error('Remote feedback is not configured');
|
|
44
|
+
// Recovery runs through the journal owner; never race its in-memory checkpoint from another CLI process.
|
|
45
|
+
const first = options.has('--port') ? Number(options.get('--port')) : 7331;
|
|
46
|
+
if (!Number.isInteger(first) || first < 1 || first > 65535)
|
|
47
|
+
throw new Error('Invalid sidecar port');
|
|
48
|
+
for (let port = first; port < Math.min(65536, first + (options.has('--port') ? 1 : 10)); port++) {
|
|
49
|
+
const base = `http://127.0.0.1:${port}`;
|
|
50
|
+
let health;
|
|
51
|
+
try {
|
|
52
|
+
health = await (await fetch(`${base}/__fb/health`, { signal: AbortSignal.timeout(500) })).json();
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (health.projectRoot !== root)
|
|
58
|
+
continue;
|
|
59
|
+
const action = options.has('--discard') ? 'discard' : options.has('--rebase') ? 'rebase' : options.has('--retry') ? 'retry' : options.has('--retry-all') ? 'retry-all' : null;
|
|
60
|
+
const response = await fetch(`${base}/__fb/remote/queue`, {
|
|
61
|
+
method: action ? 'POST' : 'GET', headers: { 'x-feedback-project-root': root, 'content-type': 'application/json', authorization: await readSidecarAuthorization(root, port) },
|
|
62
|
+
...(action ? { body: JSON.stringify({ action, id: options.get(`--${action}`) }) } : {}),
|
|
63
|
+
});
|
|
64
|
+
const result = await response.json();
|
|
65
|
+
if (!response.ok)
|
|
66
|
+
throw new Error(result.error ?? `Queue recovery failed (${response.status})`);
|
|
67
|
+
for (const op of result.queue)
|
|
68
|
+
console.log(`${op.id} ${op.method} ${op.entityId} ${op.reason ?? 'pending'}`);
|
|
69
|
+
if (!result.queue.length)
|
|
70
|
+
console.log('Remote queue: empty');
|
|
71
|
+
return 0;
|
|
72
|
+
}
|
|
73
|
+
throw new Error('Start this project\'s dev sidecar before queue recovery; use --port <port> for a custom sidecar port.');
|
|
74
|
+
}
|
|
75
|
+
if (command !== 'init' || !options.get('--api'))
|
|
76
|
+
throw new Error('Usage: feedback remote init --api <url> [--root <path>] [--key-file <private-json> --session <id>] | remote init --cloud [--project <id> | --new <name>] [--branch <name>] [--replace] | remote login | logout | whoami | status');
|
|
77
|
+
if (await readRemoteConfig(root, {}))
|
|
78
|
+
throw new Error('Remote feedback is already configured');
|
|
79
|
+
const recovery = path.join(root, '.feedback', 'remote-init.json');
|
|
80
|
+
const unfinished = await readJsonFile(recovery);
|
|
81
|
+
if (unfinished && !options.has('--key-file'))
|
|
82
|
+
throw new Error('An unfinished remote setup has a private key in .feedback/remote-init.json. Retry with --key-file pointing to that file; preserve it before creating another project.');
|
|
83
|
+
ensureRemoteGitignored(root);
|
|
84
|
+
const client = new FeedbackClient({ baseUrl: options.get('--api'), product: 'feedback-sidecar' });
|
|
85
|
+
let key, projectId;
|
|
86
|
+
if (options.has('--key-file')) {
|
|
87
|
+
// A file avoids putting the portable key in shell history or process arguments.
|
|
88
|
+
const saved = await readJsonFile(path.resolve(options.get('--key-file')));
|
|
89
|
+
const parsed = ProjectKey.parsePortable(saved?.portableKey ?? saved?.remote?.portableKey ?? '');
|
|
90
|
+
key = parsed.key;
|
|
91
|
+
projectId = parsed.projectId;
|
|
92
|
+
if (unfinished && unfinished.portableKey !== key.toPortable(projectId))
|
|
93
|
+
throw new Error('The key file differs from the unfinished remote-init.json recovery key. Preserve and finish that setup before using another key.');
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
if (options.has('--session'))
|
|
97
|
+
throw new Error('--session requires --key-file');
|
|
98
|
+
key = ProjectKey.generate();
|
|
99
|
+
projectId = (await client.createStandaloneProject(await key.derive())).id;
|
|
100
|
+
}
|
|
101
|
+
await writePrivateJson(recovery, { apiUrl: client.baseUrl, projectId, portableKey: key.toPortable(projectId) });
|
|
102
|
+
try {
|
|
103
|
+
const api = client.project(projectId, await key.derive());
|
|
104
|
+
const session = options.has('--session') ? await api.getSession(options.get('--session')) : await api.createSession();
|
|
105
|
+
await saveRemoteConfig(root, { apiUrl: client.baseUrl, projectId, sessionId: session.id, branchId: session.branchId, portableKey: key.toPortable(projectId) });
|
|
106
|
+
await unlink(recovery);
|
|
107
|
+
console.log(`Remote feedback configured\nProject: ${projectId}\nSession: ${session.id}\nKey saved privately in .feedback/remote.json`);
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
throw new Error('Remote setup did not finish. The project key is saved privately in .feedback/remote-init.json. Retry init with --key-file pointing to that file and the same --api URL (and --session if linking).');
|
|
111
|
+
}
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/cli/remote.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEjI,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAc;IACzC,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAChC,qFAAqF;IACrF,IAAI,OAAO,KAAK,OAAO,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,iBAAiB,IAAI,CAAC,OAAO,KAAK,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;QAC7J,OAAO,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,KAAK,IAAI,CAAC,GAAG,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,CAAC;IACD,MAAM,gBAAgB,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAChH,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1D,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAE,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,aAAa,EAAE,CAAC;QACvH,MAAM,gBAAgB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC/J,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,wCAAwC,SAAS,cAAc,OAAO,CAAC,EAAE,gDAAgD,CAAC,CAAC;IACzI,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,oMAAoM,CAAC,CAAC;IACxN,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function serve(argv?: string[]): Promise<number>;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { createReadStream } from 'node:fs';
|
|
2
|
+
import { readFile, stat } from 'node:fs/promises';
|
|
3
|
+
import { createServer } from 'node:http';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { addScriptTag, stampHtml } from '../core/htmlAnchors.js';
|
|
6
|
+
import { createFeedbackMiddleware } from '../integration/middleware.js';
|
|
7
|
+
import { startOrAttachSidecar } from '../integration/sidecarProcess.js';
|
|
8
|
+
/**
|
|
9
|
+
* `feedback serve [dir]`: a development server for a site that is plain HTML files, no build.
|
|
10
|
+
*
|
|
11
|
+
* Serves the folder as it is, with two changes to each page: every element carries the file and
|
|
12
|
+
* line it is written on, and the widget is added before `</head>`. The widget and its API come
|
|
13
|
+
* from the local sidecar, on this server's own origin, as a Vite dev server serves them.
|
|
14
|
+
*/
|
|
15
|
+
const types = {
|
|
16
|
+
'.html': 'text/html; charset=utf-8', '.htm': 'text/html; charset=utf-8',
|
|
17
|
+
'.css': 'text/css; charset=utf-8', '.js': 'text/javascript; charset=utf-8', '.mjs': 'text/javascript; charset=utf-8',
|
|
18
|
+
'.json': 'application/json', '.map': 'application/json', '.txt': 'text/plain; charset=utf-8', '.xml': 'application/xml',
|
|
19
|
+
'.svg': 'image/svg+xml', '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.gif': 'image/gif',
|
|
20
|
+
'.webp': 'image/webp', '.avif': 'image/avif', '.ico': 'image/x-icon',
|
|
21
|
+
'.woff': 'font/woff', '.woff2': 'font/woff2', '.ttf': 'font/ttf', '.otf': 'font/otf',
|
|
22
|
+
'.mp4': 'video/mp4', '.webm': 'video/webm', '.mp3': 'audio/mpeg', '.pdf': 'application/pdf', '.wasm': 'application/wasm',
|
|
23
|
+
};
|
|
24
|
+
const isHtml = (file) => /\.html?$/i.test(file);
|
|
25
|
+
function parse(argv) {
|
|
26
|
+
let dir;
|
|
27
|
+
let port = 5500;
|
|
28
|
+
let host = 'localhost';
|
|
29
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
30
|
+
const arg = argv[i];
|
|
31
|
+
if (arg === '--port' || arg === '-p') {
|
|
32
|
+
port = Number(argv[++i]);
|
|
33
|
+
if (!Number.isInteger(port) || port <= 0 || port > 65535)
|
|
34
|
+
return `--port needs a port number (got ${argv[i]})`;
|
|
35
|
+
}
|
|
36
|
+
else if (arg === '--host') {
|
|
37
|
+
host = argv[++i] ?? host;
|
|
38
|
+
}
|
|
39
|
+
else if (arg.startsWith('-')) {
|
|
40
|
+
return `unknown option ${arg}`;
|
|
41
|
+
}
|
|
42
|
+
else if (dir === undefined) {
|
|
43
|
+
dir = arg;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return `one folder at a time (got ${dir} and ${arg})`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return { dir: path.resolve(dir ?? '.'), projectRoot: process.cwd(), port, host };
|
|
50
|
+
}
|
|
51
|
+
async function fileAt(dir, pathname) {
|
|
52
|
+
let decoded;
|
|
53
|
+
try {
|
|
54
|
+
decoded = decodeURIComponent(pathname);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
if (decoded.includes('\0'))
|
|
60
|
+
return null;
|
|
61
|
+
const target = path.join(dir, decoded);
|
|
62
|
+
// Nothing outside the folder, however the path is spelled.
|
|
63
|
+
if (target !== dir && !target.startsWith(`${dir}${path.sep}`))
|
|
64
|
+
return null;
|
|
65
|
+
const info = await stat(target).catch(() => null);
|
|
66
|
+
if (info?.isFile())
|
|
67
|
+
return { file: target };
|
|
68
|
+
if (info?.isDirectory()) {
|
|
69
|
+
// `/blog` to `/blog/`, so the page's relative links resolve against the folder.
|
|
70
|
+
if (!pathname.endsWith('/'))
|
|
71
|
+
return { redirect: `${pathname}/` };
|
|
72
|
+
const index = path.join(target, 'index.html');
|
|
73
|
+
return (await stat(index).catch(() => null))?.isFile() ? { file: index } : null;
|
|
74
|
+
}
|
|
75
|
+
// Clean URLs: `/about` serves `about.html`, as most static hosts do.
|
|
76
|
+
if (!path.extname(target)) {
|
|
77
|
+
const page = `${target}.html`;
|
|
78
|
+
if ((await stat(page).catch(() => null))?.isFile())
|
|
79
|
+
return { file: page };
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
const relativeTo = (root, file) => path.relative(root, file).split(path.sep).join('/');
|
|
84
|
+
async function sendPage(response, file, projectRoot, status = 200) {
|
|
85
|
+
const source = await readFile(file, 'utf8');
|
|
86
|
+
const { code } = stampHtml(source, relativeTo(projectRoot, file));
|
|
87
|
+
const page = addScriptTag(code, '<script type="module" src="/__feedback/overlay/browser.js"></script>');
|
|
88
|
+
response.writeHead(status, { 'content-type': 'text/html; charset=utf-8', 'cache-control': 'no-store' });
|
|
89
|
+
response.end(page);
|
|
90
|
+
}
|
|
91
|
+
function handler(options, middleware) {
|
|
92
|
+
return (request, response) => {
|
|
93
|
+
middleware(request, response, () => {
|
|
94
|
+
void (async () => {
|
|
95
|
+
if (request.method !== 'GET' && request.method !== 'HEAD') {
|
|
96
|
+
response.writeHead(405, { allow: 'GET, HEAD' }).end();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const pathname = (request.url ?? '/').split('?')[0];
|
|
100
|
+
const found = await fileAt(options.dir, pathname);
|
|
101
|
+
if (found && 'redirect' in found) {
|
|
102
|
+
response.writeHead(301, { location: found.redirect }).end();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (!found) {
|
|
106
|
+
const missing = path.join(options.dir, '404.html');
|
|
107
|
+
if ((await stat(missing).catch(() => null))?.isFile()) {
|
|
108
|
+
await sendPage(response, missing, options.projectRoot, 404);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
response.writeHead(404, { 'content-type': 'text/plain; charset=utf-8' }).end('Not found\n');
|
|
112
|
+
}
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (isHtml(found.file)) {
|
|
116
|
+
await sendPage(response, found.file, options.projectRoot);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
response.writeHead(200, {
|
|
120
|
+
'content-type': types[path.extname(found.file).toLowerCase()] ?? 'application/octet-stream',
|
|
121
|
+
'cache-control': 'no-store',
|
|
122
|
+
});
|
|
123
|
+
if (request.method === 'HEAD') {
|
|
124
|
+
response.end();
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
createReadStream(found.file).pipe(response);
|
|
128
|
+
})().catch((error) => {
|
|
129
|
+
if (!response.headersSent)
|
|
130
|
+
response.writeHead(500, { 'content-type': 'text/plain; charset=utf-8' });
|
|
131
|
+
response.end(`feedback serve: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
export async function serve(argv = []) {
|
|
137
|
+
const options = parse(argv);
|
|
138
|
+
if (typeof options === 'string') {
|
|
139
|
+
process.stderr.write(`feedback serve: ${options}\n`);
|
|
140
|
+
return 1;
|
|
141
|
+
}
|
|
142
|
+
const info = await stat(options.dir).catch(() => null);
|
|
143
|
+
if (!info?.isDirectory()) {
|
|
144
|
+
process.stderr.write(`feedback serve: ${options.dir} is not a folder\n`);
|
|
145
|
+
return 1;
|
|
146
|
+
}
|
|
147
|
+
let sidecar = await startOrAttachSidecar({ projectRoot: options.projectRoot });
|
|
148
|
+
const resolveSidecarPort = async (revive = false) => {
|
|
149
|
+
if (revive)
|
|
150
|
+
sidecar = await startOrAttachSidecar({ projectRoot: options.projectRoot });
|
|
151
|
+
return sidecar.port;
|
|
152
|
+
};
|
|
153
|
+
const middleware = createFeedbackMiddleware({ resolveSidecarPort, projectRoot: options.projectRoot });
|
|
154
|
+
// The next free port when the asked one is taken, as dev servers do; never silently a far one.
|
|
155
|
+
for (let port = options.port; port < options.port + 10; port += 1) {
|
|
156
|
+
const server = createServer(handler(options, middleware));
|
|
157
|
+
const listening = await new Promise((resolve) => {
|
|
158
|
+
server.once('error', () => resolve(false));
|
|
159
|
+
server.listen(port, options.host, () => resolve(true));
|
|
160
|
+
});
|
|
161
|
+
if (!listening)
|
|
162
|
+
continue;
|
|
163
|
+
const shown = path.relative(process.cwd(), options.dir) || '.';
|
|
164
|
+
process.stdout.write(`feedback: serving ${shown} at http://${options.host}:${port}/\n` +
|
|
165
|
+
` sidecar on :${sidecar.port}${sidecar.attached ? ' (attached)' : ''}. Ctrl-C to stop.\n`);
|
|
166
|
+
return new Promise((resolve) => {
|
|
167
|
+
const stop = () => {
|
|
168
|
+
server.close(() => resolve(0));
|
|
169
|
+
server.closeAllConnections();
|
|
170
|
+
};
|
|
171
|
+
process.once('SIGINT', stop);
|
|
172
|
+
process.once('SIGTERM', stop);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
process.stderr.write(`feedback serve: ports ${options.port} to ${options.port + 9} are all taken. Pick one with --port.\n`);
|
|
176
|
+
return 1;
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=serve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../src/cli/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAC;AACpF,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAsB,MAAM,kCAAkC,CAAC;AAE5F;;;;;;GAMG;AAEH,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,0BAA0B,EAAE,MAAM,EAAE,0BAA0B;IACvE,MAAM,EAAE,yBAAyB,EAAE,KAAK,EAAE,gCAAgC,EAAE,MAAM,EAAE,gCAAgC;IACpH,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,2BAA2B,EAAE,MAAM,EAAE,iBAAiB;IACvH,M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;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,OAAO,CAAC,IAAI,OAAO,OAAO,CAAC,IAAI,GAAG,CAAC,yCAAyC,CAAC,CAAC;IAC5H,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `feedback sidecar [project-root]`: start this project's sidecar, or find the one already running,
|
|
3
|
+
* print its port and exit. The sidecar keeps running.
|
|
4
|
+
*
|
|
5
|
+
* For stacks whose development loop has no Node build to start it: a Django, Symfony or Rails app
|
|
6
|
+
* runs this from its own development server the first time the widget asks for its API. Prints one
|
|
7
|
+
* line of JSON, `{"port":7331}`, so the caller does not have to parse prose.
|
|
8
|
+
*/
|
|
9
|
+
export declare function sidecar(argv?: string[]): Promise<number>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { startOrAttachSidecar } from '../integration/sidecarProcess.js';
|
|
3
|
+
/**
|
|
4
|
+
* `feedback sidecar [project-root]`: start this project's sidecar, or find the one already running,
|
|
5
|
+
* print its port and exit. The sidecar keeps running.
|
|
6
|
+
*
|
|
7
|
+
* For stacks whose development loop has no Node build to start it: a Django, Symfony or Rails app
|
|
8
|
+
* runs this from its own development server the first time the widget asks for its API. Prints one
|
|
9
|
+
* line of JSON, `{"port":7331}`, so the caller does not have to parse prose.
|
|
10
|
+
*/
|
|
11
|
+
export async function sidecar(argv = []) {
|
|
12
|
+
const projectRoot = path.resolve(argv[0] ?? process.cwd());
|
|
13
|
+
try {
|
|
14
|
+
const handle = await startOrAttachSidecar({ projectRoot, keepAlive: true });
|
|
15
|
+
process.stdout.write(`${JSON.stringify({ port: handle.port, attached: handle.attached })}\n`);
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
process.stderr.write(`feedback: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=sidecar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidecar.js","sourceRoot":"","sources":["../../src/cli/sidecar.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAAiB,EAAE;IAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC;QAC9F,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9F,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anchor ids for shared mode: what a build publishes instead of a file path.
|
|
3
|
+
*
|
|
4
|
+
* The build stamps elements with an opaque id rather than `src/pages/Pricing.tsx:60:8`,
|
|
5
|
+
* because a shared preview is reachable by anyone with the link and a file tree is a map of
|
|
6
|
+
* the codebase. The dev machine turns ids back into locations; nobody else can.
|
|
7
|
+
*
|
|
8
|
+
* Both sides compute this, so it lives in core rather than in the plugin: the transform
|
|
9
|
+
* stamps the ids, and the sidecar recomputes them to resolve a comment. If the two ever
|
|
10
|
+
* disagreed, every comment made against a shared build would fail to resolve, and the
|
|
11
|
+
* failure would look like stale anchors rather than like a bug here.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Twelve hex characters, for every project, always.
|
|
15
|
+
*
|
|
16
|
+
* Fixed width lets resolution compute candidates from the repository and secret alone,
|
|
17
|
+
* without metadata from a particular build. Twelve hex characters give 48 bits: at
|
|
18
|
+
* 100,000 anchors the chance of a collision is around one in 56,000.
|
|
19
|
+
*/
|
|
20
|
+
export declare const anchorIdWidth = 12;
|
|
21
|
+
/**
|
|
22
|
+
* The id for one source location.
|
|
23
|
+
*
|
|
24
|
+
* Keyed on the project-relative path, so two checkouts of the same commit in different
|
|
25
|
+
* directories produce the same ids. An absolute path would tie every id to one machine.
|
|
26
|
+
*/
|
|
27
|
+
export declare function anchorId(secret: string, file: string, line: number, column: number): string;
|
|
28
|
+
/** The same function over an already-formatted `file:line:column` key. */
|
|
29
|
+
export declare function anchorIdFor(secret: string, key: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* A value that identifies a secret without revealing it.
|
|
32
|
+
*
|
|
33
|
+
* Rotation kills every id derived from the old secret (spec 2.4), so a manifest built under
|
|
34
|
+
* a rotated secret is dead: its ids cannot be recomputed and every lookup in it would miss.
|
|
35
|
+
* Recording this alongside the entries lets the resolver say *that* is what happened, rather
|
|
36
|
+
* than reporting a pile of unresolvable anchors that look exactly like stale code.
|
|
37
|
+
*
|
|
38
|
+
* Those two situations need different words because they need different actions: a rotated
|
|
39
|
+
* secret means re-link the project, a stale anchor means the code moved. Telling the
|
|
40
|
+
* developer the wrong one sends them to the wrong place.
|
|
41
|
+
*/
|
|
42
|
+
export declare function secretFingerprint(secret: string): string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createHmac } from 'node:crypto';
|
|
2
|
+
/**
|
|
3
|
+
* Anchor ids for shared mode: what a build publishes instead of a file path.
|
|
4
|
+
*
|
|
5
|
+
* The build stamps elements with an opaque id rather than `src/pages/Pricing.tsx:60:8`,
|
|
6
|
+
* because a shared preview is reachable by anyone with the link and a file tree is a map of
|
|
7
|
+
* the codebase. The dev machine turns ids back into locations; nobody else can.
|
|
8
|
+
*
|
|
9
|
+
* Both sides compute this, so it lives in core rather than in the plugin: the transform
|
|
10
|
+
* stamps the ids, and the sidecar recomputes them to resolve a comment. If the two ever
|
|
11
|
+
* disagreed, every comment made against a shared build would fail to resolve, and the
|
|
12
|
+
* failure would look like stale anchors rather than like a bug here.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Twelve hex characters, for every project, always.
|
|
16
|
+
*
|
|
17
|
+
* Fixed width lets resolution compute candidates from the repository and secret alone,
|
|
18
|
+
* without metadata from a particular build. Twelve hex characters give 48 bits: at
|
|
19
|
+
* 100,000 anchors the chance of a collision is around one in 56,000.
|
|
20
|
+
*/
|
|
21
|
+
export const anchorIdWidth = 12;
|
|
22
|
+
/**
|
|
23
|
+
* The id for one source location.
|
|
24
|
+
*
|
|
25
|
+
* Keyed on the project-relative path, so two checkouts of the same commit in different
|
|
26
|
+
* directories produce the same ids. An absolute path would tie every id to one machine.
|
|
27
|
+
*/
|
|
28
|
+
export function anchorId(secret, file, line, column) {
|
|
29
|
+
return anchorIdFor(secret, `${file}:${line}:${column}`);
|
|
30
|
+
}
|
|
31
|
+
/** The same function over an already-formatted `file:line:column` key. */
|
|
32
|
+
export function anchorIdFor(secret, key) {
|
|
33
|
+
return createHmac('sha256', secret).update(key).digest('hex').slice(0, anchorIdWidth);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A value that identifies a secret without revealing it.
|
|
37
|
+
*
|
|
38
|
+
* Rotation kills every id derived from the old secret (spec 2.4), so a manifest built under
|
|
39
|
+
* a rotated secret is dead: its ids cannot be recomputed and every lookup in it would miss.
|
|
40
|
+
* Recording this alongside the entries lets the resolver say *that* is what happened, rather
|
|
41
|
+
* than reporting a pile of unresolvable anchors that look exactly like stale code.
|
|
42
|
+
*
|
|
43
|
+
* Those two situations need different words because they need different actions: a rotated
|
|
44
|
+
* secret means re-link the project, a stale anchor means the code moved. Telling the
|
|
45
|
+
* developer the wrong one sends them to the wrong place.
|
|
46
|
+
*/
|
|
47
|
+
export function secretFingerprint(secret) {
|
|
48
|
+
return createHmac('sha256', secret).update('feedback:manifest:v1').digest('hex').slice(0, 16);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=anchorId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchorId.js","sourceRoot":"","sources":["../../src/core/anchorId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;;;;;;;GAWG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc,EAAE,IAAY,EAAE,IAAY,EAAE,MAAc;IACjF,OAAO,WAAW,CAAC,MAAM,EAAE,GAAG,IAAI,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC,CAAC;AAC1D,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,GAAW;IACrD,OAAO,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;AACxF,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,OAAO,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAChG,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const defaultApiBase = "https://api.ontrackd.com";
|
|
2
|
+
/**
|
|
3
|
+
* Select the legacy `/v1` route set or the contract v0 `/v0` routes.
|
|
4
|
+
* Signed plugin messages share their formats and bodies (contract section 19).
|
|
5
|
+
*
|
|
6
|
+
* Discovery uses response shapes rather than hostnames. Try the legacy route first;
|
|
7
|
+
* a 404 with the v0 error envelope records the API kind and retries on the v0 route.
|
|
8
|
+
* The result is remembered per process and fetch implementation. Legacy services
|
|
9
|
+
* receive only legacy requests; the default service (v0) is known without a probe.
|
|
10
|
+
*/
|
|
11
|
+
export type ApiKind = 'v0' | 'legacy';
|
|
12
|
+
export type ApiTarget = {
|
|
13
|
+
apiBase: string;
|
|
14
|
+
apiKind?: ApiKind;
|
|
15
|
+
sessionId?: string;
|
|
16
|
+
plan?: 'cloud' | 'standalone';
|
|
17
|
+
};
|
|
18
|
+
export declare function apiKindFor(target: string | ApiTarget, fetchImpl?: typeof fetch): ApiKind;
|
|
19
|
+
export declare function hasContractSession<T extends ApiTarget>(target: T | null | undefined): target is T & {
|
|
20
|
+
sessionId: string;
|
|
21
|
+
};
|
|
22
|
+
/** What is known of this API so far; the default service is the contract v0 Worker. */
|
|
23
|
+
export declare function knownKind(apiBase: string, fetchImpl?: typeof fetch): ApiKind | undefined;
|
|
24
|
+
/** Records what an answer showed (for callers that cannot use `routedFetch`). */
|
|
25
|
+
export declare function rememberKind(apiBase: string, fetchImpl: typeof fetch, kind: ApiKind): void;
|
|
26
|
+
/** A contract v0 refusal of a route it does not have: 404 with the v0 error envelope. */
|
|
27
|
+
export declare function isV0NotFound(response: Response): Promise<boolean>;
|
|
28
|
+
/** Response-based discovery for routes which have no equivalent on the other API. */
|
|
29
|
+
export declare function observeApiKind(apiBase: string, fetchImpl: typeof fetch, response: Response): Promise<ApiKind>;
|
|
30
|
+
export type Routed = {
|
|
31
|
+
url: string;
|
|
32
|
+
init?: RequestInit;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Sends a request on the route set the API speaks: `route(true)` is the legacy request, `route(false)`
|
|
36
|
+
* the v0 one (paths, and bodies where they differ). The answer says which was used.
|
|
37
|
+
*/
|
|
38
|
+
export declare function routedFetch(target: string | ApiTarget, fetchImpl: typeof fetch, route: (legacy: boolean) => Routed): Promise<{
|
|
39
|
+
response: Response;
|
|
40
|
+
kind: ApiKind;
|
|
41
|
+
}>;
|
|
42
|
+
export declare function pluginPath(legacy: boolean, route: 'pull' | 'recipe' | 'manifests' | 'comment', commentId?: string): string;
|