Skip to content

Commit 943a7b7

Browse files
authored
feat: Add .contextignore support and normalize linter output
2 parents 15c1e4d + a166724 commit 943a7b7

File tree

12 files changed

+651
-251
lines changed

12 files changed

+651
-251
lines changed

CODEBASE-CONTEXT.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -371,33 +371,27 @@ src/deprecated-module.js
371371

372372
**Warning:** Tooling may be required for proper implementation of `.contextignore`. AI agents may not consistently or easily use `.contextignore` as strictly as dedicated tooling can. Your mileage may vary (YMMV) depending on the AI model used.
373373

374-
## 7. Security Considerations
375-
376-
1. Avoid including sensitive information (API keys, passwords) in context files.
377-
2. Be cautious with proprietary algorithms or trade secrets.
378-
3. Use `.gitignore` to exclude sensitive context files from version control if necessary.
379-
380-
## 8. The .contextdocs File
374+
## 7. The .contextdocs File
381375

382376
The `.contextdocs` file allows developers to specify external documentation sources that should be incorporated into the project's context. This feature is particularly useful for including documentation from dependencies, libraries, or related projects.
383377

384-
### 8.1 Location and Naming
378+
### 7.1 Location and Naming
385379

386380
- The `.contextdocs` file should be placed in the root directory of the project.
387381
- It must use one of the following extensions:
388382
- `.contextdocs.md` (default, recommended)
389383
- `.contextdocs.yaml` or `.contextdocs.yml`
390384
- `.contextdocs.json`
391385

392-
### 8.2 File Structure
386+
### 7.2 File Structure
393387

394388
The `.contextdocs` file should contain an array of documentation sources. Each source can be:
395389

396390
- A file path relative to the project root
397391
- A URL to a markdown file
398392
- A package name with associated documentation files
399393

400-
### 8.3 Examples
394+
### 7.3 Examples
401395

402396
#### Markdown Format (.contextdocs.md) - Default
403397

@@ -511,7 +505,7 @@ contextdocs:
511505
}
512506
```
513507

514-
### 8.4 Behavior
508+
### 7.4 Behavior
515509

516510
- When an AI model or related tool is processing the project context, it should fetch and incorporate the specified documentation.
517511
- For local files, the content should be read from the specified path.
@@ -520,24 +514,24 @@ contextdocs:
520514

521515
**Warning:** Tooling may be required for proper implementation of `.contextdocs`. AI agents may not consistently or easily use `.contextdocs` as strictly as dedicated tooling can. Your mileage may vary (YMMV) depending on the AI model used.
522516

523-
### 8.5 Use Cases
517+
### 7.5 Use Cases
524518

525519
- Including documentation for key dependencies
526520
- Referencing company-wide coding standards or guidelines
527521
- Incorporating design documents or architectural overviews
528522
- Linking to relevant external resources or tutorials
529523

530-
### 8.6 Considerations
524+
### 7.6 Considerations
531525

532526
- Ensure that URLs point to stable, version-controlled documentation to maintain consistency.
533527
- Be mindful of the total volume of documentation to avoid overwhelming the AI model with irrelevant information.
534528
- Regularly review and update the `.contextdocs` file to ensure all referenced documentation remains relevant and up-to-date.
535529
- Consider implementing caching mechanisms for external documentation to improve performance and reduce network requests.
536530

537-
## 9. Conclusion
531+
## 8. Conclusion
538532

539533
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.
540534

541-
## 10. TypeScript Linter Implementation
535+
## 9. TypeScript Linter Implementation
542536

543537
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).

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ Welcome to the [Codebase Context Specification (CCS)](./CODEBASE-CONTEXT.md) rep
1717
- [Context File Example (.context.md)](.context.md)
1818
- [AI Assistant Prompt (CODING-ASSISTANT-PROMPT.md)](CODING-ASSISTANT-PROMPT.md)
1919

20+
## Supported Node.js Versions
21+
22+
This project supports the following Node.js versions:
23+
24+
- Node.js 18.x
25+
- Node.js 20.x
26+
- Node.js 22.x
27+
28+
We recommend using the latest LTS (Long Term Support) version of Node.js for optimal performance and security.
29+
2030
## Codebase Context: A New Convention
2131

2232
The Codebase Context Specification introduces a convention similar to `.env` and `.editorconfig` systems, but focused on documenting your code for both AI and humans. Just as `.env` files manage environment variables and `.editorconfig` ensures consistent coding styles, CCS files (`.context.md`, `.context.yaml`, `.context.json`) provide a standardized way to capture and communicate the context of your codebase.
@@ -46,8 +56,14 @@ To install the linter:
4656
npm install -g codebase-context-lint
4757
```
4858

59+
Note: Make sure you're using a supported Node.js version (18.x, 20.x, or 22.x) when installing and running the linter.
60+
4961
For more information on using the linter, please refer to the [linter's README](./linters/typescript/README.md).
5062

63+
## Recent Updates
64+
65+
We've recently updated our dependencies to address security vulnerabilities and improve compatibility with different Node.js versions. If you encounter any issues after updating, please report them in our GitHub issues.
66+
5167
## Using with AI Assistants
5268

5369
The [CODING-ASSISTANT-PROMPT.md](./CODING-ASSISTANT-PROMPT.md) file provides guidelines for AI assistants to understand and use the Codebase Context Specification. This allows for immediate adoption of the specification without requiring specific tooling integration.

examples/context-editor/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18.0.0 || 20.0.0 || 22.0.0

examples/context-editor/sample.context.md

Lines changed: 0 additions & 38 deletions
This file was deleted.

linters/typescript/README.md

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,26 @@ By adopting this convention, teams can ensure that both human developers and AI
3535

3636
For more detailed information about the Codebase Context Specification, please refer to the [main repository](https://github.com/Agentic-Insights/codebase-context-spec) and the [full specification](https://github.com/Agentic-Insights/codebase-context-spec/blob/main/CODEBASE-CONTEXT.md).
3737

38-
## 📦 Installation
38+
## � Supported Node.js Versions
39+
40+
This linter supports the following Node.js versions:
41+
42+
- Node.js 18.x
43+
- Node.js 20.x
44+
- Node.js 22.x
45+
46+
We recommend using the latest LTS (Long Term Support) version of Node.js for optimal performance and security.
47+
48+
## �📦 Installation
3949

4050
You can install the linter globally using npm:
4151

4252
```
4353
npm install -g codebase-context-lint
4454
```
4555

56+
Note: Make sure you're using a supported Node.js version (18.x, 20.x, or 22.x) when installing and running the linter.
57+
4658
## 🚀 Usage
4759

4860
After installation, you can use the linter from the command line:
@@ -58,9 +70,37 @@ Replace `<directory_to_lint>` with the path to the directory containing your Cod
5870
- 🔍 Validates the structure and content of `.context.md`, `.context.yaml`, and `.context.json` files
5971
- ✅ Checks for required fields and sections
6072
- 📄 Verifies the format of `.contextdocs.md` files
61-
- 🚫 Validates ignore patterns in `.contextignore` files
73+
- 🚫 Supports and validates `.contextignore` files for excluding specific files or directories
6274
- 💬 Provides detailed error messages and warnings
6375

76+
## 📁 .contextignore Files
77+
78+
`.contextignore` files allow you to specify patterns for files and directories that should be ignored by the Codebase Context Lint. This is useful for excluding generated files, dependencies, or any other content that doesn't need context documentation.
79+
80+
### How to use .contextignore
81+
82+
1. Create a file named `.contextignore` in any directory of your project.
83+
2. Add patterns to the file, one per line. These patterns follow the same rules as `.gitignore` files.
84+
3. The linter will respect these ignore patterns when processing files in that directory and its subdirectories.
85+
86+
Example `.contextignore` file:
87+
88+
```
89+
# Ignore node_modules directory
90+
node_modules/
91+
92+
# Ignore all .log files
93+
*.log
94+
95+
# Ignore a specific file
96+
path/to/specific/file.js
97+
98+
# Ignore all files in a specific directory
99+
path/to/ignore/*
100+
```
101+
102+
The linter will validate the syntax of your `.contextignore` files and warn about any problematic patterns, such as attempting to ignore critical context files.
103+
64104
## 🤖 Using with AI Assistants
65105

66106
While this linter provides automated validation of CCS files, you can also use the Codebase Context Specification with AI assistants without any specific tooling. The [CODING-ASSISTANT-PROMPT.md](https://github.com/Agentic-Insights/codebase-context-spec/blob/main/CODING-ASSISTANT-PROMPT.md) file in the main repository provides guidelines for AI assistants to understand and use the Codebase Context Specification.
@@ -71,7 +111,7 @@ To use the Codebase Context Specification with an AI assistant:
71111
2. Ask the AI to analyze your project's context files based on these guidelines.
72112
3. The AI will be able to provide more accurate and context-aware responses by following the instructions in the prompt.
73113

74-
Note that while this approach allows for immediate use of the specification, some features like .contextignore should eventually be applied by tooling (such as this linter) for more robust implementation.
114+
Note that while this approach allows for immediate use of the specification, some features like .contextignore are best implemented by tooling (such as this linter) for more robust and consistent application.
75115

76116
## 🛠️ Development
77117

@@ -104,11 +144,15 @@ To contribute to this project:
104144
7. Push to the branch (`git push origin feature/AmazingFeature`)
105145
8. Open a Pull Request
106146

107-
## � Learn More
147+
## 🔄 Recent Updates
148+
149+
We've recently updated our dependencies to address security vulnerabilities and improve compatibility with different Node.js versions. If you encounter any issues after updating, please report them in our GitHub issues.
150+
151+
## 📖 Learn More
108152

109153
For a deeper dive into the Codebase Context Specification, check out this [SubStack article by Vaskin](https://agenticinsights.substack.com/p/codebase-context-specification-rfc), the author of the specification.
110154

111-
## 📄 License
155+
## 📄 License
112156

113157
This project is licensed under the MIT License.
114158

0 commit comments

Comments
 (0)