Skip to content

feat: hosted cloud#100

Merged
ian-pascoe merged 19 commits into
mainfrom
feat/hosted-cloud
Jun 4, 2026
Merged

feat: hosted cloud#100
ian-pascoe merged 19 commits into
mainfrom
feat/hosted-cloud

Conversation

@ian-pascoe

Copy link
Copy Markdown
Contributor

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:

  • Added deployment targets for Caplets Cloud UI and Cloud API in 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]
  • Updated deployment logging and GitHub comment output to include Caplets Cloud UI and API URLs, providing clearer visibility into deployed endpoints.

Configuration and Tooling Improvements:

  • Updated .oxlintrc.json and .oxfmtrc.json to use recursive ignore patterns ("**/.brv/**") for better compatibility with monorepos and nested .brv directories. [1] [2]
  • Added vite as a development dependency to apps/landing/package.json to support local development and builds.
  • Added a .gitignore to .caplets/ that ignores all files except .gitignore, likely to prevent accidental check-in of local or generated files.

Documentation Updates:

  • Expanded the README.md with 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.
  • Removed unused or sensitive environment variable examples from .env.example, reflecting a move away from direct Cloudflare or Alchemy configuration in favor of managed deployment.

Design and Product Critique:

  • Added two detailed design critique documents for the Caplets Cloud UI route (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]

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 175 files, which is 25 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 41b93b03-ddeb-42eb-a2ce-2b66647cf5ea

📥 Commits

Reviewing files that changed from the base of the PR and between 240d8f6 and 0023541.

⛔ Files ignored due to path filters (3)
  • docs/assets/caplets-icon.png is excluded by !**/*.png
  • output/playwright/cloud-ui-critique.png is excluded by !**/*.png
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (175)
  • .agents/plugins/marketplace.json
  • .caplets/.gitignore
  • .changeset/remote-attach-agent-integrations.md
  • .claude-plugin/marketplace.json
  • .env.example
  • .github/workflows/deploy.yml
  • .github/workflows/pr-preview-deploy.yml
  • .gitignore
  • .impeccable/critique/2026-05-31T12-08-49Z__apps-cloud-ui-src-routes-workspace-tsx.md
  • .impeccable/critique/2026-05-31T12-57-16Z__apps-cloud-ui-src-routes-workspace-tsx.md
  • .lintstagedrc.json
  • .oxfmtrc.json
  • .oxlintrc.json
  • AGENTS.md
  • README.md
  • alchemy.run.ts
  • apps/landing/package.json
  • caplets/ast-grep/CAPLET.md
  • caplets/context7/CAPLET.md
  • caplets/playwright/CAPLET.md
  • docs/native-integrations.md
  • docs/plans/2026-05-21-mcp-resources-prompts.md
  • docs/plans/2026-05-29-cli-integration-setup.md
  • docs/plans/2026-06-04-remote-attach-and-agent-integrations.md
  • docs/project-binding.md
  • infra/alchemy-domains.ts
  • infra/alchemy-fetch-compat.test.ts
  • infra/alchemy-fetch-compat.ts
  • infra/alchemy-runner.test.ts
  • infra/alchemy-runner.ts
  • mise.toml
  • package.json
  • packages/benchmarks/package.json
  • packages/cli/package.json
  • packages/core/package.json
  • packages/core/rolldown.config.ts
  • packages/core/src/attach/options.ts
  • packages/core/src/attach/server.ts
  • packages/core/src/caplet-files-bundle.ts
  • packages/core/src/caplet-files.ts
  • packages/core/src/caplet-source/bundle.ts
  • packages/core/src/caplet-source/filesystem.ts
  • packages/core/src/caplet-source/index.ts
  • packages/core/src/caplet-source/parse.ts
  • packages/core/src/caplet-source/types.ts
  • packages/core/src/cli.ts
  • packages/core/src/cli/add.ts
  • packages/core/src/cli/commands.ts
  • packages/core/src/cli/doctor.ts
  • packages/core/src/cli/install.ts
  • packages/core/src/cli/setup-caplet.ts
  • packages/core/src/cli/setup.ts
  • packages/core/src/cloud-auth/client.ts
  • packages/core/src/cloud-auth/errors.ts
  • packages/core/src/cloud-auth/open-url.ts
  • packages/core/src/cloud-auth/store.ts
  • packages/core/src/cloud-auth/types.ts
  • packages/core/src/cloud/apply.ts
  • packages/core/src/cloud/client.ts
  • packages/core/src/cloud/presence.ts
  • packages/core/src/cloud/project-root.ts
  • packages/core/src/cloud/runtime-adapter.ts
  • packages/core/src/cloud/runtime-http.ts
  • packages/core/src/cloud/sync.ts
  • packages/core/src/config-runtime.ts
  • packages/core/src/config.ts
  • packages/core/src/config/paths.ts
  • packages/core/src/index.ts
  • packages/core/src/native/options.ts
  • packages/core/src/native/remote.ts
  • packages/core/src/native/service.ts
  • packages/core/src/project-binding/attach.ts
  • packages/core/src/project-binding/errors.ts
  • packages/core/src/project-binding/gitignore.ts
  • packages/core/src/project-binding/mutagen.ts
  • packages/core/src/project-binding/routes.ts
  • packages/core/src/project-binding/session.ts
  • packages/core/src/project-binding/sync-filter.ts
  • packages/core/src/project-binding/sync-size.ts
  • packages/core/src/project-binding/transport.ts
  • packages/core/src/project-binding/types.ts
  • packages/core/src/project-binding/workspaces.ts
  • packages/core/src/remote-control/client.ts
  • packages/core/src/remote/options.ts
  • packages/core/src/remote/selection.ts
  • packages/core/src/runtime-plan/features.ts
  • packages/core/src/runtime-plan/index.ts
  • packages/core/src/runtime-plan/planner.ts
  • packages/core/src/runtime-plan/resources.ts
  • packages/core/src/runtime-plan/types.ts
  • packages/core/src/serve/daemon/config.ts
  • packages/core/src/serve/daemon/index.ts
  • packages/core/src/serve/daemon/paths.ts
  • packages/core/src/serve/daemon/platform-darwin.ts
  • packages/core/src/serve/daemon/platform-linux.ts
  • packages/core/src/serve/daemon/platform-windows.ts
  • packages/core/src/serve/daemon/platform.ts
  • packages/core/src/serve/daemon/process.ts
  • packages/core/src/serve/daemon/types.ts
  • packages/core/src/serve/http.ts
  • packages/core/src/serve/index.ts
  • packages/core/src/serve/native-session.ts
  • packages/core/src/serve/options.ts
  • packages/core/src/server/options.ts
  • packages/core/src/setup/hash.ts
  • packages/core/src/setup/local-store.ts
  • packages/core/src/setup/runner.ts
  • packages/core/src/setup/types.ts
  • packages/core/src/tools.ts
  • packages/core/test/agent-plugins.test.ts
  • packages/core/test/attach-cli.test.ts
  • packages/core/test/attach-server.test.ts
  • packages/core/test/caplet-files.test.ts
  • packages/core/test/caplet-source.test.ts
  • packages/core/test/cli.test.ts
  • packages/core/test/cloud-apply.test.ts
  • packages/core/test/cloud-auth-client.test.ts
  • packages/core/test/cloud-auth-login-cli.test.ts
  • packages/core/test/cloud-auth-refresh-attach.test.ts
  • packages/core/test/cloud-auth.test.ts
  • packages/core/test/cloud-bundle-runtime.test.ts
  • packages/core/test/cloud-client.test.ts
  • packages/core/test/cloud-mutagen.test.ts
  • packages/core/test/cloud-presence.test.ts
  • packages/core/test/cloud-project-root.test.ts
  • packages/core/test/cloud-runtime-adapter-provenance.test.ts
  • packages/core/test/cloud-sync.test.ts
  • packages/core/test/config.test.ts
  • packages/core/test/doctor-cli.test.ts
  • packages/core/test/engine.test.ts
  • packages/core/test/fixtures/cloud-auth.ts
  • packages/core/test/fixtures/project-binding/project/build.js
  • packages/core/test/fixtures/project-binding/project/package.json
  • packages/core/test/native-options.test.ts
  • packages/core/test/native-remote.test.ts
  • packages/core/test/native.test.ts
  • packages/core/test/package-boundaries.test.ts
  • packages/core/test/project-binding-gitignore.test.ts
  • packages/core/test/project-binding-integration.test.ts
  • packages/core/test/project-binding-mutagen.test.ts
  • packages/core/test/project-binding-routes.test.ts
  • packages/core/test/project-binding-session.test.ts
  • packages/core/test/project-binding-sync-filter.test.ts
  • packages/core/test/project-binding-sync-size.test.ts
  • packages/core/test/project-binding-workspaces.test.ts
  • packages/core/test/remote-control-client.test.ts
  • packages/core/test/remote-options.test.ts
  • packages/core/test/remote-selection.test.ts
  • packages/core/test/runtime-features.test.ts
  • packages/core/test/runtime-plan-contract.test.ts
  • packages/core/test/runtime-plan.test.ts
  • packages/core/test/serve-daemon.test.ts
  • packages/core/test/serve-http.test.ts
  • packages/core/test/serve-options.test.ts
  • packages/core/test/setup-runner.test.ts
  • packages/opencode/README.md
  • packages/opencode/package.json
  • packages/opencode/test/opencode.test.ts
  • packages/pi/README.md
  • packages/pi/package.json
  • packages/pi/src/index.ts
  • packages/pi/test/pi.test.ts
  • plugins/caplets/.claude-plugin/plugin.json
  • plugins/caplets/.codex-plugin/plugin.json
  • plugins/caplets/mcp.json
  • plugins/caplets/skills/caplets/SKILL.md
  • schemas/caplet.schema.json
  • schemas/caplets-config.schema.json
  • scripts/alchemy-runner.test.ts
  • scripts/dev.ts
  • scripts/mutagen-probe.test.ts
  • scripts/mutagen-probe.ts
  • scripts/sync-plugin-versions.ts
  • tsconfig.json
  • vitest.config.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/hosted-cloud

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@socket-security

socket-security Bot commented Jun 4, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Deployed

Your 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.

@ian-pascoe ian-pascoe force-pushed the feat/hosted-cloud branch from 91e9ecb to 379bdec Compare June 4, 2026 13:08
@ian-pascoe ian-pascoe marked this pull request as ready for review June 4, 2026 18:52
@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces the Caplets hosted cloud feature: a full cloud auth flow (device login, token exchange, refresh, workspace switching), a project-binding session protocol over WebSocket, project sync manifest building with gitignore support, and remote file apply. It also adds daemon subcommands to caplets serve, a doctor command, and deployment plumbing for the Cloud UI and API.

  • Cloud auth: CloudAuthClient and CloudAuthStore implement login polling, token refresh, and secure credential storage (mode 0600). waitForCloudLogin now correctly continues polling on workspace_selection_required, and registerPresence properly serializes allowedCapletIds and fallbackConsent—both previously flagged as stubs.
  • Project binding session: WebSocket connection with bearer token passed via Sec-WebSocket-Protocol subprotocol (addressing the prior URL-query-param concern), one-shot reconnect, and REST heartbeat/cleanup.
  • Sync filter: Rebuilt buildProjectSyncManifest now correctly handles gitignore negation patterns and root-anchored (/) patterns, resolving both issues from the previous review round.

Confidence Score: 5/5

Safe to merge; all previously flagged issues (stub methods, token in URL, workspace_selection_required polling, gitignore anchoring) have been addressed in this revision.

The core cloud auth and project-binding session flows are well-implemented with proper token handling, secret redaction, and symlink/path-traversal guards. The three findings are minor edge cases: a missing ENOENT guard before realpathSync, binary files passing through the UTF-8 sync reader, and a missing token-expiry check in the switch command—none of which corrupt state or expose credentials.

packages/core/src/cloud/apply.ts (realpathSync ENOENT) and packages/core/src/cloud/sync.ts (binary file UTF-8 read) are worth a follow-up before the feature is GA.

Important Files Changed

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
Loading

Fix All in Codex

Reviews (4): Last reviewed commit: "fix(core): include binding visibility on..." | Re-trigger Greptile

Comment thread packages/core/src/project-binding/sync-filter.ts Outdated
Comment thread packages/core/src/cloud/client.ts
Comment thread packages/core/src/project-binding/session.ts
Comment thread packages/core/src/project-binding/sync-filter.ts Outdated
Comment thread packages/core/src/project-binding/session.ts
Comment thread packages/core/src/cli.ts
Comment thread packages/core/src/cloud/client.ts
@ian-pascoe ian-pascoe merged commit e388a49 into main Jun 4, 2026
7 checks passed
@ian-pascoe ian-pascoe deleted the feat/hosted-cloud branch June 4, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant