Skip to content

feat: implement REST client (PPGClient)#103

Open
2witstudios wants to merge 3 commits intomainfrom
ppg/issue-78-rest-client
Open

feat: implement REST client (PPGClient)#103
2witstudios wants to merge 3 commits intomainfrom
ppg/issue-78-rest-client

Conversation

@2witstudios
Copy link
Owner

Summary

  • Adds PPGClient Swift actor covering all 13 server endpoints with async/await
  • Typed error enum with cases: network, unauthorized, notFound, conflict, serverError, decodingError, invalidResponse, notConfigured, invalidURL
  • testConnection() method for verifying server reachability and auth
  • Custom URLSessionDelegate for self-signed TLS via pinned CA certificate (ppg-ca.der)
  • 15s request / 30s resource timeouts, Bearer token auth on all requests

Endpoints

Method Path Client Method
GET /api/status fetchStatus()
GET /api/worktrees/:id fetchWorktree(id:)
GET /api/worktrees/:id/diff fetchDiff(worktreeId:)
GET /api/agents/:id/logs fetchAgentLogs(agentId:lines:)
GET /api/config fetchConfig()
GET /api/templates fetchTemplates()
GET /api/prompts fetchPrompts()
POST /api/spawn spawn(name:agent:prompt:template:base:count:)
POST /api/agents/:id/send sendToAgent(agentId:text:keys:)
POST /api/agents/:id/kill killAgent(agentId:)
POST /api/agents/:id/restart restartAgent(agentId:prompt:)
POST /api/worktrees/:id/merge mergeWorktree(worktreeId:strategy:force:)
POST /api/worktrees/:id/pr createPR(worktreeId:title:draft:)

Plus killWorktree(worktreeId:) for POST /api/worktrees/:id/kill.

Test plan

  • Verify PPGClient compiles in Xcode alongside Model types from the iOS app branch
  • Test testConnection() against a running ppg serve instance
  • Verify each read endpoint returns decoded Swift types
  • Verify write endpoints (spawn, kill, merge, etc.) send correct JSON bodies
  • Test error mapping: 401 → .unauthorized, 404 → .notFound, 409 → .conflict
  • Test TLS pinning with self-signed cert via ppg-ca.der bundle resource

Closes #78

Actor-based REST client covering all 13 server endpoints (7 read + 6 write):
- Read: status, worktree detail, diff, agent logs, config, templates, prompts
- Write: spawn, merge, kill, restart, send input, create PR
- testConnection() for verifying reachability and auth
- Typed error enum: network, unauthorized, notFound, conflict, serverError, decodingError
- Custom URLSession delegate for self-signed TLS via pinned CA certificate
- 15s request / 30s resource timeouts

Closes #78
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2026

Warning

Rate limit exceeded

@2witstudios has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 25 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 34deb69 and b31c7e9.

📒 Files selected for processing (2)
  • ios/PPGMobile/PPGMobile/Networking/PPGClient.swift
  • src/commands/spawn.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ppg/issue-78-rest-client

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.

- Add missing `enter` parameter to `sendToAgent` (server accepts enter?: bool)
- Add missing `body` parameter to `createPR` (server accepts body?: string)
- Fix `PRResponse` to match actual server shape (success, worktreeId, prUrl)
- Ensure non-URLError/non-DecodingError exceptions propagate correctly
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.

Implement REST client (PPGClient)

1 participant