@lucasschirm/claude-session-sync 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-session-sync",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Sync Claude Code session data to S3-compatible storage.",
5
5
  "author": {
6
6
  "name": "lucasschirm"
package/README.md CHANGED
@@ -149,6 +149,120 @@ bin/session-start # SessionStart hook entry point
149
149
  bin/session-end # SessionEnd hook entry point
150
150
  bin/hook # PreCompact/PostCompact/Stop/StopFailure/SubagentStop
151
151
  bin/transcript-watcher # Detached watcher process spawned by session-start
152
+ bin/claude-sync # Standalone CLI for manual sync/list/download
153
+ ```
154
+
155
+ ## Standalone CLI
156
+
157
+ In addition to the Claude Code hooks, this package ships a standalone CLI
158
+ binary (`claude-sync`) that lets you manually upload, list, and download
159
+ sessions from S3 storage. It's useful for backfilling historical sessions,
160
+ inspecting what's been synced, or restoring sessions to a new machine.
161
+
162
+ ### Installation
163
+
164
+ The CLI is included in the same npm package. You can run it via `npx` without
165
+ installing anything:
166
+
167
+ ```bash
168
+ npx @lucasschirm/claude-session-sync sync
169
+ ```
170
+
171
+ Or install it globally for a shorter `claude-sync` command:
172
+
173
+ ```bash
174
+ npm install -g @lucasschirm/claude-session-sync
175
+ claude-sync sync
176
+ ```
177
+
178
+ ### Commands
179
+
180
+ #### `sync`
181
+
182
+ Upload all local Claude Code sessions for the current project to S3.
183
+
184
+ ```bash
185
+ claude-sync sync
186
+ ```
187
+
188
+ From the project directory, the CLI:
189
+
190
+ 1. Finds the corresponding Claude Code project folder in `~/.claude/projects/`.
191
+ 2. Lists all local `.jsonl` transcript files.
192
+ 3. For each session, checks if it already exists in S3 — if so, skips it.
193
+ 4. The first session uploaded captures workspace + global + session config.
194
+ Subsequent sessions capture only session-scoped transcripts (config is
195
+ uploaded once).
196
+ 5. Prints a per-session summary and a total.
197
+
198
+ #### `list`
199
+
200
+ List all sessions uploaded for the current project in S3.
201
+
202
+ ```bash
203
+ claude-sync list
204
+ ```
205
+
206
+ Outputs a human-readable table:
207
+
208
+ ```
209
+ SESSION ID FILES SIZE LAST MODIFIED
210
+ -------------------------------------------------------------------------
211
+ d1acf718-cd8d-4c1d-84fd-b074d231995b 43 21.1 MB 2026-08-18 19:36
212
+ test-summary-001 8 119.6 KB 2026-08-18 19:35
213
+
214
+ 2 session(s), 51 files, 21.2 MB total
215
+ ```
216
+
217
+ #### `download`
218
+
219
+ Download session files from S3 to a local directory.
220
+
221
+ ```bash
222
+ # Download a specific session
223
+ claude-sync download --session-id=<session-id> --output=<dir>
224
+
225
+ # Download all sessions for the project
226
+ claude-sync download all --output=<dir>
227
+ ```
228
+
229
+ Files are restored to `<output>/<projectId>/<sessionId>/<scope>/<relativePath>`.
230
+
231
+ ### Configuration
232
+
233
+ The CLI reads configuration from environment variables, falling back to
234
+ `.claude/settings.local.json` `env` key for any variables not set in the
235
+ process environment. This means you can configure it once in
236
+ `.claude/settings.local.json` and the CLI will pick it up automatically.
237
+
238
+ See the [Configuration](#configuration) section below for the full list of
239
+ required and optional variables.
240
+
241
+ If required variables are missing, the CLI prints an error with example
242
+ `export` commands and a `.claude/settings.local.json` template:
243
+
244
+ ```
245
+ Error: required configuration is missing or incomplete.
246
+
247
+ The following environment variables must be set:
248
+ SAL_PROJECT_ID — Unique identifier for the project.
249
+ ...
250
+
251
+ Set them via environment variables before running the CLI:
252
+
253
+ export SAL_PROJECT_ID=session-analyzer
254
+ export SAL_STORAGE_TYPE=s3
255
+ ...
256
+ npx @lucasschirm/claude-session-sync sync
257
+
258
+ Or add them to .claude/settings.local.json:
259
+
260
+ {
261
+ "env": {
262
+ "SAL_PROJECT_ID": "session-analyzer",
263
+ ...
264
+ }
265
+ }
152
266
  ```
153
267
 
154
268
  ### Updating
@@ -188,8 +302,8 @@ shell before launching `claude`.
188
302
  | `SAL_STORAGE_TYPE` | Storage backend. Currently only `s3` is supported. |
189
303
  | `SAL_STORAGE_BUCKET` | S3 bucket name. |
190
304
  | `SAL_STORAGE_REGION` | AWS region (e.g. `us-east-1`). |
191
- | `SAL_STORAGE_ID` | AWS access key ID. |
192
- | `SAL_STORAGE_SECRET` | AWS secret access key. |
305
+ | `SAL_STORAGE_ACCESS_KEY_ID` | AWS access key ID. |
306
+ | `SAL_STORAGE_SECRET_ACCESS_KEY` | AWS secret access key. |
193
307
 
194
308
  ### Optional
195
309
 
@@ -232,8 +346,8 @@ Edit `~/.claude/settings.json`:
232
346
  "SAL_STORAGE_TYPE": "s3",
233
347
  "SAL_STORAGE_BUCKET": "my-session-bucket",
234
348
  "SAL_STORAGE_REGION": "us-east-1",
235
- "SAL_STORAGE_ID": "AKIAIOSFODNN7EXAMPLE",
236
- "SAL_STORAGE_SECRET": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
349
+ "SAL_STORAGE_ACCESS_KEY_ID": "AKIAIOSFODNN7EXAMPLE",
350
+ "SAL_STORAGE_SECRET_ACCESS_KEY": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
237
351
  },
238
352
  "enabledPlugins": {
239
353
  "claude-session-sync@session-analyzer": true
@@ -253,8 +367,8 @@ gitignored by default, so credentials stay local):
253
367
  "SAL_STORAGE_TYPE": "s3",
254
368
  "SAL_STORAGE_BUCKET": "my-session-bucket",
255
369
  "SAL_STORAGE_REGION": "us-east-1",
256
- "SAL_STORAGE_ID": "AKIAIOSFODNN7EXAMPLE",
257
- "SAL_STORAGE_SECRET": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
370
+ "SAL_STORAGE_ACCESS_KEY_ID": "AKIAIOSFODNN7EXAMPLE",
371
+ "SAL_STORAGE_SECRET_ACCESS_KEY": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
258
372
  "SAL_STORAGE_ENDPOINT": "http://localhost:4566"
259
373
  }
260
374
  }
@@ -275,8 +389,8 @@ export SAL_PROJECT_ID="my-app"
275
389
  export SAL_STORAGE_TYPE="s3"
276
390
  export SAL_STORAGE_BUCKET="my-session-bucket"
277
391
  export SAL_STORAGE_REGION="us-east-1"
278
- export SAL_STORAGE_ID="AKIAIOSFODNN7EXAMPLE"
279
- export SAL_STORAGE_SECRET="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
392
+ export SAL_STORAGE_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE"
393
+ export SAL_STORAGE_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
280
394
  claude
281
395
  ```
282
396
 
@@ -293,8 +407,8 @@ For local testing without a real AWS account, run
293
407
  "SAL_STORAGE_BUCKET": "sal-sessions",
294
408
  "SAL_STORAGE_REGION": "us-east-1",
295
409
  "SAL_STORAGE_ENDPOINT": "http://localhost:4566",
296
- "SAL_STORAGE_ID": "test",
297
- "SAL_STORAGE_SECRET": "test"
410
+ "SAL_STORAGE_ACCESS_KEY_ID": "test",
411
+ "SAL_STORAGE_SECRET_ACCESS_KEY": "test"
298
412
  }
299
413
  }
300
414
  ```
@@ -340,6 +454,14 @@ packages/plugins/claude-session-sync/
340
454
  │ ├── session-start.ts # SessionStart entry point
341
455
  │ ├── session-end.ts # SessionEnd entry point
342
456
  │ ├── transcript-watcher.ts # Detached watcher spawner
457
+ │ ├── cli.ts # Standalone CLI entry point (claude-sync)
458
+ │ ├── cli/ # CLI command modules
459
+ │ │ ├── env.ts # Environment resolution (process.env + settings.local.json)
460
+ │ │ ├── config.ts # Config validation with example error messages
461
+ │ │ ├── project.ts # Claude project folder resolution
462
+ │ │ ├── sync-command.ts # "sync" command
463
+ │ │ ├── list-command.ts # "list" command
464
+ │ │ └── download-command.ts # "download" command
343
465
  │ └── index.ts # Public API barrel
344
466
  ├── bin/ # Built executables (esbuild single-file bundles)
345
467
  ├── build.mjs # esbuild bundling script