|
1 | 1 | # AI Context Convention TypeScript Linter
|
2 | 2 |
|
3 |
| -This is a TypeScript implementation of the linter for validating AI Context Convention files. |
| 3 | +This is a TypeScript-based CLI linter for validating AI Context Convention files, including `.context.md`, `.context.yaml`, `.context.json`, `.contextdocs.md`, and `.contextignore` files. |
4 | 4 |
|
5 | 5 | ## Installation
|
6 | 6 |
|
7 |
| -1. Ensure you have Node.js (v14+) and npm installed. |
8 |
| -2. Clone the entire repository: |
9 |
| - ``` |
10 |
| - git clone https://github.com/your-repo/ai-context-convention.git |
11 |
| - ``` |
12 |
| -3. Navigate to the `linters/typescript` directory: |
13 |
| - ``` |
14 |
| - cd ai-context-convention/linters/typescript |
15 |
| - ``` |
16 |
| -4. Run `npm install` to install the dependencies. |
17 |
| - |
18 |
| -## Usage |
19 |
| - |
20 |
| -To use the TypeScript linter: |
21 |
| - |
22 |
| -1. Build the TypeScript code: |
23 |
| - ``` |
24 |
| - npm run build |
25 |
| - ``` |
26 |
| - |
27 |
| -2. Run the linter on a directory: |
28 |
| - ``` |
29 |
| - npm run lint <directory_to_lint> |
30 |
| - ``` |
31 |
| - |
32 |
| - Replace `<directory_to_lint>` with the path to the directory containing the context files you want to lint. |
33 |
| - |
34 |
| - Note: You can use relative paths. For example, to lint the parent directory: |
35 |
| - ``` |
36 |
| - npm run lint ../.. |
37 |
| - ``` |
38 |
| - |
39 |
| -## Example Output |
40 |
| - |
41 |
| -When you run the linter, you'll see output similar to this: |
| 7 | +You can install the linter globally using npm: |
42 | 8 |
|
43 | 9 | ```
|
44 |
| -======================================================== |
45 |
| -AI Context Convention TypeScript Linter (v1.0.0) |
46 |
| -======================================================== |
| 10 | +npm install -g ai-context-convention-linter |
| 11 | +``` |
47 | 12 |
|
48 |
| -Linting directory: ../.. |
| 13 | +## Usage |
49 | 14 |
|
50 |
| -Linting file: .context.md |
51 |
| - - Validating Markdown structure |
52 |
| - - Checking YAML frontmatter |
53 |
| - - Verifying content against AI Context Convention Specification |
| 15 | +After installation, you can use the linter from the command line: |
54 | 16 |
|
55 |
| -Linting completed. |
| 17 | +``` |
| 18 | +ai-context-lint <directory_to_lint> |
56 | 19 | ```
|
57 | 20 |
|
58 |
| -## Features |
| 21 | +Replace `<directory_to_lint>` with the path to the directory containing your AI Context Convention files. |
59 | 22 |
|
60 |
| -The TypeScript linter performs the following checks: |
| 23 | +## Features |
61 | 24 |
|
62 |
| -- Identifies and processes .context.md, .context.yaml, and .context.json files |
63 |
| -- Validates the structure of context files |
64 |
| -- Ensures required fields are present |
65 |
| -- Checks for proper YAML frontmatter in Markdown files |
66 |
| -- Verifies the content adheres to the AI Context Convention Specification |
| 25 | +- Validates the structure and content of `.context.md`, `.context.yaml`, and `.context.json` files |
| 26 | +- Checks for required fields and sections |
| 27 | +- Verifies the format of `.contextdocs.md` files |
| 28 | +- Validates ignore patterns in `.contextignore` files |
| 29 | +- Provides detailed error messages and warnings |
67 | 30 |
|
68 | 31 | ## Development
|
69 | 32 |
|
70 |
| -To contribute to the development of this linter: |
| 33 | +To contribute to this project: |
71 | 34 |
|
72 |
| -1. Make your changes in the `typescript_linter.ts` file. |
73 |
| -2. Build the TypeScript code: |
| 35 | +1. Clone the repository: |
74 | 36 | ```
|
75 |
| - npm run build |
| 37 | + git clone https://github.com/your-repo/ai-context-convention-typescript-linter.git |
| 38 | + cd ai-context-convention-typescript-linter |
76 | 39 | ```
|
77 |
| -3. Test your changes by running the linter on sample files. |
78 | 40 |
|
79 |
| -Note: The `dist` directory, which contains the compiled JavaScript files, is ignored by git. Make sure to rebuild the project after making changes. |
| 41 | +2. Install dependencies: |
| 42 | + ``` |
| 43 | + npm install |
| 44 | + ``` |
80 | 45 |
|
81 |
| -## Contributing |
| 46 | +3. Build the project: |
| 47 | + ``` |
| 48 | + npm run build |
| 49 | + ``` |
82 | 50 |
|
83 |
| -When working on the TypeScript linter: |
| 51 | +4. To test the CLI locally, you can use: |
| 52 | + ``` |
| 53 | + npm link |
| 54 | + ``` |
| 55 | + This will create a symlink to your local development version of the package. |
84 | 56 |
|
85 |
| -1. Follow TypeScript best practices and coding conventions. |
86 |
| -2. Use strict mode and appropriate type annotations. |
87 |
| -3. Write unit tests for new functionality. |
88 |
| -4. Keep the linter consistent with other language implementations. |
89 |
| -5. Update comments and documentation as necessary. |
| 57 | +5. Create your feature branch (`git checkout -b feature/AmazingFeature`) |
| 58 | +6. Commit your changes (`git commit -m 'Add some AmazingFeature'`) |
| 59 | +7. Push to the branch (`git push origin feature/AmazingFeature`) |
| 60 | +8. Open a Pull Request |
90 | 61 |
|
91 |
| -Refer to the main README.md in the project root for the full AI Context Convention Specification and contribution guidelines. |
| 62 | +## Publishing to npm |
92 | 63 |
|
93 |
| -## Troubleshooting |
| 64 | +To publish the package to npm: |
94 | 65 |
|
95 |
| -If you encounter any issues: |
| 66 | +1. Make sure you have an npm account and are logged in: |
| 67 | + ``` |
| 68 | + npm login |
| 69 | + ``` |
96 | 70 |
|
97 |
| -1. Ensure you've run `npm install` to install all dependencies. |
98 |
| -2. Make sure you've built the project using `npm run build` before running the linter. |
99 |
| -3. Check that you're in the correct directory (`linters/typescript`) when running npm commands. |
100 |
| -4. If you see "unknown" as the version number, it means the linter couldn't read the package.json file. This doesn't affect functionality but you may want to check file permissions. |
| 71 | +2. Update the version in `package.json`: |
| 72 | + ``` |
| 73 | + npm version patch # for bug fixes |
| 74 | + npm version minor # for new features |
| 75 | + npm version major # for breaking changes |
| 76 | + ``` |
101 | 77 |
|
102 |
| -## License |
| 78 | +3. Publish the package: |
| 79 | + ``` |
| 80 | + npm publish |
| 81 | + ``` |
103 | 82 |
|
104 |
| -This project is licensed under the ISC License. |
| 83 | +Note: Make sure you have the necessary permissions to publish to the npm registry under the chosen package name. |
105 | 84 |
|
106 |
| -## Future Enhancements |
| 85 | +## License |
107 | 86 |
|
108 |
| -- Integration with VSCode extension for in-editor linting |
109 |
| -- More detailed error reporting and suggestions for fixing issues |
110 |
| -- Configuration options for customizing linting rules |
111 |
| -- Support for custom file extensions and naming conventions |
| 87 | +This project is licensed under the ISC License. |
0 commit comments