Skip to content

Commit 8f53839

Browse files
committed
feat: Rename AI Context Convention to Codebase Context Specification
1 parent 377b533 commit 8f53839

File tree

8 files changed

+67
-45
lines changed

8 files changed

+67
-45
lines changed

CODEBASE-CONTEXT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ documentation:
464464

465465
## 9. Conclusion
466466

467-
The AI Context Convention provides a flexible, standardized approach to enriching codebases with contextual information for AI models. By adopting this convention and including role-specific information, development teams can enhance AI-assisted workflows, improving code quality and development efficiency across projects of any scale or complexity. The addition of role-specific guidelines and consistent naming conventions ensures that AI models have access to comprehensive, relevant, and well-structured information tailored to different aspects of the software development lifecycle.
467+
The Codebase Context Specification provides a flexible, standardized approach to enriching codebases with contextual information for AI models. By adopting this convention and including role-specific information, development teams can enhance AI-assisted workflows, improving code quality and development efficiency across projects of any scale or complexity. The addition of role-specific guidelines and consistent naming conventions ensures that AI models have access to comprehensive, relevant, and well-structured information tailored to different aspects of the software development lifecycle.
468468

469469
## 10. TypeScript Linter Implementation
470470

471-
For details on the TypeScript implementation of the linter for validating AI Context Convention files, please refer to the [TypeScript Linter README](linters/typescript/README.md).
471+
For details on the TypeScript implementation of the linter for validating Codebase Context Specification files, please refer to the [TypeScript Linter README](linters/typescript/README.md).

linters/.context.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
module-name: AI Context Convention Linters
2+
module-name: Codebase Context Specification Linters
33
related-modules:
44
- ../examples
55
version: 1.0.0
6-
description: Contains linting tools for validating AI Context Convention files
6+
description: Contains linting tools for validating Codebase Context Specification files
77
diagrams: []
88
technologies:
99
- Python
1010
- TypeScript
1111
conventions:
1212
- Follow language-specific best practices
13-
- Adhere to AI Context Convention Specification
13+
- Adhere to Codebase Context Specification
1414
directives:
1515
- Ensure consistency between different language implementations
1616
- Write clear, well-documented code
@@ -32,7 +32,7 @@ business-requirements:
3232
- Validate structure of context files
3333
- Ensure required fields are present
3434
- Check for proper YAML frontmatter in Markdown files
35-
target-audience: Developers using the AI Context Convention
35+
target-audience: Developers using the Codebase Context Specification
3636
success-metrics:
3737
- Consistency of linting results across languages
3838
- Adoption rate among project contributors
@@ -51,7 +51,7 @@ deployment:
5151

5252
# Linters Directory
5353

54-
This directory contains linting tools for validating AI Context Convention files in different programming languages. The linters ensure that context files adhere to the specification and provide consistent, high-quality contextual information for AI-assisted development.
54+
This directory contains linting tools for validating Codebase Context Specification files in different programming languages. The linters ensure that context files adhere to the specification and provide consistent, high-quality contextual information for AI-assisted development.
5555

5656
## Contents
5757

@@ -67,9 +67,9 @@ Each language-specific subdirectory contains its own linter implementation. Refe
6767
When contributing to or modifying the linters:
6868

6969
1. Ensure consistency between different language implementations
70-
2. Follow the AI Context Convention Specification strictly
70+
2. Follow the Codebase Context Specification strictly
7171
3. Write clear, well-documented code
7272
4. Include appropriate error messages and logging for easier debugging
7373
5. Add unit tests for any new functionality or bug fixes
7474

75-
Please refer to the main README.md file in the project root for more detailed contribution guidelines and the full specification of the AI Context Convention.
75+
Please refer to the main README.md file in the project root for more detailed contribution guidelines and the full specification of the Codebase Context Specification.

linters/python/.context.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
module-name: Python Linter for AI Context Convention
2+
module-name: Python Linter for Codebase Context Specification
33
related-modules:
44
- ../typescript
55
version: 0.0.1
6-
description: Python implementation of the AI Context Convention linter (placeholder)
6+
description: Python implementation of the Codebase Context Specification linter (placeholder)
77
project-type: Linter
88
diagrams: []
99
technologies:
@@ -35,8 +35,8 @@ business-requirements:
3535
- Validate structure of context files
3636
- Ensure required fields are present
3737
- Check for proper YAML frontmatter in Markdown files
38-
- Verify content adheres to AI Context Convention Specification
39-
target-audience: Developers using the AI Context Convention
38+
- Verify content adheres to Codebase Context Specification
39+
target-audience: Developers using the Codebase Context Specification
4040
success-metrics:
4141
- Consistency with TypeScript linter results
4242
- Performance on large codebases
@@ -54,13 +54,13 @@ deployment:
5454

5555
---
5656

57-
# Python Linter for AI Context Convention (Placeholder)
57+
# Python Linter for Codebase Context Specification (Placeholder)
5858

59-
This directory is currently a placeholder for the future Python implementation of the linter for validating AI Context Convention files.
59+
This directory is currently a placeholder for the future Python implementation of the linter for validating Codebase Context Specification files.
6060

6161
## Current Status
6262

63-
The Python linter is not yet implemented. This module serves as a placeholder to indicate the planned development of a Python-based linter for the AI Context Convention.
63+
The Python linter is not yet implemented. This module serves as a placeholder to indicate the planned development of a Python-based linter for the Codebase Context Specification.
6464

6565
## Planned Functionality
6666

@@ -69,7 +69,7 @@ Once implemented, the Python linter is expected to perform the following checks:
6969
1. Validate the structure of context files (.context.md, .context.yaml, and .context.json)
7070
2. Ensure required fields are present
7171
3. Check for proper YAML frontmatter in Markdown files
72-
4. Verify that content adheres to the AI Context Convention Specification
72+
4. Verify that content adheres to the Codebase Context Specification
7373

7474
## Future Development Guidelines
7575

@@ -88,4 +88,4 @@ When the Python linter is developed, it should:
8888
3. Create a detailed implementation plan
8989
4. Begin development following the project's coding standards and best practices
9090

91-
Refer to the main README.md in the project root for the full AI Context Convention Specification and contribution guidelines.
91+
Refer to the main README.md in the project root for the full Codebase Context Specification and contribution guidelines.

linters/typescript/.context.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
module-name: TypeScript Linter for AI Context Convention
2+
module-name: TypeScript Linter for Codebase Context Specification
33
related-modules:
44
- ../python
55
version: 1.0.0
6-
description: TypeScript implementation of the AI Context Convention linter
6+
description: TypeScript implementation of the Codebase Context Specification linter
77
project-type: Linter
88
diagrams: []
99
technologies:
@@ -38,8 +38,8 @@ business-requirements:
3838
- Validate structure of context files
3939
- Ensure required fields are present
4040
- Check for proper YAML frontmatter in Markdown files
41-
- Verify content adheres to AI Context Convention Specification
42-
target-audience: Developers using the AI Context Convention
41+
- Verify content adheres to Codebase Context Specification
42+
target-audience: Developers using the Codebase Context Specification
4343
success-metrics:
4444
- Accuracy of linting results
4545
- Performance on large codebases
@@ -56,9 +56,9 @@ deployment:
5656
production-environment: npm public registry
5757
---
5858

59-
# TypeScript Linter for AI Context Convention
59+
# TypeScript Linter for Codebase Context Specification
6060

61-
This directory contains the TypeScript implementation of the linter for validating AI Context Convention files.
61+
This directory contains the TypeScript implementation of the linter for validating Codebase Context Specification files.
6262

6363
## Main Components
6464

@@ -71,7 +71,7 @@ The TypeScript linter performs the following checks:
7171
1. Validates the structure of context files
7272
2. Ensures required fields are present
7373
3. Checks for proper YAML frontmatter in Markdown files
74-
4. Verifies the content adheres to the AI Context Convention Specification
74+
4. Verifies the content adheres to the Codebase Context Specification
7575

7676
## Usage
7777

@@ -92,4 +92,4 @@ When working on the TypeScript linter:
9292
4. Keep the linter consistent with the Python implementation
9393
5. Update comments and documentation as necessary
9494

95-
Refer to the main README.md in the project root for the full AI Context Convention Specification and contribution guidelines.
95+
Refer to the main README.md in the project root for the full Codebase Context Specification and contribution guidelines.

linters/typescript/CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818

1919
### Features
2020

21-
* Add AI Context Convention specification and linter implementation ([a760aac](https://github.com/Agentic-Insights/codebase-context-spec/commit/a760aac075231a30fbc9e100a6305397840657f7))
21+
* Add Codebase Context Specification and linter implementation ([a760aac](https://github.com/Agentic-Insights/codebase-context-spec/commit/a760aac075231a30fbc9e100a6305397840657f7))
2222
* Add Codebase Context Specification (CCS) convention ([781eb1d](https://github.com/Agentic-Insights/codebase-context-spec/commit/781eb1d36ad1eaf48612f6b552f1aac8c2a45d57))
2323
* Add LICENSE.md file ([88a5b07](https://github.com/Agentic-Insights/codebase-context-spec/commit/88a5b074e4322fe9ed37a54d42d4f74df39b20af))
2424
* Add linting for .contextdocs.md and .contextignore files ([7c49a7f](https://github.com/Agentic-Insights/codebase-context-spec/commit/7c49a7f8ff366be6d16ab85a1511a4b9c9ff5d83))
25-
* Add PUBLISH.md for publishing the AI Context Convention Linter to npm ([8ea8513](https://github.com/Agentic-Insights/codebase-context-spec/commit/8ea85136f3f2c2b8ad0b8429af00c33cc0f8c8c0))
25+
* Add PUBLISH.md for publishing the Codebase Context Specification Linter to npm ([8ea8513](https://github.com/Agentic-Insights/codebase-context-spec/commit/8ea85136f3f2c2b8ad0b8429af00c33cc0f8c8c0))
2626
* Add release workflow and configuration ([903543c](https://github.com/Agentic-Insights/codebase-context-spec/commit/903543ca329ef5b18c28f738d8f34953250bbeb2))
2727
* Add tooling recommendations and future directions sections ([1dd204d](https://github.com/Agentic-Insights/codebase-context-spec/commit/1dd204df0dc5f00efb773d37fc45d31d94495263))
28-
* Add TypeScript linter for AI Context Convention files ([3d8d081](https://github.com/Agentic-Insights/codebase-context-spec/commit/3d8d0817907de1ac63359ca762b61d687299e71e))
28+
* Add TypeScript linter for Codebase Context Specification files ([3d8d081](https://github.com/Agentic-Insights/codebase-context-spec/commit/3d8d0817907de1ac63359ca762b61d687299e71e))
2929
* Bump version to 0.0.3 ([a056c13](https://github.com/Agentic-Insights/codebase-context-spec/commit/a056c13177a0f0162abf2a78f5c149b0ebc99c4b))
3030
* Bump version to 0.0.4 ([a223d1e](https://github.com/Agentic-Insights/codebase-context-spec/commit/a223d1ea4c0ae878293d38bad33e156ab2339c9c))
3131
* Bump version to 0.0.6 ([98a2d30](https://github.com/Agentic-Insights/codebase-context-spec/commit/98a2d305f24cd7b6558a9b4c4b167e765d9d2b96))
32-
* Expand AI Context Convention with role-specific sections ([b5a9197](https://github.com/Agentic-Insights/codebase-context-spec/commit/b5a9197d096101c425968008919dba45bc3a5f0f))
32+
* Expand Codebase Context Specification with role-specific sections ([b5a9197](https://github.com/Agentic-Insights/codebase-context-spec/commit/b5a9197d096101c425968008919dba45bc3a5f0f))
3333
* Implement markdown, YAML, and JSON file linting ([ba514f8](https://github.com/Agentic-Insights/codebase-context-spec/commit/ba514f8a651445c33c988f7d2d08365256a02f2b))
3434
* Improve README formatting and add icons ([f2a96d2](https://github.com/Agentic-Insights/codebase-context-spec/commit/f2a96d29bb28da224f7dc87524fe21c99c991ca4))
3535
* new specification for codebase context ([af17b2b](https://github.com/Agentic-Insights/codebase-context-spec/commit/af17b2be8ddfe045587ed4c1951437eceb79c119))

linters/typescript/PUBLISH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Publishing AI Context Convention Linter to npm
1+
# Publishing Codebase Context Specification Linter to npm
22

33
## Publish via semantic-release
44

linters/typescript/src/context_linter.ts

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,43 +59,56 @@ export class ContextLinter {
5959

6060
private async lintContextFile(filePath: string): Promise<void> {
6161
console.log(`\nLinting file: ${filePath}`);
62-
await lintFileIfExists(filePath, (fileContent) => {
62+
await lintFileIfExists(filePath, async (fileContent) => {
63+
let isValid = false;
6364
if (filePath.endsWith('.context.md')) {
64-
this.lintMarkdownFile(fileContent);
65+
isValid = await this.lintMarkdownFile(fileContent);
6566
} else if (filePath.endsWith('.context.yaml')) {
66-
this.lintYamlFile(fileContent);
67+
isValid = await this.lintYamlFile(fileContent);
6768
} else if (filePath.endsWith('.context.json')) {
68-
this.lintJsonFile(fileContent);
69+
isValid = await this.lintJsonFile(fileContent);
6970
}
71+
this.printValidationResult(isValid, filePath);
7072
});
7173
}
7274

73-
private lintMarkdownFile(content: string): void {
75+
private printValidationResult(isValid: boolean, filePath: string): void {
76+
const fileName = path.basename(filePath);
77+
if (isValid) {
78+
console.log(` ✅ ${fileName} passed validation`);
79+
} else {
80+
console.error(` ❌ ${fileName} failed validation`);
81+
}
82+
}
83+
84+
private async lintMarkdownFile(content: string): Promise<boolean> {
7485
console.log(' - Validating Markdown structure');
7586
console.log(' - Checking YAML frontmatter');
7687

7788
const parts = content.split('---\n');
7889
if (parts.length < 3) {
7990
console.error(' Error: Invalid markdown structure. YAML frontmatter is missing or incomplete.');
80-
return;
91+
return false;
8192
}
8293

8394
const frontmatter = parts[1];
8495
const markdownContent = parts.slice(2).join('---\n').trim();
8596

8697
try {
8798
const frontmatterData = yaml.load(frontmatter) as Record<string, unknown>;
88-
this.contextValidator.validateContextData(frontmatterData, 'markdown');
99+
await this.contextValidator.validateContextData(frontmatterData, 'markdown');
89100
} catch (error) {
90101
console.error(` Error parsing YAML frontmatter: ${error}`);
102+
return false;
91103
}
92104

93-
this.validateMarkdownContent(markdownContent);
105+
return this.validateMarkdownContent(markdownContent);
94106
}
95107

96-
private validateMarkdownContent(content: string): void {
108+
private validateMarkdownContent(content: string): boolean {
97109
const tokens = this.md.parse(content, {});
98110
let hasTitle = false;
111+
let isValid = true;
99112

100113
for (const token of tokens) {
101114
if (token.type === 'heading_open' && token.tag === 'h1' && !hasTitle) {
@@ -106,38 +119,47 @@ export class ContextLinter {
106119
const hrefToken = tokens[tokens.indexOf(token) + 1];
107120
if (hrefToken.type !== 'text' || !hrefToken.content.startsWith('http')) {
108121
console.error(' Warning: Link may be improperly formatted or using relative path.');
122+
isValid = false;
109123
}
110124
}
111125

112126
if (token.type === 'fence' && !token.info) {
113127
console.error(' Warning: Code block is missing language specification.');
128+
isValid = false;
114129
}
115130
}
116131

117132
if (!hasTitle) {
118133
console.error(' Error: Markdown content should start with a title (H1 heading).');
134+
isValid = false;
119135
}
136+
137+
return isValid;
120138
}
121139

122-
private lintYamlFile(content: string): void {
140+
private async lintYamlFile(content: string): Promise<boolean> {
123141
console.log(' - Validating YAML structure');
124142

125143
try {
126144
const yamlData = yaml.load(content) as Record<string, unknown>;
127-
this.contextValidator.validateContextData(yamlData, 'yaml');
145+
await this.contextValidator.validateContextData(yamlData, 'yaml');
146+
return true;
128147
} catch (error) {
129148
console.error(` Error parsing YAML file: ${error}`);
149+
return false;
130150
}
131151
}
132152

133-
private lintJsonFile(content: string): void {
153+
private async lintJsonFile(content: string): Promise<boolean> {
134154
console.log(' - Validating JSON structure');
135155

136156
try {
137157
const jsonData = JSON.parse(content) as Record<string, unknown>;
138-
this.contextValidator.validateContextData(jsonData, 'json');
158+
await this.contextValidator.validateContextData(jsonData, 'json');
159+
return true;
139160
} catch (error) {
140161
console.error(` Error parsing JSON file: ${error}`);
162+
return false;
141163
}
142164
}
143165
}

linters/typescript/src/utils/file_utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export async function fileExists(filePath: string): Promise<boolean> {
3333
export function printHeader(packageVersion: string, directoryPath: string): void {
3434
console.log(`
3535
========================================================
36-
AI Context Convention Linter (v${packageVersion})
36+
Codebase Context Specification (CCS) Linter (v${packageVersion})
3737
========================================================
3838
`);
3939
console.log(`Linting directory: ${directoryPath}\n`);

0 commit comments

Comments
 (0)