@xelth/eck-snapshot 4.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/package.json +7 -1
- package/setup.json +47 -5
- package/src/cli/cli.js +71 -81
- package/src/cli/commands/createSnapshot.js +215 -194
- package/src/cli/commands/setupGemini.js +1 -1
- package/src/cli/commands/setupGemini.test.js +1 -1
- package/src/cli/commands/showFile.js +39 -0
- package/src/cli/commands/updateSnapshot.js +75 -0
- package/src/core/skeletonizer.js +176 -0
- package/src/templates/multiAgent.md +31 -86
- package/src/templates/skeleton-instruction.md +16 -0
- package/src/templates/update-prompt.template.md +19 -0
- package/src/utils/aiHeader.js +290 -116
- package/src/utils/fileUtils.js +47 -6
- package/src/utils/gitUtils.js +44 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xelth/eck-snapshot",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "A powerful CLI tool to create and restore single-file text snapshots of Git repositories and directories. Optimized for AI context and LLM workflows.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"url": "https://github.com/xelth-com/eckSnapshot.git"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"@babel/generator": "^7.25.6",
|
|
32
33
|
"@babel/parser": "^7.25.6",
|
|
33
34
|
"@babel/traverse": "^7.25.6",
|
|
34
35
|
"chalk": "^5.3.0",
|
|
@@ -43,6 +44,11 @@
|
|
|
43
44
|
"ora": "^8.1.0",
|
|
44
45
|
"p-limit": "^5.0.0",
|
|
45
46
|
"p-retry": "^6.2.1",
|
|
47
|
+
"tree-sitter": "^0.25.0",
|
|
48
|
+
"tree-sitter-c": "^0.24.1",
|
|
49
|
+
"tree-sitter-java": "^0.23.5",
|
|
50
|
+
"tree-sitter-kotlin": "^0.3.8",
|
|
51
|
+
"tree-sitter-python": "^0.25.0",
|
|
46
52
|
"which": "^4.0.0"
|
|
47
53
|
},
|
|
48
54
|
"devDependencies": {
|
package/setup.json
CHANGED
|
@@ -374,7 +374,6 @@
|
|
|
374
374
|
"dirsToIgnore": [
|
|
375
375
|
"node_modules/",
|
|
376
376
|
".git/",
|
|
377
|
-
".eck/",
|
|
378
377
|
"dist/",
|
|
379
378
|
"build/",
|
|
380
379
|
".next/",
|
|
@@ -387,6 +386,27 @@
|
|
|
387
386
|
"create-snapshot/"
|
|
388
387
|
],
|
|
389
388
|
"includeHidden": false,
|
|
389
|
+
"eckDirectoryFiltering": {
|
|
390
|
+
"_comment": "Smart filtering for .eck directory - includes documentation but excludes confidential files",
|
|
391
|
+
"enabled": true,
|
|
392
|
+
"confidentialPatterns": [
|
|
393
|
+
"SERVER_ACCESS.md",
|
|
394
|
+
"CREDENTIALS*.md",
|
|
395
|
+
"SECRETS*.md",
|
|
396
|
+
"*.secret",
|
|
397
|
+
"*.key",
|
|
398
|
+
"*.pem",
|
|
399
|
+
".env*"
|
|
400
|
+
],
|
|
401
|
+
"alwaysIncludePatterns": [
|
|
402
|
+
"ARCHITECTURE.md",
|
|
403
|
+
"CONTEXT.md",
|
|
404
|
+
"OPERATIONS.md",
|
|
405
|
+
"ROADMAP.md",
|
|
406
|
+
"TECH_DEBT.md",
|
|
407
|
+
"README.md"
|
|
408
|
+
]
|
|
409
|
+
},
|
|
390
410
|
"projectSpecific": {
|
|
391
411
|
"android": {
|
|
392
412
|
"filesToIgnore": [
|
|
@@ -539,9 +559,11 @@
|
|
|
539
559
|
"Request ENV scan from agent",
|
|
540
560
|
"Analyze User Request in their native language",
|
|
541
561
|
"Formulate environment-appropriate technical plan",
|
|
542
|
-
"Propose the plan
|
|
543
|
-
"
|
|
544
|
-
"
|
|
562
|
+
"Propose the high-level plan in the user's language",
|
|
563
|
+
"STOP and WAIT for explicit user confirmation",
|
|
564
|
+
"ONLY after approval: Generate environment-specific JSON command block in a SEPARATE message",
|
|
565
|
+
"Communicate with user in their language, commands in ENGLISH",
|
|
566
|
+
"CRITICAL: Never output JSON commands until the user agrees to the plan"
|
|
545
567
|
]
|
|
546
568
|
},
|
|
547
569
|
"executionAgents": {
|
|
@@ -568,7 +590,9 @@
|
|
|
568
590
|
"electron debug",
|
|
569
591
|
"file editing",
|
|
570
592
|
"testing commands",
|
|
571
|
-
"browser automation"
|
|
593
|
+
"browser automation (chrome_mcp)",
|
|
594
|
+
"visual regression testing",
|
|
595
|
+
"network logging"
|
|
572
596
|
],
|
|
573
597
|
"restrictions": [
|
|
574
598
|
"no PM2 commands",
|
|
@@ -713,6 +737,24 @@
|
|
|
713
737
|
]
|
|
714
738
|
}
|
|
715
739
|
},
|
|
740
|
+
"browserAutomation": {
|
|
741
|
+
"enabled": true,
|
|
742
|
+
"provider": "Claude in Chrome MCP",
|
|
743
|
+
"availableFor": ["local_dev"],
|
|
744
|
+
"usage_protocol": "CRITICAL: Browser tasks MUST be executed directly by the interactive 'local_dev' agent using its internal tools. DO NOT delegate browser tasks via the 'eck-snapshot ask-claude' CLI command, as the subprocess lacks MCP context.",
|
|
745
|
+
"capabilities": {
|
|
746
|
+
"navigation": "Navigate URLs, handle tabs/windows",
|
|
747
|
+
"interaction": "Click, type, scroll, drag-and-drop",
|
|
748
|
+
"inspection": "Read DOM, extract text, verify styles",
|
|
749
|
+
"debugging": "Access console logs, network activity",
|
|
750
|
+
"visual": "Generate screenshots, record GIF"
|
|
751
|
+
},
|
|
752
|
+
"restrictions": [
|
|
753
|
+
"No non-consensual file downloads",
|
|
754
|
+
"No sensitive credentials interaction",
|
|
755
|
+
"MUST NOT use 'eck-snapshot ask-claude' wrapper for these tasks"
|
|
756
|
+
]
|
|
757
|
+
},
|
|
716
758
|
"header": {
|
|
717
759
|
"defaultEnabled": true,
|
|
718
760
|
"_comment": "Controls whether AI instruction headers are included by default in snapshots"
|
package/src/cli/cli.js
CHANGED
|
@@ -7,6 +7,7 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
7
7
|
const __dirname = path.dirname(__filename);
|
|
8
8
|
|
|
9
9
|
import { createRepoSnapshot } from './commands/createSnapshot.js';
|
|
10
|
+
import { updateSnapshot } from './commands/updateSnapshot.js';
|
|
10
11
|
import { restoreSnapshot } from './commands/restoreSnapshot.js';
|
|
11
12
|
import { pruneSnapshot } from './commands/pruneSnapshot.js';
|
|
12
13
|
import { generateConsilium } from './commands/consilium.js';
|
|
@@ -19,6 +20,7 @@ import { detectProfiles } from './commands/detectProfiles.js';
|
|
|
19
20
|
import { generateProfileGuide } from './commands/generateProfileGuide.js';
|
|
20
21
|
import { setupGemini } from './commands/setupGemini.js';
|
|
21
22
|
import { generateAutoDocs } from './commands/autoDocs.js';
|
|
23
|
+
import { showFile } from './commands/showFile.js';
|
|
22
24
|
import inquirer from 'inquirer';
|
|
23
25
|
import ora from 'ora';
|
|
24
26
|
import { execa } from 'execa';
|
|
@@ -31,10 +33,10 @@ async function checkCodeBoundaries(filePath, agentId) {
|
|
|
31
33
|
try {
|
|
32
34
|
const content = await fs.readFile(filePath, 'utf-8');
|
|
33
35
|
const boundaryRegex = /\/\* AGENT_BOUNDARY:\[([^\]]+)\] START \*\/([\s\S]*?)\/\* AGENT_BOUNDARY:\[[^\]]+\] END \*\//g;
|
|
34
|
-
|
|
36
|
+
|
|
35
37
|
const boundaries = [];
|
|
36
38
|
let match;
|
|
37
|
-
|
|
39
|
+
|
|
38
40
|
while ((match = boundaryRegex.exec(content)) !== null) {
|
|
39
41
|
boundaries.push({
|
|
40
42
|
owner: match[1],
|
|
@@ -43,7 +45,7 @@ async function checkCodeBoundaries(filePath, agentId) {
|
|
|
43
45
|
content: match[2]
|
|
44
46
|
});
|
|
45
47
|
}
|
|
46
|
-
|
|
48
|
+
|
|
47
49
|
return {
|
|
48
50
|
file: filePath,
|
|
49
51
|
hasBoundaries: boundaries.length > 0,
|
|
@@ -63,89 +65,61 @@ async function checkCodeBoundaries(filePath, agentId) {
|
|
|
63
65
|
export function run() {
|
|
64
66
|
const program = new Command();
|
|
65
67
|
|
|
66
|
-
const helpGuide = `eck-snapshot (v4.
|
|
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
|
-
-> Includes all .js files in the 'src' directory and its subdirectories,
|
|
117
|
-
but excludes any file ending in '.test.js'.
|
|
118
|
-
Note: Quotes are required for complex patterns.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
Step 4: Intelligently Prune a Snapshot
|
|
122
|
-
If a snapshot is still too large, \`prune\` uses AI to shrink it to a target size,
|
|
123
|
-
keeping only the most important files.
|
|
124
|
-
|
|
125
|
-
> Usage:
|
|
126
|
-
$ eck-snapshot prune myProject_snapshot.md --target-size 500KB
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
Step 5 (Alternative): Truncate Files by Line Count
|
|
130
|
-
A faster, non-AI method to reduce size by keeping only the top N lines of each file.
|
|
131
|
-
Useful for a high-level overview.
|
|
132
|
-
|
|
133
|
-
> Usage:
|
|
134
|
-
$ eck-snapshot --max-lines-per-file 200
|
|
135
|
-
|
|
136
|
-
--- Auxiliary Commands ---
|
|
137
|
-
|
|
138
|
-
- restore: Restore a project from a snapshot file.
|
|
139
|
-
- 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).
|
|
140
|
-
- detect: Show how eckSnapshot identifies your project type.
|
|
141
|
-
- ask-gpt / ask-claude: Directly query the configured AI coder agents.
|
|
142
|
-
- setup-gemini: Auto-configure integration with gemini-cli.
|
|
68
|
+
const helpGuide = `eck-snapshot (v4.1.0) - AI-Native Repository Context Tool.
|
|
69
|
+
|
|
70
|
+
--- 🚀 Core Workflow: Optimized for Web LLMs (Gemini/ChatGPT) ---
|
|
71
|
+
|
|
72
|
+
1. Initial Context (Maximum Compression)
|
|
73
|
+
Create a lightweight map of your entire project. Bodies of functions are hidden.
|
|
74
|
+
This fits huge monoliths into the context window.
|
|
75
|
+
|
|
76
|
+
$ eck-snapshot --skeleton
|
|
77
|
+
-> Generates: .eck/snapshots/<name>_sk.md (Upload this to AI)
|
|
78
|
+
|
|
79
|
+
2. Lazy Loading (On-Demand Details)
|
|
80
|
+
If the AI needs to see the implementation of specific files, it will ask you.
|
|
81
|
+
You can display multiple files at once to copy-paste back to the chat.
|
|
82
|
+
|
|
83
|
+
$ eck-snapshot show src/auth.js src/utils/hash.js
|
|
84
|
+
|
|
85
|
+
3. Working & Updating
|
|
86
|
+
As you apply changes, the AI loses context. Instead of re-sending the full repo,
|
|
87
|
+
send only what changed since the last snapshot.
|
|
88
|
+
|
|
89
|
+
$ eck-snapshot update
|
|
90
|
+
-> Generates: .eck/snapshots/update_<timestamp>.md (Contains changed files + git diff)
|
|
91
|
+
|
|
92
|
+
--- 🛠️ Managing Context Profiles ---
|
|
93
|
+
|
|
94
|
+
Option A: Auto-Detection (Best for start)
|
|
95
|
+
Uses AI to scan folders and suggest profiles (backend, frontend, etc).
|
|
96
|
+
$ eck-snapshot profile-detect
|
|
97
|
+
|
|
98
|
+
Option B: Manual Guide (Best for large repos)
|
|
99
|
+
If the project is too big for auto-detection, this generates a prompt text file
|
|
100
|
+
that you can paste into a powerful Web LLM (like Gemini 1.5 Pro) to design profiles manually.
|
|
101
|
+
|
|
102
|
+
1. Run: $ eck-snapshot generate-profile-guide
|
|
103
|
+
2. Open: .eck/profile_generation_guide.md
|
|
104
|
+
3. Copy: Paste the content into your AI chat.
|
|
105
|
+
4. Save: Take the JSON response and save it to .eck/profiles.json
|
|
106
|
+
|
|
107
|
+
Option C: Using Profiles
|
|
108
|
+
$ eck-snapshot --profile backend
|
|
109
|
+
$ eck-snapshot --profile "frontend,-**/*.test.js" (Ad-hoc filtering)
|
|
110
|
+
|
|
111
|
+
--- 🧩 Auxiliary Commands ---
|
|
112
|
+
|
|
113
|
+
- restore: Restore files from a snapshot to disk.
|
|
114
|
+
- prune: Use AI to shrink a snapshot file by importance.
|
|
115
|
+
- ask-gpt/claude: Delegate tasks to agents directly (via API).
|
|
116
|
+
- setup-gemini: Configure gemini-cli integration.
|
|
143
117
|
`;
|
|
144
118
|
|
|
145
119
|
program
|
|
146
120
|
.name('eck-snapshot')
|
|
147
121
|
.description('A lightweight, platform-independent CLI for creating project snapshots.')
|
|
148
|
-
.version('4.
|
|
122
|
+
.version('4.1.0')
|
|
149
123
|
.addHelpText('before', helpGuide);
|
|
150
124
|
|
|
151
125
|
// Main snapshot command
|
|
@@ -168,6 +142,7 @@ Useful for a high-level overview.
|
|
|
168
142
|
.option('--profile <name>', 'Filter files using profiles and/or ad-hoc glob patterns.')
|
|
169
143
|
.option('--agent', 'Generate a snapshot optimized for a command-line agent')
|
|
170
144
|
.option('--with-ja', 'Generate a detailed snapshot for the Junior Architect agent')
|
|
145
|
+
.option('--skeleton', 'Enable skeleton mode: strip function bodies to save context window tokens')
|
|
171
146
|
.option('--max-lines-per-file <number>', 'Truncate files to max N lines (e.g., 200 for compact snapshots)', (val) => parseInt(val))
|
|
172
147
|
.action(createRepoSnapshot)
|
|
173
148
|
.addHelpText('after', `
|
|
@@ -216,6 +191,14 @@ Creating Custom Profiles:
|
|
|
216
191
|
eck-snapshot profile-detect (auto-generates profiles using AI)
|
|
217
192
|
`);
|
|
218
193
|
|
|
194
|
+
// Update snapshot command
|
|
195
|
+
program
|
|
196
|
+
.command('update')
|
|
197
|
+
.description('Create a delta snapshot of changed files since the last full snapshot')
|
|
198
|
+
.argument('[repoPath]', 'Path to the repository', process.cwd())
|
|
199
|
+
.option('--config <path>', 'Configuration file path')
|
|
200
|
+
.action(updateSnapshot);
|
|
201
|
+
|
|
219
202
|
// Restore command
|
|
220
203
|
program
|
|
221
204
|
.command('restore')
|
|
@@ -423,5 +406,12 @@ Authentication:
|
|
|
423
406
|
.description('Auto-generate documentation from gemini-extension.json files')
|
|
424
407
|
.action(generateAutoDocs);
|
|
425
408
|
|
|
409
|
+
// Show file command (for skeleton mode lazy loading)
|
|
410
|
+
program
|
|
411
|
+
.command('show')
|
|
412
|
+
.description('Output the full content of specific file(s) (for AI lazy loading)')
|
|
413
|
+
.argument('<filePaths...>', 'Space-separated paths to files')
|
|
414
|
+
.action(showFile);
|
|
415
|
+
|
|
426
416
|
program.parse(process.argv);
|
|
427
417
|
}
|