coder-config 0.41.27 → 0.41.30
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 +1 -1
- package/lib/workstreams.js +249 -0
- package/package.json +1 -1
- package/ui/dist/assets/{index-DesFZJt6.js → index-CFgS5YV_.js} +69 -69
- package/ui/dist/assets/{index-BxGFW_6W.css → index-X0dVhMey.css} +1 -1
- package/ui/dist/index.html +2 -2
- package/ui/routes/workstreams.js +23 -0
- package/ui/server.cjs +7 -0
package/lib/constants.js
CHANGED
package/lib/workstreams.js
CHANGED
|
@@ -628,6 +628,253 @@ function workstreamCheckPath(installDir, targetPath, silent = false) {
|
|
|
628
628
|
return isWithin;
|
|
629
629
|
}
|
|
630
630
|
|
|
631
|
+
/**
|
|
632
|
+
* Generate rules/context from project repositories using Claude Code
|
|
633
|
+
* Runs `claude -p` to analyze repos and generate smart context
|
|
634
|
+
*/
|
|
635
|
+
async function generateRulesWithClaude(projects) {
|
|
636
|
+
if (!projects || projects.length === 0) {
|
|
637
|
+
return '';
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
const { execFileSync } = require('child_process');
|
|
641
|
+
|
|
642
|
+
const projectPaths = projects.map(p =>
|
|
643
|
+
path.resolve(p.replace(/^~/, process.env.HOME || ''))
|
|
644
|
+
);
|
|
645
|
+
|
|
646
|
+
const projectList = projectPaths.map(p => `- ${p}`).join('\n');
|
|
647
|
+
|
|
648
|
+
const prompt = `Analyze these project repositories and generate concise workstream context rules for an AI coding assistant. Focus on:
|
|
649
|
+
1. What each project does (brief description)
|
|
650
|
+
2. Key technologies and frameworks used
|
|
651
|
+
3. How the projects relate to each other (if multiple)
|
|
652
|
+
4. Any important conventions or patterns to follow
|
|
653
|
+
|
|
654
|
+
Projects:
|
|
655
|
+
${projectList}
|
|
656
|
+
|
|
657
|
+
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.`;
|
|
658
|
+
|
|
659
|
+
try {
|
|
660
|
+
// Run claude -p with the prompt using execFileSync (safer than exec)
|
|
661
|
+
const result = execFileSync('claude', ['-p', prompt], {
|
|
662
|
+
cwd: projectPaths[0],
|
|
663
|
+
encoding: 'utf8',
|
|
664
|
+
timeout: 60000, // 60 second timeout
|
|
665
|
+
maxBuffer: 1024 * 1024, // 1MB buffer
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
return result.trim();
|
|
669
|
+
} catch (error) {
|
|
670
|
+
console.error('Claude generation failed:', error.message);
|
|
671
|
+
// Fall back to simple generation
|
|
672
|
+
return generateRulesFromRepos(projects);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Generate rules/context from project repositories
|
|
678
|
+
* Reads README.md, package.json, CLAUDE.md, etc. to create a summary
|
|
679
|
+
*/
|
|
680
|
+
function generateRulesFromRepos(projects) {
|
|
681
|
+
if (!projects || projects.length === 0) {
|
|
682
|
+
return '';
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
const lines = [];
|
|
686
|
+
lines.push('# Workstream Context');
|
|
687
|
+
lines.push('');
|
|
688
|
+
lines.push('## Repositories');
|
|
689
|
+
lines.push('');
|
|
690
|
+
|
|
691
|
+
for (const projectPath of projects) {
|
|
692
|
+
const absPath = path.resolve(projectPath.replace(/^~/, process.env.HOME || ''));
|
|
693
|
+
const name = path.basename(absPath);
|
|
694
|
+
|
|
695
|
+
lines.push(`### ${name}`);
|
|
696
|
+
lines.push('');
|
|
697
|
+
|
|
698
|
+
// Check for CLAUDE.md first (most relevant for Claude context)
|
|
699
|
+
const claudeMdPath = path.join(absPath, 'CLAUDE.md');
|
|
700
|
+
if (fs.existsSync(claudeMdPath)) {
|
|
701
|
+
try {
|
|
702
|
+
const content = fs.readFileSync(claudeMdPath, 'utf8');
|
|
703
|
+
// Extract first section or summary
|
|
704
|
+
const firstSection = extractFirstSection(content);
|
|
705
|
+
if (firstSection) {
|
|
706
|
+
lines.push(firstSection.trim());
|
|
707
|
+
lines.push('');
|
|
708
|
+
continue; // CLAUDE.md is comprehensive, skip other files
|
|
709
|
+
}
|
|
710
|
+
} catch (e) {
|
|
711
|
+
// Ignore read errors
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
// Check for package.json (JavaScript/TypeScript projects)
|
|
716
|
+
const packageJsonPath = path.join(absPath, 'package.json');
|
|
717
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
718
|
+
try {
|
|
719
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
720
|
+
if (pkg.description) {
|
|
721
|
+
lines.push(`**Description:** ${pkg.description}`);
|
|
722
|
+
lines.push('');
|
|
723
|
+
}
|
|
724
|
+
const deps = Object.keys(pkg.dependencies || {});
|
|
725
|
+
const devDeps = Object.keys(pkg.devDependencies || {});
|
|
726
|
+
if (deps.length > 0 || devDeps.length > 0) {
|
|
727
|
+
const keyDeps = [...deps, ...devDeps].filter(d =>
|
|
728
|
+
['react', 'vue', 'angular', 'next', 'express', 'fastify', 'koa',
|
|
729
|
+
'typescript', 'prisma', 'drizzle', 'mongoose', 'sequelize',
|
|
730
|
+
'tailwindcss', 'vite', 'webpack', 'jest', 'vitest', 'mocha'].includes(d)
|
|
731
|
+
);
|
|
732
|
+
if (keyDeps.length > 0) {
|
|
733
|
+
lines.push(`**Stack:** ${keyDeps.join(', ')}`);
|
|
734
|
+
lines.push('');
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
} catch (e) {
|
|
738
|
+
// Ignore parse errors
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
// Check for pyproject.toml (Python projects)
|
|
743
|
+
const pyprojectPath = path.join(absPath, 'pyproject.toml');
|
|
744
|
+
if (fs.existsSync(pyprojectPath)) {
|
|
745
|
+
try {
|
|
746
|
+
const content = fs.readFileSync(pyprojectPath, 'utf8');
|
|
747
|
+
const descMatch = content.match(/description\s*=\s*"([^"]+)"/);
|
|
748
|
+
if (descMatch) {
|
|
749
|
+
lines.push(`**Description:** ${descMatch[1]}`);
|
|
750
|
+
lines.push('');
|
|
751
|
+
}
|
|
752
|
+
// Detect common Python frameworks
|
|
753
|
+
const frameworks = [];
|
|
754
|
+
if (content.includes('fastapi')) frameworks.push('FastAPI');
|
|
755
|
+
if (content.includes('django')) frameworks.push('Django');
|
|
756
|
+
if (content.includes('flask')) frameworks.push('Flask');
|
|
757
|
+
if (content.includes('sqlalchemy')) frameworks.push('SQLAlchemy');
|
|
758
|
+
if (content.includes('pytest')) frameworks.push('pytest');
|
|
759
|
+
if (frameworks.length > 0) {
|
|
760
|
+
lines.push(`**Stack:** ${frameworks.join(', ')}`);
|
|
761
|
+
lines.push('');
|
|
762
|
+
}
|
|
763
|
+
} catch (e) {
|
|
764
|
+
// Ignore read errors
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
// Check for README.md
|
|
769
|
+
const readmePath = path.join(absPath, 'README.md');
|
|
770
|
+
if (fs.existsSync(readmePath)) {
|
|
771
|
+
try {
|
|
772
|
+
const content = fs.readFileSync(readmePath, 'utf8');
|
|
773
|
+
// Extract first paragraph or description
|
|
774
|
+
const firstPara = extractFirstParagraph(content);
|
|
775
|
+
if (firstPara && firstPara.length > 20) {
|
|
776
|
+
lines.push(firstPara.trim());
|
|
777
|
+
lines.push('');
|
|
778
|
+
}
|
|
779
|
+
} catch (e) {
|
|
780
|
+
// Ignore read errors
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
// Check for Cargo.toml (Rust projects)
|
|
785
|
+
const cargoPath = path.join(absPath, 'Cargo.toml');
|
|
786
|
+
if (fs.existsSync(cargoPath)) {
|
|
787
|
+
try {
|
|
788
|
+
const content = fs.readFileSync(cargoPath, 'utf8');
|
|
789
|
+
const descMatch = content.match(/description\s*=\s*"([^"]+)"/);
|
|
790
|
+
if (descMatch) {
|
|
791
|
+
lines.push(`**Description:** ${descMatch[1]}`);
|
|
792
|
+
lines.push('');
|
|
793
|
+
}
|
|
794
|
+
lines.push('**Language:** Rust');
|
|
795
|
+
lines.push('');
|
|
796
|
+
} catch (e) {
|
|
797
|
+
// Ignore read errors
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// Check for go.mod (Go projects)
|
|
802
|
+
const goModPath = path.join(absPath, 'go.mod');
|
|
803
|
+
if (fs.existsSync(goModPath)) {
|
|
804
|
+
lines.push('**Language:** Go');
|
|
805
|
+
lines.push('');
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// If nothing was found, just note the path
|
|
809
|
+
if (lines[lines.length - 1] === '' && lines[lines.length - 2] === `### ${name}`) {
|
|
810
|
+
lines.push(`*Project at ${absPath.replace(process.env.HOME || '', '~')}*`);
|
|
811
|
+
lines.push('');
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
return lines.join('\n').trim();
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/**
|
|
819
|
+
* Extract first meaningful section from markdown
|
|
820
|
+
*/
|
|
821
|
+
function extractFirstSection(content) {
|
|
822
|
+
const lines = content.split('\n');
|
|
823
|
+
let result = [];
|
|
824
|
+
let inSection = false;
|
|
825
|
+
let lineCount = 0;
|
|
826
|
+
|
|
827
|
+
for (const line of lines) {
|
|
828
|
+
// Skip initial title
|
|
829
|
+
if (!inSection && line.startsWith('# ')) {
|
|
830
|
+
inSection = true;
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
if (inSection) {
|
|
834
|
+
// Stop at next heading or after reasonable amount of content
|
|
835
|
+
if (line.startsWith('## ') && lineCount > 3) break;
|
|
836
|
+
if (lineCount > 15) break;
|
|
837
|
+
result.push(line);
|
|
838
|
+
if (line.trim()) lineCount++;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
return result.join('\n').trim();
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* Extract first paragraph from README
|
|
847
|
+
*/
|
|
848
|
+
function extractFirstParagraph(content) {
|
|
849
|
+
const lines = content.split('\n');
|
|
850
|
+
let result = [];
|
|
851
|
+
let started = false;
|
|
852
|
+
let emptyLineCount = 0;
|
|
853
|
+
|
|
854
|
+
for (const line of lines) {
|
|
855
|
+
// Skip badges, titles, and empty lines at start
|
|
856
|
+
if (!started) {
|
|
857
|
+
if (line.startsWith('#') || line.startsWith('![') || line.startsWith('[!') || !line.trim()) {
|
|
858
|
+
continue;
|
|
859
|
+
}
|
|
860
|
+
started = true;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
if (started) {
|
|
864
|
+
if (!line.trim()) {
|
|
865
|
+
emptyLineCount++;
|
|
866
|
+
if (emptyLineCount > 1) break;
|
|
867
|
+
} else {
|
|
868
|
+
emptyLineCount = 0;
|
|
869
|
+
result.push(line);
|
|
870
|
+
if (result.length > 5) break;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
return result.join(' ').replace(/\s+/g, ' ').trim();
|
|
876
|
+
}
|
|
877
|
+
|
|
631
878
|
module.exports = {
|
|
632
879
|
getWorkstreamsPath,
|
|
633
880
|
loadWorkstreams,
|
|
@@ -650,4 +897,6 @@ module.exports = {
|
|
|
650
897
|
workstreamInstallHookCodex,
|
|
651
898
|
workstreamDeactivate,
|
|
652
899
|
workstreamCheckPath,
|
|
900
|
+
generateRulesFromRepos,
|
|
901
|
+
generateRulesWithClaude,
|
|
653
902
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coder-config",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.30",
|
|
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",
|