-
Notifications
You must be signed in to change notification settings - Fork 83
Add C as a supported output language #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0924e50
3f687e1
8d5e98d
7dc804a
6f57963
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1088,6 +1088,7 @@ def handle_settings(mode_color=THEME_PRIMARY): | |
| Choice(title="csharp", value="csharp"), | ||
| Choice(title="php", value="php"), | ||
| Choice(title="ruby", value="ruby"), | ||
| Choice(title="c", value="c"), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Adding Prompt for AI agents |
||
| Choice(title="back", value="back"), | ||
| ] | ||
| lang = questionary.select( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| **Generate a C program** that replicates the API calls found in the traffic. The following are guidelines — use your judgment on what's appropriate for the specific API: | ||
|
|
||
| - C has no HTTP client or JSON support in its standard library, unlike every other output language here — use `libcurl` for requests and vendor `cJSON` (a small, widely-used, permissively-licensed single-file JSON library) for JSON, rather than hand-rolling either from scratch | ||
| - Don't hand-write or reconstruct `cJSON.c`/`cJSON.h` from memory — fetch the exact, pinned upstream source instead, so the vendored copy is the real, complete library rather than a possibly incomplete or subtly wrong approximation: | ||
| - `curl -fsSL -o {scripts_dir}/cJSON.c https://raw.githubusercontent.com/DaveGamble/cJSON/v1.7.18/cJSON.c` | ||
| - `curl -fsSL -o {scripts_dir}/cJSON.h https://raw.githubusercontent.com/DaveGamble/cJSON/v1.7.18/cJSON.h` | ||
| - `libcurl` itself is a system library this project can't fetch or vendor — if compilation fails because `curl/curl.h` isn't found, stop and report a clear error naming the missing prerequisite (e.g. "libcurl development headers not found — install libcurl4-openssl-dev (Debian/Ubuntu) or curl (Homebrew) and retry") rather than running a package manager yourself; installing system packages is a host change the user should make and confirm, not something to do silently inside an auto-authorized session | ||
| - Reuse one `CURL` handle across requests rather than creating a new one per call | ||
| - Create a separate function for each distinct API endpoint, with a small struct for its response shape | ||
| - Check every `libcurl`/allocation return value; don't ignore errors | ||
| - Include a `main` function with example usage | ||
|
|
||
| **Authentication & credentials:** | ||
| - Hardcode all cookies, tokens, session IDs, and auth headers found in the traffic directly in the program | ||
| - The user should be able to run the program immediately with zero configuration — no env vars, no config files, no manual setup beyond what's generated | ||
| - If the API uses cookies, enable `libcurl`'s cookie engine (`CURLOPT_COOKIEFILE`, e.g. pointed at an in-memory/empty string to just turn it on) so cookies persist automatically across requests on the same handle | ||
| - If the API uses Bearer tokens or API keys, hardcode them in the request headers | ||
| - Handle auth refresh so the program doesn't go stale: if you see a token refresh endpoint, OAuth refresh flow, or login endpoint in the traffic, implement automatic re-authentication when a request returns 401/403. If cookies have expiry, re-fetch them before they expire | ||
|
|
||
| **Testing:** | ||
| - Unlike every other language here, this needs a compile step before it can run — a single `{run_command}` handles both | ||
| - You have up to 5 attempts to fix issues | ||
|
|
||
| Save the program to: `{scripts_dir}/{client_filename}` | ||
| Save documentation to: `{scripts_dir}/README.md` | ||
| Save the vendored JSON library to: `{scripts_dir}/cJSON.c` and `{scripts_dir}/cJSON.h` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Selecting C creates
api_client.c, butreverse-api-engineer run <run_id>still discovers only files with a.pysuffix. A C-only run is therefore reported as having no scripts, so the normal run-by-ID workflow cannot execute the newly supported output.Prompt To Fix With AI