@xelth/eck-snapshot 4.0.0 → 4.2.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 +13 -3
- package/setup.json +57 -35
- package/src/cli/cli.js +81 -134
- package/src/cli/commands/autoDocs.js +1 -32
- package/src/cli/commands/createSnapshot.js +338 -198
- package/src/cli/commands/doctor.js +60 -0
- 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/config.js +44 -0
- package/src/core/skeletonizer.js +201 -0
- package/src/services/claudeCliService.js +5 -0
- package/src/templates/agent-prompt.template.md +104 -7
- package/src/templates/architect-prompt.template.md +112 -23
- package/src/templates/multiAgent.md +40 -86
- package/src/templates/skeleton-instruction.md +16 -0
- package/src/templates/update-prompt.template.md +19 -0
- package/src/utils/aiHeader.js +373 -147
- package/src/utils/eckProtocolParser.js +221 -0
- package/src/utils/fileUtils.js +212 -175
- package/src/utils/gitUtils.js +44 -0
- package/src/utils/tokenEstimator.js +4 -1
- package/src/cli/commands/askGpt.js +0 -29
- package/src/services/authService.js +0 -20
- package/src/services/dispatcherService.js +0 -33
- package/src/services/gptService.js +0 -302
- package/src/services/gptService.test.js +0 -120
- package/src/templates/vectorMode.md +0 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xelth/eck-snapshot",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.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",
|
|
@@ -19,8 +19,7 @@
|
|
|
19
19
|
"test": "vitest",
|
|
20
20
|
"test:ui": "vitest --ui",
|
|
21
21
|
"test:run": "vitest run",
|
|
22
|
-
"docs:auto": "node index.js docs-auto"
|
|
23
|
-
"test:gpt": "vitest src/services/gptService.test.js"
|
|
22
|
+
"docs:auto": "node index.js docs-auto"
|
|
24
23
|
},
|
|
25
24
|
"author": "xelth-com",
|
|
26
25
|
"license": "MIT",
|
|
@@ -29,6 +28,7 @@
|
|
|
29
28
|
"url": "https://github.com/xelth-com/eckSnapshot.git"
|
|
30
29
|
},
|
|
31
30
|
"dependencies": {
|
|
31
|
+
"@babel/generator": "^7.25.6",
|
|
32
32
|
"@babel/parser": "^7.25.6",
|
|
33
33
|
"@babel/traverse": "^7.25.6",
|
|
34
34
|
"chalk": "^5.3.0",
|
|
@@ -40,11 +40,21 @@
|
|
|
40
40
|
"inquirer": "^9.2.20",
|
|
41
41
|
"is-binary-path": "^2.1.0",
|
|
42
42
|
"micromatch": "^4.0.8",
|
|
43
|
+
"minimatch": "^9.0.3",
|
|
43
44
|
"ora": "^8.1.0",
|
|
44
45
|
"p-limit": "^5.0.0",
|
|
45
46
|
"p-retry": "^6.2.1",
|
|
46
47
|
"which": "^4.0.0"
|
|
47
48
|
},
|
|
49
|
+
"optionalDependencies": {
|
|
50
|
+
"tree-sitter": "^0.25.0",
|
|
51
|
+
"tree-sitter-c": "^0.24.1",
|
|
52
|
+
"tree-sitter-go": "^0.23.4",
|
|
53
|
+
"tree-sitter-java": "^0.23.5",
|
|
54
|
+
"tree-sitter-kotlin": "^0.3.8",
|
|
55
|
+
"tree-sitter-python": "^0.25.0",
|
|
56
|
+
"tree-sitter-rust": "^0.23.2"
|
|
57
|
+
},
|
|
48
58
|
"devDependencies": {
|
|
49
59
|
"jsdom": "^24.0.0",
|
|
50
60
|
"vitest": "^2.0.0"
|
package/setup.json
CHANGED
|
@@ -231,16 +231,13 @@
|
|
|
231
231
|
},
|
|
232
232
|
"contextProfiles": {
|
|
233
233
|
"backend": {
|
|
234
|
-
"description": "Backend API,
|
|
234
|
+
"description": "Backend API, services, business logic",
|
|
235
235
|
"include": [
|
|
236
236
|
"packages/backend/**",
|
|
237
|
-
"packages/core/**"
|
|
238
|
-
"knexfile.js",
|
|
239
|
-
"migrations/**"
|
|
237
|
+
"packages/core/**"
|
|
240
238
|
],
|
|
241
239
|
"exclude": [
|
|
242
240
|
"**/*.test.*",
|
|
243
|
-
"**/*.sqlite*",
|
|
244
241
|
"node_modules/**"
|
|
245
242
|
]
|
|
246
243
|
},
|
|
@@ -301,8 +298,7 @@
|
|
|
301
298
|
"description": "Database schema and migrations only",
|
|
302
299
|
"include": [
|
|
303
300
|
"**/migrations/**",
|
|
304
|
-
"**/
|
|
305
|
-
"**/schema.sql"
|
|
301
|
+
"**/schema/**"
|
|
306
302
|
]
|
|
307
303
|
},
|
|
308
304
|
"deployment": {
|
|
@@ -374,7 +370,6 @@
|
|
|
374
370
|
"dirsToIgnore": [
|
|
375
371
|
"node_modules/",
|
|
376
372
|
".git/",
|
|
377
|
-
".eck/",
|
|
378
373
|
"dist/",
|
|
379
374
|
"build/",
|
|
380
375
|
".next/",
|
|
@@ -387,6 +382,27 @@
|
|
|
387
382
|
"create-snapshot/"
|
|
388
383
|
],
|
|
389
384
|
"includeHidden": false,
|
|
385
|
+
"eckDirectoryFiltering": {
|
|
386
|
+
"_comment": "Smart filtering for .eck directory - includes documentation but excludes confidential files",
|
|
387
|
+
"enabled": true,
|
|
388
|
+
"confidentialPatterns": [
|
|
389
|
+
"SERVER_ACCESS.md",
|
|
390
|
+
"CREDENTIALS*.md",
|
|
391
|
+
"SECRETS*.md",
|
|
392
|
+
"*.secret",
|
|
393
|
+
"*.key",
|
|
394
|
+
"*.pem",
|
|
395
|
+
".env*"
|
|
396
|
+
],
|
|
397
|
+
"alwaysIncludePatterns": [
|
|
398
|
+
"ARCHITECTURE.md",
|
|
399
|
+
"CONTEXT.md",
|
|
400
|
+
"OPERATIONS.md",
|
|
401
|
+
"ROADMAP.md",
|
|
402
|
+
"TECH_DEBT.md",
|
|
403
|
+
"README.md"
|
|
404
|
+
]
|
|
405
|
+
},
|
|
390
406
|
"projectSpecific": {
|
|
391
407
|
"android": {
|
|
392
408
|
"filesToIgnore": [
|
|
@@ -524,6 +540,10 @@
|
|
|
524
540
|
"maxDepth": 10,
|
|
525
541
|
"concurrency": 10
|
|
526
542
|
},
|
|
543
|
+
"security": {
|
|
544
|
+
"scanForSecrets": true,
|
|
545
|
+
"_comment": "Automatically detects and redacts API keys, tokens, and credentials in snapshots to prevent accidental exposure"
|
|
546
|
+
},
|
|
527
547
|
"output": {
|
|
528
548
|
"defaultFormat": "md",
|
|
529
549
|
"defaultPath": "./.eck/snapshots",
|
|
@@ -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",
|
|
@@ -647,25 +671,6 @@
|
|
|
647
671
|
"no hardware debugging interfaces"
|
|
648
672
|
]
|
|
649
673
|
},
|
|
650
|
-
"ci_cd": {
|
|
651
|
-
"active": false,
|
|
652
|
-
"name": "CI/CD Pipeline Agent (AGENT_CI_CD)",
|
|
653
|
-
"description": "Automated testing and deployment pipeline",
|
|
654
|
-
"guiSupport": false,
|
|
655
|
-
"capabilities": [
|
|
656
|
-
"npm ci",
|
|
657
|
-
"npm test",
|
|
658
|
-
"npm run build",
|
|
659
|
-
"docker build",
|
|
660
|
-
"artifact generation"
|
|
661
|
-
],
|
|
662
|
-
"restrictions": [
|
|
663
|
-
"no interactive commands",
|
|
664
|
-
"no GUI applications",
|
|
665
|
-
"no watch modes",
|
|
666
|
-
"no development servers"
|
|
667
|
-
]
|
|
668
|
-
},
|
|
669
674
|
"gemini_wsl": {
|
|
670
675
|
"active": true,
|
|
671
676
|
"name": "Gemini WSL Agent (Junior Architect)",
|
|
@@ -713,6 +718,24 @@
|
|
|
713
718
|
]
|
|
714
719
|
}
|
|
715
720
|
},
|
|
721
|
+
"browserAutomation": {
|
|
722
|
+
"enabled": true,
|
|
723
|
+
"provider": "Claude in Chrome MCP",
|
|
724
|
+
"availableFor": ["local_dev"],
|
|
725
|
+
"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.",
|
|
726
|
+
"capabilities": {
|
|
727
|
+
"navigation": "Navigate URLs, handle tabs/windows",
|
|
728
|
+
"interaction": "Click, type, scroll, drag-and-drop",
|
|
729
|
+
"inspection": "Read DOM, extract text, verify styles",
|
|
730
|
+
"debugging": "Access console logs, network activity",
|
|
731
|
+
"visual": "Generate screenshots, record GIF"
|
|
732
|
+
},
|
|
733
|
+
"restrictions": [
|
|
734
|
+
"No non-consensual file downloads",
|
|
735
|
+
"No sensitive credentials interaction",
|
|
736
|
+
"MUST NOT use 'eck-snapshot ask-claude' wrapper for these tasks"
|
|
737
|
+
]
|
|
738
|
+
},
|
|
716
739
|
"header": {
|
|
717
740
|
"defaultEnabled": true,
|
|
718
741
|
"_comment": "Controls whether AI instruction headers are included by default in snapshots"
|
|
@@ -721,7 +744,6 @@
|
|
|
721
744
|
"envScanRequest": "src/templates/envScanRequest.md",
|
|
722
745
|
"gitWorkflow": "src/templates/gitWorkflow.md",
|
|
723
746
|
"multiAgent": "src/templates/multiAgent.md",
|
|
724
|
-
"vectorMode": "src/templates/vectorMode.md",
|
|
725
747
|
"agent": "src/templates/agent-prompt.template.md"
|
|
726
748
|
}
|
|
727
749
|
},
|
|
@@ -760,11 +782,11 @@
|
|
|
760
782
|
},
|
|
761
783
|
"database_expert": {
|
|
762
784
|
"active": true,
|
|
763
|
-
"modelName": "
|
|
785
|
+
"modelName": "Claude",
|
|
764
786
|
"role": "Database Specialist",
|
|
765
787
|
"strengths": [
|
|
766
|
-
"
|
|
767
|
-
"
|
|
788
|
+
"Schema design",
|
|
789
|
+
"Query optimization",
|
|
768
790
|
"data integrity"
|
|
769
791
|
]
|
|
770
792
|
},
|
package/src/cli/cli.js
CHANGED
|
@@ -7,18 +7,19 @@ 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';
|
|
13
14
|
import { detectProject, testFileParsing } from './commands/detectProject.js';
|
|
14
15
|
import { trainTokens, showTokenStats } from './commands/trainTokens.js';
|
|
15
|
-
import { askGpt } from './commands/askGpt.js';
|
|
16
|
-
import { ask as askGptService } from '../services/gptService.js';
|
|
17
16
|
import { executePrompt, executePromptWithSession } from '../services/claudeCliService.js';
|
|
18
17
|
import { detectProfiles } from './commands/detectProfiles.js';
|
|
19
18
|
import { generateProfileGuide } from './commands/generateProfileGuide.js';
|
|
20
19
|
import { setupGemini } from './commands/setupGemini.js';
|
|
21
20
|
import { generateAutoDocs } from './commands/autoDocs.js';
|
|
21
|
+
import { showFile } from './commands/showFile.js';
|
|
22
|
+
import { runDoctor } from './commands/doctor.js';
|
|
22
23
|
import inquirer from 'inquirer';
|
|
23
24
|
import ora from 'ora';
|
|
24
25
|
import { execa } from 'execa';
|
|
@@ -31,10 +32,10 @@ async function checkCodeBoundaries(filePath, agentId) {
|
|
|
31
32
|
try {
|
|
32
33
|
const content = await fs.readFile(filePath, 'utf-8');
|
|
33
34
|
const boundaryRegex = /\/\* AGENT_BOUNDARY:\[([^\]]+)\] START \*\/([\s\S]*?)\/\* AGENT_BOUNDARY:\[[^\]]+\] END \*\//g;
|
|
34
|
-
|
|
35
|
+
|
|
35
36
|
const boundaries = [];
|
|
36
37
|
let match;
|
|
37
|
-
|
|
38
|
+
|
|
38
39
|
while ((match = boundaryRegex.exec(content)) !== null) {
|
|
39
40
|
boundaries.push({
|
|
40
41
|
owner: match[1],
|
|
@@ -43,7 +44,7 @@ async function checkCodeBoundaries(filePath, agentId) {
|
|
|
43
44
|
content: match[2]
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
+
|
|
47
48
|
return {
|
|
48
49
|
file: filePath,
|
|
49
50
|
hasBoundaries: boundaries.length > 0,
|
|
@@ -63,89 +64,61 @@ async function checkCodeBoundaries(filePath, agentId) {
|
|
|
63
64
|
export function run() {
|
|
64
65
|
const program = new Command();
|
|
65
66
|
|
|
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.
|
|
67
|
+
const helpGuide = `eck-snapshot (v4.1.0) - AI-Native Repository Context Tool.
|
|
68
|
+
|
|
69
|
+
--- 🚀 Core Workflow: Optimized for Web LLMs (Gemini/ChatGPT) ---
|
|
70
|
+
|
|
71
|
+
1. Initial Context (Maximum Compression)
|
|
72
|
+
Create a lightweight map of your entire project. Bodies of functions are hidden.
|
|
73
|
+
This fits huge monoliths into the context window.
|
|
74
|
+
|
|
75
|
+
$ eck-snapshot --skeleton
|
|
76
|
+
-> Generates: .eck/snapshots/<name>_sk.md (Upload this to AI)
|
|
77
|
+
|
|
78
|
+
2. Lazy Loading (On-Demand Details)
|
|
79
|
+
If the AI needs to see the implementation of specific files, it will ask you.
|
|
80
|
+
You can display multiple files at once to copy-paste back to the chat.
|
|
81
|
+
|
|
82
|
+
$ eck-snapshot show src/auth.js src/utils/hash.js
|
|
83
|
+
|
|
84
|
+
3. Working & Updating
|
|
85
|
+
As you apply changes, the AI loses context. Instead of re-sending the full repo,
|
|
86
|
+
send only what changed since the last snapshot.
|
|
87
|
+
|
|
88
|
+
$ eck-snapshot update
|
|
89
|
+
-> Generates: .eck/snapshots/update_<timestamp>.md (Contains changed files + git diff)
|
|
90
|
+
|
|
91
|
+
--- 🛠️ Managing Context Profiles ---
|
|
92
|
+
|
|
93
|
+
Option A: Auto-Detection (Best for start)
|
|
94
|
+
Uses AI to scan folders and suggest profiles (backend, frontend, etc).
|
|
95
|
+
$ eck-snapshot profile-detect
|
|
96
|
+
|
|
97
|
+
Option B: Manual Guide (Best for large repos)
|
|
98
|
+
If the project is too big for auto-detection, this generates a prompt text file
|
|
99
|
+
that you can paste into a powerful Web LLM (like Gemini 1.5 Pro) to design profiles manually.
|
|
100
|
+
|
|
101
|
+
1. Run: $ eck-snapshot generate-profile-guide
|
|
102
|
+
2. Open: .eck/profile_generation_guide.md
|
|
103
|
+
3. Copy: Paste the content into your AI chat.
|
|
104
|
+
4. Save: Take the JSON response and save it to .eck/profiles.json
|
|
105
|
+
|
|
106
|
+
Option C: Using Profiles
|
|
107
|
+
$ eck-snapshot --profile backend
|
|
108
|
+
$ eck-snapshot --profile "frontend,-**/*.test.js" (Ad-hoc filtering)
|
|
109
|
+
|
|
110
|
+
--- 🧩 Auxiliary Commands ---
|
|
111
|
+
|
|
112
|
+
- restore: Restore files from a snapshot to disk.
|
|
113
|
+
- prune: Use AI to shrink a snapshot file by importance.
|
|
114
|
+
- ask-claude: Delegate tasks to Claude CLI agent.
|
|
115
|
+
- setup-gemini: Configure gemini-cli integration.
|
|
143
116
|
`;
|
|
144
117
|
|
|
145
118
|
program
|
|
146
119
|
.name('eck-snapshot')
|
|
147
120
|
.description('A lightweight, platform-independent CLI for creating project snapshots.')
|
|
148
|
-
.version('4.
|
|
121
|
+
.version('4.1.0')
|
|
149
122
|
.addHelpText('before', helpGuide);
|
|
150
123
|
|
|
151
124
|
// Main snapshot command
|
|
@@ -168,6 +141,7 @@ Useful for a high-level overview.
|
|
|
168
141
|
.option('--profile <name>', 'Filter files using profiles and/or ad-hoc glob patterns.')
|
|
169
142
|
.option('--agent', 'Generate a snapshot optimized for a command-line agent')
|
|
170
143
|
.option('--with-ja', 'Generate a detailed snapshot for the Junior Architect agent')
|
|
144
|
+
.option('--skeleton', 'Enable skeleton mode: strip function bodies to save context window tokens')
|
|
171
145
|
.option('--max-lines-per-file <number>', 'Truncate files to max N lines (e.g., 200 for compact snapshots)', (val) => parseInt(val))
|
|
172
146
|
.action(createRepoSnapshot)
|
|
173
147
|
.addHelpText('after', `
|
|
@@ -216,6 +190,14 @@ Creating Custom Profiles:
|
|
|
216
190
|
eck-snapshot profile-detect (auto-generates profiles using AI)
|
|
217
191
|
`);
|
|
218
192
|
|
|
193
|
+
// Update snapshot command
|
|
194
|
+
program
|
|
195
|
+
.command('update')
|
|
196
|
+
.description('Create a delta snapshot of changed files since the last full snapshot')
|
|
197
|
+
.argument('[repoPath]', 'Path to the repository', process.cwd())
|
|
198
|
+
.option('--config <path>', 'Configuration file path')
|
|
199
|
+
.action(updateSnapshot);
|
|
200
|
+
|
|
219
201
|
// Restore command
|
|
220
202
|
program
|
|
221
203
|
.command('restore')
|
|
@@ -263,47 +245,6 @@ Creating Custom Profiles:
|
|
|
263
245
|
console.log(JSON.stringify(result, null, 2));
|
|
264
246
|
});
|
|
265
247
|
|
|
266
|
-
program
|
|
267
|
-
.command('ask-gpt')
|
|
268
|
-
.description('Delegate tasks to OpenAI Codex agent with automatic authentication')
|
|
269
|
-
.argument('<payload>', 'JSON payload string (e.g. \'{"objective": "Calculate 5+2"}\')')
|
|
270
|
-
.option('-v, --verbose', 'Enable verbose logging and detailed execution output')
|
|
271
|
-
.option('--model <name>', 'Model to use (default: gpt-5-codex)', 'gpt-5-codex')
|
|
272
|
-
.option('--reasoning <level>', 'Reasoning level: low, medium, high (default: high)', 'high')
|
|
273
|
-
.action((payloadArg, cmd) => askGpt(payloadArg, cmd))
|
|
274
|
-
.addHelpText('after', `
|
|
275
|
-
Examples:
|
|
276
|
-
Ask a simple question:
|
|
277
|
-
eck-snapshot ask-gpt '{"objective": "What is 5+2?"}'
|
|
278
|
-
|
|
279
|
-
Request code changes with context:
|
|
280
|
-
eck-snapshot ask-gpt '{
|
|
281
|
-
"target_agent": "local_dev",
|
|
282
|
-
"task_id": "feature-123",
|
|
283
|
-
"payload": {
|
|
284
|
-
"objective": "Add error handling to login function",
|
|
285
|
-
"files_to_modify": [{"path": "src/auth.js", "action": "modify"}]
|
|
286
|
-
},
|
|
287
|
-
"post_execution_steps": {
|
|
288
|
-
"journal_entry": {
|
|
289
|
-
"type": "feat",
|
|
290
|
-
"scope": "auth",
|
|
291
|
-
"summary": "Add error handling"
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}' --verbose
|
|
295
|
-
|
|
296
|
-
Prerequisites:
|
|
297
|
-
1. Install Codex CLI: npm install -g @openai/codex
|
|
298
|
-
2. Login: codex login (requires ChatGPT Plus/Pro subscription)
|
|
299
|
-
3. The command automatically loads .eck project context
|
|
300
|
-
|
|
301
|
-
Authentication:
|
|
302
|
-
- Uses your existing 'codex login' credentials
|
|
303
|
-
- Auto-retries on authentication errors
|
|
304
|
-
- Supports ChatGPT Plus/Pro subscriptions
|
|
305
|
-
`);
|
|
306
|
-
|
|
307
248
|
// Project detection command
|
|
308
249
|
program
|
|
309
250
|
.command('detect')
|
|
@@ -361,16 +302,8 @@ Authentication:
|
|
|
361
302
|
const result = await executePrompt(prompt, options.continue);
|
|
362
303
|
console.log(JSON.stringify(result, null, 2));
|
|
363
304
|
} catch (error) {
|
|
364
|
-
console.
|
|
365
|
-
|
|
366
|
-
try {
|
|
367
|
-
const payload = (typeof prompt === 'string' && prompt.startsWith('{')) ? prompt : JSON.stringify({ objective: prompt });
|
|
368
|
-
const gptResult = await askGptService(payload, { verbose: false });
|
|
369
|
-
console.log(JSON.stringify(gptResult, null, 2));
|
|
370
|
-
} catch (gptError) {
|
|
371
|
-
console.error('Failed to execute prompt with both Claude and GPT:', gptError.message);
|
|
372
|
-
process.exit(1);
|
|
373
|
-
}
|
|
305
|
+
console.error(`Failed to execute prompt: ${error.message}`);
|
|
306
|
+
process.exit(1);
|
|
374
307
|
}
|
|
375
308
|
});
|
|
376
309
|
|
|
@@ -423,5 +356,19 @@ Authentication:
|
|
|
423
356
|
.description('Auto-generate documentation from gemini-extension.json files')
|
|
424
357
|
.action(generateAutoDocs);
|
|
425
358
|
|
|
359
|
+
// Show file command (for skeleton mode lazy loading)
|
|
360
|
+
program
|
|
361
|
+
.command('show')
|
|
362
|
+
.description('Output the full content of specific file(s) (for AI lazy loading)')
|
|
363
|
+
.argument('<filePaths...>', 'Space-separated paths to files')
|
|
364
|
+
.action(showFile);
|
|
365
|
+
|
|
366
|
+
// Doctor command (health check for manifests)
|
|
367
|
+
program
|
|
368
|
+
.command('doctor')
|
|
369
|
+
.description('Check project health and detect unfinished manifest stubs')
|
|
370
|
+
.argument('[repoPath]', 'Path to the repository', process.cwd())
|
|
371
|
+
.action(runDoctor);
|
|
372
|
+
|
|
426
373
|
program.parse(process.argv);
|
|
427
374
|
}
|
|
@@ -19,38 +19,7 @@ export async function generateAutoDocs() {
|
|
|
19
19
|
await fs.access(extensionsDir);
|
|
20
20
|
} catch (error) {
|
|
21
21
|
console.log(`Extensions directory not found at: ${extensionsDir}`);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// Create the directory structure
|
|
25
|
-
await fs.mkdir(extensionsDir, { recursive: true });
|
|
26
|
-
|
|
27
|
-
// Create a sample gemini-extension.json file for demonstration
|
|
28
|
-
const sampleExtension = {
|
|
29
|
-
name: "sample-extension",
|
|
30
|
-
description: "Sample Gemini extension for demonstration",
|
|
31
|
-
commands: [
|
|
32
|
-
{
|
|
33
|
-
name: "sample-command",
|
|
34
|
-
description: "A sample command for testing auto-docs",
|
|
35
|
-
usage: "sample-command [options]",
|
|
36
|
-
examples: ["sample-command --help"]
|
|
37
|
-
}
|
|
38
|
-
],
|
|
39
|
-
tools: [
|
|
40
|
-
{
|
|
41
|
-
name: "sample-tool",
|
|
42
|
-
description: "A sample tool for testing auto-docs",
|
|
43
|
-
usage: "Use this tool for sample operations"
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
await fs.writeFile(
|
|
49
|
-
path.join(extensionsDir, 'sample-extension.json'),
|
|
50
|
-
JSON.stringify(sampleExtension, null, 2)
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
console.log('Created sample extension at:', path.join(extensionsDir, 'sample-extension.json'));
|
|
22
|
+
return;
|
|
54
23
|
}
|
|
55
24
|
|
|
56
25
|
// Read all JSON files in the extensions directory
|