@xelth/eck-snapshot 5.8.6 → 5.9.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 +1 -1
- package/setup.json +64 -60
- package/src/cli/cli.js +23 -3
- package/src/cli/commands/createSnapshot.js +104 -99
- package/src/cli/commands/updateSnapshot.js +7 -0
- package/src/templates/opencode/coder.template.md +8 -1
- package/src/templates/opencode/junior-architect.template.md +29 -46
- package/src/utils/aiHeader.js +18 -18
- package/src/utils/claudeMdGenerator.js +101 -119
- package/src/utils/opencodeAgentsGenerator.js +21 -224
- package/src/utils/telemetry.js +98 -0
- package/src/utils/tokenEstimator.js +42 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xelth/eck-snapshot",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.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",
|
package/setup.json
CHANGED
|
@@ -576,66 +576,70 @@
|
|
|
576
576
|
"capabilities": ["npm", "git", "basic editing"],
|
|
577
577
|
"restrictions": ["Do not use for complex architectural tasks"]
|
|
578
578
|
},
|
|
579
|
-
"jas": {
|
|
580
|
-
"active": true,
|
|
581
|
-
"name": "Junior Architect (Sonnet 4.5)",
|
|
582
|
-
"description": "
|
|
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": "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
|
-
"
|
|
624
|
-
"active": true,
|
|
625
|
-
"name": "Junior Architect (
|
|
626
|
-
"description": "
|
|
627
|
-
"guiSupport":
|
|
628
|
-
"identification": {
|
|
629
|
-
"markers": ["
|
|
630
|
-
},
|
|
631
|
-
"capabilities": [
|
|
632
|
-
"
|
|
633
|
-
"
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
"
|
|
637
|
-
|
|
638
|
-
|
|
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
|
+
},
|
|
639
643
|
"production_server": {
|
|
640
644
|
"active": true,
|
|
641
645
|
"name": "Production Server Agent (AGENT_PROD_SERVER)",
|
package/src/cli/cli.js
CHANGED
|
@@ -17,6 +17,7 @@ import { executePrompt, executePromptWithSession } from '../services/claudeCliSe
|
|
|
17
17
|
import { detectProfiles } from './commands/detectProfiles.js';
|
|
18
18
|
import { generateProfileGuide } from './commands/generateProfileGuide.js';
|
|
19
19
|
import { setupGemini } from './commands/setupGemini.js';
|
|
20
|
+
import { pushTelemetry } from '../utils/telemetry.js';
|
|
20
21
|
|
|
21
22
|
import { showFile } from './commands/showFile.js';
|
|
22
23
|
import { runDoctor } from './commands/doctor.js';
|
|
@@ -181,9 +182,9 @@ Option C: Using Profiles
|
|
|
181
182
|
.option('--enhanced', 'Use enhanced multi-agent headers (default: true)', true)
|
|
182
183
|
.option('--profile [name]', 'Filter files using profiles and/or ad-hoc glob patterns. Run without argument to list available profiles.')
|
|
183
184
|
.option('--agent', 'Generate a snapshot optimized for a command-line agent')
|
|
184
|
-
.option('--
|
|
185
|
-
.option('--
|
|
186
|
-
.option('--
|
|
185
|
+
.option('--jas', 'Enable Project Mode for Junior Architect Sonnet (Claude Code only)')
|
|
186
|
+
.option('--jao', 'Enable Project Mode for Junior Architect Opus (Claude Code only)')
|
|
187
|
+
.option('--jaz', 'Enable Project Mode for Junior Architect GLM (OpenCode Z.AI only)')
|
|
187
188
|
.option('--zh', 'Communicate with GLM Z.AI workers in Chinese for better quality')
|
|
188
189
|
.option('--skeleton', 'Enable skeleton mode: strip function bodies to save context window tokens')
|
|
189
190
|
.option('--max-lines-per-file <number>', 'Truncate files to max N lines (e.g., 200 for compact snapshots)', (val) => parseInt(val))
|
|
@@ -403,5 +404,24 @@ Quick --profile Examples:
|
|
|
403
404
|
.option('-v, --verbose', 'Show detailed output')
|
|
404
405
|
.action(envPull);
|
|
405
406
|
|
|
407
|
+
// Telemetry commands
|
|
408
|
+
const telemetryCmd = program.command('telemetry').description('Manage Telemetry Hub synchronization');
|
|
409
|
+
telemetryCmd
|
|
410
|
+
.command('push')
|
|
411
|
+
.description('Manually push the latest AnswerToSA.md report to xelth.com/T/report')
|
|
412
|
+
.argument('[repoPath]', 'Path to the repository', process.cwd())
|
|
413
|
+
.action(async (repoPath) => {
|
|
414
|
+
console.log(chalk.blue('Pushing agent telemetry...'));
|
|
415
|
+
await pushTelemetry(repoPath, false);
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
telemetryCmd
|
|
419
|
+
.command('sync-weights')
|
|
420
|
+
.description('Fetch the latest global token estimation weights from Telemetry Hub')
|
|
421
|
+
.action(async () => {
|
|
422
|
+
const { syncTokenWeights } = await import('../utils/tokenEstimator.js');
|
|
423
|
+
await syncTokenWeights();
|
|
424
|
+
});
|
|
425
|
+
|
|
406
426
|
program.parse(process.argv);
|
|
407
427
|
}
|
|
@@ -629,19 +629,19 @@ export async function createRepoSnapshot(repoPath, options) {
|
|
|
629
629
|
...options // Command-line options have the final say
|
|
630
630
|
};
|
|
631
631
|
|
|
632
|
-
// Detect architect modes
|
|
633
|
-
const
|
|
634
|
-
const
|
|
635
|
-
const
|
|
636
|
-
|
|
637
|
-
// If NOT in Junior Architect mode, hide JA-specific documentation to prevent context pollution
|
|
638
|
-
if (!options.withJa && !
|
|
639
|
-
if (!config.filesToIgnore) config.filesToIgnore = [];
|
|
640
|
-
config.filesToIgnore.push(
|
|
641
|
-
'COMMANDS_REFERENCE.md',
|
|
642
|
-
'codex_delegation_snapshot.md'
|
|
643
|
-
);
|
|
644
|
-
}
|
|
632
|
+
// Detect architect modes
|
|
633
|
+
const isJas = options.jas;
|
|
634
|
+
const isJao = options.jao;
|
|
635
|
+
const isJaz = options.jaz;
|
|
636
|
+
|
|
637
|
+
// If NOT in Junior Architect mode, hide JA-specific documentation to prevent context pollution
|
|
638
|
+
if (!options.withJa && !isJas && !isJao && !isJaz) {
|
|
639
|
+
if (!config.filesToIgnore) config.filesToIgnore = [];
|
|
640
|
+
config.filesToIgnore.push(
|
|
641
|
+
'COMMANDS_REFERENCE.md',
|
|
642
|
+
'codex_delegation_snapshot.md'
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
645
|
|
|
646
646
|
// Apply defaults for options that may not be provided via command line
|
|
647
647
|
if (!config.output) {
|
|
@@ -720,83 +720,83 @@ export async function createRepoSnapshot(repoPath, options) {
|
|
|
720
720
|
// File body always includes full content
|
|
721
721
|
let fileBody = (directoryTree ? `\n## Directory Structure\n\n\`\`\`\n${directoryTree}\`\`\`\n\n` : '') + contentArray.join('');
|
|
722
722
|
|
|
723
|
-
// Helper to write snapshot file
|
|
724
|
-
const writeSnapshot = async (suffix, isAgentMode) => {
|
|
725
|
-
// CHANGE: Force agent to FALSE for the main snapshot header.
|
|
726
|
-
// The snapshot is read by the Human/Senior Arch, not the Agent itself.
|
|
727
|
-
// The Agent reads CLAUDE.md.
|
|
728
|
-
const opts = { ...options, agent: false,
|
|
729
|
-
const header = await generateEnhancedAIHeader({ stats, repoName, mode: 'file', eckManifest, options: opts, repoPath: processedRepoPath }, isGitRepo);
|
|
730
|
-
|
|
731
|
-
// Compact filename format: eck{ShortName}{timestamp}_{hash}_{suffix}.md
|
|
732
|
-
// getShortRepoName ensures Capitalized Start/End (e.g. SnaOt)
|
|
733
|
-
const shortHash = gitHash ? gitHash.substring(0, 7) : '';
|
|
734
|
-
const shortRepoName = getShortRepoName(repoName);
|
|
735
|
-
|
|
736
|
-
let fname = `eck${shortRepoName}${timestamp}`;
|
|
737
|
-
if (shortHash) fname += `_${shortHash}`;
|
|
738
|
-
|
|
739
|
-
// Add mode suffix
|
|
740
|
-
if (options.skeleton) {
|
|
741
|
-
fname += '_sk';
|
|
742
|
-
} else if (suffix) {
|
|
743
|
-
fname += suffix;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
const fullContent = header + fileBody;
|
|
747
|
-
const sizeKB = Math.max(1, Math.round(Buffer.byteLength(fullContent, 'utf-8') / 1024));
|
|
748
|
-
fname += `_${sizeKB}kb.${fileExtension}`;
|
|
749
|
-
const fpath = path.join(outputPath, fname);
|
|
750
|
-
await fs.writeFile(fpath, fullContent);
|
|
751
|
-
console.log(`📄 Generated Snapshot: ${fname}`);
|
|
752
|
-
|
|
753
|
-
// --- FEATURE: Active Snapshot (.eck/lastsnapshot/) ---
|
|
754
|
-
// Only create .eck/lastsnapshot/ entries for the main snapshot
|
|
755
|
-
if (!isAgentMode) {
|
|
756
|
-
try {
|
|
757
|
-
const snapDir = path.join(originalCwd, '.eck', 'lastsnapshot');
|
|
758
|
-
await fs.mkdir(snapDir, { recursive: true });
|
|
759
|
-
|
|
760
|
-
// 1. Clean up OLD snapshots in this specific folder
|
|
761
|
-
// We keep AnswerToSA.md, but remove old snapshots and legacy answer.md
|
|
762
|
-
const existingFiles = await fs.readdir(snapDir);
|
|
763
|
-
for (const file of existingFiles) {
|
|
764
|
-
if ((file.startsWith('eck') && file.endsWith('.md')) || file === 'answer.md') {
|
|
765
|
-
await fs.unlink(path.join(snapDir, file));
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
// 2. Save the NEW specific named file
|
|
770
|
-
await fs.writeFile(path.join(snapDir, fname), fullContent);
|
|
771
|
-
|
|
772
|
-
console.log(chalk.cyan(`📋 Active snapshot updated in .eck/lastsnapshot/: ${fname}`));
|
|
773
|
-
} catch (e) {
|
|
774
|
-
// Non-critical failure
|
|
775
|
-
console.warn(chalk.yellow(`⚠️ Could not update .eck/lastsnapshot/: ${e.message}`));
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
// --------------------------------------------
|
|
779
|
-
|
|
780
|
-
return fpath;
|
|
781
|
-
};
|
|
782
|
-
|
|
783
|
-
// Generate snapshot file for ALL modes
|
|
784
|
-
if (
|
|
785
|
-
architectFilePath = await writeSnapshot('
|
|
786
|
-
} else if (
|
|
787
|
-
architectFilePath = await writeSnapshot('
|
|
788
|
-
} else if (
|
|
789
|
-
architectFilePath = await writeSnapshot('
|
|
790
|
-
} else {
|
|
791
|
-
// Standard snapshot behavior
|
|
792
|
-
architectFilePath = await writeSnapshot('', false);
|
|
793
|
-
|
|
794
|
-
// --- File 2: Junior Architect Snapshot (legacy --with-ja support) ---
|
|
795
|
-
if (options.withJa && fileExtension === 'md') {
|
|
796
|
-
console.log('🖋️ Generating Junior Architect (_ja) snapshot...');
|
|
797
|
-
jaFilePath = await writeSnapshot('_ja', true);
|
|
798
|
-
}
|
|
799
|
-
}
|
|
723
|
+
// Helper to write snapshot file
|
|
724
|
+
const writeSnapshot = async (suffix, isAgentMode) => {
|
|
725
|
+
// CHANGE: Force agent to FALSE for the main snapshot header.
|
|
726
|
+
// The snapshot is read by the Human/Senior Arch, not the Agent itself.
|
|
727
|
+
// The Agent reads CLAUDE.md.
|
|
728
|
+
const opts = { ...options, agent: false, jas: isJas, jao: isJao, jaz: isJaz };
|
|
729
|
+
const header = await generateEnhancedAIHeader({ stats, repoName, mode: 'file', eckManifest, options: opts, repoPath: processedRepoPath }, isGitRepo);
|
|
730
|
+
|
|
731
|
+
// Compact filename format: eck{ShortName}{timestamp}_{hash}_{suffix}.md
|
|
732
|
+
// getShortRepoName ensures Capitalized Start/End (e.g. SnaOt)
|
|
733
|
+
const shortHash = gitHash ? gitHash.substring(0, 7) : '';
|
|
734
|
+
const shortRepoName = getShortRepoName(repoName);
|
|
735
|
+
|
|
736
|
+
let fname = `eck${shortRepoName}${timestamp}`;
|
|
737
|
+
if (shortHash) fname += `_${shortHash}`;
|
|
738
|
+
|
|
739
|
+
// Add mode suffix
|
|
740
|
+
if (options.skeleton) {
|
|
741
|
+
fname += '_sk';
|
|
742
|
+
} else if (suffix) {
|
|
743
|
+
fname += suffix;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
const fullContent = header + fileBody;
|
|
747
|
+
const sizeKB = Math.max(1, Math.round(Buffer.byteLength(fullContent, 'utf-8') / 1024));
|
|
748
|
+
fname += `_${sizeKB}kb.${fileExtension}`;
|
|
749
|
+
const fpath = path.join(outputPath, fname);
|
|
750
|
+
await fs.writeFile(fpath, fullContent);
|
|
751
|
+
console.log(`📄 Generated Snapshot: ${fname}`);
|
|
752
|
+
|
|
753
|
+
// --- FEATURE: Active Snapshot (.eck/lastsnapshot/) ---
|
|
754
|
+
// Only create .eck/lastsnapshot/ entries for the main snapshot
|
|
755
|
+
if (!isAgentMode) {
|
|
756
|
+
try {
|
|
757
|
+
const snapDir = path.join(originalCwd, '.eck', 'lastsnapshot');
|
|
758
|
+
await fs.mkdir(snapDir, { recursive: true });
|
|
759
|
+
|
|
760
|
+
// 1. Clean up OLD snapshots in this specific folder
|
|
761
|
+
// We keep AnswerToSA.md, but remove old snapshots and legacy answer.md
|
|
762
|
+
const existingFiles = await fs.readdir(snapDir);
|
|
763
|
+
for (const file of existingFiles) {
|
|
764
|
+
if ((file.startsWith('eck') && file.endsWith('.md')) || file === 'answer.md') {
|
|
765
|
+
await fs.unlink(path.join(snapDir, file));
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
// 2. Save the NEW specific named file
|
|
770
|
+
await fs.writeFile(path.join(snapDir, fname), fullContent);
|
|
771
|
+
|
|
772
|
+
console.log(chalk.cyan(`📋 Active snapshot updated in .eck/lastsnapshot/: ${fname}`));
|
|
773
|
+
} catch (e) {
|
|
774
|
+
// Non-critical failure
|
|
775
|
+
console.warn(chalk.yellow(`⚠️ Could not update .eck/lastsnapshot/: ${e.message}`));
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
// --------------------------------------------
|
|
779
|
+
|
|
780
|
+
return fpath;
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
// Generate snapshot file for ALL modes
|
|
784
|
+
if (isJas) {
|
|
785
|
+
architectFilePath = await writeSnapshot('_jas', true);
|
|
786
|
+
} else if (isJao) {
|
|
787
|
+
architectFilePath = await writeSnapshot('_jao', true);
|
|
788
|
+
} else if (isJaz) {
|
|
789
|
+
architectFilePath = await writeSnapshot('_jaz', true);
|
|
790
|
+
} else {
|
|
791
|
+
// Standard snapshot behavior
|
|
792
|
+
architectFilePath = await writeSnapshot('', false);
|
|
793
|
+
|
|
794
|
+
// --- File 2: Junior Architect Snapshot (legacy --with-ja support) ---
|
|
795
|
+
if (options.withJa && fileExtension === 'md') {
|
|
796
|
+
console.log('🖋️ Generating Junior Architect (_ja) snapshot...');
|
|
797
|
+
jaFilePath = await writeSnapshot('_ja', true);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
800
|
|
|
801
801
|
// Save git anchor for future delta updates
|
|
802
802
|
await saveGitAnchor(processedRepoPath);
|
|
@@ -816,15 +816,20 @@ export async function createRepoSnapshot(repoPath, options) {
|
|
|
816
816
|
console.log('🔐 Scanning for confidential files...');
|
|
817
817
|
const confidentialFiles = await scanEckForConfidentialFiles(processedRepoPath, config);
|
|
818
818
|
|
|
819
|
-
let claudeMode = 'coder';
|
|
820
|
-
if (isJas) claudeMode = 'jas';
|
|
821
|
-
if (isJao) claudeMode = 'jao';
|
|
822
|
-
if (
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
819
|
+
let claudeMode = 'coder';
|
|
820
|
+
if (isJas) claudeMode = 'jas';
|
|
821
|
+
if (isJao) claudeMode = 'jao';
|
|
822
|
+
if (isJaz) claudeMode = 'jaz';
|
|
823
|
+
|
|
824
|
+
// Claude Code exclusively uses CLAUDE.md
|
|
825
|
+
if (isJas || isJao || (!isJaz && !options.withJa)) {
|
|
826
|
+
await updateClaudeMd(processedRepoPath, claudeMode, directoryTree, confidentialFiles, { zh: options.zh });
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// OpenCode exclusively uses AGENTS.md
|
|
830
|
+
if (isJaz || (!isJas && !isJao && !options.withJa)) {
|
|
831
|
+
await generateOpenCodeAgents(processedRepoPath, claudeMode, directoryTree, confidentialFiles, { zh: options.zh });
|
|
832
|
+
}
|
|
828
833
|
|
|
829
834
|
// --- Combined Report ---
|
|
830
835
|
console.log('\n✅ Snapshot generation complete!');
|
|
@@ -9,6 +9,7 @@ import { readFileWithSizeCheck, parseSize, formatSize, matchesPattern, loadGitig
|
|
|
9
9
|
import { detectProjectType, getProjectSpecificFiltering } from '../../utils/projectDetector.js';
|
|
10
10
|
import { execa } from 'execa';
|
|
11
11
|
import { fileURLToPath } from 'url';
|
|
12
|
+
import { pushTelemetry } from '../../utils/telemetry.js';
|
|
12
13
|
|
|
13
14
|
// Mirror the same hidden-path guard used in createSnapshot.js
|
|
14
15
|
function isHiddenPath(filePath) {
|
|
@@ -206,6 +207,9 @@ export async function updateSnapshot(repoPath, options) {
|
|
|
206
207
|
|
|
207
208
|
console.log(`📦 Included ${includedCount} changed files.`);
|
|
208
209
|
|
|
210
|
+
// Auto-push telemetry
|
|
211
|
+
await pushTelemetry(repoPath, true);
|
|
212
|
+
|
|
209
213
|
} catch (error) {
|
|
210
214
|
spinner.fail(`Update failed: ${error.message}`);
|
|
211
215
|
}
|
|
@@ -297,6 +301,9 @@ export async function updateSnapshotJson(repoPath) {
|
|
|
297
301
|
timestamp: timestamp
|
|
298
302
|
}));
|
|
299
303
|
|
|
304
|
+
// Auto-push telemetry (fire and forget so it doesn't break JSON output)
|
|
305
|
+
pushTelemetry(repoPath, true).catch(() => {});
|
|
306
|
+
|
|
300
307
|
} catch (error) {
|
|
301
308
|
console.log(JSON.stringify({ status: "error", message: error.message }));
|
|
302
309
|
}
|
|
@@ -5,7 +5,14 @@ You are an Expert Developer. The architecture is already decided. Your job is to
|
|
|
5
5
|
|
|
6
6
|
## DEFINITION OF DONE (CRITICAL)
|
|
7
7
|
When the task is complete:
|
|
8
|
-
1. **
|
|
8
|
+
1. **WRITE** your report to \`.eck/lastsnapshot/AnswerToSA.md\` (overwrite, not append). Use this exact format:
|
|
9
|
+
```markdown
|
|
10
|
+
# Report: [Task Name]
|
|
11
|
+
**Executor:** [Your Exact Model Name, e.g., GLM-4.7 (OpenCode)]
|
|
12
|
+
**Status:** [SUCCESS / BLOCKED / FAILED]
|
|
13
|
+
**Changes:**
|
|
14
|
+
- Modified X
|
|
15
|
+
```
|
|
9
16
|
2. **Use the \`eck_finish_task\` tool** to commit and sync context.
|
|
10
17
|
- This tool automatically creates a git commit and generates a delta snapshot
|
|
11
18
|
3. **DO NOT** use raw git commands for the final commit.
|
|
@@ -1,74 +1,62 @@
|
|
|
1
|
-
# 🧠 ROLE: Junior Architect (
|
|
1
|
+
# 🧠 ROLE: Swarm Orchestrator & Junior Architect (GLM-4.7)
|
|
2
2
|
|
|
3
|
-
## 1. PROJECT
|
|
4
|
-
You are
|
|
3
|
+
## 1. PROJECT MODE ACTIVE
|
|
4
|
+
You are operating in **Project Mode** inside OpenCode. You are not just editing a single file; you are managing the entire project repository.
|
|
5
5
|
- **Source of Truth:** The file system is your source of truth.
|
|
6
|
-
- **Documentation:** The
|
|
6
|
+
- **Documentation:** The `.eck/` directory contains project context. READ filenames to understand what is available.
|
|
7
7
|
- **Directory Structure:**
|
|
8
|
-
|
|
8
|
+
```
|
|
9
9
|
{{tree}}
|
|
10
|
-
|
|
10
|
+
```
|
|
11
11
|
|
|
12
|
-
## 2.
|
|
12
|
+
## 2. SWARM DELEGATION PROTOCOL (TOKEN ECONOMY)
|
|
13
13
|
|
|
14
14
|
### A. Token Efficiency: When NOT to Delegate
|
|
15
15
|
**DO NOT delegate tasks where explanation costs more tokens than execution.**
|
|
16
16
|
* *Examples:*
|
|
17
|
-
- Reading a config file → Just use
|
|
18
|
-
- Checking if file exists → Use
|
|
19
|
-
- Fixing a typo → Use
|
|
17
|
+
- Reading a config file → Just use `Read` tool (1 tool call vs explaining to GLM Z.AI)
|
|
18
|
+
- Checking if file exists → Use `Bash test -f` or `Read`
|
|
19
|
+
- Fixing a typo → Use `Edit` tool directly
|
|
20
20
|
- Writing < 50 lines of glue code
|
|
21
21
|
* **Rule:** If you can solve it in 1-2 tool calls, DO IT YOURSELF.
|
|
22
22
|
|
|
23
|
-
### B. Heavy Lifting (DELEGATE TO
|
|
24
|
-
For bulk work where delegation saves YOUR expensive context:
|
|
23
|
+
### B. Heavy Lifting (DELEGATE TO WORKERS)
|
|
24
|
+
For bulk work where delegation saves YOUR expensive context window, YOU MUST delegate to your GLM Z.AI Swarm:
|
|
25
25
|
* *Examples:*
|
|
26
26
|
- Implementing complex business logic (> 100 lines)
|
|
27
27
|
- Refactoring entire modules
|
|
28
28
|
- Writing comprehensive test suites
|
|
29
29
|
- Generating boilerplate code
|
|
30
|
-
* **Action:** Use
|
|
30
|
+
* **Action:** Use `glm_zai_backend`, `glm_zai_frontend`, `glm_zai_qa`, or `glm_zai_refactor`.
|
|
31
31
|
|
|
32
32
|
## 3. DEFINITION OF DONE (CRITICAL)
|
|
33
33
|
When you have completed your coding task and verified it works:
|
|
34
|
-
1. **DO NOT** run
|
|
34
|
+
1. **DO NOT** run `git commit` manually.
|
|
35
35
|
2. **DO NOT** just say "I'm done".
|
|
36
|
-
3. **Use the
|
|
36
|
+
3. **Use the `eck_finish_task` tool** to finalize the task.
|
|
37
37
|
- This tool automatically:
|
|
38
|
-
- Updates
|
|
39
|
-
- Creates a proper git commit
|
|
40
|
-
- Generates a delta snapshot (
|
|
41
|
-
- This is the standard way to complete any task.
|
|
38
|
+
- Updates `.eck/lastsnapshot/AnswerToSA.md` with your status
|
|
39
|
+
- Creates a proper git commit
|
|
40
|
+
- Generates a delta snapshot (`eck-snapshot update-auto`) for context sync
|
|
42
41
|
|
|
43
|
-
## 4.
|
|
42
|
+
## 4. SWARM ERROR RECOVERY & THE RALPH LOOP
|
|
44
43
|
**Core Directive:** You are "deterministically persistent". Failures are expected, giving up is not.
|
|
45
44
|
|
|
46
45
|
1. **Iterative Correction:**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
|
|
54
|
-
2. **Intelligent Retry (GLM ZAI Supervision):**
|
|
55
|
-
* If a GLM ZAI worker produces bad code:
|
|
56
|
-
* **DON'T** repeat the same prompt.
|
|
57
|
-
* **Analyze WHY** it failed (missing context? wrong import?).
|
|
58
|
-
* **Guide** the worker: "Previous attempt failed because X. Try again using pattern Y."
|
|
59
|
-
* **Takeover:** If GLM ZAI fails twice, **DO IT YOURSELF**.
|
|
60
|
-
|
|
61
|
-
3. **Definition of Done:**
|
|
62
|
-
* A task is ONLY done when the verification command (e.g., \`npm test\`) exits with code 0.
|
|
63
|
-
* If you cannot achieve green tests after max retries, produce a detailed report of *why* it is blocked.
|
|
46
|
+
* If a build fails or tests turn red: **DO NOT STOP**.
|
|
47
|
+
* **Read** the error message, **Think** about the cause, **Fix** the code, and **Retry**.
|
|
48
|
+
2. **Intelligent Retry (Swarm Supervision):**
|
|
49
|
+
* If a GLM Z.AI worker produces bad code, **DON'T** repeat the same prompt.
|
|
50
|
+
* **Analyze WHY** it failed and **Guide** the worker: "Previous attempt failed because X. Try again using pattern Y."
|
|
51
|
+
* **Takeover:** If the worker fails twice, **DO IT YOURSELF**.
|
|
64
52
|
|
|
65
53
|
## 5. REPORTING PROTOCOL
|
|
66
|
-
At the end of your task, you **MUST**
|
|
67
|
-
This file communicates your results back to the Senior Architect (Gemini).
|
|
54
|
+
At the end of your task, you **MUST** overwrite `.eck/lastsnapshot/AnswerToSA.md` BEFORE calling `eck_finish_task`.
|
|
68
55
|
|
|
69
56
|
**Format for .eck/lastsnapshot/AnswerToSA.md:**
|
|
70
|
-
|
|
57
|
+
```markdown
|
|
71
58
|
# Report: [Task Name]
|
|
59
|
+
**Executor:** [Your Exact Model Name, e.g., GLM-4.7 (OpenCode)]
|
|
72
60
|
**Status:** [SUCCESS / BLOCKED / FAILED]
|
|
73
61
|
**Changes:**
|
|
74
62
|
- Modified X
|
|
@@ -77,9 +65,4 @@ This file communicates your results back to the Senior Architect (Gemini).
|
|
|
77
65
|
- Ran test Z -> Passed
|
|
78
66
|
**Next Steps / Questions:**
|
|
79
67
|
- [What should the Architect do next?]
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
## 6. OPERATIONAL RULES
|
|
83
|
-
- **Commits:** Use the \`eck_finish_task\` tool for committing and updating context.
|
|
84
|
-
- **Manifests:** If you see [STUB] in .eck/ files, update them.
|
|
85
|
-
- **Reporting:** NEVER finish a session without writing \`.eck/lastsnapshot/AnswerToSA.md\` and calling \`eck_finish_task\`.
|
|
68
|
+
```
|
package/src/utils/aiHeader.js
CHANGED
|
@@ -72,11 +72,11 @@ function getVisibleAgents(executionAgents, options) {
|
|
|
72
72
|
// These keys must match IDs in setup.json
|
|
73
73
|
const standardCoders = ['local_dev', 'production_server', 'android_wsl_dev'];
|
|
74
74
|
|
|
75
|
-
// 2. Determine Priority Agent (The Junior Architect)
|
|
76
|
-
let priorityAgentKey = null;
|
|
77
|
-
if (options.jas) priorityAgentKey = 'jas';
|
|
78
|
-
if (options.jao) priorityAgentKey = 'jao';
|
|
79
|
-
if (options.
|
|
75
|
+
// 2. Determine Priority Agent (The Junior Architect)
|
|
76
|
+
let priorityAgentKey = null;
|
|
77
|
+
if (options.jas) priorityAgentKey = 'jas';
|
|
78
|
+
if (options.jao) priorityAgentKey = 'jao';
|
|
79
|
+
if (options.jaz) priorityAgentKey = 'jaz';
|
|
80
80
|
|
|
81
81
|
// 3. Build the list
|
|
82
82
|
// If a JA is selected, add them FIRST with a note
|
|
@@ -438,10 +438,10 @@ ${operationsSection}
|
|
|
438
438
|
// The `agent` prompt template is used ONLY in CLAUDE.md (via claudeMdGenerator.js)
|
|
439
439
|
// NOT in the snapshot itself.
|
|
440
440
|
|
|
441
|
-
const
|
|
442
|
-
const
|
|
443
|
-
const
|
|
444
|
-
const isJaMode =
|
|
441
|
+
const isJas = context.options && context.options.jas;
|
|
442
|
+
const isJao = context.options && context.options.jao;
|
|
443
|
+
const isJaz = context.options && context.options.jaz;
|
|
444
|
+
const isJaMode = isJas || isJao || isJaz;
|
|
445
445
|
|
|
446
446
|
// --- Determine Workflow Content based on JA Flag ---
|
|
447
447
|
let hierarchicalWorkflow = '';
|
|
@@ -449,15 +449,15 @@ ${operationsSection}
|
|
|
449
449
|
|
|
450
450
|
if (isJaMode) {
|
|
451
451
|
// Instructions strictly for the Senior Architect on how to use the JA
|
|
452
|
-
hierarchicalWorkflow = `### 👑 ROYAL COURT ARCHITECTURE (Active)
|
|
453
|
-
|
|
454
|
-
You are the **Senior Architect**. You have a **Junior Architect** available to handle implementation.
|
|
455
|
-
|
|
456
|
-
**PROTOCOL:**
|
|
457
|
-
1. **Prefer Delegation:** Unless the task is trivial (1-2 file edits), assign it to the **Junior Architect** (ID: \`jas\`, \`jao\`, or \`
|
|
458
|
-
2. **Direct Execution:** Only use \`local_dev\` or \`production_server\` directly if the Junior Architect fails or for simple "hotfixes".
|
|
459
|
-
3. **No Micro-Management:** Do not tell the Junior Architect *how* to use GLM Z.AI or internal tools. Just give them the strategic objective.
|
|
460
|
-
`;
|
|
452
|
+
hierarchicalWorkflow = `### 👑 ROYAL COURT ARCHITECTURE (Active)
|
|
453
|
+
|
|
454
|
+
You are the **Senior Architect**. You have a **Junior Architect** available to handle implementation.
|
|
455
|
+
|
|
456
|
+
**PROTOCOL:**
|
|
457
|
+
1. **Prefer Delegation:** Unless the task is trivial (1-2 file edits), assign it to the **Junior Architect** (ID: \`jas\`, \`jao\`, or \`jaz\` - see agents list above).
|
|
458
|
+
2. **Direct Execution:** Only use \`local_dev\` or \`production_server\` directly if the Junior Architect fails or for simple "hotfixes".
|
|
459
|
+
3. **No Micro-Management:** Do not tell the Junior Architect *how* to use GLM Z.AI or internal tools. Just give them the strategic objective.
|
|
460
|
+
`;
|
|
461
461
|
|
|
462
462
|
commandFormats = `### COMMAND FORMATS (Eck-Protocol v2)
|
|
463
463
|
|