Skip to content

feat: cURL bundle exporter core (#42) - #45

Merged
rwrife merged 1 commit into
mainfrom
feat/issue-42-export-curl-bundle
Jul 13, 2026
Merged

feat: cURL bundle exporter core (#42)#45
rwrife merged 1 commit into
mainfrom
feat/issue-42-export-curl-bundle

Conversation

@rwrife

@rwrife rwrife commented Jul 12, 2026

Copy link
Copy Markdown
Owner

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 .http files into a runnable bash curl bundle.

  • src/core/export/curl.ts — takes ExportInputFile[] and options (secret redaction list, custom placeholder, optional banner), returns { script, requestsWritten, warnings }. Reuses the existing requestToCurl renderer and toUndiciRequest zod validation, so any bug fixes there flow through automatically.
  • Secret redaction — applied to URL, headers, body and the # 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.
  • Graceful skips.grpc / .ws inputs in a mixed .requests/ tree produce an unsupported-kind warning instead of failing the export. Empty .http files produce a no-requests note.
  • Zod fallout — per-request toUndiciRequest failures surface as invalid-request warnings without aborting the rest of the bundle.
  • Deterministic output — no timestamps, no random ordering; test snapshots stay stable.
  • README — new ## Exporting to other tools section 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 the redact list; export-report webview; workspace path guard).
  • src/core/export/postman.ts — v2.1 collection JSON, round-trip against src/core/import/postman.ts fixtures.
  • 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 export subcommand without duplication.

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.
@rwrife
rwrife merged commit 2c1b4e5 into main Jul 13, 2026
8 checks passed
@rwrife
rwrife deleted the feat/issue-42-export-curl-bundle branch July 13, 2026 09:01
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.

[feature] Export .http files to Postman v2.1 / OpenAPI 3.x / cURL bundle

1 participant