@lucasschirm/claude-session-sync 0.1.1 → 0.2.2

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.2",
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,154 @@ 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 objects in the configured storage. Supports five forms:
201
+
202
+ ```bash
203
+ # List all projects in storage
204
+ claude-sync list
205
+
206
+ # List sessions for the current project (requires SAL_PROJECT_ID)
207
+ claude-sync list --current
208
+
209
+ # List sessions for a specific project
210
+ claude-sync list <project-id>
211
+
212
+ # List files in a session
213
+ claude-sync list <project-id> --session=<session-id>
214
+
215
+ # List files under a session sub-path
216
+ claude-sync list <project-id> --session=<session-id> --path=<path>
217
+ ```
218
+
219
+ `--path` is relative to the session folder. For example, `--path=session` lists all files under the `session/` scope, and `--path=session/configs` lists files under that sub-path.
220
+
221
+ Examples:
222
+
223
+ ```
224
+ PROJECT ID SESSIONS FILES SIZE LAST MODIFIED
225
+ -------------------------------------------------------------------------
226
+ session-analyzer 12 410 84.3 MB 2026-08-18 19:36
227
+ my-other-project 3 18 2.1 MB 2026-08-17 10:11
228
+
229
+ 2 project(s), 410 files, 86.4 MB total
230
+ ```
231
+
232
+ ```
233
+ SESSION ID FILES SIZE LAST MODIFIED
234
+ -------------------------------------------------------------------------
235
+ d1acf718-cd8d-4c1d-84fd-b074d231995b 43 21.1 MB 2026-08-18 19:36
236
+ test-summary-001 8 119.6 KB 2026-08-18 19:35
237
+
238
+ 2 session(s), 51 files, 21.2 MB total
239
+ ```
240
+
241
+ ```
242
+ KEY SIZE LAST MODIFIED
243
+ -------------------------------------------------------------------------
244
+ manifest.json 2.4 KB 2026-08-18 19:36
245
+ session/transcript.jsonl 1.1 MB 2026-08-18 19:36
246
+ workspace/package.json 3.2 KB 2026-08-18 19:35
247
+
248
+ 3 file(s), 1.1 MB total
249
+ ```
250
+
251
+ #### `download`
252
+
253
+ Download session files from S3 to a local directory.
254
+
255
+ ```bash
256
+ # Download a specific session
257
+ claude-sync download --session-id=<session-id> --output=<dir>
258
+
259
+ # Download all sessions for the project
260
+ claude-sync download all --output=<dir>
261
+ ```
262
+
263
+ Files are restored to `<output>/<projectId>/<sessionId>/<scope>/<relativePath>`.
264
+
265
+ ### Configuration
266
+
267
+ The CLI reads configuration from environment variables, falling back to
268
+ `.claude/settings.local.json` `env` key for any variables not set in the
269
+ process environment. This means you can configure it once in
270
+ `.claude/settings.local.json` and the CLI will pick it up automatically.
271
+
272
+ See the [Configuration](#configuration) section below for the full list of
273
+ required and optional variables.
274
+
275
+ If required variables are missing, the CLI prints an error with example
276
+ `export` commands and a `.claude/settings.local.json` template:
277
+
278
+ ```
279
+ Error: required configuration is missing or incomplete.
280
+
281
+ The following environment variables must be set:
282
+ SAL_PROJECT_ID — Unique identifier for the project.
283
+ ...
284
+
285
+ Set them via environment variables before running the CLI:
286
+
287
+ export SAL_PROJECT_ID=session-analyzer
288
+ export SAL_STORAGE_TYPE=s3
289
+ ...
290
+ npx @lucasschirm/claude-session-sync sync
291
+
292
+ Or add them to .claude/settings.local.json:
293
+
294
+ {
295
+ "env": {
296
+ "SAL_PROJECT_ID": "session-analyzer",
297
+ ...
298
+ }
299
+ }
152
300
  ```
153
301
 
154
302
  ### Updating
@@ -188,8 +336,8 @@ shell before launching `claude`.
188
336
  | `SAL_STORAGE_TYPE` | Storage backend. Currently only `s3` is supported. |
189
337
  | `SAL_STORAGE_BUCKET` | S3 bucket name. |
190
338
  | `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. |
339
+ | `SAL_STORAGE_ACCESS_KEY_ID` | AWS access key ID. |
340
+ | `SAL_STORAGE_SECRET_ACCESS_KEY` | AWS secret access key. |
193
341
 
194
342
  ### Optional
195
343
 
@@ -232,8 +380,8 @@ Edit `~/.claude/settings.json`:
232
380
  "SAL_STORAGE_TYPE": "s3",
233
381
  "SAL_STORAGE_BUCKET": "my-session-bucket",
234
382
  "SAL_STORAGE_REGION": "us-east-1",
235
- "SAL_STORAGE_ID": "AKIAIOSFODNN7EXAMPLE",
236
- "SAL_STORAGE_SECRET": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
383
+ "SAL_STORAGE_ACCESS_KEY_ID": "AKIAIOSFODNN7EXAMPLE",
384
+ "SAL_STORAGE_SECRET_ACCESS_KEY": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
237
385
  },
238
386
  "enabledPlugins": {
239
387
  "claude-session-sync@session-analyzer": true
@@ -253,8 +401,8 @@ gitignored by default, so credentials stay local):
253
401
  "SAL_STORAGE_TYPE": "s3",
254
402
  "SAL_STORAGE_BUCKET": "my-session-bucket",
255
403
  "SAL_STORAGE_REGION": "us-east-1",
256
- "SAL_STORAGE_ID": "AKIAIOSFODNN7EXAMPLE",
257
- "SAL_STORAGE_SECRET": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
404
+ "SAL_STORAGE_ACCESS_KEY_ID": "AKIAIOSFODNN7EXAMPLE",
405
+ "SAL_STORAGE_SECRET_ACCESS_KEY": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
258
406
  "SAL_STORAGE_ENDPOINT": "http://localhost:4566"
259
407
  }
260
408
  }
@@ -275,8 +423,8 @@ export SAL_PROJECT_ID="my-app"
275
423
  export SAL_STORAGE_TYPE="s3"
276
424
  export SAL_STORAGE_BUCKET="my-session-bucket"
277
425
  export SAL_STORAGE_REGION="us-east-1"
278
- export SAL_STORAGE_ID="AKIAIOSFODNN7EXAMPLE"
279
- export SAL_STORAGE_SECRET="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
426
+ export SAL_STORAGE_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE"
427
+ export SAL_STORAGE_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
280
428
  claude
281
429
  ```
282
430
 
@@ -293,8 +441,8 @@ For local testing without a real AWS account, run
293
441
  "SAL_STORAGE_BUCKET": "sal-sessions",
294
442
  "SAL_STORAGE_REGION": "us-east-1",
295
443
  "SAL_STORAGE_ENDPOINT": "http://localhost:4566",
296
- "SAL_STORAGE_ID": "test",
297
- "SAL_STORAGE_SECRET": "test"
444
+ "SAL_STORAGE_ACCESS_KEY_ID": "test",
445
+ "SAL_STORAGE_SECRET_ACCESS_KEY": "test"
298
446
  }
299
447
  }
300
448
  ```
@@ -340,6 +488,14 @@ packages/plugins/claude-session-sync/
340
488
  │ ├── session-start.ts # SessionStart entry point
341
489
  │ ├── session-end.ts # SessionEnd entry point
342
490
  │ ├── transcript-watcher.ts # Detached watcher spawner
491
+ │ ├── cli.ts # Standalone CLI entry point (claude-sync)
492
+ │ ├── cli/ # CLI command modules
493
+ │ │ ├── env.ts # Environment resolution (process.env + settings.local.json)
494
+ │ │ ├── config.ts # Config validation with example error messages
495
+ │ │ ├── project.ts # Claude project folder resolution
496
+ │ │ ├── sync-command.ts # "sync" command
497
+ │ │ ├── list-command.ts # "list" command
498
+ │ │ └── download-command.ts # "download" command
343
499
  │ └── index.ts # Public API barrel
344
500
  ├── bin/ # Built executables (esbuild single-file bundles)
345
501
  ├── build.mjs # esbuild bundling script