@repo-os/repoos 0.5.45
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.md +110 -0
- package/README.md +272 -0
- package/dist/.build-info.json +4 -0
- package/dist/.build-stamp.json +3 -0
- package/dist/cli/colors.d.ts +13 -0
- package/dist/cli/colors.js +37 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +221 -0
- package/dist/commands/check.d.ts +170 -0
- package/dist/commands/check.js +1227 -0
- package/dist/commands/docs.d.ts +2 -0
- package/dist/commands/docs.js +70 -0
- package/dist/commands/gc.d.ts +1 -0
- package/dist/commands/gc.js +57 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.js +699 -0
- package/dist/commands/screenshots.d.ts +7 -0
- package/dist/commands/screenshots.js +77 -0
- package/dist/commands/serve.d.ts +55 -0
- package/dist/commands/serve.js +204 -0
- package/dist/commands/status.d.ts +140 -0
- package/dist/commands/status.js +569 -0
- package/dist/commands/stop.d.ts +1 -0
- package/dist/commands/stop.js +59 -0
- package/dist/commands/tasks.d.ts +47 -0
- package/dist/commands/tasks.js +334 -0
- package/dist/commands/tunnel.d.ts +1 -0
- package/dist/commands/tunnel.js +1271 -0
- package/dist/commands/ui-harness.d.ts +53 -0
- package/dist/commands/ui-harness.js +62 -0
- package/dist/commands/ui-smoke.d.ts +6 -0
- package/dist/commands/ui-smoke.js +220 -0
- package/dist/commands/upgrade.d.ts +15 -0
- package/dist/commands/upgrade.js +188 -0
- package/dist/core/auth-store.d.ts +81 -0
- package/dist/core/auth-store.js +530 -0
- package/dist/core/auth.d.ts +75 -0
- package/dist/core/auth.js +124 -0
- package/dist/core/bootstrap.d.ts +41 -0
- package/dist/core/bootstrap.js +236 -0
- package/dist/core/build.d.ts +92 -0
- package/dist/core/build.js +249 -0
- package/dist/core/canary.d.ts +10 -0
- package/dist/core/canary.js +14 -0
- package/dist/core/check-failure-summary.d.ts +10 -0
- package/dist/core/check-failure-summary.js +34 -0
- package/dist/core/config.d.ts +160 -0
- package/dist/core/config.js +1288 -0
- package/dist/core/context-pack.d.ts +74 -0
- package/dist/core/context-pack.js +778 -0
- package/dist/core/db.d.ts +236 -0
- package/dist/core/db.js +747 -0
- package/dist/core/detect.d.ts +69 -0
- package/dist/core/detect.js +251 -0
- package/dist/core/docs.d.ts +76 -0
- package/dist/core/docs.js +225 -0
- package/dist/core/frontmatter.d.ts +29 -0
- package/dist/core/frontmatter.js +215 -0
- package/dist/core/git.d.ts +505 -0
- package/dist/core/git.js +1453 -0
- package/dist/core/indexer.d.ts +33 -0
- package/dist/core/indexer.js +282 -0
- package/dist/core/input.d.ts +66 -0
- package/dist/core/input.js +222 -0
- package/dist/core/logger.d.ts +70 -0
- package/dist/core/logger.js +138 -0
- package/dist/core/models.d.ts +45 -0
- package/dist/core/models.js +291 -0
- package/dist/core/net-probe.d.ts +4 -0
- package/dist/core/net-probe.js +20 -0
- package/dist/core/providers/deepinfra.d.ts +23 -0
- package/dist/core/providers/deepinfra.js +44 -0
- package/dist/core/providers/index.d.ts +24 -0
- package/dist/core/providers/index.js +59 -0
- package/dist/core/providers/openrouter.d.ts +28 -0
- package/dist/core/providers/openrouter.js +82 -0
- package/dist/core/providers/spend.d.ts +86 -0
- package/dist/core/providers/spend.js +286 -0
- package/dist/core/providers/types.d.ts +56 -0
- package/dist/core/providers/types.js +39 -0
- package/dist/core/repoos.d.ts +59 -0
- package/dist/core/repoos.js +221 -0
- package/dist/core/runtime.d.ts +35 -0
- package/dist/core/runtime.js +167 -0
- package/dist/core/skills-registry.d.ts +39 -0
- package/dist/core/skills-registry.js +148 -0
- package/dist/core/skills-registry.test.d.ts +1 -0
- package/dist/core/skills-registry.test.js +52 -0
- package/dist/core/sysmem.d.ts +7 -0
- package/dist/core/sysmem.js +55 -0
- package/dist/core/tailscale.d.ts +2 -0
- package/dist/core/tailscale.js +19 -0
- package/dist/core/task.d.ts +53 -0
- package/dist/core/task.js +310 -0
- package/dist/core/toml-line.d.ts +20 -0
- package/dist/core/toml-line.js +52 -0
- package/dist/core/toml-validate.d.ts +44 -0
- package/dist/core/toml-validate.js +335 -0
- package/dist/core/tunnel-assistant.d.ts +30 -0
- package/dist/core/tunnel-assistant.js +65 -0
- package/dist/core/tunnel-registry.d.ts +96 -0
- package/dist/core/tunnel-registry.js +267 -0
- package/dist/core/tunnel-registry.test.d.ts +1 -0
- package/dist/core/tunnel-registry.test.js +309 -0
- package/dist/core/tunnel.d.ts +103 -0
- package/dist/core/tunnel.js +320 -0
- package/dist/core/types.d.ts +811 -0
- package/dist/core/types.js +27 -0
- package/dist/core/worktree-gc.d.ts +57 -0
- package/dist/core/worktree-gc.js +194 -0
- package/dist/server/__tests__/integration-job.test.d.ts +1 -0
- package/dist/server/__tests__/integration-job.test.js +129 -0
- package/dist/server/agents.d.ts +1020 -0
- package/dist/server/agents.js +4070 -0
- package/dist/server/attachments.d.ts +51 -0
- package/dist/server/attachments.js +130 -0
- package/dist/server/auto-engineering.d.ts +45 -0
- package/dist/server/auto-engineering.js +275 -0
- package/dist/server/branchless-release.d.ts +22 -0
- package/dist/server/branchless-release.js +67 -0
- package/dist/server/built-in-agents.d.ts +305 -0
- package/dist/server/built-in-agents.js +1838 -0
- package/dist/server/cto-monitor.d.ts +35 -0
- package/dist/server/cto-monitor.js +281 -0
- package/dist/server/cto.d.ts +125 -0
- package/dist/server/cto.js +590 -0
- package/dist/server/deployments.d.ts +119 -0
- package/dist/server/deployments.js +325 -0
- package/dist/server/diff-snapshot.d.ts +20 -0
- package/dist/server/diff-snapshot.js +73 -0
- package/dist/server/done.d.ts +160 -0
- package/dist/server/done.js +488 -0
- package/dist/server/freeform.d.ts +55 -0
- package/dist/server/freeform.js +179 -0
- package/dist/server/handoff.d.ts +99 -0
- package/dist/server/handoff.js +575 -0
- package/dist/server/hetzner.d.ts +45 -0
- package/dist/server/hetzner.js +117 -0
- package/dist/server/icons.d.ts +8 -0
- package/dist/server/icons.js +195 -0
- package/dist/server/integration-job.d.ts +75 -0
- package/dist/server/integration-job.js +144 -0
- package/dist/server/integration-orchestrator.d.ts +211 -0
- package/dist/server/integration-orchestrator.js +1299 -0
- package/dist/server/integration-status.d.ts +48 -0
- package/dist/server/integration-status.js +71 -0
- package/dist/server/live-index.d.ts +295 -0
- package/dist/server/live-index.js +452 -0
- package/dist/server/model-test.d.ts +20 -0
- package/dist/server/model-test.js +100 -0
- package/dist/server/ntfy.d.ts +57 -0
- package/dist/server/ntfy.js +112 -0
- package/dist/server/pm-attachments.d.ts +35 -0
- package/dist/server/pm-attachments.js +181 -0
- package/dist/server/pm-runs.d.ts +58 -0
- package/dist/server/pm-runs.js +80 -0
- package/dist/server/preview.d.ts +174 -0
- package/dist/server/preview.js +641 -0
- package/dist/server/release.d.ts +88 -0
- package/dist/server/release.js +449 -0
- package/dist/server/reload.d.ts +194 -0
- package/dist/server/reload.js +586 -0
- package/dist/server/remote-validation.d.ts +132 -0
- package/dist/server/remote-validation.js +478 -0
- package/dist/server/repo-lock.d.ts +36 -0
- package/dist/server/repo-lock.js +141 -0
- package/dist/server/review-guard.d.ts +14 -0
- package/dist/server/review-guard.js +159 -0
- package/dist/server/review.d.ts +243 -0
- package/dist/server/review.js +1211 -0
- package/dist/server/routes/agents.d.ts +6 -0
- package/dist/server/routes/agents.js +28 -0
- package/dist/server/routes/auth.d.ts +60 -0
- package/dist/server/routes/auth.js +755 -0
- package/dist/server/routes/config.d.ts +20 -0
- package/dist/server/routes/config.js +347 -0
- package/dist/server/routes/debugger.d.ts +33 -0
- package/dist/server/routes/debugger.js +360 -0
- package/dist/server/routes/deployments.d.ts +3 -0
- package/dist/server/routes/deployments.js +16 -0
- package/dist/server/routes/docs.d.ts +8 -0
- package/dist/server/routes/docs.js +135 -0
- package/dist/server/routes/helpers.d.ts +21 -0
- package/dist/server/routes/helpers.js +171 -0
- package/dist/server/routes/index.d.ts +19 -0
- package/dist/server/routes/index.js +18 -0
- package/dist/server/routes/info.d.ts +17 -0
- package/dist/server/routes/info.js +177 -0
- package/dist/server/routes/inputs.d.ts +7 -0
- package/dist/server/routes/inputs.js +125 -0
- package/dist/server/routes/model-providers.d.ts +27 -0
- package/dist/server/routes/model-providers.js +94 -0
- package/dist/server/routes/models.d.ts +3 -0
- package/dist/server/routes/models.js +36 -0
- package/dist/server/routes/notify.d.ts +2 -0
- package/dist/server/routes/notify.js +17 -0
- package/dist/server/routes/playground.d.ts +29 -0
- package/dist/server/routes/playground.js +81 -0
- package/dist/server/routes/release.d.ts +20 -0
- package/dist/server/routes/release.js +86 -0
- package/dist/server/routes/router.d.ts +12 -0
- package/dist/server/routes/router.js +32 -0
- package/dist/server/routes/skill-registry.d.ts +5 -0
- package/dist/server/routes/skill-registry.js +51 -0
- package/dist/server/routes/tasks.d.ts +58 -0
- package/dist/server/routes/tasks.js +1442 -0
- package/dist/server/routes/transcribe.d.ts +2 -0
- package/dist/server/routes/transcribe.js +124 -0
- package/dist/server/routes/types.d.ts +68 -0
- package/dist/server/routes/types.js +1 -0
- package/dist/server/routes/ui.d.ts +5 -0
- package/dist/server/routes/ui.js +81 -0
- package/dist/server/routes/utils.d.ts +3 -0
- package/dist/server/routes/utils.js +23 -0
- package/dist/server/serve-reaper.d.ts +135 -0
- package/dist/server/serve-reaper.js +491 -0
- package/dist/server/server.d.ts +49 -0
- package/dist/server/server.js +2171 -0
- package/dist/server/supervisor.d.ts +89 -0
- package/dist/server/supervisor.js +231 -0
- package/dist/server/system.d.ts +198 -0
- package/dist/server/system.js +480 -0
- package/dist/server/task-check.d.ts +45 -0
- package/dist/server/task-check.js +71 -0
- package/dist/server/task-transitions.d.ts +51 -0
- package/dist/server/task-transitions.js +78 -0
- package/dist/server/task-watchdog.d.ts +158 -0
- package/dist/server/task-watchdog.js +681 -0
- package/dist/server/test-run.d.ts +28 -0
- package/dist/server/test-run.js +81 -0
- package/dist/server/watcher.d.ts +21 -0
- package/dist/server/watcher.js +194 -0
- package/dist/server/write.d.ts +94 -0
- package/dist/server/write.js +345 -0
- package/dist/ui/assets/AgentsView-CF4wRvHh.css +1 -0
- package/dist/ui/assets/AgentsView-D-myL-kA.js +1 -0
- package/dist/ui/assets/ContextView-D3TC-RSp.css +1 -0
- package/dist/ui/assets/ContextView-DsOqAdyE.js +4 -0
- package/dist/ui/assets/DashboardView-BOhsIJqO.js +1 -0
- package/dist/ui/assets/DashboardView-Ck9o0RP2.css +1 -0
- package/dist/ui/assets/DeploymentsView--iIUVfEH.css +1 -0
- package/dist/ui/assets/DeploymentsView-DXu_FYR2.js +1 -0
- package/dist/ui/assets/InputsView-24HVbVPk.js +1 -0
- package/dist/ui/assets/InputsView-BLb7GHtx.css +1 -0
- package/dist/ui/assets/LoginView-6QlGg6cx.css +1 -0
- package/dist/ui/assets/LoginView-BqupI0Lt.js +1 -0
- package/dist/ui/assets/ReleasesView-BEG1A0YH.css +1 -0
- package/dist/ui/assets/ReleasesView-CAgMuxpe.js +3 -0
- package/dist/ui/assets/SettingsView-CA-NYSMK.css +1 -0
- package/dist/ui/assets/SettingsView-O3iZSnjg.js +3 -0
- package/dist/ui/assets/WorkView-D8Tl6qwy.js +1 -0
- package/dist/ui/assets/WorkView-DMYL2s3W.css +1 -0
- package/dist/ui/assets/abnfDiagram-VCTEODGH-J5lkSnEE.js +1 -0
- package/dist/ui/assets/arc-BHZnmhhM.js +1 -0
- package/dist/ui/assets/architecture-7GRP2DOG-pLdFt-xS.js +1 -0
- package/dist/ui/assets/architectureDiagram-5GKGNRK7-C3k89uKX.js +36 -0
- package/dist/ui/assets/array-BifhSqXX.js +1 -0
- package/dist/ui/assets/blockDiagram-I7D4REHJ-AWNoBzop.js +129 -0
- package/dist/ui/assets/button-lbikqSph.js +1 -0
- package/dist/ui/assets/c4Diagram-7LVT6UL2-DKG1D5gd.js +38 -0
- package/dist/ui/assets/channel-gA4qBv3A.js +1 -0
- package/dist/ui/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/dist/ui/assets/chunk-4HAMMTFA-D1YR8lF_.js +62 -0
- package/dist/ui/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/dist/ui/assets/chunk-75Z2AOVW-5GuBxfsL.js +2 -0
- package/dist/ui/assets/chunk-DU6HZSFF-DfdNNqwa.js +127 -0
- package/dist/ui/assets/chunk-F27PBJKO-BPZzinQ4.js +1 -0
- package/dist/ui/assets/chunk-FOHPRMQF-l2z4K2jD.js +161 -0
- package/dist/ui/assets/chunk-GMAD6QVW-DGWvSKj5.js +72 -0
- package/dist/ui/assets/chunk-GVQU2GXP-D6Aw75wJ.js +1 -0
- package/dist/ui/assets/chunk-IMKFNOWR-B8mMBKCW.js +231 -0
- package/dist/ui/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/dist/ui/assets/chunk-L3NEJ4N5-D5OJuXYE.js +1 -0
- package/dist/ui/assets/chunk-OSK3NFVY-B7r9w2UW.js +10 -0
- package/dist/ui/assets/chunk-P2QGCYS3-C74X4AQX.js +1 -0
- package/dist/ui/assets/chunk-POPQ4Y6H-C5_u1gUS.js +1 -0
- package/dist/ui/assets/chunk-PWAF6VOD-DfoTLtxn.js +1 -0
- package/dist/ui/assets/chunk-SHT3W25Y-D40m2eqz.js +168 -0
- package/dist/ui/assets/chunk-SVP7TREG-euxi0Kap.js +88 -0
- package/dist/ui/assets/chunk-TICWLB2K-fkdxngzN.js +206 -0
- package/dist/ui/assets/chunk-XXDRQBXY-DFBUG-OT.js +1 -0
- package/dist/ui/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/dist/ui/assets/classDiagram-ZZMXUADV-BzW8bq2P.js +1 -0
- package/dist/ui/assets/classDiagram-v2-VYDZK3BY-BzW8bq2P.js +1 -0
- package/dist/ui/assets/cose-bilkent-JH36ORCC-BTcgMon1.js +1 -0
- package/dist/ui/assets/cynefin-OW5HDTMX-B5m_COsS.js +1 -0
- package/dist/ui/assets/cynefinDiagram-5FMLGOSQ-C-AG6CGe.js +62 -0
- package/dist/ui/assets/cytoscape.esm-FBntH-9t.js +321 -0
- package/dist/ui/assets/dagre-GXQ25YYZ-DDfDnp8L.js +4 -0
- package/dist/ui/assets/dagre-PrKaheQc.js +1 -0
- package/dist/ui/assets/defaultLocale-BFoDCU3G.js +1 -0
- package/dist/ui/assets/diagram-S7CK7UJ4-DjQZAlEY.js +30 -0
- package/dist/ui/assets/diagram-UQ7AKVKN-DAZ9yp1B.js +41 -0
- package/dist/ui/assets/diagram-VSXAHHWV-BWepUKJD.js +3 -0
- package/dist/ui/assets/diagram-VX7I27RA-EcV1J81b.js +24 -0
- package/dist/ui/assets/diagram-Z3DM3KII-Dbz7XU_K.js +24 -0
- package/dist/ui/assets/dist-DTg6UBE_.js +1 -0
- package/dist/ui/assets/ebnfDiagram-PWID7BFC-BUyQw8Mm.js +1 -0
- package/dist/ui/assets/erDiagram-RLTQ6QDP-WVf8ukKt.js +99 -0
- package/dist/ui/assets/eventmodeling-NTZA5JFV-DHqyLOAn.js +1 -0
- package/dist/ui/assets/flowDiagram-HODETNUW-CYk_ze5K.js +1 -0
- package/dist/ui/assets/ganttDiagram-EL5Y4UJY-rB4MZuB-.js +292 -0
- package/dist/ui/assets/gitGraph-4MIJSDKK-BOTWM8dY.js +1 -0
- package/dist/ui/assets/gitGraphDiagram-WWUBYQGX-eYscuhtP.js +106 -0
- package/dist/ui/assets/graphlib-DS17s2tU.js +1 -0
- package/dist/ui/assets/index-BACBfnga.css +1 -0
- package/dist/ui/assets/index-BOQ-ust6.js +26 -0
- package/dist/ui/assets/info-A6RAGUB7-_67wOORe.js +1 -0
- package/dist/ui/assets/infoDiagram-27XIBGKW-XVXbddTA.js +2 -0
- package/dist/ui/assets/init-C-OQMol4.js +1 -0
- package/dist/ui/assets/ishikawaDiagram-5VMMS53U-ClLNiEru.js +70 -0
- package/dist/ui/assets/journeyDiagram-3NMN7TZE-NRawjR6i.js +139 -0
- package/dist/ui/assets/kanban-definition-UXKFOSKX-BgSzBfIx.js +89 -0
- package/dist/ui/assets/katex-DolUETbr.js +257 -0
- package/dist/ui/assets/line-KAyfuul4.js +1 -0
- package/dist/ui/assets/linear-cCCPOpu7.js +1 -0
- package/dist/ui/assets/mermaid-parser.core-CgXZk1iN.js +7 -0
- package/dist/ui/assets/mermaid.core-BUUkChHW.js +44 -0
- package/dist/ui/assets/mindmap-definition-YA3MSWOX-Cpn7vW4r.js +96 -0
- package/dist/ui/assets/ordinal-BDEzSJ7C.js +1 -0
- package/dist/ui/assets/packet-AYTQ26CC-0lZwM-d6.js +1 -0
- package/dist/ui/assets/path-COt_16Va.js +1 -0
- package/dist/ui/assets/pegDiagram-XKGWAZYB-impy0inn.js +1 -0
- package/dist/ui/assets/pie-WAS4IAKB-CqfdGHYg.js +1 -0
- package/dist/ui/assets/pieDiagram-E7YTZNPT-CxjL4I1h.js +39 -0
- package/dist/ui/assets/quadrantDiagram-AXDQQJYC-Cjd1QMIe.js +7 -0
- package/dist/ui/assets/radar-RG4KPBEZ-CRkQIwiv.js +1 -0
- package/dist/ui/assets/railroad-74A4TZTK-i67XSWTB.js +1 -0
- package/dist/ui/assets/railroad-abnf-HS5TGJTU-Cv9m5aS3.js +1 -0
- package/dist/ui/assets/railroad-ebnf-LZEXJU2U-C5ZIn-Jh.js +1 -0
- package/dist/ui/assets/railroad-peg-WCYAUIDC-CGra9Oq-.js +1 -0
- package/dist/ui/assets/railroadDiagram-O6MQD6OU-_pK0qyaY.js +1 -0
- package/dist/ui/assets/releases-B0WNV-SY.js +1 -0
- package/dist/ui/assets/repoos-cto-square.webp +0 -0
- package/dist/ui/assets/repoos-helpful-pm-square.webp +0 -0
- package/dist/ui/assets/repoos-orchestrator-square.webp +0 -0
- package/dist/ui/assets/repoos-performance-agent-square.webp +0 -0
- package/dist/ui/assets/repoos-ross-from-friends-square.webp +0 -0
- package/dist/ui/assets/repoos-tech-debt-agent-square.webp +0 -0
- package/dist/ui/assets/requirementDiagram-BXWQKSXE-CRrFX-yw.js +84 -0
- package/dist/ui/assets/rough.esm-By172zw-.js +1 -0
- package/dist/ui/assets/sankeyDiagram-P5KCCOFB-X_xFRj9E.js +40 -0
- package/dist/ui/assets/sequenceDiagram-WJ2MYXX4-Byb49lKf.js +162 -0
- package/dist/ui/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
- package/dist/ui/assets/src-BH-TyZbA.js +1 -0
- package/dist/ui/assets/stateDiagram-D77RDMKH-CzaPrqYF.js +1 -0
- package/dist/ui/assets/stateDiagram-v2-MP3YSRHH-BCXckz7K.js +1 -0
- package/dist/ui/assets/swimlanes-42K2YHIH-Cx_1lnqr.js +1 -0
- package/dist/ui/assets/swimlanesDiagram-VR7AAH4N-54qsKi6A.js +8 -0
- package/dist/ui/assets/timeline-definition-24CTP7MA-B1IbZPQ-.js +120 -0
- package/dist/ui/assets/treeView-Q6P3EWNA-DFWhVE3d.js +1 -0
- package/dist/ui/assets/treemap-WGGIJYW6-BmbYPThn.js +1 -0
- package/dist/ui/assets/vendor-ui-DPm7zLxi.js +3 -0
- package/dist/ui/assets/vendor-vue-CobgyEJp.js +1 -0
- package/dist/ui/assets/vennDiagram-4TSXK5OY-Ae2AtRpt.js +34 -0
- package/dist/ui/assets/wardley-WFR3VGLG-BtD4X4tL.js +1 -0
- package/dist/ui/assets/wardleyDiagram-VM6X3IG4-B3YN2fTd.js +78 -0
- package/dist/ui/assets/xychartDiagram-S5SC5T6Z-CIzJfMKA.js +7 -0
- package/dist/ui/favicon.svg +11 -0
- package/dist/ui/index.html +49 -0
- package/dist/ui/sw.js +48 -0
- package/package.json +91 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication module for RepoOS.
|
|
3
|
+
*
|
|
4
|
+
* Opt-in, disabled by default. When enabled, protects all UI, API, and SSE
|
|
5
|
+
* routes with server-side sessions and HttpOnly cookies. Supports email OTP
|
|
6
|
+
* (via Resend) and Google OAuth as login methods.
|
|
7
|
+
*
|
|
8
|
+
* Zero runtime dependencies — native crypto, fetch, and SQLite.
|
|
9
|
+
*/
|
|
10
|
+
import { randomBytes, createHash, timingSafeEqual } from "node:crypto";
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Crypto utilities
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
/** Generate a cryptographically random hex string. */
|
|
15
|
+
export function randomHex(bytes = 32) {
|
|
16
|
+
return randomBytes(bytes).toString("hex");
|
|
17
|
+
}
|
|
18
|
+
/** Generate a 6-digit OTP code. */
|
|
19
|
+
export function generateOtp() {
|
|
20
|
+
return String(randomBytes(4).readUInt32BE(0) % 1_000_000).padStart(6, "0");
|
|
21
|
+
}
|
|
22
|
+
/** SHA-256 hash a string (for OTP storage). */
|
|
23
|
+
export function hashOtp(code) {
|
|
24
|
+
return createHash("sha256").update(code).digest("hex");
|
|
25
|
+
}
|
|
26
|
+
/** Constant-time string comparison. */
|
|
27
|
+
export function timingSafeEqualStr(a, b) {
|
|
28
|
+
if (a.length !== b.length)
|
|
29
|
+
return false;
|
|
30
|
+
return timingSafeEqual(Buffer.from(a, "utf8"), Buffer.from(b, "utf8"));
|
|
31
|
+
}
|
|
32
|
+
/** Generate a random session token. */
|
|
33
|
+
export function generateSessionToken() {
|
|
34
|
+
return randomHex(32);
|
|
35
|
+
}
|
|
36
|
+
/** Hash a session token for storage. */
|
|
37
|
+
export function hashSessionToken(token) {
|
|
38
|
+
return createHash("sha256").update(token).digest("hex");
|
|
39
|
+
}
|
|
40
|
+
/** Generate a CSRF-like state parameter for OAuth. */
|
|
41
|
+
export function generateOAuthState() {
|
|
42
|
+
return randomHex(16);
|
|
43
|
+
}
|
|
44
|
+
/** Generate a PKCE code verifier (43-128 chars, unreserved chars only). */
|
|
45
|
+
export function generatePkceVerifier() {
|
|
46
|
+
const buf = randomBytes(32);
|
|
47
|
+
// base64url encode
|
|
48
|
+
return buf.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
49
|
+
}
|
|
50
|
+
/** SHA-256 hash for PKCE code challenge, base64url encoded. */
|
|
51
|
+
export function pkceChallenge(verifier) {
|
|
52
|
+
return createHash("sha256")
|
|
53
|
+
.update(verifier)
|
|
54
|
+
.digest("base64")
|
|
55
|
+
.replace(/\+/g, "-")
|
|
56
|
+
.replace(/\//g, "_")
|
|
57
|
+
.replace(/=+$/, "");
|
|
58
|
+
}
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
// Session cookie helpers
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
export const SESSION_COOKIE_NAME = "repoos_session";
|
|
63
|
+
export const DEFAULT_SESSION_MAX_AGE = 7 * 24 * 60 * 60; // 7 days
|
|
64
|
+
export function buildSessionCookie(token, maxAge, secure) {
|
|
65
|
+
const parts = [
|
|
66
|
+
`${SESSION_COOKIE_NAME}=${token}`,
|
|
67
|
+
"HttpOnly",
|
|
68
|
+
`Path=/`,
|
|
69
|
+
`SameSite=Lax`,
|
|
70
|
+
`Max-Age=${maxAge}`,
|
|
71
|
+
];
|
|
72
|
+
if (secure)
|
|
73
|
+
parts.push("Secure");
|
|
74
|
+
return parts.join("; ");
|
|
75
|
+
}
|
|
76
|
+
export function parseCookies(header) {
|
|
77
|
+
const out = {};
|
|
78
|
+
if (!header)
|
|
79
|
+
return out;
|
|
80
|
+
for (const part of header.split(";")) {
|
|
81
|
+
const [key, ...rest] = part.split("=");
|
|
82
|
+
if (key && rest.length)
|
|
83
|
+
out[key.trim()] = rest.join("=").trim();
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
// Email validation
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
export function isValidEmail(email) {
|
|
91
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
92
|
+
}
|
|
93
|
+
export class RateLimiter {
|
|
94
|
+
entries = new Map();
|
|
95
|
+
windowMs;
|
|
96
|
+
maxAttempts;
|
|
97
|
+
constructor(windowMs, maxAttempts) {
|
|
98
|
+
this.windowMs = windowMs;
|
|
99
|
+
this.maxAttempts = maxAttempts;
|
|
100
|
+
}
|
|
101
|
+
/** Returns true if the request should be allowed. */
|
|
102
|
+
tryAcquire(key) {
|
|
103
|
+
const now = Date.now();
|
|
104
|
+
const entry = this.entries.get(key);
|
|
105
|
+
if (!entry || now > entry.resetAt) {
|
|
106
|
+
this.entries.set(key, { count: 1, resetAt: now + this.windowMs });
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
if (entry.count >= this.maxAttempts)
|
|
110
|
+
return false;
|
|
111
|
+
entry.count++;
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
/** Reset a key (e.g. after successful OTP verify). */
|
|
115
|
+
reset(key) {
|
|
116
|
+
this.entries.delete(key);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// OTP request: max 5 per email per 10 minutes
|
|
120
|
+
export const otpRequestLimiter = new RateLimiter(10 * 60 * 1000, 5);
|
|
121
|
+
// OTP verify: max 5 failed attempts per email per 10 minutes
|
|
122
|
+
export const otpVerifyLimiter = new RateLimiter(10 * 60 * 1000, 5);
|
|
123
|
+
// Global: max 100 OTP requests per IP per hour
|
|
124
|
+
export const globalRateLimiter = new RateLimiter(60 * 60 * 1000, 100);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { RepoOSConfig, Task } from "./types.js";
|
|
2
|
+
/** Outcome of a single bootstrap step. */
|
|
3
|
+
export interface BootstrapStep {
|
|
4
|
+
name: string;
|
|
5
|
+
ok: boolean;
|
|
6
|
+
durationMs: number;
|
|
7
|
+
detail?: string;
|
|
8
|
+
}
|
|
9
|
+
/** Full bootstrap result — surfaced in the context pack and telemetry. */
|
|
10
|
+
export interface BootstrapResult {
|
|
11
|
+
ok: boolean;
|
|
12
|
+
/** All steps executed (successful or failed). */
|
|
13
|
+
steps: BootstrapStep[];
|
|
14
|
+
/** Total wall-clock duration in ms. */
|
|
15
|
+
durationMs: number;
|
|
16
|
+
/** When !ok, the first failing reason (human-readable). */
|
|
17
|
+
reason?: string;
|
|
18
|
+
}
|
|
19
|
+
/** The package manager detected in a worktree, or null. */
|
|
20
|
+
export type PackageManager = "bun" | "npm" | null;
|
|
21
|
+
/**
|
|
22
|
+
* Detect the package manager for a directory. Checks lockfiles first (the
|
|
23
|
+
* authoritative signal) then falls back to binary probe.
|
|
24
|
+
*/
|
|
25
|
+
export declare function detectPackageManager(dir: string): PackageManager;
|
|
26
|
+
/**
|
|
27
|
+
* Run the bootstrap phase for a task in its worktree. Returns a structured
|
|
28
|
+
* result with per-step timing — callers surface failures as launch blockers
|
|
29
|
+
* and record telemetry.
|
|
30
|
+
*
|
|
31
|
+
* Steps (in order):
|
|
32
|
+
* 1. Validate the repo root is readable and has a valid config
|
|
33
|
+
* 2. Validate the worktree path exists and is within expected bounds
|
|
34
|
+
* 3. Check the orchestration build is not obviously broken
|
|
35
|
+
* 4. Install dependencies if node_modules is missing
|
|
36
|
+
*
|
|
37
|
+
* The agent is never launched on step failure (the caller checks `result.ok`).
|
|
38
|
+
* Every step that fails stops the bootstrap: later steps are skipped and
|
|
39
|
+
* recorded as such.
|
|
40
|
+
*/
|
|
41
|
+
export declare function bootstrap(config: RepoOSConfig, task: Task, branch: string, cwd: string): Promise<BootstrapResult>;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bootstrap phase that runs before every agent turn (initial and resumed).
|
|
3
|
+
*
|
|
4
|
+
* RepoOS can deterministically prepare a worktree before an agent sees it:
|
|
5
|
+
* validate the root/worktree/branch, make dev dependencies available, and
|
|
6
|
+
* confirm the RepoOS CLI used for orchestration is trustworthy. Agents should
|
|
7
|
+
* never spend tokens on predictable setup.
|
|
8
|
+
*
|
|
9
|
+
* All mutations are safe: bootsrap never rewrites source, task content,
|
|
10
|
+
* lockfiles, or unrelated user changes. Failures stop the launch with a clear
|
|
11
|
+
* actionable error and the worktree stays recoverable.
|
|
12
|
+
*
|
|
13
|
+
* Zero runtime deps — `node:child_process` only. Like the rest of core, every
|
|
14
|
+
* check here is best-effort and degrades gracefully.
|
|
15
|
+
*/
|
|
16
|
+
import { spawnSync } from "node:child_process";
|
|
17
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
/**
|
|
20
|
+
* Detect the package manager for a directory. Checks lockfiles first (the
|
|
21
|
+
* authoritative signal) then falls back to binary probe.
|
|
22
|
+
*/
|
|
23
|
+
export function detectPackageManager(dir) {
|
|
24
|
+
if (existsSync(join(dir, "bun.lock")) || existsSync(join(dir, "bun.lockb"))) {
|
|
25
|
+
return "bun";
|
|
26
|
+
}
|
|
27
|
+
if (existsSync(join(dir, "package-lock.json"))) {
|
|
28
|
+
return "npm";
|
|
29
|
+
}
|
|
30
|
+
if (existsSync(join(dir, "package.json"))) {
|
|
31
|
+
const probe = spawnSync("bun", ["--version"], { cwd: dir, timeout: 4000 });
|
|
32
|
+
if (probe.status === 0)
|
|
33
|
+
return "bun";
|
|
34
|
+
const npmProbe = spawnSync("npm", ["--version"], { cwd: dir, timeout: 4000 });
|
|
35
|
+
if (npmProbe.status === 0)
|
|
36
|
+
return "npm";
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Which install command to use. `bun install --frozen-lockfile` never mutates
|
|
42
|
+
* the lockfile; `npm ci` does the same (requires an existing lockfile). Both
|
|
43
|
+
* reuse the package manager's cache/store so the cost on a warm cache is low.
|
|
44
|
+
*/
|
|
45
|
+
function installCommand(pm, dir) {
|
|
46
|
+
if (pm === "bun") {
|
|
47
|
+
return { cmd: "bun", args: ["install", "--frozen-lockfile"] };
|
|
48
|
+
}
|
|
49
|
+
if (pm === "npm") {
|
|
50
|
+
if (!existsSync(join(dir, "package-lock.json"))) {
|
|
51
|
+
return { cmd: "npm", args: ["install"] };
|
|
52
|
+
}
|
|
53
|
+
return { cmd: "npm", args: ["ci"] };
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
async function timed(fn) {
|
|
58
|
+
const start = Date.now();
|
|
59
|
+
const value = await fn();
|
|
60
|
+
return { value, durationMs: Date.now() - start };
|
|
61
|
+
}
|
|
62
|
+
function timedSync(fn) {
|
|
63
|
+
const start = Date.now();
|
|
64
|
+
const value = fn();
|
|
65
|
+
return { value, durationMs: Date.now() - start };
|
|
66
|
+
}
|
|
67
|
+
const STEP_NAMES = {
|
|
68
|
+
VALIDATE_ROOT: "validate-repo-root",
|
|
69
|
+
VALIDATE_WORKTREE: "validate-worktree",
|
|
70
|
+
CHECK_BUILD: "check-orchestration-build",
|
|
71
|
+
INSTALL_DEPS: "install-dependencies",
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Check whether the RepoOS build used for orchestration (the CLI the agent
|
|
75
|
+
* will run for `repoos check` inside the worktree) is trustworthy.
|
|
76
|
+
*
|
|
77
|
+
* The check only blocks when evidence of a compiled build system exists:
|
|
78
|
+
* a `src/` directory AND a `package.json` with a build script. Without both,
|
|
79
|
+
* there is no compiled output to check — the bootstrap skips this step.
|
|
80
|
+
*/
|
|
81
|
+
function checkOrchestrationBuild(config, cwd) {
|
|
82
|
+
const hasSrc = existsSync(join(config.root, "src"));
|
|
83
|
+
const pkgPath = join(config.root, "package.json");
|
|
84
|
+
let hasBuild = false;
|
|
85
|
+
if (existsSync(pkgPath)) {
|
|
86
|
+
try {
|
|
87
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
88
|
+
hasBuild = typeof pkg?.scripts?.build === "string";
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
/* unreadable */
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (!hasSrc || !hasBuild) {
|
|
95
|
+
return { ok: true, detail: "no compiled build system detected — skipping build check" };
|
|
96
|
+
}
|
|
97
|
+
const buildMarker = join(config.root, "dist", ".build-info.json");
|
|
98
|
+
if (!existsSync(buildMarker)) {
|
|
99
|
+
return {
|
|
100
|
+
ok: false,
|
|
101
|
+
detail: "dist/.build-info.json missing — run `bun run build` in the main checkout",
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return { ok: true, detail: "build marker present" };
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Validate the worktree directory exists and is safe to use. Returns true
|
|
108
|
+
* when the cwd is a real directory inside (or equal to) the repo root or
|
|
109
|
+
* its worktrees directory. Never rewrites anything.
|
|
110
|
+
*
|
|
111
|
+
* Uses realpathSync on all paths so macOS symlinks (/var → /private/var)
|
|
112
|
+
* don't cause false mismatches.
|
|
113
|
+
*/
|
|
114
|
+
function validateWorktree(config, cwd) {
|
|
115
|
+
if (!existsSync(cwd)) {
|
|
116
|
+
return { ok: false, detail: `worktree path does not exist: ${cwd}` };
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
const normalizedCwd = realpathSync(cwd);
|
|
120
|
+
const normalizedRoot = realpathSync(config.root);
|
|
121
|
+
const wtDir = join(config.root, "..");
|
|
122
|
+
const normalizedWtDir = realpathSync(wtDir);
|
|
123
|
+
if (normalizedCwd === normalizedRoot ||
|
|
124
|
+
normalizedCwd.startsWith(normalizedRoot + "/") ||
|
|
125
|
+
normalizedCwd.startsWith(normalizedWtDir + "/")) {
|
|
126
|
+
return { ok: true, detail: "worktree path valid" };
|
|
127
|
+
}
|
|
128
|
+
return { ok: false, detail: `worktree path outside expected locations: ${cwd}` };
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
// realpathSync fails if the path doesn't exist (already caught above)
|
|
132
|
+
return { ok: false, detail: `cannot resolve worktree path: ${cwd}` };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Install development dependencies in the worktree when `node_modules` is
|
|
137
|
+
* missing. Uses the detected package manager with a lockfile-respecting command
|
|
138
|
+
* so the lockfile is never mutated. No-op when `node_modules` already exists.
|
|
139
|
+
*
|
|
140
|
+
* Safe: `--frozen-lockfile` / `npm ci` never rewrite lockfiles or package.json.
|
|
141
|
+
* The package-manager cache (e.g. `~/.bun/install/cache`) is reused so a cold
|
|
142
|
+
* network fetch is only needed on the first-ever install.
|
|
143
|
+
*/
|
|
144
|
+
function installDeps(dir) {
|
|
145
|
+
if (existsSync(join(dir, "node_modules"))) {
|
|
146
|
+
return { ok: true, detail: "node_modules already present" };
|
|
147
|
+
}
|
|
148
|
+
const pm = detectPackageManager(dir);
|
|
149
|
+
if (!pm) {
|
|
150
|
+
return { ok: true, detail: "no package.json — nothing to install" };
|
|
151
|
+
}
|
|
152
|
+
const cmd = installCommand(pm, dir);
|
|
153
|
+
if (!cmd) {
|
|
154
|
+
return { ok: true, detail: `package manager ${pm} detected but no install command available` };
|
|
155
|
+
}
|
|
156
|
+
const proc = spawnSync(cmd.cmd, cmd.args, { cwd: dir, timeout: 120_000 });
|
|
157
|
+
if (proc.status !== 0) {
|
|
158
|
+
const err = proc.stderr?.toString("utf8").trim().split("\n").slice(-3).join(" ") || "unknown error";
|
|
159
|
+
return { ok: false, detail: `${cmd.cmd} install failed: ${err}` };
|
|
160
|
+
}
|
|
161
|
+
return { ok: true, detail: `dependencies installed with ${cmd.cmd}` };
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Run the bootstrap phase for a task in its worktree. Returns a structured
|
|
165
|
+
* result with per-step timing — callers surface failures as launch blockers
|
|
166
|
+
* and record telemetry.
|
|
167
|
+
*
|
|
168
|
+
* Steps (in order):
|
|
169
|
+
* 1. Validate the repo root is readable and has a valid config
|
|
170
|
+
* 2. Validate the worktree path exists and is within expected bounds
|
|
171
|
+
* 3. Check the orchestration build is not obviously broken
|
|
172
|
+
* 4. Install dependencies if node_modules is missing
|
|
173
|
+
*
|
|
174
|
+
* The agent is never launched on step failure (the caller checks `result.ok`).
|
|
175
|
+
* Every step that fails stops the bootstrap: later steps are skipped and
|
|
176
|
+
* recorded as such.
|
|
177
|
+
*/
|
|
178
|
+
export async function bootstrap(config, task, branch, cwd) {
|
|
179
|
+
const overallStart = Date.now();
|
|
180
|
+
const steps = [];
|
|
181
|
+
const add = (name, ok, durationMs, detail) => {
|
|
182
|
+
steps.push({ name, ok, durationMs, detail });
|
|
183
|
+
return ok;
|
|
184
|
+
};
|
|
185
|
+
// Step 1: validate repo root
|
|
186
|
+
const { value: rootOk, durationMs: rootDur } = timedSync(() => {
|
|
187
|
+
if (!existsSync(config.root)) {
|
|
188
|
+
return { ok: false, detail: `repo root does not exist: ${config.root}` };
|
|
189
|
+
}
|
|
190
|
+
if (!existsSync(join(config.root, config.workDir))) {
|
|
191
|
+
return { ok: false, detail: `work dir missing in root: ${config.workDir}` };
|
|
192
|
+
}
|
|
193
|
+
return { ok: true, detail: "repo root valid" };
|
|
194
|
+
});
|
|
195
|
+
if (!add(STEP_NAMES.VALIDATE_ROOT, rootOk.ok, rootDur, rootOk.detail)) {
|
|
196
|
+
return {
|
|
197
|
+
ok: false,
|
|
198
|
+
steps,
|
|
199
|
+
durationMs: Date.now() - overallStart,
|
|
200
|
+
reason: rootOk.detail,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
// Step 2: validate worktree
|
|
204
|
+
const { value: wtOk, durationMs: wtDur } = timedSync(() => validateWorktree(config, cwd));
|
|
205
|
+
if (!add(STEP_NAMES.VALIDATE_WORKTREE, wtOk.ok, wtDur, wtOk.detail)) {
|
|
206
|
+
return {
|
|
207
|
+
ok: false,
|
|
208
|
+
steps,
|
|
209
|
+
durationMs: Date.now() - overallStart,
|
|
210
|
+
reason: wtOk.detail,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
// Step 3: check orchestration build
|
|
214
|
+
const { value: buildOk, durationMs: buildDur } = timedSync(() => checkOrchestrationBuild(config, cwd));
|
|
215
|
+
if (!add(STEP_NAMES.CHECK_BUILD, buildOk.ok, buildDur, buildOk.detail)) {
|
|
216
|
+
return {
|
|
217
|
+
ok: false,
|
|
218
|
+
steps,
|
|
219
|
+
durationMs: Date.now() - overallStart,
|
|
220
|
+
reason: buildOk.detail,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
// Step 4: install dependencies (async — may spawn a child process)
|
|
224
|
+
const { value: depsOk, durationMs: depsDur } = await timed(async () => installDeps(cwd));
|
|
225
|
+
add(STEP_NAMES.INSTALL_DEPS, depsOk.ok, depsDur, depsOk.detail);
|
|
226
|
+
const durationMs = Date.now() - overallStart;
|
|
227
|
+
if (!depsOk.ok) {
|
|
228
|
+
return {
|
|
229
|
+
ok: false,
|
|
230
|
+
steps,
|
|
231
|
+
durationMs,
|
|
232
|
+
reason: depsOk.detail,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
return { ok: true, steps, durationMs };
|
|
236
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export interface BuildCheckResult {
|
|
2
|
+
stale: boolean;
|
|
3
|
+
/** Human-readable message, or null if no issue. */
|
|
4
|
+
message: string | null;
|
|
5
|
+
/**
|
|
6
|
+
* Machine-readable code:
|
|
7
|
+
* 'fresh' — build is up to date
|
|
8
|
+
* 'stale' — src/ changed since last build
|
|
9
|
+
* 'no-marker' — dist/.build-info.json missing (not a RepoOS build)
|
|
10
|
+
* 'no-build' — dist/ does not exist
|
|
11
|
+
* 'corrupt' — dist/.build-info.json exists but is unreadable
|
|
12
|
+
* 'dev-mode' — running from src/, not dist/ (node --strip-types)
|
|
13
|
+
* 'published' — no src/ directory (npm/published install)
|
|
14
|
+
*/
|
|
15
|
+
code: "fresh" | "stale" | "no-marker" | "no-build" | "corrupt" | "dev-mode" | "published";
|
|
16
|
+
/**
|
|
17
|
+
* Whether RepoOS's build-staleness contract applies to this checkout. True
|
|
18
|
+
* only once a `dist/.build-info.json` marker exists: that marker is written
|
|
19
|
+
* by RepoOS's own `bun run build`, so its absence (or the absence of `dist/`
|
|
20
|
+
* entirely) means the project uses a different build pipeline and staleness
|
|
21
|
+
* cannot be assessed there. `repoos check` degrades those to a skip instead
|
|
22
|
+
* of a hard failure; `stale` stays true so callers that need a usable build
|
|
23
|
+
* still trigger one.
|
|
24
|
+
*/
|
|
25
|
+
applicable: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the package root relative to the running binary.
|
|
29
|
+
* Same resolution pattern as findUiHtml in server.ts.
|
|
30
|
+
*/
|
|
31
|
+
export declare function findPackageRoot(): string | null;
|
|
32
|
+
/**
|
|
33
|
+
* Staleness check against an explicit repo root — used for a task's worktree
|
|
34
|
+
* before previewing it. A worktree is stale when its `src/` hash no longer
|
|
35
|
+
* matches its own `dist/.build-info.json` (or the marker is missing). A
|
|
36
|
+
* checkout with no `src/` is treated as published (nothing to check).
|
|
37
|
+
*/
|
|
38
|
+
export declare function checkBuildForRoot(root: string): BuildCheckResult;
|
|
39
|
+
/**
|
|
40
|
+
* Whether a build invocation may skip its work entirely. Only a checkout whose
|
|
41
|
+
* marker proves `src/` is unchanged (`code: "fresh"`) may skip; every other
|
|
42
|
+
* outcome — a missing or mismatched marker, a missing `dist/`, a published
|
|
43
|
+
* install — must build. `force` (the `--force` flag / `REPOOS_FORCE_BUILD=1`)
|
|
44
|
+
* always builds, even when the marker says fresh.
|
|
45
|
+
*
|
|
46
|
+
* This is the single decision every build caller shares. `scripts/build.mjs`
|
|
47
|
+
* turns it into the skip; `repoos check` calls `bun run build` and inherits it,
|
|
48
|
+
* so staleness is never silently absorbed (check reports staleness first in its
|
|
49
|
+
* own step, then the build step repairs).
|
|
50
|
+
*/
|
|
51
|
+
export declare function shouldSkipBuild(result: BuildCheckResult, force?: boolean): boolean;
|
|
52
|
+
export declare function checkBuild(): BuildCheckResult;
|
|
53
|
+
/**
|
|
54
|
+
* Read the build timestamp for a checkout. The timestamp lives in
|
|
55
|
+
* `dist/.build-stamp.json` (gitignored) rather than `dist/.build-info.json`,
|
|
56
|
+
* so the marker that staleness and reload compare stays byte-identical across
|
|
57
|
+
* rebuilds of identical source. Falls back to a legacy inline `generatedAt` in
|
|
58
|
+
* the marker so installs built before the split still report a build age.
|
|
59
|
+
* Best-effort: null when neither file is readable.
|
|
60
|
+
*/
|
|
61
|
+
export declare function readBuildStamp(root: string): string | null;
|
|
62
|
+
/**
|
|
63
|
+
* Build version + timestamp for the running install, resolved relative to THIS
|
|
64
|
+
* module so it works for every layout:
|
|
65
|
+
*
|
|
66
|
+
* - standalone (curl / `repoos upgrade`): <installRoot>/core/build.js
|
|
67
|
+
* → `.build-info.json` + `.build-stamp.json` sit at <installRoot>
|
|
68
|
+
* - linked dev build (compiled): <repo>/dist/core/build.js
|
|
69
|
+
* → both files sit at <repo>/dist
|
|
70
|
+
* - source run (`bun src/cli/index.ts`): <repo>/src/core/build.ts
|
|
71
|
+
* → no marker beside it; fall back to <repo>/dist, then package.json
|
|
72
|
+
*
|
|
73
|
+
* The old path read `package.json` only — but the release tarball
|
|
74
|
+
* (`tar -C dist .`) ships `.build-info.json` (`{ hash, version }`) and
|
|
75
|
+
* `.build-stamp.json`, NOT `package.json`, so every standalone install
|
|
76
|
+
* reported its version as "unknown". `.build-info.json` is the source of truth
|
|
77
|
+
* here; `package.json` is just the last-resort fallback for a source checkout.
|
|
78
|
+
*/
|
|
79
|
+
export declare function readBuildMeta(): {
|
|
80
|
+
version: string | null;
|
|
81
|
+
buildAt: string | null;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* The dir-relative core of {@link readBuildMeta}, split out so it can be tested
|
|
85
|
+
* against synthetic layouts. `markerDir` is where `.build-info.json` /
|
|
86
|
+
* `.build-stamp.json` are expected to sit (with `<markerDir>/../dist` tried as
|
|
87
|
+
* the source-checkout fallback).
|
|
88
|
+
*/
|
|
89
|
+
export declare function readBuildMetaFrom(markerDir: string): {
|
|
90
|
+
version: string | null;
|
|
91
|
+
buildAt: string | null;
|
|
92
|
+
};
|