feat(import): real Bruno (.bru) → .http translator#15
Merged
Conversation
The previous Bruno importer copied each `request.bru` file's contents
verbatim into a `.http` file, so imported collections did not run — `.bru`
syntax is not `.http` syntax. This replaces it with an actual Bru Lang
parser (`bru_to_http`) that understands Bruno's block format and re-emits
equivalent Forge `.http` requests:
- meta/method/url, query (`params:query` or inline), headers (disabled
entries dropped)
- all auth schemes: bearer, basic, apikey, digest, ntlm, awsv4, wsse, and
oauth2 (client-credentials / password / authorization-code grants)
- bodies: json, xml, text, sparql, graphql (+ variables), form-urlencoded,
multipart (with `@file(...)` parts) — with brace-balanced block parsing
so JSON bodies survive intact
- pre-request vars → file variables; post-response vars → `@capture`;
assertions → `@assert` (operators mapped, unsupported ones dropped);
pre/post scripts and `tests {}` → script blocks; docs → comments
The collection importer now handles both the modern (requests at the
collection root) and legacy (`.bruno/requests`) layouts, skips
folder/collection settings files, and translates Bruno environment
`.bru` (`vars {}`) files into `--env-file`-loadable `.env` files.
Every translation test re-parses the emitted `.http` with the Forge
parser and asserts the resulting model — a true round trip.
https://claude.ai/code/session_016jgMTwiYCiZA8F9JMFGfWR
GamalAnwar
added a commit
that referenced
this pull request
Jun 18, 2026
The previous Bruno importer copied each `request.bru` file's contents
verbatim into a `.http` file, so imported collections did not run — `.bru`
syntax is not `.http` syntax. This replaces it with an actual Bru Lang
parser (`bru_to_http`) that understands Bruno's block format and re-emits
equivalent Forge `.http` requests:
- meta/method/url, query (`params:query` or inline), headers (disabled
entries dropped)
- all auth schemes: bearer, basic, apikey, digest, ntlm, awsv4, wsse, and
oauth2 (client-credentials / password / authorization-code grants)
- bodies: json, xml, text, sparql, graphql (+ variables), form-urlencoded,
multipart (with `@file(...)` parts) — with brace-balanced block parsing
so JSON bodies survive intact
- pre-request vars → file variables; post-response vars → `@capture`;
assertions → `@assert` (operators mapped, unsupported ones dropped);
pre/post scripts and `tests {}` → script blocks; docs → comments
The collection importer now handles both the modern (requests at the
collection root) and legacy (`.bruno/requests`) layouts, skips
folder/collection settings files, and translates Bruno environment
`.bru` (`vars {}`) files into `--env-file`-loadable `.env` files.
Every translation test re-parses the emitted `.http` with the Forge
parser and asserts the resulting model — a true round trip.
GamalAnwar
added a commit
that referenced
this pull request
Jun 18, 2026
The previous Bruno importer copied each `request.bru` file's contents
verbatim into a `.http` file, so imported collections did not run — `.bru`
syntax is not `.http` syntax. This replaces it with an actual Bru Lang
parser (`bru_to_http`) that understands Bruno's block format and re-emits
equivalent Forge `.http` requests:
- meta/method/url, query (`params:query` or inline), headers (disabled
entries dropped)
- all auth schemes: bearer, basic, apikey, digest, ntlm, awsv4, wsse, and
oauth2 (client-credentials / password / authorization-code grants)
- bodies: json, xml, text, sparql, graphql (+ variables), form-urlencoded,
multipart (with `@file(...)` parts) — with brace-balanced block parsing
so JSON bodies survive intact
- pre-request vars → file variables; post-response vars → `@capture`;
assertions → `@assert` (operators mapped, unsupported ones dropped);
pre/post scripts and `tests {}` → script blocks; docs → comments
The collection importer now handles both the modern (requests at the
collection root) and legacy (`.bruno/requests`) layouts, skips
folder/collection settings files, and translates Bruno environment
`.bru` (`vars {}`) files into `--env-file`-loadable `.env` files.
Every translation test re-parses the emitted `.http` with the Forge
parser and asserts the resulting model — a true round trip.
GamalAnwar
added a commit
that referenced
this pull request
Jun 18, 2026
The previous Bruno importer copied each `request.bru` file's contents
verbatim into a `.http` file, so imported collections did not run — `.bru`
syntax is not `.http` syntax. This replaces it with an actual Bru Lang
parser (`bru_to_http`) that understands Bruno's block format and re-emits
equivalent Forge `.http` requests:
- meta/method/url, query (`params:query` or inline), headers (disabled
entries dropped)
- all auth schemes: bearer, basic, apikey, digest, ntlm, awsv4, wsse, and
oauth2 (client-credentials / password / authorization-code grants)
- bodies: json, xml, text, sparql, graphql (+ variables), form-urlencoded,
multipart (with `@file(...)` parts) — with brace-balanced block parsing
so JSON bodies survive intact
- pre-request vars → file variables; post-response vars → `@capture`;
assertions → `@assert` (operators mapped, unsupported ones dropped);
pre/post scripts and `tests {}` → script blocks; docs → comments
The collection importer now handles both the modern (requests at the
collection root) and legacy (`.bruno/requests`) layouts, skips
folder/collection settings files, and translates Bruno environment
`.bru` (`vars {}`) files into `--env-file`-loadable `.env` files.
Every translation test re-parses the emitted `.http` with the Forge
parser and asserts the resulting model — a true round trip.
GamalAnwar
added a commit
that referenced
this pull request
Jun 18, 2026
The previous Bruno importer copied each `request.bru` file's contents
verbatim into a `.http` file, so imported collections did not run — `.bru`
syntax is not `.http` syntax. This replaces it with an actual Bru Lang
parser (`bru_to_http`) that understands Bruno's block format and re-emits
equivalent Forge `.http` requests:
- meta/method/url, query (`params:query` or inline), headers (disabled
entries dropped)
- all auth schemes: bearer, basic, apikey, digest, ntlm, awsv4, wsse, and
oauth2 (client-credentials / password / authorization-code grants)
- bodies: json, xml, text, sparql, graphql (+ variables), form-urlencoded,
multipart (with `@file(...)` parts) — with brace-balanced block parsing
so JSON bodies survive intact
- pre-request vars → file variables; post-response vars → `@capture`;
assertions → `@assert` (operators mapped, unsupported ones dropped);
pre/post scripts and `tests {}` → script blocks; docs → comments
The collection importer now handles both the modern (requests at the
collection root) and legacy (`.bruno/requests`) layouts, skips
folder/collection settings files, and translates Bruno environment
`.bru` (`vars {}`) files into `--env-file`-loadable `.env` files.
Every translation test re-parses the emitted `.http` with the Forge
parser and asserts the resulting model — a true round trip.
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.
Summary
The previous Bruno importer copied each
request.brufile's contents verbatim into a.httpfile — but.brusyntax isn't.httpsyntax, so imported collections didn't actually run. This replaces it with a real Bru Lang →.httptranslator so a Bruno user can import their collection and have it execute immediately. (This is the migration on-ramp identified in the Bruno gap analysis.)bru_to_httpparses Bruno's block format and emits equivalent Forge directives:params:query/queryblock or inline), headers (disabled~entries dropped)@file(...)parts) — with brace-balanced block parsing so JSON bodies survive intact@capture; assertions →@assert(operators mapped; unsupported ones dropped rather than mistranslated); pre/post scripts andtests {}→ script blocks; docs → comments (prefixed so a markdown###can't be read as a request separator)The collection importer now handles both the modern (requests at the collection root) and legacy (
.bruno/requests) layouts, skips folder/collection settings files, and translates Bruno environment.bru(vars {}) files into--env-file-loadable.envfiles.Testing
Every translation test re-parses the emitted
.httpwith the Forge parser and asserts the resulting model — a true round trip, not a string match. 30 tests; the module is at ~96% line coverage and the workspace stays above the 95% gate.🤖 Generated with Claude Code
Generated by Claude Code