Skip to content

Commit 6cc98a8

Browse files
feat(http): add collection import (#767)
* feat(http): add Postman import foundation * feat(http): simplify button size in import dialog * feat(http): add Bruno OpenCollection import * refactor(http): use shadcn alert for import warnings * feat(http): add OpenAPI import * fix(http): show request params in loaded URL * refactor(http): move import action to sidebar header * chore(http): clarify import dialog copy * docs(http): document collection import * chore: clean
1 parent 5371e92 commit 6cc98a8

34 files changed

Lines changed: 4402 additions & 77 deletions

File tree

docs/superpowers/plans/2026-05-03-http-import-formats.md

Lines changed: 403 additions & 0 deletions
Large diffs are not rendered by default.

docs/website/.vitepress/config.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export default defineConfig({
138138
{ text: 'HTTP Client', link: '/documentation/http/' },
139139
{ text: 'Requests', link: '/documentation/http/requests' },
140140
{ text: 'Environments', link: '/documentation/http/environments' },
141+
{ text: 'Importing Collections', link: '/documentation/http/importing' },
141142
],
142143
},
143144
{
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: Importing HTTP Collections
3+
description: "Import OpenAPI, Postman, and Bruno collections into the massCode HTTP space."
4+
---
5+
6+
# Importing Collections
7+
8+
Use import when you already have API collections or specifications in another tool and want to bring them into the HTTP space without recreating requests by hand.
9+
10+
<img :src="withBase('/http-import.png')">
11+
12+
## Supported Formats
13+
14+
HTTP import supports:
15+
16+
- **OpenAPI JSON/YAML** - generates requests from OpenAPI operations.
17+
- **Postman Collection v2.1 JSON** - imports folders, requests, params, headers, bodies, descriptions, and supported auth.
18+
- **Postman Environment JSON** - optional environment file imported together with a Postman collection.
19+
- **Bruno OpenCollection YAML** - imports single-file Bruno OpenCollection exports.
20+
- **Bruno OpenCollection ZIP** - imports zipped Bruno OpenCollection exports.
21+
22+
## Opening Import
23+
24+
Open the **HTTP** space and click the import button in the HTTP sidebar header. The import button is next to the **HTTP Client** title because importing can create folders, requests, and environments.
25+
26+
## Selecting Files
27+
28+
Use either method in the import dialog:
29+
30+
- Click **Choose files** and select one or more files from disk.
31+
- Drag files into the drop zone.
32+
33+
For Postman, select the collection JSON and, optionally, the environment JSON in the same import dialog.
34+
35+
## Preview
36+
37+
After files are selected, massCode reads them and shows a preview before anything is written to your vault.
38+
39+
The preview includes:
40+
41+
- number of collections
42+
- number of requests
43+
- number of environments
44+
- collection names with folder and request counts
45+
- environment names with variable counts
46+
- warnings for skipped or unsupported features
47+
48+
Click **Import** to create the previewed items in the HTTP space.
49+
50+
## Where Imported Data Goes
51+
52+
Each imported collection becomes a new top-level folder in the HTTP space. Nested folders and requests are created under that collection folder.
53+
54+
Imported environments are added to the **Environments** panel. Environment variables are stored as plain text in your vault, the same as variables created manually in HTTP.
55+
56+
## Warnings
57+
58+
Some external client features do not have an equivalent in the current HTTP space model. When that happens, import keeps the request data it can represent and shows a warning.
59+
60+
Common warnings include:
61+
62+
- runtime scripts skipped
63+
- assertions skipped
64+
- disabled environment variables skipped
65+
- unsupported auth skipped or converted when possible
66+
67+
Requests and environments are still importable when warnings are shown.
68+
69+
<script setup>
70+
import { withBase } from 'vitepress'
71+
</script>

docs/website/documentation/http/index.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: HTTP Client
3-
description: "Use the HTTP space in massCode as a lightweight local-first API client for saved requests, environments, previews, and responses."
3+
description: "Use the HTTP space in massCode as a lightweight local-first API client for saved requests, imported collections, environments, previews, and responses."
44
---
55

66
# HTTP Client
77

88
<AppVersion text=">=5.3" />
99

10-
HTTP is the API client space inside massCode. Use it to keep reusable requests next to your snippets and notes, test endpoints during development, and store small API collections in your local vault.
10+
HTTP is the API client space inside massCode. Use it to keep reusable requests next to your snippets and notes, import existing API collections, test endpoints during development, and store small API collections in your local vault.
1111

1212
Access HTTP from the **HTTP** icon in the Space rail. The layout follows the same workspace pattern as Code and Notes: folders on the left, requests in the middle, and the request editor with preview and response panels on the right.
1313

@@ -19,6 +19,7 @@ Use HTTP when you want a lightweight request client without leaving massCode.
1919

2020
- test local or remote API endpoints
2121
- save repeatable requests by project or service
22+
- import collections from OpenAPI, Postman, or Bruno
2223
- keep request descriptions close to implementation notes
2324
- switch variables between local, staging, and production environments
2425
- copy a request as raw HTTP or cURL for debugging and sharing
@@ -33,6 +34,10 @@ Requests store the method, URL, params, headers, body, auth settings, and markdo
3334

3435
Environments store reusable variables for local, staging, and production APIs. The URL field keeps variables visible while you edit, while preview and request execution resolve values from the active environment.
3536

37+
### [Importing Collections](/documentation/http/importing)
38+
39+
Importing creates HTTP folders, requests, and environments from external collection files. HTTP supports OpenAPI JSON/YAML, Postman Collection v2.1 JSON with optional Postman Environment JSON, and Bruno OpenCollection YAML or ZIP exports.
40+
3641
## Folders
3742

3843
HTTP requests are organized in folders. Selecting a folder shows its requests and selects the first request in that folder. Folders support nesting, drag and drop ordering, inline rename, and custom folder icons.

docs/website/documentation/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Use Notes for longer markdown documents that do not fit well into snippets: proj
2121

2222
## HTTP
2323

24-
Use HTTP as a lightweight API client inside massCode. Store requests in folders, switch environments, preview the outgoing request as raw HTTP or cURL, send it from the editor, and inspect the response body and headers without leaving your workspace.
24+
Use HTTP as a lightweight API client inside massCode. Store requests in folders, import collections from OpenAPI, Postman, or Bruno, switch environments, preview the outgoing request as raw HTTP or cURL, send it from the editor, and inspect the response body and headers without leaving your workspace.
2525

2626
## Math
2727

58.9 KB
Loading

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
"interactjs": "^1.10.27",
9595
"js-yaml": "^4.1.0",
9696
"jsondiffpatch": "^0.7.3",
97+
"jszip": "^3.10.1",
9798
"ky": "^1.7.5",
9899
"lucide-vue-next": "^0.476.0",
99100
"markmap-lib": "^0.18.11",

pnpm-lock.yaml

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/api/dto/http-import.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import Elysia, { t } from 'elysia'
2+
3+
const httpImportFile = t.Object({
4+
content: t.String(),
5+
encoding: t.Optional(t.Union([t.Literal('text'), t.Literal('base64')])),
6+
name: t.String(),
7+
})
8+
9+
const httpImportWarning = t.Object({
10+
message: t.String(),
11+
source: t.String(),
12+
})
13+
14+
const httpImportPreviewCollection = t.Object({
15+
folders: t.Number(),
16+
index: t.Number(),
17+
name: t.String(),
18+
requests: t.Number(),
19+
})
20+
21+
const httpImportPreviewEnvironment = t.Object({
22+
index: t.Number(),
23+
name: t.String(),
24+
variables: t.Number(),
25+
})
26+
27+
const httpImportPreviewInput = t.Object({
28+
files: t.Array(httpImportFile),
29+
})
30+
31+
const httpImportApplyInput = t.Object({
32+
files: t.Array(httpImportFile),
33+
selectedCollectionIndexes: t.Optional(t.Array(t.Number())),
34+
selectedEnvironmentIndexes: t.Optional(t.Array(t.Number())),
35+
})
36+
37+
const httpImportPreviewResponse = t.Object({
38+
collections: t.Array(httpImportPreviewCollection),
39+
environments: t.Array(httpImportPreviewEnvironment),
40+
warnings: t.Array(httpImportWarning),
41+
})
42+
43+
const httpImportApplyResponse = t.Object({
44+
collections: t.Number(),
45+
createdCollectionNames: t.Array(t.String()),
46+
environments: t.Number(),
47+
folders: t.Number(),
48+
requests: t.Number(),
49+
warnings: t.Array(httpImportWarning),
50+
})
51+
52+
export const httpImportDTO = new Elysia().model({
53+
httpImportApplyInput,
54+
httpImportApplyResponse,
55+
httpImportPreviewInput,
56+
httpImportPreviewResponse,
57+
})
58+
59+
export type HttpImportPreviewInput = typeof httpImportPreviewInput.static
60+
export type HttpImportApplyInput = typeof httpImportApplyInput.static
61+
export type HttpImportPreviewResponse = typeof httpImportPreviewResponse.static
62+
export type HttpImportApplyResponse = typeof httpImportApplyResponse.static

src/main/api/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import folders from './routes/folders'
88
import httpEnvironments from './routes/http-environments'
99
import httpFolders from './routes/http-folders'
1010
import httpHistory from './routes/http-history'
11+
import httpImport from './routes/http-import'
1112
import httpRequests from './routes/http-requests'
1213
import noteFolders from './routes/note-folders'
1314
import noteTags from './routes/note-tags'
@@ -51,6 +52,7 @@ export async function initApi() {
5152
.use(httpRequests)
5253
.use(httpEnvironments)
5354
.use(httpHistory)
55+
.use(httpImport)
5456
.listen(port)
5557

5658
// eslint-disable-next-line no-console

0 commit comments

Comments
 (0)