claude-snap 1.0.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mohammad Ali Shuvo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,342 @@
1
+ <div align="center">
2
+
3
+ <img src="assets/claude-snap-banner.svg" alt="claude-snap banner" width="100%" />
4
+
5
+ <br/>
6
+ <br/>
7
+
8
+ <img src="assets/claude-snap-logo.svg" alt="claude-snap logo" width="80" />
9
+
10
+ # claude-snap
11
+
12
+ **Never re-explain your codebase to Claude again.**
13
+
14
+ `claude-snap` is a zero-config CLI that snapshots your project context — stack, architecture, conventions, git state — and restores it in Claude in seconds. Works across unlimited sessions.
15
+
16
+ <br/>
17
+
18
+ [![npm version](https://img.shields.io/npm/v/claude-snap.svg?style=flat-square&color=cb3837)](https://www.npmjs.com/package/claude-snap)
19
+ [![npm downloads](https://img.shields.io/npm/dm/claude-snap.svg?style=flat-square&color=blue)](https://www.npmjs.com/package/claude-snap)
20
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
21
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D16.0.0-brightgreen?style=flat-square)](https://nodejs.org)
22
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/shuvo18103107/claude-snap/pulls)
23
+
24
+ <br/>
25
+
26
+ [Installation](#-installation) · [How It Works](#-how-it-works) · [Commands](#-commands) · [Supported Stacks](#-supported-stacks) · [Contributing](#-contributing)
27
+
28
+ </div>
29
+
30
+ ---
31
+
32
+ ## The Problem
33
+
34
+ You're deep in a feature with Claude — architecture decided, patterns set, halfway through a refactor. Then the token limit hits.
35
+
36
+ **New session. Claude knows nothing.** You spend 10 minutes re-explaining the stack, the conventions, what you were doing, why.
37
+
38
+ Every. Single. Time.
39
+
40
+ ---
41
+
42
+ ## The Solution
43
+
44
+ `claude-snap` maintains two files per project:
45
+
46
+ | File | Purpose |
47
+ |------|---------|
48
+ | `CLAUDE.md` | Project bible — stack, architecture, conventions, rules. Auto-generated from your codebase. |
49
+ | `.claude/state.md` | Live session state — what's in progress, next action, blockers. Claude writes this at session end. |
50
+
51
+ One command at the start of a session. Claude reads both files and comes back fully oriented in ~5 seconds.
52
+
53
+ ```
54
+ claude-snap end → Claude writes exact state to file
55
+ claude-snap start → Claude reads files → back in flow instantly
56
+ ```
57
+
58
+ ---
59
+
60
+ ## Demo
61
+
62
+ **`claude-snap init` — auto-detects your entire project in seconds**
63
+
64
+ ![claude-snap init demo](assets/demo-init.png)
65
+
66
+ <br/>
67
+
68
+ **`claude-snap start` — session-start prompt, copied to clipboard**
69
+
70
+ ![claude-snap start demo](assets/demo-start.png)
71
+
72
+ <br/>
73
+
74
+ **`claude-snap status` — see your live session state at a glance**
75
+
76
+ ![claude-snap status demo](assets/demo-status.png)
77
+
78
+ <br/>
79
+
80
+ **`claude-snap end` — session-end prompt, copied to clipboard**
81
+
82
+ ![claude-snap end demo](assets/demo-end.png)
83
+
84
+ ---
85
+
86
+ ## Installation
87
+
88
+ ```bash
89
+ npm install -g claude-snap
90
+ ```
91
+
92
+ That's it. No config files, no accounts, no API keys.
93
+
94
+ ---
95
+
96
+ ## Quick Start
97
+
98
+ ```bash
99
+ # 1. Go to any project
100
+ cd your-project
101
+
102
+ # 2. Initialize — auto-detects everything
103
+ claude-snap init
104
+
105
+ # 3. Start a session — paste into Claude
106
+ claude-snap start
107
+
108
+ # 4. End a session — paste into Claude
109
+ claude-snap end
110
+ ```
111
+
112
+ **The workflow:**
113
+
114
+ 1. Run `claude-snap start` → prompt copied to clipboard
115
+ 2. Paste into Claude → Claude reads `CLAUDE.md` + `state.md`, replies with a crisp status
116
+ 3. Work with Claude normally
117
+ 4. When session ends (or token limit hits), run `claude-snap end` → paste into Claude
118
+ 5. Claude writes the exact state to `.claude/state.md`
119
+ 6. Next session: repeat from step 1
120
+
121
+ ---
122
+
123
+ ## How It Works
124
+
125
+ ### `claude-snap init`
126
+
127
+ Scans your project and auto-generates `CLAUDE.md` — your project bible:
128
+
129
+ | What | How It's Detected |
130
+ |------|------------------|
131
+ | Language | `tsconfig.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `pubspec.yaml` |
132
+ | Framework | `package.json` deps — React, Next.js, Express, NestJS, Django, FastAPI, Gin, Axum... |
133
+ | UI Library | Tailwind, shadcn/ui, Material UI, Chakra, Radix, Mantine, Ant Design |
134
+ | Test setup | Jest, Vitest, pytest, Playwright, Cypress |
135
+ | Package manager | `pnpm-lock.yaml`, `yarn.lock`, `bun.lockb`, `package-lock.json` |
136
+ | Commands | `package.json` scripts (dev, test, build) |
137
+ | Git history | Recent commits, most active files, current branch |
138
+ | Design system | Figma URLs, design tokens, Storybook, Tailwind config |
139
+
140
+ Then asks ~5 questions for things static analysis can't detect: architecture overview, coding conventions, domain concepts, critical rules.
141
+
142
+ ### `claude-snap start`
143
+
144
+ Generates a compact prompt (~50 tokens) that tells Claude to:
145
+ - Read `CLAUDE.md` + `.claude/state.md`
146
+ - Reply with current project, in-progress task, next action, and blockers
147
+ - Then wait for your instruction
148
+
149
+ ### `claude-snap end`
150
+
151
+ Generates a detailed prompt that tells Claude to write directly to `.claude/state.md` with:
152
+ - Every incomplete task (file paths, function names, what's done vs left)
153
+ - The single most important next step
154
+ - Open questions and blockers
155
+ - Carry-over context a cold session would need
156
+
157
+ ### `claude-snap checkpoint`
158
+
159
+ A lighter mid-session sync. Updates only "In Progress" and "Next Action". Run it after a big commit.
160
+
161
+ ---
162
+
163
+ ## Commands
164
+
165
+ ```bash
166
+ claude-snap init # Set up a project (interactive, auto-detects stack)
167
+ claude-snap start # Session start — loads context prompt to clipboard
168
+ claude-snap end # Session end — state-update prompt to clipboard
169
+ claude-snap checkpoint # Mid-session quick sync (after big commits)
170
+ claude-snap status # View current state.md in terminal
171
+ claude-snap decisions # View decision log
172
+ claude-snap scan # Re-scan project and regenerate CLAUDE.md
173
+ ```
174
+
175
+ ### Flags
176
+
177
+ ```bash
178
+ claude-snap init --yes # Skip prompts, use all auto-detected values
179
+ claude-snap start --no-copy # Print prompt only, don't copy to clipboard
180
+ claude-snap end --no-copy # Print prompt only, don't copy to clipboard
181
+ ```
182
+
183
+ ---
184
+
185
+ ## What Gets Created
186
+
187
+ ```
188
+ your-project/
189
+ ├── CLAUDE.md ← Project bible (auto-generated, you refine)
190
+ ├── .claudeignore ← Tells Claude which files to skip
191
+ └── .claude/
192
+ ├── state.md ← Live session state (Claude writes this)
193
+ ├── decisions.md ← Key architectural decision log
194
+ ├── settings.json ← Claude Code Stop hook (session-end reminder)
195
+ └── prompts/
196
+ ├── session-start.md ← The start prompt
197
+ ├── session-end.md ← The end prompt
198
+ └── checkpoint.md ← The checkpoint prompt
199
+ ```
200
+
201
+ > **Pro tip:** Commit `.claude/` to git. State syncs across machines and teammates automatically. New team member? They run `claude-snap start` and Claude already knows the architecture and what's in progress.
202
+
203
+ ---
204
+
205
+ ## Example Files
206
+
207
+ <details>
208
+ <summary><strong>CLAUDE.md — generated output</strong></summary>
209
+
210
+ ```markdown
211
+ # ironforge-api
212
+ > High-performance REST API for the Esois platform
213
+
214
+ ## Stack
215
+ TypeScript, Express, Prisma, Jest
216
+ **Testing:** Jest
217
+ **UI:** (none)
218
+
219
+ ## Structure
220
+ src/routes/
221
+ src/services/
222
+ src/db/
223
+ src/types/
224
+ tests/
225
+
226
+ ### Key Directories
227
+ - `src/routes/` → Express route handlers
228
+ - `src/services/` → Business logic layer
229
+ - `src/db/` → Database queries (raw SQL via pg client)
230
+ - `src/types/` → Shared TypeScript interfaces
231
+
232
+ ## Architecture
233
+ REST API → Service layer → DB queries. No ORM — raw SQL in src/db/queries/.
234
+ Auth via JWT (access + refresh tokens). Redis for session storage.
235
+
236
+ ## Coding Conventions
237
+ - Async/await everywhere, no .then() chains
238
+ - Custom AppError class for all thrown errors
239
+ - Never inline SQL — all queries in src/db/queries/
240
+
241
+ ## Commands
242
+ \`\`\`bash
243
+ # Dev
244
+ npm run dev
245
+
246
+ # Test
247
+ npm test
248
+
249
+ # Build
250
+ npm run build
251
+ \`\`\`
252
+
253
+ ## Critical Rules
254
+ - Never inline SQL — use src/db/queries/
255
+ - Never expose raw errors to the client
256
+ ```
257
+
258
+ </details>
259
+
260
+ <details>
261
+ <summary><strong>state.md — what Claude writes after a session</strong></summary>
262
+
263
+ ```markdown
264
+ # Session State
265
+ _Last updated: 2025-04-04 | Project: ironforge-api_
266
+
267
+ ## Status
268
+ 🟡 In progress
269
+
270
+ ## Currently In Progress
271
+ - [ ] `src/services/auth.ts` → `refreshToken()` method
272
+ - Done: input validation, token decode, expiry check (~line 89)
273
+ - Remaining: DB update for token rotation, emit `auth.refresh` event
274
+
275
+ ## Next Action
276
+ > Add DB update call in refreshToken() around line 89, then emit the event.
277
+ > Pattern reference: src/services/user.ts:createUser() for event emission.
278
+
279
+ ## Open Questions
280
+ - Should refresh tokens be single-use? Leaning yes for security.
281
+
282
+ ## Carry-over Context
283
+ - Mid-refactor: old token pattern used sessions table, new uses token_store table. 40% migrated.
284
+ ```
285
+
286
+ </details>
287
+
288
+ ---
289
+
290
+ ## Supported Stacks
291
+
292
+ | Language | Frameworks Detected |
293
+ |----------|-------------------|
294
+ | **JavaScript / TypeScript** | React, Next.js, Remix, Nuxt, Vue, Angular, Svelte, Astro, SolidJS, Express, Fastify, NestJS, Koa, Hono, tRPC, GraphQL |
295
+ | **Python** | Django, FastAPI, Flask |
296
+ | **Rust** | Axum, Actix |
297
+ | **Go** | Gin, Echo, Fiber |
298
+ | **Java / Kotlin** | Maven (pom.xml), Gradle (build.gradle) |
299
+ | **Dart / Flutter** | pubspec.yaml |
300
+ | **Ruby** | Gemfile |
301
+ | **PHP** | composer.json |
302
+ | **Elixir** | mix.exs |
303
+
304
+ ---
305
+
306
+ ## Claude Code Integration
307
+
308
+ If you use the **Claude Code CLI**, `CLAUDE.md` is read automatically at session start — no paste needed.
309
+
310
+ `claude-snap init` also writes `.claude/settings.json` with a **Stop hook** that reminds you to run `claude-snap end` whenever a Claude Code session ends.
311
+
312
+ ---
313
+
314
+ ## For Teams
315
+
316
+ Commit `.claude/` to your repository. Benefits:
317
+
318
+ - **Onboarding** — new engineers run `claude-snap start` and Claude already knows the full architecture
319
+ - **Context sync** — state stays consistent across machines
320
+ - **Decision log** — `.claude/decisions.md` tracks key architectural choices over time
321
+ - **No setup** — teammates install `claude-snap` globally, then just use it
322
+
323
+ ---
324
+
325
+ ## Contributing
326
+
327
+ Contributions welcome!
328
+
329
+ ```bash
330
+ git clone https://github.com/shuvo18103107/claude-snap.git
331
+ cd claude-snap
332
+ npm install
333
+ npm link
334
+ ```
335
+
336
+ Open issues or PRs → [github.com/shuvo18103107/claude-snap](https://github.com/shuvo18103107/claude-snap)
337
+
338
+ ---
339
+
340
+ ## License
341
+
342
+ MIT © [Mohammad Ali Shuvo](https://github.com/shuvo18103107)
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const { Command } = require('commander');
5
+ const pkg = require('../package.json');
6
+
7
+ const program = new Command();
8
+
9
+ program
10
+ .name('claude-snap')
11
+ .description('Multi-session Claude context manager — keeps Claude in sync across sessions')
12
+ .version(pkg.version);
13
+
14
+ program
15
+ .command('init')
16
+ .description('Set up Claude context for a project (auto-detects stack, structure, git history)')
17
+ .option('-y, --yes', 'Accept all auto-detected values without prompts')
18
+ .action((opts) => require('../src/commands/init')(opts));
19
+
20
+ program
21
+ .command('scan')
22
+ .description('Re-scan project and regenerate CLAUDE.md (non-destructive, shows diff)')
23
+ .action(() => require('../src/commands/scan')());
24
+
25
+ program
26
+ .command('start')
27
+ .description('Generate session-start prompt and copy to clipboard')
28
+ .option('--no-copy', 'Print only, do not copy to clipboard')
29
+ .action((opts) => require('../src/commands/start')(opts));
30
+
31
+ program
32
+ .command('end')
33
+ .description('Generate session-end prompt and copy to clipboard')
34
+ .option('--no-copy', 'Print only, do not copy to clipboard')
35
+ .action((opts) => require('../src/commands/end')(opts));
36
+
37
+ program
38
+ .command('checkpoint')
39
+ .description('Generate mid-session checkpoint prompt and copy to clipboard')
40
+ .option('--no-copy', 'Print only, do not copy to clipboard')
41
+ .action((opts) => require('../src/commands/checkpoint')(opts));
42
+
43
+ program
44
+ .command('status')
45
+ .description('Show current session state from .claude/state.md')
46
+ .action(() => require('../src/commands/status')());
47
+
48
+ program
49
+ .command('decisions')
50
+ .description('Show decision log from .claude/decisions.md')
51
+ .action(() => require('../src/commands/decisions')());
52
+
53
+ // Show help if no command given
54
+ if (process.argv.length === 2) {
55
+ program.outputHelp();
56
+ process.exit(0);
57
+ }
58
+
59
+ program.parse(process.argv);
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "claude-snap",
3
+ "version": "1.0.0",
4
+ "description": "Multi-session Claude context manager for engineers and designers — auto-detects your project, keeps Claude in sync across sessions with zero manual work.",
5
+ "keywords": [
6
+ "claude",
7
+ "claude-ai",
8
+ "claude-code",
9
+ "ai",
10
+ "context-management",
11
+ "developer-tools",
12
+ "productivity",
13
+ "llm",
14
+ "ai-tools",
15
+ "session",
16
+ "context",
17
+ "workflow",
18
+ "engineering",
19
+ "coding-assistant"
20
+ ],
21
+ "author": {
22
+ "name": "Mohammad Ali Shuvo",
23
+ "email": "shuvo105746@gmail.com",
24
+ "url": "https://github.com/shuvo18103107"
25
+ },
26
+ "license": "MIT",
27
+ "homepage": "https://github.com/shuvo18103107/claude-snap#readme",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/shuvo18103107/claude-snap.git"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/shuvo18103107/claude-snap/issues"
34
+ },
35
+ "bin": {
36
+ "claude-snap": "bin/claude-snap.js"
37
+ },
38
+ "main": "./src/index.js",
39
+ "files": [
40
+ "bin/",
41
+ "src/",
42
+ "README.md",
43
+ "LICENSE"
44
+ ],
45
+ "engines": {
46
+ "node": ">=16.0.0"
47
+ },
48
+ "dependencies": {
49
+ "chalk": "^4.1.2",
50
+ "commander": "^11.1.0",
51
+ "inquirer": "^8.2.6"
52
+ },
53
+ "scripts": {
54
+ "dev": "node bin/claude-snap.js"
55
+ }
56
+ }
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ const chalk = require('chalk');
4
+ const { findProjectRoot, getProjectName } = require('../utils/project');
5
+ const { generateCheckpointPrompt } = require('../templates');
6
+ const { copyToClipboard } = require('../utils/clipboard');
7
+ const ui = require('../utils/ui');
8
+
9
+ module.exports = async function checkpoint(opts = {}) {
10
+ const projectRoot = findProjectRoot();
11
+
12
+ if (!projectRoot) {
13
+ ui.error('No Claude context found. Run ' + chalk.cyan('claude-snap init') + ' first.');
14
+ process.exit(1);
15
+ }
16
+
17
+ const prompt = generateCheckpointPrompt();
18
+
19
+ console.log('');
20
+ console.log(chalk.bold.blue('◆ Checkpoint for:'), chalk.cyan(getProjectName(projectRoot)));
21
+ console.log('');
22
+
23
+ ui.promptBox('CHECKPOINT — Paste this into Claude', prompt);
24
+
25
+ if (opts.copy !== false) {
26
+ const copied = copyToClipboard(prompt);
27
+ if (copied) {
28
+ ui.clipboardSuccess();
29
+ } else {
30
+ ui.clipboardFail();
31
+ }
32
+ }
33
+ };
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ const chalk = require('chalk');
4
+ const { findProjectRoot, readFile, getProjectName, DECISIONS_FILE } = require('../utils/project');
5
+ const ui = require('../utils/ui');
6
+
7
+ module.exports = async function decisions() {
8
+ const projectRoot = findProjectRoot();
9
+
10
+ if (!projectRoot) {
11
+ ui.error('No Claude context found. Run ' + chalk.cyan('claude-snap init') + ' first.');
12
+ process.exit(1);
13
+ }
14
+
15
+ const content = readFile(projectRoot, DECISIONS_FILE);
16
+ const projectName = getProjectName(projectRoot);
17
+
18
+ if (!content) {
19
+ ui.error('.claude/decisions.md not found. Run ' + chalk.cyan('claude-snap init'));
20
+ process.exit(1);
21
+ }
22
+
23
+ console.log('');
24
+ console.log(chalk.bold.cyan(`● ${projectName} — Decision Log`));
25
+ console.log('');
26
+
27
+ // Parse and display decisions nicely
28
+ const decisions = content.split(/(?=^## \[)/m).slice(1); // Split on ## [DATE]
29
+
30
+ if (!decisions.length) {
31
+ ui.info('No decisions logged yet.');
32
+ console.log(chalk.dim(' Add entries to .claude/decisions.md'));
33
+ return;
34
+ }
35
+
36
+ decisions.slice(0, 10).forEach(block => {
37
+ const lines = block.split('\n');
38
+ const titleLine = lines[0]; // ## [DATE] Title
39
+ const titleMatch = titleLine.match(/^## \[(.+?)\] (.+)/);
40
+
41
+ if (titleMatch) {
42
+ console.log(chalk.bold.yellow(` [${titleMatch[1]}] ${titleMatch[2]}`));
43
+ lines.slice(1).forEach(line => {
44
+ if (line.trim() && !line.startsWith('---')) {
45
+ console.log(chalk.white(' ' + line));
46
+ }
47
+ });
48
+ console.log('');
49
+ }
50
+ });
51
+ };
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ const chalk = require('chalk');
4
+ const { findProjectRoot, getProjectName } = require('../utils/project');
5
+ const { generateEndPrompt } = require('../templates');
6
+ const { copyToClipboard } = require('../utils/clipboard');
7
+ const ui = require('../utils/ui');
8
+
9
+ module.exports = async function end(opts = {}) {
10
+ const projectRoot = findProjectRoot();
11
+
12
+ if (!projectRoot) {
13
+ ui.error('No Claude context found. Run ' + chalk.cyan('claude-snap init') + ' first.');
14
+ process.exit(1);
15
+ }
16
+
17
+ const prompt = generateEndPrompt();
18
+
19
+ console.log('');
20
+ console.log(chalk.bold.yellow('⏹ Ending session for:'), chalk.cyan(getProjectName(projectRoot)));
21
+ console.log('');
22
+
23
+ ui.promptBox('SESSION END — Paste this into Claude', prompt);
24
+
25
+ if (opts.copy !== false) {
26
+ const copied = copyToClipboard(prompt);
27
+ if (copied) {
28
+ ui.clipboardSuccess();
29
+ } else {
30
+ ui.clipboardFail();
31
+ }
32
+ }
33
+
34
+ console.log(chalk.dim('After Claude updates state.md, your next session will start exactly here.'));
35
+ console.log('');
36
+ };