@xelth/eck-snapshot 3.0.0 β 4.1.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/README.md +120 -292
- package/index.js +14 -971
- package/package.json +30 -6
- package/setup.json +847 -0
- package/src/cli/cli.js +417 -0
- package/src/cli/commands/askGpt.js +29 -0
- package/src/cli/commands/autoDocs.js +150 -0
- package/src/cli/commands/consilium.js +86 -0
- package/src/cli/commands/createSnapshot.js +622 -0
- package/src/cli/commands/detectProfiles.js +98 -0
- package/src/cli/commands/detectProject.js +112 -0
- package/src/cli/commands/generateProfileGuide.js +91 -0
- package/src/cli/commands/pruneSnapshot.js +106 -0
- package/src/cli/commands/restoreSnapshot.js +173 -0
- package/src/cli/commands/setupGemini.js +149 -0
- package/src/cli/commands/setupGemini.test.js +115 -0
- package/src/cli/commands/showFile.js +39 -0
- package/src/cli/commands/trainTokens.js +38 -0
- package/src/cli/commands/updateSnapshot.js +75 -0
- package/src/config.js +81 -0
- package/src/core/skeletonizer.js +176 -0
- package/src/services/authService.js +20 -0
- package/src/services/claudeCliService.js +621 -0
- package/src/services/claudeCliService.test.js +267 -0
- package/src/services/dispatcherService.js +33 -0
- package/src/services/gptService.js +302 -0
- package/src/services/gptService.test.js +120 -0
- package/src/templates/agent-prompt.template.md +29 -0
- package/src/templates/architect-prompt.template.md +50 -0
- package/src/templates/envScanRequest.md +4 -0
- package/src/templates/gitWorkflow.md +32 -0
- package/src/templates/multiAgent.md +109 -0
- package/src/templates/skeleton-instruction.md +16 -0
- package/src/templates/update-prompt.template.md +19 -0
- package/src/templates/vectorMode.md +22 -0
- package/src/utils/aiHeader.js +477 -0
- package/src/utils/fileUtils.js +969 -0
- package/src/utils/gitUtils.js +44 -0
- package/src/utils/projectDetector.js +704 -0
- package/src/utils/tokenEstimator.js +198 -0
- package/.ecksnapshot.config.js +0 -35
package/README.md
CHANGED
|
@@ -1,292 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
eck-snapshot
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
eck-snapshot --
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
## βοΈ Configuration
|
|
122
|
-
|
|
123
|
-
Create `.ecksnapshot.config.js` in your project root:
|
|
124
|
-
|
|
125
|
-
```javascript
|
|
126
|
-
export default {
|
|
127
|
-
// Files to ignore by name or pattern
|
|
128
|
-
filesToIgnore: [
|
|
129
|
-
'package-lock.json',
|
|
130
|
-
'*.log',
|
|
131
|
-
'*.tmp'
|
|
132
|
-
],
|
|
133
|
-
|
|
134
|
-
// File extensions to ignore
|
|
135
|
-
extensionsToIgnore: [
|
|
136
|
-
'.sqlite3',
|
|
137
|
-
'.env',
|
|
138
|
-
'.DS_Store',
|
|
139
|
-
'.ico',
|
|
140
|
-
'.png',
|
|
141
|
-
'.jpg'
|
|
142
|
-
],
|
|
143
|
-
|
|
144
|
-
// Directories to ignore
|
|
145
|
-
dirsToIgnore: [
|
|
146
|
-
'node_modules/',
|
|
147
|
-
'.git/',
|
|
148
|
-
'dist/',
|
|
149
|
-
'build/',
|
|
150
|
-
'coverage/'
|
|
151
|
-
],
|
|
152
|
-
|
|
153
|
-
// Size and performance limits
|
|
154
|
-
maxFileSize: '10MB',
|
|
155
|
-
maxTotalSize: '100MB',
|
|
156
|
-
maxDepth: 10,
|
|
157
|
-
concurrency: 10
|
|
158
|
-
};
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
## π Command Reference
|
|
162
|
-
|
|
163
|
-
### Snapshot Command
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
eck-snapshot [options] [path]
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
**Core Options:**
|
|
170
|
-
- `-o, --output <dir>` - Output directory (default: ./snapshots)
|
|
171
|
-
- `-d, --dir` - Directory mode: scan any folder recursively
|
|
172
|
-
- `--no-ai-header` - Skip AI instruction header (clean mode)
|
|
173
|
-
- `-v, --verbose` - Show detailed processing information
|
|
174
|
-
|
|
175
|
-
**Format & Compression:**
|
|
176
|
-
- `--format <type>` - Output format: md (default) or json
|
|
177
|
-
- `--compress` - Create gzipped output (.gz extension)
|
|
178
|
-
- `--no-tree` - Exclude directory tree from output
|
|
179
|
-
|
|
180
|
-
**Filtering:**
|
|
181
|
-
- `--include-hidden` - Include hidden files (starting with .)
|
|
182
|
-
- `--max-file-size <size>` - Maximum individual file size (e.g., 5MB)
|
|
183
|
-
- `--max-total-size <size>` - Maximum total snapshot size (e.g., 50MB)
|
|
184
|
-
- `--config <path>` - Path to custom configuration file
|
|
185
|
-
|
|
186
|
-
### Restore Command
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
eck-snapshot restore [options] <snapshot_file> [target_directory]
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
**Control Options:**
|
|
193
|
-
- `-f, --force` - Skip confirmation prompts
|
|
194
|
-
- `--dry-run` - Preview without writing files
|
|
195
|
-
- `-v, --verbose` - Show detailed processing information
|
|
196
|
-
|
|
197
|
-
**Filtering:**
|
|
198
|
-
- `--include <patterns>` - Include only matching files (wildcards supported)
|
|
199
|
-
- `--exclude <patterns>` - Exclude matching files (wildcards supported)
|
|
200
|
-
- `--concurrency <number>` - Number of concurrent operations (default: 10)
|
|
201
|
-
|
|
202
|
-
## π Working with AI Models
|
|
203
|
-
|
|
204
|
-
### For Gemini 2.0 Pro (1M context)
|
|
205
|
-
```bash
|
|
206
|
-
# Create comprehensive snapshot with AI instructions
|
|
207
|
-
eck-snapshot --format md --compress
|
|
208
|
-
```
|
|
209
|
-
The generated file includes detailed instructions for Gemini to analyze your project and provide structured commands for Claude Code.
|
|
210
|
-
|
|
211
|
-
### For Claude Code
|
|
212
|
-
```bash
|
|
213
|
-
# Clean, focused snapshot
|
|
214
|
-
eck-snapshot --no-ai-header --max-total-size 200MB
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### For ChatGPT/Other Models
|
|
218
|
-
```bash
|
|
219
|
-
# Standard snapshot with moderate size limits
|
|
220
|
-
eck-snapshot --max-total-size 50MB --no-ai-header
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
## π§ Advanced Use Cases
|
|
224
|
-
|
|
225
|
-
### Monorepo Support
|
|
226
|
-
```bash
|
|
227
|
-
# Snapshot specific package in monorepo
|
|
228
|
-
eck-snapshot ./packages/core --dir --output ./snapshots/core
|
|
229
|
-
|
|
230
|
-
# Multiple packages
|
|
231
|
-
eck-snapshot ./packages/api --dir && eck-snapshot ./packages/web --dir
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### CI/CD Integration
|
|
235
|
-
```bash
|
|
236
|
-
# Create release snapshot
|
|
237
|
-
eck-snapshot --format json --compress --output ./artifacts
|
|
238
|
-
|
|
239
|
-
# Documentation generation
|
|
240
|
-
eck-snapshot --no-ai-header --format md --output ./docs/snapshots
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
### Migration & Archival
|
|
244
|
-
```bash
|
|
245
|
-
# Complete project archive
|
|
246
|
-
eck-snapshot --include-hidden --format json --compress --max-total-size 1GB
|
|
247
|
-
|
|
248
|
-
# Selective migration
|
|
249
|
-
eck-snapshot restore archive.json.gz --include "src/*" "docs/*" --exclude "*.test.*"
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
## π Output Formats
|
|
253
|
-
|
|
254
|
-
### Markdown Format (Default)
|
|
255
|
-
- Human-readable structure
|
|
256
|
-
- AI instruction headers (optional)
|
|
257
|
-
- Directory tree visualization
|
|
258
|
-
- File content with clear delimiters
|
|
259
|
-
|
|
260
|
-
### JSON Format
|
|
261
|
-
- Structured metadata
|
|
262
|
-
- Programmatic processing friendly
|
|
263
|
-
- Includes statistics and file information
|
|
264
|
-
- Perfect for automation workflows
|
|
265
|
-
|
|
266
|
-
## π‘οΈ Security Features
|
|
267
|
-
|
|
268
|
-
- **Path Validation**: Prevents directory traversal during restore
|
|
269
|
-
- **File Sanitization**: Validates all file paths and names
|
|
270
|
-
- **Confirmation Prompts**: Requires approval before overwriting files
|
|
271
|
-
- **Size Limits**: Protects against extremely large operations
|
|
272
|
-
|
|
273
|
-
## π Performance
|
|
274
|
-
|
|
275
|
-
- **Parallel Processing**: Concurrent file operations for speed
|
|
276
|
-
- **Progress Tracking**: Real-time progress bars for long operations
|
|
277
|
-
- **Memory Efficient**: Streams large files to avoid memory issues
|
|
278
|
-
- **Smart Caching**: Optimized for repeated operations
|
|
279
|
-
|
|
280
|
-
## π License
|
|
281
|
-
|
|
282
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
283
|
-
|
|
284
|
-
## π€ Contributing
|
|
285
|
-
|
|
286
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
287
|
-
|
|
288
|
-
## π Support
|
|
289
|
-
|
|
290
|
-
- **Issues**: [GitHub Issues](https://github.com/xelth-com/eckSnapshot/issues)
|
|
291
|
-
- **Documentation**: This README and `--help` commands
|
|
292
|
-
- **Examples**: See the examples directory in the repository
|
|
1
|
+
|
|
2
|
+
# eckSnapshot
|
|
3
|
+
|
|
4
|
+
A lightweight, platform-independent CLI for creating focused, AI-ready project snapshots.
|
|
5
|
+
|
|
6
|
+
`eckSnapshot` is a powerful command-line tool designed to solve a critical problem in AI-assisted development: providing clear, complete, and focused context to Large Language Models (LLMs). It allows you to package an entire project codebaseβor just specific parts of itβinto a single, clean text file.
|
|
7
|
+
|
|
8
|
+
This tool is built for a modern workflow where you act as the architect, guiding the overall strategy, while AI agents handle the detailed implementation.
|
|
9
|
+
|
|
10
|
+
## The Core Workflow
|
|
11
|
+
|
|
12
|
+
`eckSnapshot` is designed to support a two-part AI workflow for maximum efficiency and quality:
|
|
13
|
+
|
|
14
|
+
1. **The Architect LLM (Gemini, GPT-4, Grok):** A model with a large context window. You provide it with a snapshot of your project, and it analyzes the codebase to create a high-level plan for new features or refactoring.
|
|
15
|
+
2. **The Coder LLM (Claude Code, OpenAI Codex):** A model specialized in writing and modifying code. It takes the detailed instructions generated by the Architect and performs the hands-on coding tasks.
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
1. **Node.js** (v18.x or higher).
|
|
20
|
+
2. **An AI Assistant CLI (at least one):**
|
|
21
|
+
* **Claude:** An active **Claude Pro** subscription and the `claude-code` CLI installed.
|
|
22
|
+
* **OpenAI:** An active **ChatGPT Plus/Pro** subscription and the `@openai/codex` CLI installed (`npm install -g @openai/codex`).
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
Install `eckSnapshot` globally on your system using npm:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install -g @xelth/eck-snapshot
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Once installed, you can run the tool using the `eck-snapshot` command from any directory.
|
|
33
|
+
|
|
34
|
+
## A Step-by-Step Guide to Using eckSnapshot
|
|
35
|
+
|
|
36
|
+
Hereβs the most common workflow, from creating a full snapshot to focusing on specific features.
|
|
37
|
+
|
|
38
|
+
#### Step 1: Create a Full Project Snapshot
|
|
39
|
+
|
|
40
|
+
This is your primary command. It scans your project and packs all relevant code into a single file.
|
|
41
|
+
|
|
42
|
+
> **Usage:**
|
|
43
|
+
> ```bash
|
|
44
|
+
> dimi@xelth:/mnt/c/Users/xelth/myProject$ eck-snapshot
|
|
45
|
+
> ```
|
|
46
|
+
|
|
47
|
+
* **What it does:** Creates a file like `myProject_snapshot_... .md` in the `.eck/snapshots/` directory. This file contains your project's directory structure and the complete code. You can now pass this file to your Architect LLM for analysis.
|
|
48
|
+
|
|
49
|
+
#### Step 2: Handle Large Projects with Auto-Profiling
|
|
50
|
+
|
|
51
|
+
If your project is too large for an LLM's context window, `profile-detect` can automatically slice it into logical parts (profiles) using AI.
|
|
52
|
+
|
|
53
|
+
> **Usage:**
|
|
54
|
+
> ```bash
|
|
55
|
+
> dimi@xelth:/mnt/c/Users/xelth/myProject$ eck-snapshot profile-detect
|
|
56
|
+
> ```
|
|
57
|
+
|
|
58
|
+
* **Output Example:**
|
|
59
|
+
```
|
|
60
|
+
β¨ Detected Profiles:
|
|
61
|
+
---------------------------
|
|
62
|
+
- cli
|
|
63
|
+
- services
|
|
64
|
+
- core
|
|
65
|
+
- templates
|
|
66
|
+
- docs
|
|
67
|
+
- config
|
|
68
|
+
```
|
|
69
|
+
* **What it does:** Analyzes your project and saves these logical groupings into a `.eck/profiles.json` file, which you can use in the next step.
|
|
70
|
+
|
|
71
|
+
#### Step 3: Use Profiles to Create Focused Snapshots
|
|
72
|
+
|
|
73
|
+
The `--profile` option gives you powerful control over what goes into a snapshot. You can combine profiles, exclude files, and even use ad-hoc patterns.
|
|
74
|
+
|
|
75
|
+
> **Example 1: Combine and Exclude Profiles**
|
|
76
|
+
>
|
|
77
|
+
> Create a snapshot of the core logic, services, and CLI, but exclude all documentation and configuration files.
|
|
78
|
+
> ```bash
|
|
79
|
+
> eck-snapshot --profile "core,services,cli,-docs,-config"
|
|
80
|
+
> ```
|
|
81
|
+
|
|
82
|
+
> **Example 2: Use Ad-Hoc Glob Patterns**
|
|
83
|
+
>
|
|
84
|
+
> Include all `.js` files in the `src` directory but exclude all test files, without using a pre-defined profile.
|
|
85
|
+
> ```bash
|
|
86
|
+
> eck-snapshot --profile "src/**/*.js,-**/*.test.js"
|
|
87
|
+
> ```
|
|
88
|
+
> *Note: Quotes are required when using complex patterns with wildcards (`*`) or commas.*
|
|
89
|
+
|
|
90
|
+
#### Step 4: Intelligently Prune a Snapshot
|
|
91
|
+
|
|
92
|
+
If a snapshot is still too large, `prune` uses AI to shrink it to a target size, keeping only the most important files for understanding the code.
|
|
93
|
+
|
|
94
|
+
> **Usage:**
|
|
95
|
+
> ```bash
|
|
96
|
+
> eck-snapshot prune myProject_snapshot.md --target-size 500KB
|
|
97
|
+
> ```
|
|
98
|
+
|
|
99
|
+
#### Step 5 (Alternative): Truncate Files by Line Count
|
|
100
|
+
|
|
101
|
+
A faster, non-AI method to reduce snapshot size. This command keeps only the top N lines of each file, which is useful for a high-level architectural overview.
|
|
102
|
+
|
|
103
|
+
> **Usage:**
|
|
104
|
+
> ```bash
|
|
105
|
+
> eck-snapshot --max-lines-per-file 200
|
|
106
|
+
> ```
|
|
107
|
+
|
|
108
|
+
## Auxiliary Commands
|
|
109
|
+
|
|
110
|
+
* `restore <snapshot_file>`: Recreates a project's file structure from a snapshot.
|
|
111
|
+
* `generate-profile-guide`: Creates a guide for manual profile creation. Use this if `profile-detect` fails on very large projects, as it allows you to use an LLM with a larger context window (e.g., a web UI).
|
|
112
|
+
* `detect`: Shows how `eckSnapshot` has identified your project type and what default file filters are being applied.
|
|
113
|
+
* `ask-gpt` / `ask-claude`: Directly delegate a task to your configured AI coder agents from the command line.
|
|
114
|
+
* `setup-gemini`: A utility to automatically configure integration with the `gemini-cli`.
|
|
115
|
+
|
|
116
|
+
For a full list of commands and options, run `eck-snapshot --help`.
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
This project is licensed under the MIT License.
|