@xelth/eck-snapshot 6.0.8 → 6.0.9
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xelth/eck-snapshot",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.9",
|
|
4
4
|
"description": "A powerful CLI tool to create and restore single-file text snapshots of Git repositories. Optimized for AI context, LLM workflows, and multi-agent Swarm coordination.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -25,6 +25,7 @@ import { saveGitAnchor } from '../../utils/gitUtils.js';
|
|
|
25
25
|
import { skeletonize } from '../../core/skeletonizer.js';
|
|
26
26
|
import { updateClaudeMd } from '../../utils/claudeMdGenerator.js';
|
|
27
27
|
import { generateOpenCodeAgents } from '../../utils/opencodeAgentsGenerator.js';
|
|
28
|
+
import { ensureProjectMcpConfig } from './setupMcp.js';
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* Creates dynamic project context based on detection results
|
|
@@ -824,6 +825,15 @@ export async function createRepoSnapshot(repoPath, options) {
|
|
|
824
825
|
// Claude Code exclusively uses CLAUDE.md
|
|
825
826
|
if (isJas || isJao || (!isJaz && !options.withJa)) {
|
|
826
827
|
await updateClaudeMd(processedRepoPath, claudeMode, directoryTree, confidentialFiles, { zh: options.zh });
|
|
828
|
+
// Ensure .mcp.json with eck-core is present so Claude Code agents have MCP tools
|
|
829
|
+
try {
|
|
830
|
+
const mcpCreated = await ensureProjectMcpConfig(processedRepoPath);
|
|
831
|
+
if (mcpCreated) {
|
|
832
|
+
console.log(chalk.green('🔌 Created .mcp.json with eck-core MCP server'));
|
|
833
|
+
}
|
|
834
|
+
} catch (e) {
|
|
835
|
+
// Non-critical — agent can still use manual fallback
|
|
836
|
+
}
|
|
827
837
|
}
|
|
828
838
|
|
|
829
839
|
// OpenCode exclusively uses AGENTS.md
|
|
@@ -262,3 +262,60 @@ async function setupForOpenCode(packageRoot, eckCorePath, glmZaiPath, options) {
|
|
|
262
262
|
console.log(chalk.gray('\n OpenCode will read MCP servers from opencode.json on next start.'));
|
|
263
263
|
console.log(chalk.gray(' Use `eck-snapshot --jas` or `--jao` to generate AGENTS.md for OpenCode.\n'));
|
|
264
264
|
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Silently ensure .mcp.json exists in the target project root with eck-core configured.
|
|
268
|
+
* Called automatically during snapshot creation so any Claude Code session
|
|
269
|
+
* in that project will have eck_finish_task / eck_fail_task available.
|
|
270
|
+
*
|
|
271
|
+
* @param {string} repoPath - Target project root
|
|
272
|
+
* @returns {boolean} true if file was created/updated, false if already OK
|
|
273
|
+
*/
|
|
274
|
+
export async function ensureProjectMcpConfig(repoPath) {
|
|
275
|
+
const packageRoot = path.resolve(__dirname, '../../..');
|
|
276
|
+
const eckCorePath = path.join(packageRoot, 'scripts', 'mcp-eck-core.js');
|
|
277
|
+
const mcpJsonPath = path.join(repoPath, '.mcp.json');
|
|
278
|
+
|
|
279
|
+
// Read existing .mcp.json if present
|
|
280
|
+
let config = {};
|
|
281
|
+
try {
|
|
282
|
+
const content = await fs.readFile(mcpJsonPath, 'utf-8');
|
|
283
|
+
config = JSON.parse(content);
|
|
284
|
+
} catch { /* doesn't exist yet */ }
|
|
285
|
+
|
|
286
|
+
// Ensure root mcpServers key exists (required by Claude Code schema)
|
|
287
|
+
if (!config.mcpServers) {
|
|
288
|
+
config.mcpServers = {};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Check if eck-core is already configured with correct path
|
|
292
|
+
if (config.mcpServers['eck-core'] &&
|
|
293
|
+
config.mcpServers['eck-core'].command === 'node' &&
|
|
294
|
+
config.mcpServers['eck-core'].args?.[0] === eckCorePath) {
|
|
295
|
+
return false; // Already up to date
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Add/update eck-core inside mcpServers
|
|
299
|
+
config.mcpServers['eck-core'] = {
|
|
300
|
+
command: 'node',
|
|
301
|
+
args: [eckCorePath]
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
await fs.writeFile(mcpJsonPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
|
|
305
|
+
|
|
306
|
+
// Ensure .mcp.json is in .gitignore (it contains absolute paths)
|
|
307
|
+
try {
|
|
308
|
+
const gitignorePath = path.join(repoPath, '.gitignore');
|
|
309
|
+
let gitignore = '';
|
|
310
|
+
try {
|
|
311
|
+
gitignore = await fs.readFile(gitignorePath, 'utf-8');
|
|
312
|
+
} catch { /* no .gitignore */ }
|
|
313
|
+
|
|
314
|
+
if (!gitignore.includes('.mcp.json')) {
|
|
315
|
+
const suffix = gitignore.endsWith('\n') || gitignore === '' ? '' : '\n';
|
|
316
|
+
await fs.writeFile(gitignorePath, gitignore + suffix + '.mcp.json\n', 'utf-8');
|
|
317
|
+
}
|
|
318
|
+
} catch { /* non-critical */ }
|
|
319
|
+
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
@@ -51,9 +51,14 @@ Your task is NOT complete until code works globally.
|
|
|
51
51
|
- **DO NOT** try to manually write to \`.eck/lastsnapshot/AnswerToSA.md\` with the \`Write\` tool.
|
|
52
52
|
- **WARNING:** USE ONLY ONCE PER TASK. Do not use this tool or \`eck-snapshot update\` for intermediate testing.
|
|
53
53
|
|
|
54
|
-
**
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
**IF \`eck_finish_task\` IS NOT VISIBLE in your tool list:**
|
|
55
|
+
The tool may be registered as a **deferred tool**. Before falling back, you MUST try:
|
|
56
|
+
1. **Search:** Call \`ToolSearch\` with query \`"select:mcp__eck-core__eck_finish_task,mcp__eck-core__eck_fail_task"\` to load deferred MCP tools.
|
|
57
|
+
2. If ToolSearch returns the tools — use them normally.
|
|
58
|
+
3. If ToolSearch confirms they don't exist — run \`eck-snapshot setup-mcp\` in the terminal, then retry ToolSearch.
|
|
59
|
+
|
|
60
|
+
**MANUAL FALLBACK (Only if ToolSearch AND setup-mcp both fail):**
|
|
61
|
+
0. **WARN THE USER:** State clearly: "⚠️ \`eck-core\` MCP server is not connected. Proceeding with manual fallback."
|
|
57
62
|
1. **READ:** Read \`.eck/lastsnapshot/AnswerToSA.md\` using your \`Read\` tool (REQUIRED before overwriting).
|
|
58
63
|
2. **WRITE:** Overwrite that file with your report.
|
|
59
64
|
3. **COMMIT (CRITICAL):** Run \`git add .\` and \`git commit -m "chore: task report"\` in the terminal.
|
|
@@ -87,9 +92,14 @@ Pass your detailed markdown report into the \`status\` argument.
|
|
|
87
92
|
- **DO NOT** manually write to \`AnswerToSA.md\` with your file editing tools.
|
|
88
93
|
- **WARNING: USE ONLY ONCE.** Do not use for intermediate testing.
|
|
89
94
|
|
|
90
|
-
**
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
**IF \`eck_finish_task\` IS NOT VISIBLE in your tool list:**
|
|
96
|
+
The tool may be registered as a **deferred tool**. Before falling back, you MUST try:
|
|
97
|
+
1. **Search:** Call \`ToolSearch\` with query \`"select:mcp__eck-core__eck_finish_task,mcp__eck-core__eck_fail_task"\` to load deferred MCP tools.
|
|
98
|
+
2. If ToolSearch returns the tools — use them normally.
|
|
99
|
+
3. If ToolSearch confirms they don't exist — run \`eck-snapshot setup-mcp\` in the terminal, then retry ToolSearch.
|
|
100
|
+
|
|
101
|
+
**MANUAL FALLBACK (Only if ToolSearch AND setup-mcp both fail):**
|
|
102
|
+
0. **WARN THE USER:** State clearly: "⚠️ \`eck-core\` MCP server is not connected. Proceeding with manual fallback."
|
|
93
103
|
1. **READ:** Read \`.eck/lastsnapshot/AnswerToSA.md\` using your \`Read\` tool (REQUIRED before overwriting).
|
|
94
104
|
2. **WRITE:** Overwrite that file with your report.
|
|
95
105
|
3. **COMMIT (CRITICAL):** Run \`git add .\` and \`git commit -m "chore: task report"\` in the terminal.
|