feat: cURL bundle exporter core (#42) - #45
Merged
Conversation
Pure exporter in src/core/export/curl.ts that turns parsed .http files into a runnable bash script bundle — one curl command per request, grouped by source file with # === <path> === section headers. - Secret redaction happens on URL, headers, body AND the request-label comment above each command, so a secret sitting in a query string can never leak through the comment even after the curl line is redacted. - gRPC / WebSocket inputs are skipped with an unsupported-kind warning so a mixed .requests/ tree export doesn't fail outright. - Zod validation failures per-request surface as invalid-request warnings without aborting the rest of the bundle. - Deterministic output (no timestamps, no random ordering) — snapshots cleanly in tests. - +11 unit tests covering happy path, redaction (default + custom placeholder), determinism, unsupported kinds, empty files, multi-file grouping, banner sanitisation, named-request labels, and zod fallout. Extension command wiring (scope picker, env picker, SecretStorage enumeration, export report webview) and the Postman + OpenAPI exporters are separate follow-up slices tracked on #42.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #42 (partially — see follow-ups).
What changed
First slice of the export system from #42: a pure, VS Code-free exporter that turns a set of parsed
.httpfiles into a runnable bashcurlbundle.src/core/export/curl.ts— takesExportInputFile[]and options (secret redaction list, custom placeholder, optional banner), returns{ script, requestsWritten, warnings }. Reuses the existingrequestToCurlrenderer andtoUndiciRequestzod validation, so any bug fixes there flow through automatically.# request: …label comment above each curl line. A secret in a query string can't leak through the comment even after the curl line has been redacted. Custom placeholder is honoured..grpc/.wsinputs in a mixed.requests/tree produce anunsupported-kindwarning instead of failing the export. Empty.httpfiles produce ano-requestsnote.toUndiciRequestfailures surface asinvalid-requestwarnings without aborting the rest of the bundle.## Exporting to other toolssection explaining what's landed and what's next.Tests
+11 unit tests in
test/export.curl.test.ts. Full suite: 409 passed. Lint + typecheck clean.Follow-ups (still open on #42)
Reqit: Export to cURL bundle…command wiring (scope picker → current file / current folder / entire.requests/tree; env picker; SecretStorage enumeration for theredactlist; export-report webview; workspace path guard).src/core/export/postman.ts— v2.1 collection JSON, round-trip againstsrc/core/import/postman.tsfixtures.src/core/export/openapi.ts— OpenAPI 3.1 YAML/JSON stub generated from operations + history examples.Kept intentionally small so the pure core lands first and can back both the extension command and any future CLI
reqit exportsubcommand without duplication.