feat: hosted cloud#100
Conversation
|
Important Review skippedToo many files! This PR contains 175 files, which is 25 over the limit of 150. To get a review, narrow the scope: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (175)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
🚀 Preview DeployedYour changes have been deployed to a preview environment: 🌐 Landing Page: https://pr-100.preview.caplets.dev Built from commit ac86ce3 🤖 This comment updates automatically with each push. |
91e9ecb to
379bdec
Compare
|
| Filename | Overview |
|---|---|
| packages/core/src/cli.ts | Adds cloud auth (login/status/logout/workspaces/switch), attach, daemon, and doctor commands; waitForCloudLogin now correctly continues polling on workspace_selection_required; switch command missing proactive token refresh. |
| packages/core/src/cloud-auth/client.ts | New cloud auth HTTP client with login polling, token exchange, refresh, workspace switching, and secret redaction; well-structured and handles errors cleanly. |
| packages/core/src/cloud-auth/store.ts | Credential store with mode-0600 file writes, schema migration, and platform-aware path resolution; secure and well-tested shape. |
| packages/core/src/cloud/client.ts | CapletsCloudClient now fully serializes allowedCapletIds, fallbackConsent, and projectFiles in registerPresence, addressing prior review concerns. |
| packages/core/src/cloud/apply.ts | Remote file apply with path-traversal and symlink guards; realpathSync call at line 55 can throw ENOENT if the project root is deleted before apply. |
| packages/core/src/cloud/sync.ts | projectSyncFiles reads all manifest files with readFileSync("utf8") without filtering binary files, potentially sending garbled content to the cloud registration endpoint. |
| packages/core/src/cloud/presence.ts | ProjectBindingSessionManager wraps cloud presence lifecycle (register, heartbeat, updateCaplets, stop) with idempotent start and clean shutdown. |
| packages/core/src/project-binding/session.ts | New WebSocket-based project binding session with heartbeat, one-retry reconnect, and proper cleanup; bearer token correctly passed via Sec-WebSocket-Protocol subprotocol. |
| packages/core/src/project-binding/sync-filter.ts | New manifest builder with proper gitignore negation support and correct anchored-pattern semantics; addresses both issues flagged in previous review. |
| packages/core/src/remote/selection.ts | Remote selection resolves self-hosted vs. hosted-cloud mode, performs proactive token refresh, and validates workspace match before building the remote config. |
Sequence Diagram
sequenceDiagram
participant CLI
participant CloudAuthClient
participant CloudAuthStore
participant RemoteSelection
participant ProjectBindingSession
participant CloudServer
CLI->>CloudAuthClient: startLogin(deviceName, workspace?)
CloudAuthClient->>CloudServer: POST /api/cloud-client/login/start
CloudServer-->>CloudAuthClient: "{loginId, loginUrl, userCode}"
CLI->>CLI: openBrowserUrl(loginUrl)
loop poll until completed or timeout
CLI->>CloudAuthClient: pollLogin(loginId)
CloudAuthClient->>CloudServer: "GET /api/cloud-client/login/{loginId}"
CloudServer-->>CloudAuthClient: "pending | workspace_selection_required | completed"
end
CLI->>CloudAuthClient: exchangeToken(loginId, oneTimeCode)
CloudAuthClient->>CloudServer: POST /api/cloud-client/token
CloudServer-->>CloudAuthClient: "{accessToken, refreshToken, expiresAt, ...}"
CLI->>CloudAuthStore: save(credentials)
Note over CLI,CloudServer: Later: caplets attach
CLI->>RemoteSelection: resolveRemoteSelection()
RemoteSelection->>CloudAuthStore: load()
opt token near expiry
RemoteSelection->>CloudAuthClient: refresh(refreshToken)
CloudAuthClient->>CloudServer: POST /api/cloud-client/refresh
CloudServer-->>CloudAuthClient: new credentials
RemoteSelection->>CloudAuthStore: save(refreshed)
end
CLI->>ProjectBindingSession: runProjectBindingSession(remote)
ProjectBindingSession->>CloudServer: POST /control/project-bindings/sessions
CloudServer-->>ProjectBindingSession: "{bindingId, sessionId}"
ProjectBindingSession->>CloudServer: WS connect (subprotocol: caplets.bearer.token)
CloudServer-->>ProjectBindingSession: state/ready messages
loop heartbeat
ProjectBindingSession->>CloudServer: PATCH heartbeat
ProjectBindingSession->>CloudServer: WS heartbeat message
end
Reviews (4): Last reviewed commit: "fix(core): include binding visibility on..." | Re-trigger Greptile
This pull request introduces several infrastructure, configuration, and documentation changes to support Caplets Cloud, improve development workflows, and clarify project setup. The most significant updates include new deployment targets for Caplets Cloud UI and API, improved ignore patterns for tooling, updates to documentation for Cloud Auth, and the addition of design critique documents for the Cloud UI.
Infrastructure and Deployment Enhancements:
alchemy.run.ts, including configuration for Cloudflare D1 database, R2 storage, and domain/environment management. This enables preview and production deployments of the Cloud UI and API with appropriate bindings and environment variables. [1] [2]Configuration and Tooling Improvements:
.oxlintrc.jsonand.oxfmtrc.jsonto use recursive ignore patterns ("**/.brv/**") for better compatibility with monorepos and nested.brvdirectories. [1] [2]viteas a development dependency toapps/landing/package.jsonto support local development and builds..gitignoreto.caplets/that ignores all files except.gitignore, likely to prevent accidental check-in of local or generated files.Documentation Updates:
README.mdwith detailed instructions for Caplets Cloud Auth, including CLI commands for login, workspace management, token handling, and differences between hosted and self-hosted authentication. This clarifies the authentication model for developers and users..env.example, reflecting a move away from direct Cloudflare or Alchemy configuration in favor of managed deployment.Design and Product Critique:
apps-cloud-ui-src-routes-workspace-tsx), summarizing usability, design health, and actionable product issues. These critiques provide guidance for future UI/UX improvements and highlight current blockers and priorities. [1] [2]