@xelth/eck-snapshot 2.2.0 β 4.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 +21 -0
- package/README.md +119 -225
- package/index.js +14 -776
- package/package.json +25 -7
- package/setup.json +805 -0
- package/src/cli/cli.js +427 -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 +601 -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/trainTokens.js +38 -0
- package/src/config.js +81 -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 +164 -0
- package/src/templates/vectorMode.md +22 -0
- package/src/utils/aiHeader.js +303 -0
- package/src/utils/fileUtils.js +928 -0
- package/src/utils/projectDetector.js +704 -0
- package/src/utils/tokenEstimator.js +198 -0
- package/.ecksnapshot.config.js +0 -35
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dmytro Surovtsev
|
|
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
CHANGED
|
@@ -1,226 +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
|
-
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
eck-snapshot restore snapshot.txt --dry-run
|
|
121
|
-
|
|
122
|
-
# Restore only specific files using patterns
|
|
123
|
-
eck-snapshot restore snapshot.txt --include "*.js" "*.json"
|
|
124
|
-
|
|
125
|
-
# Restore everything except certain files
|
|
126
|
-
eck-snapshot restore snapshot.txt --exclude "*.log" "node_modules/*"
|
|
127
|
-
|
|
128
|
-
# Restore with custom concurrency and verbose output
|
|
129
|
-
eck-snapshot restore snapshot.txt --concurrency 20 --verbose
|
|
130
|
-
|
|
131
|
-
# Restore compressed snapshots
|
|
132
|
-
eck-snapshot restore project_snapshot.txt.gz ./restored
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## Configuration
|
|
136
|
-
|
|
137
|
-
You can create a `.ecksnapshot.config.js` file in your project's root directory to customize the tool's behavior.
|
|
138
|
-
|
|
139
|
-
**Example `.ecksnapshot.config.js`:**
|
|
140
|
-
|
|
141
|
-
```javascript
|
|
142
|
-
export default {
|
|
143
|
-
// Files to ignore by name or pattern
|
|
144
|
-
filesToIgnore: [
|
|
145
|
-
'package-lock.json',
|
|
146
|
-
'*.log',
|
|
147
|
-
],
|
|
148
|
-
// File extensions to ignore
|
|
149
|
-
extensionsToIgnore: [
|
|
150
|
-
'.sqlite3',
|
|
151
|
-
'.env',
|
|
152
|
-
],
|
|
153
|
-
// Directories to ignore (must have a trailing slash)
|
|
154
|
-
dirsToIgnore: [
|
|
155
|
-
'node_modules/',
|
|
156
|
-
'.git/',
|
|
157
|
-
'dist/',
|
|
158
|
-
],
|
|
159
|
-
// Size and performance settings
|
|
160
|
-
maxFileSize: '10MB',
|
|
161
|
-
maxTotalSize: '100MB',
|
|
162
|
-
maxDepth: 10,
|
|
163
|
-
concurrency: 10
|
|
164
|
-
};
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Advanced Features
|
|
168
|
-
|
|
169
|
-
### Restore Command Options
|
|
170
|
-
|
|
171
|
-
The restore command offers powerful filtering and control options:
|
|
172
|
-
|
|
173
|
-
- **`--dry-run`**: Preview what files would be restored without actually writing them
|
|
174
|
-
- **`--include <patterns>`**: Only restore files matching the specified patterns (supports wildcards)
|
|
175
|
-
- **`--exclude <patterns>`**: Skip files matching the specified patterns (supports wildcards)
|
|
176
|
-
- **`--concurrency <number>`**: Control how many files are processed simultaneously (default: 10)
|
|
177
|
-
- **`--force`**: Skip confirmation prompts and overwrite existing files
|
|
178
|
-
- **`--verbose`**: Show detailed information about each file being processed
|
|
179
|
-
|
|
180
|
-
### Supported Formats
|
|
181
|
-
|
|
182
|
-
- **Plain Text** (`.txt`): Human-readable format, ideal for LLM context
|
|
183
|
-
- **JSON** (`.json`): Structured format with metadata and statistics
|
|
184
|
-
- **Compressed** (`.gz`): Any format can be gzipped for smaller file sizes
|
|
185
|
-
|
|
186
|
-
### Security Features
|
|
187
|
-
|
|
188
|
-
- **Path Validation**: Prevents directory traversal attacks during restore operations
|
|
189
|
-
- **File Sanitization**: Validates file paths and names for security
|
|
190
|
-
- **Confirmation Prompts**: Requires user confirmation before overwriting files (unless `--force` is used)
|
|
191
|
-
|
|
192
|
-
## Command Reference
|
|
193
|
-
|
|
194
|
-
### Snapshot Command
|
|
195
|
-
```bash
|
|
196
|
-
eck-snapshot [options] [repoPath]
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
**Options:**
|
|
200
|
-
- `-o, --output <dir>`: Output directory for snapshots
|
|
201
|
-
- `--no-tree`: Exclude directory tree from output
|
|
202
|
-
- `-v, --verbose`: Show detailed processing information
|
|
203
|
-
- `--max-file-size <size>`: Maximum individual file size (e.g., 10MB)
|
|
204
|
-
- `--max-total-size <size>`: Maximum total snapshot size (e.g., 100MB)
|
|
205
|
-
- `--max-depth <number>`: Maximum directory depth for tree generation
|
|
206
|
-
- `--config <path>`: Path to custom configuration file
|
|
207
|
-
- `--compress`: Create gzipped output
|
|
208
|
-
- `--include-hidden`: Include hidden files (starting with .)
|
|
209
|
-
- `--format <type>`: Output format: txt or json
|
|
210
|
-
|
|
211
|
-
### Restore Command
|
|
212
|
-
```bash
|
|
213
|
-
eck-snapshot restore [options] <snapshot_file> [target_directory]
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
**Options:**
|
|
217
|
-
- `-f, --force`: Force overwrite without confirmation
|
|
218
|
-
- `-v, --verbose`: Show detailed processing information
|
|
219
|
-
- `--dry-run`: Preview without actually writing files
|
|
220
|
-
- `--include <patterns>`: Include only matching files
|
|
221
|
-
- `--exclude <patterns>`: Exclude matching files
|
|
222
|
-
- `--concurrency <number>`: Number of concurrent operations
|
|
223
|
-
|
|
224
|
-
## License
|
|
225
|
-
|
|
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
|
+
|
|
226
120
|
This project is licensed under the MIT License.
|