# Obol File Refactor — TypeScript Modernization to GitHub PR

> Obol File Refactor — TypeScript Modernization to GitHub PR is a paid API for AI agents from api.obol.sh, paid per call via x402, $1/call, status unknown (last checked 2026-10-12).

Takes a file path in a GitHub repo, rewrites it as modernized TypeScript, and opens a pull request with the changes

## Facts

- Endpoint: POST https://api.obol.sh/refactor?utm_source=zero.xyz
- Price: $1/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-12
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/obol-file-refactor-typescript-modernization-to-github-pr-c31d123b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_rn8N5YH1CRHLmeHkceasB

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability obol-file-refactor-typescript-modernization-to-github-pr-c31d123b -d '<json body>'
```

Example prompt: Can you modernize src/lib/utils.ts in my GitHub repo myorg/my-app — refactor it to clean, modern TypeScript and open a pull request? Notify me at dev@example.com when it's ready.

## When to prefer this

Use this endpoint when you have a specific file in a GitHub repository that needs to be modernized to current TypeScript standards and you want the result delivered as a pull request without manual editing. It is ideal for automating code quality improvements on individual files in existing repos, especially when you want a reviewable PR workflow rather than just a code suggestion.

## Known failure modes

- File path not found in repo — returns error indicating missing path
- Repo not accessible or invalid owner/repo format — authentication or 404 error
- GitHub API rate limit or permission issues preventing fork or PR creation
- Payment failure via x402 protocol — request rejected before processing
- Invalid or malformed email — notification may not be sent but PR may still be created
- File is not TypeScript or JavaScript — refactoring output may be unexpected

## How this service works

Obol: File → modernized TypeScript → GitHub PR — $5 USDC

## Output

Returns a pull request URL opened on a fork of the target repo, the fork URL, the branch name, and a list of file paths written to that branch — all reflecting the modernized TypeScript version of the specified file.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "path",
  "repo"
 ],
 "properties": {
  "path": {
   "type": "string",
   "description": "Path to the file to refactor (e.g. src/lib/utils.ts)"
  },
  "repo": {
   "type": "string",
   "description": "GitHub repo in owner/repo format"
  },
  "email": {
   "type": "string",
   "description": "Email address to notify when PR is ready"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "pr": {
  "type": "string",
  "description": "URL of the opened pull request"
 },
 "fork": {
  "type": "string",
  "description": "URL of the forked repository"
 },
 "files": {
  "type": "array",
  "description": "File paths written to the branch"
 },
 "branch": {
  "type": "string",
  "description": "Branch name on the fork"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/obol-file-refactor-typescript-modernization-to-github-pr-c31d123b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.obol.sh](https://www.zero.xyz/host/api.obol.sh/llms.txt)
