Skip to content
This repository was archived by the owner on Jun 4, 2026. It is now read-only.

Commit 1e93baf

Browse files
Chrisclaude
authored andcommitted
docs: document push --batch, content-type routing, manifest shape
- README.md + .claude/CLAUDE.md: add push --batch / --batch-size to the command examples plus a callout on when the --batch path applies (source only; binary and plain text stay on per-file POST). - AGENTS.md: add a contributor-facing Content-Type Routing table (file-class → path → headers) so anyone touching batch-upload.ts knows which extensions belong where. Add a Manifest Shape section documenting the new {localHash, remoteMtime} format and the migration from the pre-1.0.1 bare-string form. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 57385f5 commit 1e93baf

3 files changed

Lines changed: 38 additions & 7 deletions

File tree

.claude/CLAUDE.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,17 @@ boxel sync . --prefer-newest # Keep newest version
192192
boxel sync . --delete # Sync deletions both ways
193193
boxel sync . --dry-run # Preview only
194194

195-
boxel push ./local <url> # One-way push (local → remote)
196-
boxel push ./local <url> --delete # Push and remove orphaned remote files
197-
boxel pull <url> ./local # One-way pull (remote → local)
195+
boxel push ./local <url> # One-way push (local → remote)
196+
boxel push ./local <url> --delete # Push and remove orphaned remote files
197+
boxel push ./local <url> --batch # Atomic batch upload (10/batch default)
198+
boxel push ./local <url> --batch --batch-size 25 # Custom batch size
199+
boxel pull <url> ./local # One-way pull (remote → local)
198200
```
199201

200202
> **Pull writes a manifest:** After `boxel pull <url> ./local` downloads files, it automatically writes `.boxel-sync.json` so `boxel sync .` works immediately against the fresh directory. No manual step needed between pull and first sync.
201203
204+
> **`push --batch`:** `.gts` definitions upload individually in dependency order; `.json` instances batch through `/_atomic` in groups of N. Faster for bulk pushes (50+ files). Binary files (images, fonts) and plain-text files (`.md`, `.csv`, `.yaml`) always take the per-file POST path because `/_atomic` only accepts card and source resource types.
205+
202206
**Failed download cleanup:** When `sync` encounters files that return 500 errors (broken/corrupted on server), it will prompt you to delete them:
203207
```
204208
⚠️ 3 file(s) failed to download (server error):

AGENTS.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,34 @@ boxel gather . -s /path/to/repo
112112

113113
## Batch Upload API
114114
The CLI supports batch uploads via the `/_atomic` endpoint:
115-
- Used by `track --push` for efficient multi-file uploads
115+
- Used by `track --push` and `push --batch` for efficient multi-file uploads
116116
- Sorts definitions (.gts) before instances (.json) for proper indexing
117117
- Fallback strategy: full batch → smaller batches → individual uploads
118118
- See `src/lib/batch-upload.ts` for implementation
119119

120+
### Content-type routing (since 1.0.1)
121+
Before sending bytes anywhere, the uploader decides which path a file takes based on extension (see `src/lib/content-type.ts`):
122+
123+
| File class | Examples | Path | Content-Type | Accept |
124+
|---|---|---|---|---|
125+
| Compilable source | `.gts`, `.ts`, `.tsx`, `.js`, `.jsx`, `.cjs`, `.mjs`, `.css`, `.scss`, `.less`, `.sass`, `.html` | `/_atomic` (type: `source`) | per-extension MIME | `application/vnd.card+source` |
126+
| Card JSON | `.json` | `/_atomic` (type: `card`, fallback `source` on parse failure) | `application/json` | `application/vnd.card+source` |
127+
| Plain text, non-source | `.md`, `.txt`, `.csv`, `.yaml`, `.xml` | per-file POST | per-extension MIME | `*/*` |
128+
| Binary | `.png`, `.jpg`, `.woff`, `.pdf`, `.zip`, etc. | per-file POST | per-extension MIME or `application/octet-stream` | `*/*` |
129+
130+
Rationale: `/_atomic` rejects anything its module compiler can't parse. Plain text and binary files need their raw bytes stored directly, which only the per-file POST endpoint does correctly.
131+
132+
### Manifest shape (since 1.0.1)
133+
All three sync commands agree on one `.boxel-sync.json` shape:
134+
```ts
135+
interface SyncManifest {
136+
workspaceUrl: string;
137+
lastSyncTime?: number;
138+
files: Record<string, { localHash: string; remoteMtime: number }>;
139+
}
140+
```
141+
`push.ts` migrates the pre-1.0.1 format (`files[path] = hashString`) on read. New writes always use the object form. Mirror this shape if adding a new command that touches the manifest.
142+
120143
## Notes for Agents Editing This Repo
121144
- Prefer minimal, targeted command changes in `src/commands/*.ts`.
122145
- Validate with local build/tests when feasible.

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,17 @@ boxel sync . --prefer-newest # Keep newest by timestamp
218218
boxel sync . --delete # Sync deletions both ways
219219
boxel sync . --dry-run # Preview only
220220

221-
boxel push ./local <url> # One-way push (local → remote)
222-
boxel push ./local <url> --delete # Push and remove orphaned remote files
223-
boxel pull <url> ./local # One-way pull (remote → local)
221+
boxel push ./local <url> # One-way push (local → remote)
222+
boxel push ./local <url> --delete # Push and remove orphaned remote files
223+
boxel push ./local <url> --batch # Atomic batch upload (10 files per batch)
224+
boxel push ./local <url> --batch --batch-size 25 # Custom batch size
225+
boxel pull <url> ./local # One-way pull (remote → local)
224226
```
225227

226228
> **Note:** `boxel pull` writes `.boxel-sync.json` automatically after a fresh download, so you can run `boxel sync .` immediately against a freshly-pulled workspace with no extra setup.
227229
230+
> **`--batch` mode** (push only): `.gts` definitions upload individually in dependency order, then `.json` instances batch through the server's `/_atomic` endpoint in groups of N. Meaningfully faster on big pushes (50+ files) and reduces UI flashing during server re-indexing. Binary files (images, fonts) and plain-text files (`.md`, `.csv`, `.yaml`) are routed to per-file POST regardless of mode, because `/_atomic` only accepts card and source resource types.
231+
228232
**Failed download cleanup:** When `sync` encounters files that return 500 errors (broken on server), it will prompt you to delete them:
229233
```
230234
⚠️ 3 file(s) failed to download (server error):

0 commit comments

Comments
 (0)