feat: add c language compatibility

This commit is contained in:
Affaan Mustafa
2026-04-08 15:42:49 -07:00
parent 9bd8e8b3c7
commit 86cbe3d616
6 changed files with 45 additions and 2 deletions

View File

@@ -25,8 +25,8 @@ This is a **production-ready AI coding plugin** providing 47 specialized agents,
| e2e-runner | End-to-end Playwright testing | Critical user flows | | e2e-runner | End-to-end Playwright testing | Critical user flows |
| refactor-cleaner | Dead code cleanup | Code maintenance | | refactor-cleaner | Dead code cleanup | Code maintenance |
| doc-updater | Documentation and codemaps | Updating docs | | doc-updater | Documentation and codemaps | Updating docs |
| cpp-reviewer | C++ code review | C++ projects | | cpp-reviewer | C/C++ code review | C and C++ projects |
| cpp-build-resolver | C++ build errors | C++ build failures | | cpp-build-resolver | C/C++ build errors | C and C++ build failures |
| docs-lookup | Documentation lookup via Context7 | API/docs questions | | docs-lookup | Documentation lookup via Context7 | API/docs questions |
| go-reviewer | Go code review | Go projects | | go-reviewer | Go code review | Go projects |
| go-build-resolver | Go build errors | Go build failures | | go-build-resolver | Go build errors | Go build failures |

View File

@@ -193,6 +193,14 @@
"framework-language" "framework-language"
] ]
}, },
{
"id": "lang:c",
"family": "language",
"description": "C engineering guidance using the shared C/C++ standards and testing stack. Currently resolves through the shared framework-language module.",
"modules": [
"framework-language"
]
},
{ {
"id": "lang:kotlin", "id": "lang:kotlin",
"family": "language", "family": "language",

View File

@@ -37,6 +37,7 @@ const LEGACY_COMPAT_BASE_MODULE_IDS_BY_TARGET = Object.freeze({
], ],
}); });
const LEGACY_LANGUAGE_ALIAS_TO_CANONICAL = Object.freeze({ const LEGACY_LANGUAGE_ALIAS_TO_CANONICAL = Object.freeze({
c: 'c',
cpp: 'cpp', cpp: 'cpp',
csharp: 'csharp', csharp: 'csharp',
go: 'go', go: 'go',
@@ -52,6 +53,7 @@ const LEGACY_LANGUAGE_ALIAS_TO_CANONICAL = Object.freeze({
typescript: 'typescript', typescript: 'typescript',
}); });
const LEGACY_LANGUAGE_EXTRA_MODULE_IDS = Object.freeze({ const LEGACY_LANGUAGE_EXTRA_MODULE_IDS = Object.freeze({
c: ['framework-language'],
cpp: ['framework-language'], cpp: ['framework-language'],
csharp: ['framework-language'], csharp: ['framework-language'],
go: ['framework-language'], go: ['framework-language'],

View File

@@ -50,6 +50,11 @@ const LANGUAGE_RULES = [
markers: ['pom.xml', 'build.gradle', 'build.gradle.kts'], markers: ['pom.xml', 'build.gradle', 'build.gradle.kts'],
extensions: ['.java'] extensions: ['.java']
}, },
{
type: 'c',
markers: [],
extensions: ['.c']
},
{ {
type: 'csharp', type: 'csharp',
markers: [], markers: [],

View File

@@ -74,6 +74,8 @@ function runTests() {
const components = listInstallComponents(); const components = listInstallComponents();
assert.ok(components.some(component => component.id === 'lang:typescript'), assert.ok(components.some(component => component.id === 'lang:typescript'),
'Should include lang:typescript'); 'Should include lang:typescript');
assert.ok(components.some(component => component.id === 'lang:c'),
'Should include lang:c');
assert.ok(components.some(component => component.id === 'capability:security'), assert.ok(components.some(component => component.id === 'capability:security'),
'Should include capability:security'); 'Should include capability:security');
})) passed++; else failed++; })) passed++; else failed++;
@@ -87,6 +89,7 @@ function runTests() {
assert.ok(languages.includes('kotlin')); assert.ok(languages.includes('kotlin'));
assert.ok(languages.includes('rust')); assert.ok(languages.includes('rust'));
assert.ok(languages.includes('cpp')); assert.ok(languages.includes('cpp'));
assert.ok(languages.includes('c'));
assert.ok(languages.includes('csharp')); assert.ok(languages.includes('csharp'));
})) passed++; else failed++; })) passed++; else failed++;
@@ -183,6 +186,17 @@ function runTests() {
'cpp should resolve to framework-language module'); 'cpp should resolve to framework-language module');
})) passed++; else failed++; })) passed++; else failed++;
if (test('resolves c legacy compatibility into framework-language module', () => {
const selection = resolveLegacyCompatibilitySelection({
target: 'cursor',
legacyLanguages: ['c'],
});
assert.ok(selection.moduleIds.includes('rules-core'));
assert.ok(selection.moduleIds.includes('framework-language'),
'c should resolve to framework-language module');
})) passed++; else failed++;
if (test('resolves csharp legacy compatibility into framework-language module', () => { if (test('resolves csharp legacy compatibility into framework-language module', () => {
const selection = resolveLegacyCompatibilitySelection({ const selection = resolveLegacyCompatibilitySelection({
target: 'cursor', target: 'cursor',

View File

@@ -220,6 +220,20 @@ function runTests() {
} }
})) passed++; else failed++; })) passed++; else failed++;
console.log('\nC Detection:');
if (test('detects c from top-level .c files', () => {
const dir = createTempDir();
try {
writeTestFile(dir, 'main.c', 'int main(void) { return 0; }\n');
const result = detectProjectType(dir);
assert.ok(result.languages.includes('c'));
assert.strictEqual(result.primary, 'c');
} finally {
cleanupDir(dir);
}
})) passed++; else failed++;
// Go detection // Go detection
console.log('\nGo Detection:'); console.log('\nGo Detection:');