coder-config 0.46.13 → 0.46.15-beta
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/lib/constants.js
CHANGED
package/lib/workstreams.js
CHANGED
|
@@ -800,6 +800,53 @@ function getAvailableAITools() {
|
|
|
800
800
|
* @param {string} toolId - AI tool to use (default: 'claude')
|
|
801
801
|
* @param {object} options - Tool-specific options (e.g., { model: 'llama3.2' } for ollama)
|
|
802
802
|
*/
|
|
803
|
+
/**
|
|
804
|
+
* Read key project files and return their content for AI analysis
|
|
805
|
+
* Since spawned AI processes can't read files, we read them ourselves
|
|
806
|
+
*/
|
|
807
|
+
function gatherProjectContent(projectPath) {
|
|
808
|
+
const keyFiles = [
|
|
809
|
+
'CLAUDE.md', 'GEMINI.md', 'README.md',
|
|
810
|
+
'package.json', 'pyproject.toml', 'Cargo.toml', 'go.mod',
|
|
811
|
+
'.claude/rules', '.gemini/rules'
|
|
812
|
+
];
|
|
813
|
+
|
|
814
|
+
const content = [];
|
|
815
|
+
const projectName = path.basename(projectPath);
|
|
816
|
+
|
|
817
|
+
for (const file of keyFiles) {
|
|
818
|
+
const filePath = path.join(projectPath, file);
|
|
819
|
+
try {
|
|
820
|
+
const stat = fs.statSync(filePath);
|
|
821
|
+
if (stat.isDirectory()) {
|
|
822
|
+
// Read all .md files in rules directory
|
|
823
|
+
const rules = fs.readdirSync(filePath)
|
|
824
|
+
.filter(f => f.endsWith('.md'))
|
|
825
|
+
.slice(0, 5); // Limit to 5 rules
|
|
826
|
+
for (const rule of rules) {
|
|
827
|
+
const ruleContent = fs.readFileSync(path.join(filePath, rule), 'utf8');
|
|
828
|
+
if (ruleContent.length < 2000) {
|
|
829
|
+
content.push(`### ${projectName}/${file}/${rule}\n${ruleContent}`);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
} else if (stat.isFile()) {
|
|
833
|
+
const fileContent = fs.readFileSync(filePath, 'utf8');
|
|
834
|
+
// Limit file size to avoid huge prompts
|
|
835
|
+
if (fileContent.length < 5000) {
|
|
836
|
+
content.push(`### ${projectName}/${file}\n${fileContent}`);
|
|
837
|
+
} else if (file === 'package.json' || file === 'pyproject.toml') {
|
|
838
|
+
// For package files, extract key info even if large
|
|
839
|
+
content.push(`### ${projectName}/${file}\n${fileContent.slice(0, 2000)}...`);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
} catch (e) {
|
|
843
|
+
// File doesn't exist or can't be read, skip
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
return content;
|
|
848
|
+
}
|
|
849
|
+
|
|
803
850
|
async function generateRulesWithAI(projects, toolId = 'claude', options = {}) {
|
|
804
851
|
if (!projects || projects.length === 0) {
|
|
805
852
|
return '';
|
|
@@ -834,16 +881,26 @@ async function generateRulesWithAI(projects, toolId = 'claude', options = {}) {
|
|
|
834
881
|
}
|
|
835
882
|
}
|
|
836
883
|
|
|
837
|
-
|
|
884
|
+
// Gather content from project files (since spawned AI can't read files)
|
|
885
|
+
const projectContents = [];
|
|
886
|
+
for (const projectPath of allProjects) {
|
|
887
|
+
const content = gatherProjectContent(projectPath);
|
|
888
|
+
if (content.length > 0) {
|
|
889
|
+
projectContents.push(`## ${path.basename(projectPath)} (${projectPath})\n\n${content.join('\n\n')}`);
|
|
890
|
+
} else {
|
|
891
|
+
projectContents.push(`## ${path.basename(projectPath)} (${projectPath})\n\n(No key files found)`);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
838
894
|
|
|
839
|
-
const prompt = `
|
|
895
|
+
const prompt = `Based on the following project files, generate concise workstream context rules for an AI coding assistant. Focus on:
|
|
840
896
|
1. What each project does (brief description)
|
|
841
897
|
2. Key technologies and frameworks used
|
|
842
898
|
3. How the projects relate to each other (if multiple)
|
|
843
899
|
4. Any important conventions or patterns to follow
|
|
844
900
|
|
|
845
|
-
|
|
846
|
-
${
|
|
901
|
+
---
|
|
902
|
+
${projectContents.join('\n\n---\n\n')}
|
|
903
|
+
---
|
|
847
904
|
|
|
848
905
|
Output markdown suitable for injecting into an AI assistant's context. Keep it concise (under 500 words). Do not include code blocks or examples - just descriptions and guidelines.`;
|
|
849
906
|
|
|
@@ -857,7 +914,7 @@ Output markdown suitable for injecting into an AI assistant's context. Keep it c
|
|
|
857
914
|
cwd: allProjects[0],
|
|
858
915
|
encoding: 'utf8',
|
|
859
916
|
timeout: 120000, // 2 minute timeout (some models are slower)
|
|
860
|
-
maxBuffer: 1024 * 1024, //
|
|
917
|
+
maxBuffer: 1024 * 1024 * 5, // 5MB buffer for larger prompts
|
|
861
918
|
});
|
|
862
919
|
|
|
863
920
|
return result.trim();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coder-config",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.15-beta",
|
|
4
4
|
"description": "Configuration manager for AI coding tools - Claude Code, Gemini CLI, Codex CLI, Antigravity. Manage MCPs, rules, permissions, memory, and workstreams.",
|
|
5
5
|
"author": "regression.io",
|
|
6
6
|
"main": "config-loader.js",
|