@xelth/eck-snapshot 5.9.0 → 6.6.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 +321 -190
- package/index.js +1 -1
- package/package.json +15 -2
- package/scripts/mcp-eck-core.js +143 -13
- package/setup.json +119 -81
- package/src/cli/cli.js +256 -385
- package/src/cli/commands/createSnapshot.js +391 -175
- package/src/cli/commands/recon.js +308 -0
- package/src/cli/commands/setupMcp.js +280 -19
- package/src/cli/commands/trainTokens.js +42 -32
- package/src/cli/commands/updateSnapshot.js +136 -43
- package/src/core/depthConfig.js +54 -0
- package/src/core/skeletonizer.js +280 -21
- package/src/templates/architect-prompt.template.md +34 -0
- package/src/templates/multiAgent.md +68 -15
- package/src/templates/opencode/coder.template.md +53 -17
- package/src/templates/opencode/junior-architect.template.md +54 -15
- package/src/templates/skeleton-instruction.md +1 -1
- package/src/templates/update-prompt.template.md +2 -0
- package/src/utils/aiHeader.js +57 -27
- package/src/utils/claudeMdGenerator.js +182 -88
- package/src/utils/fileUtils.js +217 -149
- package/src/utils/gitUtils.js +12 -8
- package/src/utils/opencodeAgentsGenerator.js +8 -2
- package/src/utils/projectDetector.js +66 -21
- package/src/utils/tokenEstimator.js +11 -7
- package/src/cli/commands/consilium.js +0 -86
- package/src/cli/commands/detectProfiles.js +0 -98
- package/src/cli/commands/envSync.js +0 -319
- package/src/cli/commands/generateProfileGuide.js +0 -144
- package/src/cli/commands/pruneSnapshot.js +0 -106
- package/src/cli/commands/restoreSnapshot.js +0 -173
- package/src/cli/commands/setupGemini.js +0 -149
- package/src/cli/commands/setupGemini.test.js +0 -115
- package/src/cli/commands/showFile.js +0 -39
- package/src/services/claudeCliService.js +0 -626
- package/src/services/claudeCliService.test.js +0 -267
package/scripts/mcp-eck-core.js
CHANGED
|
@@ -23,9 +23,23 @@ const server = new Server(
|
|
|
23
23
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
24
24
|
return {
|
|
25
25
|
tools: [
|
|
26
|
+
{
|
|
27
|
+
name: "eck_fail_task",
|
|
28
|
+
description: "Use this if you are stuck, blocked, or unable to complete the task. It saves your report to AnswerToSA.md and generates an emergency snapshot WITHOUT committing broken code. Do NOT use this if tests pass.",
|
|
29
|
+
inputSchema: {
|
|
30
|
+
type: "object",
|
|
31
|
+
properties: {
|
|
32
|
+
status: {
|
|
33
|
+
type: "string",
|
|
34
|
+
description: "Detailed explanation of why you are blocked, what you tried, and what the Architect should know."
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
required: ["status"]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
26
40
|
{
|
|
27
41
|
name: "eck_finish_task",
|
|
28
|
-
description: "Completes the current coding task. 1) Overwrites AnswerToSA.md with status for the Architect. 2) Stages all changes. 3) Commits with the provided message. 4) Automatically updates the context snapshot.
|
|
42
|
+
description: "Completes the current coding task. 1) Overwrites AnswerToSA.md with status for the Architect. 2) Stages all changes. 3) Commits with the provided message. 4) Automatically updates the context snapshot. WARNING: USE ONLY ONCE PER TASK WHEN 100% FINISHED. Do NOT use this for intermediate saves or testing during your debugging loop.",
|
|
29
43
|
inputSchema: {
|
|
30
44
|
type: "object",
|
|
31
45
|
properties: {
|
|
@@ -40,12 +54,128 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
40
54
|
},
|
|
41
55
|
required: ["status", "message"]
|
|
42
56
|
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "eck_manifest_edit",
|
|
60
|
+
description: "Atomically edits an .eck manifest file (like TECH_DEBT.md, ROADMAP.md) WITHOUT reading the entire file into context. Use this to save tokens.",
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: {
|
|
64
|
+
file: {
|
|
65
|
+
type: "string",
|
|
66
|
+
description: "Name of the file in .eck/ (e.g., 'TECH_DEBT.md')"
|
|
67
|
+
},
|
|
68
|
+
action: {
|
|
69
|
+
type: "string",
|
|
70
|
+
enum: ["append_to_section", "replace_text"],
|
|
71
|
+
description: "Action to perform: append bullet to a section, or replace specific text."
|
|
72
|
+
},
|
|
73
|
+
section_header: {
|
|
74
|
+
type: "string",
|
|
75
|
+
description: "For 'append_to_section': The exact markdown header to append under (e.g., '## Active', '# Sprint 1')."
|
|
76
|
+
},
|
|
77
|
+
content: {
|
|
78
|
+
type: "string",
|
|
79
|
+
description: "The text to append (e.g., '- [ ] Fix memory leak'), or the new text for replace_text."
|
|
80
|
+
},
|
|
81
|
+
target_text: {
|
|
82
|
+
type: "string",
|
|
83
|
+
description: "For 'replace_text': The exact old text you want to find and replace (e.g., '- [ ] Bug 123')."
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
required: ["file", "action", "content"]
|
|
87
|
+
}
|
|
43
88
|
}
|
|
44
89
|
]
|
|
45
90
|
};
|
|
46
91
|
});
|
|
47
92
|
|
|
48
93
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
94
|
+
if (request.params.name === "eck_fail_task") {
|
|
95
|
+
const { status } = request.params.arguments;
|
|
96
|
+
const workDir = process.cwd();
|
|
97
|
+
|
|
98
|
+
try {
|
|
99
|
+
const answerDir = path.join(workDir, '.eck', 'lastsnapshot');
|
|
100
|
+
await fs.mkdir(answerDir, { recursive: true });
|
|
101
|
+
await fs.writeFile(
|
|
102
|
+
path.join(answerDir, 'AnswerToSA.md'),
|
|
103
|
+
`# Agent Report (BLOCKED/FAILED)\n\n${status}\n`,
|
|
104
|
+
'utf-8'
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const cliPath = path.join(PROJECT_ROOT, "index.js");
|
|
108
|
+
const { stdout } = await execa("node", [cliPath, JSON.stringify({ name: "eck_update_auto", arguments: { fail: true } })], { cwd: workDir, timeout: 120000 });
|
|
109
|
+
|
|
110
|
+
let result;
|
|
111
|
+
try {
|
|
112
|
+
result = JSON.parse(stdout);
|
|
113
|
+
} catch (e) {
|
|
114
|
+
return { content: [{ type: "text", text: `⚠️ Task aborted, but snapshot update returned invalid JSON: ${stdout}` }] };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
content: [{
|
|
119
|
+
type: "text",
|
|
120
|
+
text: `🚨 Task marked as FAILED.\n📝 AnswerToSA.md updated\n📸 Emergency Snapshot: ${result.snapshot_file} (${result.files_count} files)`
|
|
121
|
+
}]
|
|
122
|
+
};
|
|
123
|
+
} catch (error) {
|
|
124
|
+
return { content: [{ type: "text", text: `❌ Error: ${error.message}\n${error.stderr || ''}` }], isError: true };
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (request.params.name === "eck_manifest_edit") {
|
|
129
|
+
const { file, action, section_header, content, target_text } = request.params.arguments;
|
|
130
|
+
const workDir = process.cwd();
|
|
131
|
+
const manifestPath = path.join(workDir, '.eck', file);
|
|
132
|
+
|
|
133
|
+
try {
|
|
134
|
+
let fileContent = '';
|
|
135
|
+
try {
|
|
136
|
+
fileContent = await fs.readFile(manifestPath, 'utf-8');
|
|
137
|
+
} catch (e) {
|
|
138
|
+
if (e.code === 'ENOENT') {
|
|
139
|
+
fileContent = `# ${file.replace('.md', '')}\n\n`;
|
|
140
|
+
} else {
|
|
141
|
+
throw e;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
let updatedContent = fileContent;
|
|
146
|
+
|
|
147
|
+
if (action === 'replace_text') {
|
|
148
|
+
if (!target_text) throw new Error("target_text is required for replace_text action");
|
|
149
|
+
if (!fileContent.includes(target_text)) throw new Error(`Target text not found in ${file}`);
|
|
150
|
+
updatedContent = fileContent.replace(target_text, content);
|
|
151
|
+
} else if (action === 'append_to_section') {
|
|
152
|
+
if (!section_header) throw new Error("section_header is required for append_to_section action");
|
|
153
|
+
|
|
154
|
+
const regex = new RegExp(`^(${section_header.replace(/[.*+?^$\\{}()|[\\]\\\\]/g, '\\$&')}\\s*\\r?\\n)`, 'm');
|
|
155
|
+
const match = regex.exec(fileContent);
|
|
156
|
+
|
|
157
|
+
if (match) {
|
|
158
|
+
const insertPos = match.index + match[0].length;
|
|
159
|
+
updatedContent = fileContent.slice(0, insertPos) + content + '\n' + fileContent.slice(insertPos);
|
|
160
|
+
} else {
|
|
161
|
+
const suffix = fileContent.endsWith('\n') ? '' : '\n';
|
|
162
|
+
updatedContent = fileContent + suffix + '\n' + section_header + '\n' + content + '\n';
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
await fs.writeFile(manifestPath, updatedContent, 'utf-8');
|
|
167
|
+
return {
|
|
168
|
+
content: [{ type: "text", text: `✅ Successfully edited ${file}` }]
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
} catch (error) {
|
|
172
|
+
return {
|
|
173
|
+
content: [{ type: "text", text: `❌ Error editing manifest: ${error.message}` }],
|
|
174
|
+
isError: true
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
49
179
|
if (request.params.name === "eck_finish_task") {
|
|
50
180
|
const { status, message } = request.params.arguments;
|
|
51
181
|
const workDir = process.cwd();
|
|
@@ -68,7 +198,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
68
198
|
|
|
69
199
|
// 4. Auto Update Snapshot
|
|
70
200
|
const cliPath = path.join(PROJECT_ROOT, "index.js");
|
|
71
|
-
const { stdout } = await execa("node", [cliPath, "
|
|
201
|
+
const { stdout } = await execa("node", [cliPath, JSON.stringify({ name: "eck_update_auto" })], { cwd: workDir, timeout: 120000 });
|
|
72
202
|
|
|
73
203
|
let result;
|
|
74
204
|
try {
|
|
@@ -106,14 +236,14 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
106
236
|
};
|
|
107
237
|
});
|
|
108
238
|
|
|
109
|
-
const transport = new StdioServerTransport();
|
|
110
|
-
await server.connect(transport);
|
|
111
|
-
|
|
112
|
-
// --- Graceful Shutdown Handler ---
|
|
113
|
-
process.stdout.on('error', (err) => {
|
|
114
|
-
if (err.code === 'EPIPE') {
|
|
115
|
-
process.exit(0);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
process.on('SIGINT', () => process.exit(0));
|
|
119
|
-
process.on('SIGTERM', () => process.exit(0));
|
|
239
|
+
const transport = new StdioServerTransport();
|
|
240
|
+
await server.connect(transport);
|
|
241
|
+
|
|
242
|
+
// --- Graceful Shutdown Handler ---
|
|
243
|
+
process.stdout.on('error', (err) => {
|
|
244
|
+
if (err.code === 'EPIPE') {
|
|
245
|
+
process.exit(0);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
process.on('SIGINT', () => process.exit(0));
|
|
249
|
+
process.on('SIGTERM', () => process.exit(0));
|
package/setup.json
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_comment": "Central configuration file for eck-snapshot. ALL settings are configured here.",
|
|
3
3
|
"projectContext": {
|
|
4
|
-
"name": "
|
|
5
|
-
"type": "
|
|
4
|
+
"name": "",
|
|
5
|
+
"type": "",
|
|
6
6
|
"architecture": {
|
|
7
|
-
"workspaces": [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"@eckasse/adapters",
|
|
11
|
-
"@eckasse/shared-frontend"
|
|
12
|
-
],
|
|
13
|
-
"stack": [
|
|
14
|
-
"Node.js",
|
|
15
|
-
"Express",
|
|
16
|
-
"Electron",
|
|
17
|
-
"PostgreSQL",
|
|
18
|
-
"WebSocket"
|
|
19
|
-
],
|
|
20
|
-
"aiIntegration": "Google Gemini for POS natural language control"
|
|
7
|
+
"workspaces": [],
|
|
8
|
+
"stack": [],
|
|
9
|
+
"aiIntegration": ""
|
|
21
10
|
}
|
|
22
11
|
},
|
|
23
12
|
"projectDetection": {
|
|
@@ -188,6 +177,19 @@
|
|
|
188
177
|
"lib"
|
|
189
178
|
],
|
|
190
179
|
"priority": 6
|
|
180
|
+
},
|
|
181
|
+
"postgresql": {
|
|
182
|
+
"files": [
|
|
183
|
+
"postgresql.conf",
|
|
184
|
+
"pg_hba.conf",
|
|
185
|
+
"PG_VERSION"
|
|
186
|
+
],
|
|
187
|
+
"directories": [
|
|
188
|
+
"data/base",
|
|
189
|
+
"data/global",
|
|
190
|
+
"data/pg_wal"
|
|
191
|
+
],
|
|
192
|
+
"priority": 10
|
|
191
193
|
}
|
|
192
194
|
}
|
|
193
195
|
},
|
|
@@ -366,7 +368,11 @@
|
|
|
366
368
|
".jpg",
|
|
367
369
|
".jpeg",
|
|
368
370
|
".gif",
|
|
369
|
-
".svg"
|
|
371
|
+
".svg",
|
|
372
|
+
".wal",
|
|
373
|
+
".pcapng",
|
|
374
|
+
".jsonl",
|
|
375
|
+
".csv"
|
|
370
376
|
],
|
|
371
377
|
"dirsToIgnore": [
|
|
372
378
|
"node_modules/",
|
|
@@ -532,6 +538,38 @@
|
|
|
532
538
|
".so",
|
|
533
539
|
".out"
|
|
534
540
|
]
|
|
541
|
+
},
|
|
542
|
+
"postgresql": {
|
|
543
|
+
"filesToIgnore": [
|
|
544
|
+
"PG_VERSION",
|
|
545
|
+
"postmaster.pid",
|
|
546
|
+
"postmaster.opts",
|
|
547
|
+
"pg_ident.conf",
|
|
548
|
+
"*.log"
|
|
549
|
+
],
|
|
550
|
+
"dirsToIgnore": [
|
|
551
|
+
"base/",
|
|
552
|
+
"global/",
|
|
553
|
+
"pg_wal/",
|
|
554
|
+
"pg_xact/",
|
|
555
|
+
"pg_commit_ts/",
|
|
556
|
+
"pg_dynshmem/",
|
|
557
|
+
"pg_logical/",
|
|
558
|
+
"pg_multixact/",
|
|
559
|
+
"pg_notify/",
|
|
560
|
+
"pg_replslot/",
|
|
561
|
+
"pg_serial/",
|
|
562
|
+
"pg_snapshots/",
|
|
563
|
+
"pg_stat/",
|
|
564
|
+
"pg_stat_tmp/",
|
|
565
|
+
"pg_subtrans/",
|
|
566
|
+
"pg_tblspc/",
|
|
567
|
+
"pg_twophase/"
|
|
568
|
+
],
|
|
569
|
+
"extensionsToIgnore": [
|
|
570
|
+
".fsm",
|
|
571
|
+
".vm"
|
|
572
|
+
]
|
|
535
573
|
}
|
|
536
574
|
}
|
|
537
575
|
},
|
|
@@ -576,70 +614,70 @@
|
|
|
576
614
|
"capabilities": ["npm", "git", "basic editing"],
|
|
577
615
|
"restrictions": ["Do not use for complex architectural tasks"]
|
|
578
616
|
},
|
|
579
|
-
"jas": {
|
|
580
|
-
"active": true,
|
|
581
|
-
"name": "Junior Architect (Sonnet 4.5)",
|
|
582
|
-
"description": "Project Mode Orchestrator (Claude Code only). Smart & Fast Manager. Manages GLM Z.AI workers for efficient task delegation.",
|
|
583
|
-
"guiSupport": true,
|
|
584
|
-
"identification": {
|
|
585
|
-
"markers": ["sonnet", "fast_architect"]
|
|
586
|
-
},
|
|
587
|
-
"capabilities": [
|
|
588
|
-
"glm_zai_frontend",
|
|
589
|
-
"glm_zai_backend",
|
|
590
|
-
"glm_zai_qa",
|
|
591
|
-
"glm_zai_refactor",
|
|
592
|
-
"glm_zai_general",
|
|
593
|
-
"git operations",
|
|
594
|
-
"npm run dev"
|
|
595
|
-
],
|
|
596
|
-
"restrictions": [
|
|
597
|
-
"Prefer delegating heavy coding to GLM Z.AI workers",
|
|
598
|
-
"Focus on glue code and logic verification"
|
|
599
|
-
]
|
|
600
|
-
},
|
|
601
|
-
"jao": {
|
|
602
|
-
"active": true,
|
|
603
|
-
"name": "Junior Architect (Opus 4.5)",
|
|
604
|
-
"description": "Project Mode Orchestrator (Claude Code only). Deep Thinker & Planner. Expensive. Use for critical architecture, security, and complex logic.",
|
|
605
|
-
"guiSupport": true,
|
|
606
|
-
"identification": {
|
|
607
|
-
"markers": ["opus", "deep_architect"]
|
|
608
|
-
},
|
|
609
|
-
"capabilities": [
|
|
610
|
-
"glm_zai_frontend",
|
|
611
|
-
"glm_zai_backend",
|
|
612
|
-
"glm_zai_qa",
|
|
613
|
-
"glm_zai_refactor",
|
|
614
|
-
"glm_zai_general",
|
|
615
|
-
"analysis"
|
|
616
|
-
],
|
|
617
|
-
"restrictions": [
|
|
618
|
-
"STRICTLY DELEGATE boilerplate to GLM Z.AI",
|
|
619
|
-
"Verify every line of code generated by workers",
|
|
620
|
-
"Plan before execution"
|
|
621
|
-
]
|
|
622
|
-
},
|
|
623
|
-
"jaz": {
|
|
624
|
-
"active": true,
|
|
625
|
-
"name": "Junior Architect (GLM-4.7 via OpenCode)",
|
|
626
|
-
"description": "Project Orchestrator for OpenCode. Highly accessible/budget-friendly. Manages the GLM Z.AI worker swarm.",
|
|
627
|
-
"guiSupport": true,
|
|
628
|
-
"identification": {
|
|
629
|
-
"markers": ["opencode", "glm-4.7"]
|
|
630
|
-
},
|
|
631
|
-
"capabilities": [
|
|
632
|
-
"glm_zai_frontend",
|
|
633
|
-
"glm_zai_backend",
|
|
634
|
-
"glm_zai_qa",
|
|
635
|
-
"glm_zai_refactor",
|
|
636
|
-
"glm_zai_general",
|
|
637
|
-
"git operations"
|
|
638
|
-
],
|
|
639
|
-
"restrictions": [
|
|
640
|
-
"Strictly delegate complex/large logic to workers to preserve context window"
|
|
641
|
-
]
|
|
642
|
-
},
|
|
617
|
+
"jas": {
|
|
618
|
+
"active": true,
|
|
619
|
+
"name": "Junior Architect (Sonnet 4.5)",
|
|
620
|
+
"description": "Project Mode Orchestrator (Claude Code only). Smart & Fast Manager. Manages GLM Z.AI workers for efficient task delegation.",
|
|
621
|
+
"guiSupport": true,
|
|
622
|
+
"identification": {
|
|
623
|
+
"markers": ["sonnet", "fast_architect"]
|
|
624
|
+
},
|
|
625
|
+
"capabilities": [
|
|
626
|
+
"glm_zai_frontend",
|
|
627
|
+
"glm_zai_backend",
|
|
628
|
+
"glm_zai_qa",
|
|
629
|
+
"glm_zai_refactor",
|
|
630
|
+
"glm_zai_general",
|
|
631
|
+
"git operations",
|
|
632
|
+
"npm run dev"
|
|
633
|
+
],
|
|
634
|
+
"restrictions": [
|
|
635
|
+
"Prefer delegating heavy coding to GLM Z.AI workers",
|
|
636
|
+
"Focus on glue code and logic verification"
|
|
637
|
+
]
|
|
638
|
+
},
|
|
639
|
+
"jao": {
|
|
640
|
+
"active": true,
|
|
641
|
+
"name": "Junior Architect (Opus 4.5)",
|
|
642
|
+
"description": "Project Mode Orchestrator (Claude Code only). Deep Thinker & Planner. Expensive. Use for critical architecture, security, and complex logic.",
|
|
643
|
+
"guiSupport": true,
|
|
644
|
+
"identification": {
|
|
645
|
+
"markers": ["opus", "deep_architect"]
|
|
646
|
+
},
|
|
647
|
+
"capabilities": [
|
|
648
|
+
"glm_zai_frontend",
|
|
649
|
+
"glm_zai_backend",
|
|
650
|
+
"glm_zai_qa",
|
|
651
|
+
"glm_zai_refactor",
|
|
652
|
+
"glm_zai_general",
|
|
653
|
+
"analysis"
|
|
654
|
+
],
|
|
655
|
+
"restrictions": [
|
|
656
|
+
"STRICTLY DELEGATE boilerplate to GLM Z.AI",
|
|
657
|
+
"Verify every line of code generated by workers",
|
|
658
|
+
"Plan before execution"
|
|
659
|
+
]
|
|
660
|
+
},
|
|
661
|
+
"jaz": {
|
|
662
|
+
"active": true,
|
|
663
|
+
"name": "Junior Architect (GLM-4.7 via OpenCode)",
|
|
664
|
+
"description": "Project Orchestrator for OpenCode. Highly accessible/budget-friendly. Manages the GLM Z.AI worker swarm.",
|
|
665
|
+
"guiSupport": true,
|
|
666
|
+
"identification": {
|
|
667
|
+
"markers": ["opencode", "glm-4.7"]
|
|
668
|
+
},
|
|
669
|
+
"capabilities": [
|
|
670
|
+
"glm_zai_frontend",
|
|
671
|
+
"glm_zai_backend",
|
|
672
|
+
"glm_zai_qa",
|
|
673
|
+
"glm_zai_refactor",
|
|
674
|
+
"glm_zai_general",
|
|
675
|
+
"git operations"
|
|
676
|
+
],
|
|
677
|
+
"restrictions": [
|
|
678
|
+
"Strictly delegate complex/large logic to workers to preserve context window"
|
|
679
|
+
]
|
|
680
|
+
},
|
|
643
681
|
"production_server": {
|
|
644
682
|
"active": true,
|
|
645
683
|
"name": "Production Server Agent (AGENT_PROD_SERVER)",
|