Skip to content

feat: org-scoped manual approval handler (onecli.org.configureManualApproval)#49

Merged
guyb1 merged 1 commit into
mainfrom
feat/org-approvals
Jul 6, 2026
Merged

feat: org-scoped manual approval handler (onecli.org.configureManualApproval)#49
guyb1 merged 1 commit into
mainfrom
feat/org-approvals

Conversation

@guyb1

@guyb1 guyb1 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What

Adds onecli.org.configureManualApproval(callback, options?) — a cross-project sibling of the existing onecli.configureManualApproval. With an organization API key (oc_org_…), it watches pending manual-approval requests across every project in the organization from one handler; each request carries its own projectId, which the SDK uses to route the decision back to the right project.

Additive and backward-compatible — the project ApprovalClient and configureManualApproval are unchanged.

Why

Companion to the gateway's new org approval route (below). A supervisor with an org key previously had no SDK path to watch approvals org-wide.

How

  • New OrgApprovalClient (src/approvals/org.ts) — polls GET /v1/org/approvals/pending with Authorization: Bearer oc_org_… and no X-Project-Id (the org is derived from the key); submits each decision to the existing POST /v1/approvals/{id}/decision with X-Project-Id: request.projectId (410-tolerant).
  • Additive types: OrgApprovalRequest extends ApprovalRequest { projectId }, OrgManualApprovalCallback, OrgManualApprovalOptions.
  • OrgClient gains an optional 4th ctor arg (gatewayUrl) + configureManualApproval; the facade threads it through. Existing callers are unaffected.
  • An additive onError hook surfaces poll failures (auth, network, gateway-URL resolution) instead of the project loop's silent catch {}.

Cross-repo contract

GET /v1/org/approvals/pending · auth = org API key (key-derived, no X-Organization-Id) · items carry projectId · decisions reuse POST /v1/approvals/{id}/decision + X-Project-Id. This SDK is inert until the gateway route ships.

Merge / release order: cloud gateway (merge + deploy) → this PR (release) → onecli-docs (last).

Related PRs

Review

Process: self-review + an independent adversarial TypeScript reviewer (public-API + type-design lens), skills loaded in full.

Skills applied: typescript-pro / typescript-advanced-types (public API type design, backward-compat, wire correctness) — 1 HIGH fix: resolveGatewayUrl() sat outside the retry loop in start(), so a gateway-URL resolution failure (the common default path) propagated out and was swallowed — onError never fired and the loop never retried. Moved resolution inside the loop (it caches on success) and added a regression test. Everything else clean: ApprovalClient byte-unchanged, OrgClient 4th arg optional, no cloud-private leakage (no gateway internals, no X-Organization-Id).

Gates (green): pnpm typecheck + pnpm test (91, incl. 3 org) + pnpm build (CJS/ESM/DTS).

release-please: feat: → minor.

🤖 Generated with Claude Code

…pproval)

Adds OrgApprovalClient, a cross-project sibling of the manual-approval handler:
it polls GET /v1/org/approvals/pending with an organization API key (no
X-Project-Id), and routes each decision back to the request's own project via
the existing POST /v1/approvals/{id}/decision route with X-Project-Id. Additive
and backward-compatible - the project ApprovalClient is unchanged. An onError
hook surfaces poll failures (including gateway-URL resolution) instead of
swallowing them.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@guyb1 guyb1 merged commit 62f09cb into main Jul 6, 2026
3 checks passed
@guyb1 guyb1 deleted the feat/org-approvals branch July 6, 2026 19:07
@guyb1 guyb1 mentioned this pull request Jul 6, 2026
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