Skip to content

Commit 5371e92

Browse files
feat(http): add HTTP client space (#766)
* feat(http): scaffold space registration, route and locales * feat(http): add storage types, paths and contracts * feat(http): add state, frontmatter parser and disk sync * feat(http): add folders and requests storages Implements HttpFoldersStorage (CRUD over folders persisted in state.yaml plus filesystem dirs) and HttpRequestsStorage (CRUD over .md request files with frontmatter). Extends shared validation kinds to cover 'request' for sibling-name conflict messages. * feat(http): wire environments, history, provider and watcher Adds HTTP environments and history storages on top of state.yaml, exposes createHttpStorageProvider via useHttpStorage(), registers HTTP space in PERSISTED_SPACE_IDS and integrates http runtime cache into the markdown watcher so external file changes resync and broadcast storage-synced. * feat(http): add API DTOs and routes for folders, requests, environments and history * feat(http): add execute IPC handler with undici, env interpolation and history * refactor(http): extract shared types to src/main/types/http.ts Single source of truth for HTTP primitives shared between main, IPC and renderer (renderer tsconfig already includes src/main/types/**). Removes duplicate definitions from runtime/types.ts and inline declarations in the IPC handler. * feat(http): add renderer composables for folders, requests, environments, history and execute Module-level reactive state for the HTTP space. Mirrors the notes-space pattern: useHttpFolders/useHttpRequests/useHttpEnvironments/useHttpHistory talk to the REST API, useHttpExecute wraps the spaces:http:execute IPC, useHttpApp owns the cross-composable folderId/requestId selection. useHttpRequests tracks a draft snapshot against the loaded request so the UI can detect dirty state and offer save/discard. Adds the spaces.http.untitledRequest i18n key for default request names. * feat(http): scaffold 3-column space layout with sidebar/editor/response HttpSpace view wires LayoutThreeColumn with HttpSidebar, RequestEditor and ResponsePanel placeholders. useHttpSpaceInit kicks off folders/requests/ environments/history fetches once on mount. Real component bodies follow in Phase 6.2-6.5. * feat(http): render sidebar tree with folders, requests and context menus * feat(http): split layout into folders sidebar, requests list and editor pane * fix(http): use registered Http* component names and add search input * fix(http): match notes list header layout (single search row with + button) * feat(http): add description and enabled flags on header/query KV entries * feat(http): redesign KeyValueTable with checkbox, description column and row actions * refactor(http-editor): polish header, drop save button and rename description tab to pre-request * style(http): show full uppercase method label in HttpMethodBadge * refactor(http): migrate folders sidebar to UiTree with multi-select and drag-drop * feat(http): multi-select, multi-delete and drag-drop in request list * feat(store): add http selection state to app store * feat(http): persist selected request and folder across reloads * refactor(http): remove unused send button label and folder info display * feat(http): bidirectional sync between request URL and query params * feat(http): implement body, auth and description tabs * feat(http): polish ResponsePanel with status, headers and copy * fix(http): use Http* prefix for tab components * feat(http): replace body textarea with CM6 editor and JSON validation * feat(http): validate JSON body on blur instead of every change * fix(http): hide internal JSON parse error details from user * fix(http): nest response i18n keys inside editor namespace * fix(http): apply custom scrollbar class to overflow containers * feat(http): hide pre-request tab until implementation * fix(http): avoid duplicate query params * fix(http): refresh state after storage changes * fix(http): persist active space * fix(http): localize empty request url * feat(http): support sidebar/list visibility toggle via View menu * style(http): align RequestEditor header with code/notes editor pattern * style(http): drop font-mono from URL input * feat(http): api-based search with state restore Mirror notes/snippets search pattern: server-side filter by name and url via ?search= query, separate requestsBySearch list, snapshot of selection before search and restore on clear. Eliminate redundant GET /:id calls by selecting from already-loaded list data. * feat(http): environments switcher and manager dialog EnvironmentSwitcher — icon button in RequestEditor header with active env tooltip and popover (none / list / manage). EnvironmentManagerDialog — two-pane modal with env list and key/value variables editor, autosave debounced 500ms, draft re-syncs only on selection change to avoid races. * feat(http): variable interpolation highlight and autocomplete * style(http): render {{var}} as chips * style(http): theme-aware {{var}} chip colors via tokens * feat(http): add request name input above url row * style(http): use default variant for method select and url input * style(http): tweak environment and send icons in editor header * feat(http): validate request name on rename * feat(http): auto-rename request on folder change conflict * chore: prevent auto-focus on close for environment popover * fix(http): make response panel resizable * feat(http): add request preview panel * refactor(http): use compact preview copy action * refactor(http): add response header copy action * refactor(http): move response summary to bottom panel * refactor(http): reuse code viewer for response body * refactor(cm): share editor extensions * feat(http): highlight request preview * refactor(cm): remove notes extension aliases * feat(http): move environments to sidebar * feat(http): track donation activity * fix(http): align environment rows * refactor(http): align body editor with cm6 viewer * fix(http): use ui font in url input * feat(http): reorder math space definition in getSpaceDefinitions * feat(http): add send request shortcut * feat(notes): link http requests * fix(http): refresh vault changes * fix(http): interpolate preview variables * feat(http): expand request context menu * feat(http): add http preferences * fix(http): tune environment panel * fix(http): confirm environment deletes * refactor(http): reuse key value table * fix(http): improve selected request item * feat(http): add folder custom icons * fix(http): select first request on folder change * docs: add http space documentation * chore(docs): remove AppVersion tag from environments and requests documentation * fix(http): prevent environment dialog autofocus tooltips
1 parent 54680f7 commit 5371e92

141 files changed

Lines changed: 11114 additions & 97 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-sponsored.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,3 @@ jobs:
7676
dist/*.snap
7777
if-no-files-found: warn
7878
retention-days: 30
79-
80-

.github/workflows/release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,3 @@ jobs:
118118
append_body: true
119119
env:
120120
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121-
122-

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ fix #123
3131

3232
It's ok to have multiple commits in a single PR, you don't need to rebase or force push for your changes as we will use Squash and Merge to squash the commits into one commit when merging.
3333

34-
And of course please test your code before PR.
34+
And of course please test your code before PR.

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A free, open-source developer workspace.
88
</p>
99

1010
<p align="center">
11-
<strong>Snippets, notes, calculations, and dev tools in one local-first app.</strong>
11+
<strong>Snippets, notes, HTTP requests, calculations, and dev tools in one local-first app.</strong>
1212
<br>
1313
Your data stays on your machine as plain Markdown files.
1414
</p>
@@ -75,7 +75,7 @@ massCode is free and open source. But building and maintaining a quality tool ta
7575

7676
## About
7777

78-
Originally a snippet manager, massCode now brings together snippets, notes, calculations, and developer tools in one desktop app, so everyday work stays in one place.
78+
Originally a snippet manager, massCode now brings together snippets, notes, HTTP requests, calculations, and developer tools in one desktop app, so everyday work stays in one place.
7979

8080
## Features
8181

@@ -101,6 +101,17 @@ Write longer markdown documents right next to your snippets: project docs, draft
101101
- Fullscreen presentation mode for demos and meetings
102102
- Callout blocks and image embedding
103103

104+
### HTTP Client
105+
106+
Keep API requests close to your code snippets and project notes with a lightweight HTTP client built into massCode.
107+
108+
- Organize requests with folders and custom folder icons
109+
- Use environments and `{{variables}}` for local, staging, and production APIs
110+
- Edit params, headers, body, auth, and markdown descriptions
111+
- Preview requests as raw HTTP or cURL before sending
112+
- Inspect response status, time, size, body, and headers
113+
- Send the current request with <kbd>Cmd+Enter</kbd> on macOS or <kbd>Ctrl+Enter</kbd> on Windows and Linux
114+
104115
### Math Notebook
105116

106117
A calculator-style notebook for natural-language calculations, conversions, and date math without leaving your workflow.
@@ -122,7 +133,7 @@ Built-in utilities for the small tasks that usually send you to a browser tab:
122133

123134
## Markdown Vault
124135

125-
Your snippets and notes live as plain `.md` files on disk with frontmatter metadata, so the data stays readable and portable.
136+
Your snippets, notes, and HTTP requests live as plain `.md` files on disk with frontmatter metadata, so the data stays readable and portable.
126137

127138
- **Git-friendly** - track changes and sync via any Git remote
128139
- **Cloud sync** - works with iCloud, Dropbox, Google Drive, Syncthing

docs/website/.vitepress/_data/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"win": "https://github.com/massCodeIO/massCode/releases/download/v4.7.1/massCode-4.7.1-x64.exe",
66
"winPortable": "https://github.com/massCodeIO/massCode/releases/download/v4.7.1/massCode-4.7.1-x64-portable.exe",
77
"linux": "https://github.com/massCodeIO/massCode/releases/download/v4.7.1/massCode-4.7.1.AppImage"
8-
}
8+
}

docs/website/.vitepress/config.mts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ export default defineConfig({
132132
{ text: 'Search', link: '/documentation/notes/search' },
133133
],
134134
},
135+
{
136+
text: 'HTTP',
137+
items: [
138+
{ text: 'HTTP Client', link: '/documentation/http/' },
139+
{ text: 'Requests', link: '/documentation/http/requests' },
140+
{ text: 'Environments', link: '/documentation/http/environments' },
141+
],
142+
},
135143
{
136144
text: 'Math',
137145
items: [
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: HTTP Environments
3+
description: "Use HTTP environments in massCode to manage reusable variables for local, staging, and production API requests."
4+
---
5+
6+
# Environments
7+
8+
Environments store reusable variables for requests. Use them for values that change between local, staging, and production APIs, such as base URLs, user IDs, organization IDs, and tokens.
9+
10+
<img :src="withBase('/http-envs.png')">
11+
12+
## Variables
13+
14+
Use variables with double braces:
15+
16+
```text
17+
{{apiUrl}}/v1/users/{{userId}}/sessions
18+
```
19+
20+
The URL field keeps variables visible while you edit. Preview and request execution resolve variables from the active environment.
21+
22+
Variables can be used in:
23+
24+
- URL
25+
- params
26+
- headers
27+
- body
28+
- auth fields
29+
30+
## Active Environment
31+
32+
Use the **Environments** panel below folders to choose the active environment.
33+
34+
Select **No environment** when you want requests to keep variables unresolved. This is useful when you are editing templates or copying a request without applying local values.
35+
36+
## Managing Environments
37+
38+
Open **Manage** from the Environments panel to create environments and edit variables.
39+
40+
Each environment has:
41+
42+
- a name
43+
- a key-value table of variables
44+
45+
The active environment is stored as part of the HTTP space state.
46+
47+
<script setup>
48+
import { withBase } from 'vitepress'
49+
</script>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
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."
4+
---
5+
6+
# HTTP Client
7+
8+
<AppVersion text=">=5.3" />
9+
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.
11+
12+
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.
13+
14+
<img :src="withBase('/http.png')">
15+
16+
## When to use HTTP
17+
18+
Use HTTP when you want a lightweight request client without leaving massCode.
19+
20+
- test local or remote API endpoints
21+
- save repeatable requests by project or service
22+
- keep request descriptions close to implementation notes
23+
- switch variables between local, staging, and production environments
24+
- copy a request as raw HTTP or cURL for debugging and sharing
25+
26+
## Main Concepts
27+
28+
### [Requests](/documentation/http/requests)
29+
30+
Requests store the method, URL, params, headers, body, auth settings, and markdown description for an API call. The editor autosaves changes, shows an outgoing request preview, and sends the selected request with <kbd>Cmd+Enter</kbd> on macOS or <kbd>Ctrl+Enter</kbd> on Windows or Linux.
31+
32+
### [Environments](/documentation/http/environments)
33+
34+
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.
35+
36+
## Folders
37+
38+
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.
39+
40+
## Storage
41+
42+
HTTP data is stored in your vault under the `http` folder. Requests are markdown files with YAML frontmatter, so they can be backed up and synced together with the rest of your massCode data.
43+
44+
<script setup>
45+
import { withBase } from 'vitepress'
46+
</script>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: HTTP Requests
3+
description: "Create, edit, preview, send, duplicate, and inspect HTTP requests in the massCode HTTP space."
4+
---
5+
6+
# Requests
7+
8+
Requests are the main items in the HTTP space. Each request stores the method, URL, params, headers, body, auth settings, and a markdown description.
9+
10+
## Creating Requests
11+
12+
Create a request from the request list header or from a folder context menu. New requests are created in the selected folder.
13+
14+
Request context menus include actions for:
15+
16+
- duplicate
17+
- delete
18+
- copy request preview
19+
- copy internal link
20+
- reveal in file manager
21+
22+
## Request Editor
23+
24+
The request editor is split into focused tabs:
25+
26+
- **Params** - query parameters sent with the URL
27+
- **Headers** - request headers
28+
- **Body** - JSON, text, form URL encoded, or multipart form data
29+
- **Auth** - none, bearer token, or basic auth
30+
- **Description** - markdown notes for the request
31+
32+
Changes are saved automatically while you edit.
33+
34+
## Body
35+
36+
Use the body tab to choose the payload format for methods that send data.
37+
38+
- **JSON** and **Text** use a CodeMirror editor.
39+
- **Form URL Encoded** uses key-value rows.
40+
- **Multipart Form Data** supports text and file rows.
41+
42+
## Sending Requests
43+
44+
Send the selected request with one of these methods:
45+
46+
- Click the send button next to the URL field.
47+
- Select **"Editor"** > **"Send Request"** from the menu bar.
48+
- Press <kbd>Cmd+Enter</kbd> on macOS or <kbd>Ctrl+Enter</kbd> on Windows or Linux.
49+
50+
## Preview
51+
52+
The lower panel can show the outgoing request before it is sent.
53+
54+
- **HTTP** preview shows the request line, host, headers, and body.
55+
- **cURL** preview builds a command you can paste into a terminal.
56+
57+
Use the copy button in the preview panel to copy the active preview.
58+
59+
## Response Viewer
60+
61+
After a request is sent, the response panel shows:
62+
63+
- status, duration, and response size
64+
- body and headers tabs
65+
- JSON formatting for JSON responses
66+
- copy action for response body and headers
67+
68+
HTTP has its own editor preferences, including line wrapping for request previews, request bodies, and response viewers.

docs/website/documentation/index.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: Documentation Overview
3-
description: "Explore the massCode documentation for code snippets, markdown notes, math notebook, storage, sync, themes, JSON Diff, and built-in developer tools."
3+
description: "Explore the massCode documentation for code snippets, markdown notes, HTTP requests, math notebook, storage, sync, themes, JSON Diff, and built-in developer tools."
44
---
55

66
# Overview
77

8-
massCode is a free and open source developer workspace for code snippets, markdown notes, calculations, and quick developer utilities. Instead of scattering everyday work across an editor, a notes app, a calculator, and a handful of websites, you keep it in four focused Spaces inside one local-first desktop app.
8+
massCode is a free and open source developer workspace for code snippets, markdown notes, HTTP requests, calculations, and quick developer utilities. Instead of scattering everyday work across an editor, a notes app, an HTTP client, a calculator, and a handful of websites, you keep it in focused Spaces inside one local-first desktop app.
99

1010
Switch between Spaces using the rail on the left side of the app.
1111

@@ -19,6 +19,10 @@ Use Code to build a reusable snippet library across projects and languages. The
1919

2020
Use Notes for longer markdown documents that do not fit well into snippets: project notes, drafts, technical docs, meeting notes, and personal knowledge bases. It uses the same three-column layout as Code and adds a Notes Dashboard, live preview, a notes graph, mindmaps, and fullscreen presentation mode.
2121

22+
## HTTP
23+
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.
25+
2226
## Math
2327

2428
Math is a calculator-style notebook for quick development math without leaving massCode. Use it for currency conversion, unit conversion, date math, finance, and natural-language calculations with instant results on every line.

0 commit comments

Comments
 (0)