Skip to content

Commit 5559eeb

Browse files
committed
chore: update README.md file
1 parent b2b3fef commit 5559eeb

File tree

1 file changed

+95
-6
lines changed

1 file changed

+95
-6
lines changed

README.md

Lines changed: 95 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
1616
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
17+
1718
**Table of Contents**
1819

1920
- [Features](#features)
@@ -41,16 +42,18 @@
4142
## Features
4243

4344
### CodeOwners
45+
4446
- **Advanced Parsing**: Parse CODEOWNERS files recursively across directory structures
45-
- **Ownership Analysis**: Analyze file ownership patterns and generate detailed reports
46-
- **Tag Support**: Organize and query files using custom tags in CODEOWNERS
47-
- **High Performance**: Efficient caching and parallel processing for large repositories
48-
- **Flexible Filtering**: Filter files by owners, tags, or ownership status
49-
- **Multiple Output Formats**: Support for text, JSON, and binary output formats
47+
- **Ownership Analysis**: Analyze file ownership patterns and generate detailed reports
48+
- **Tag Support**: Organize and query files using custom tags in CODEOWNERS
49+
- **High Performance**: Efficient caching and parallel processing for large repositories
50+
- **Flexible Filtering**: Filter files by owners, tags, or ownership status
51+
- **Multiple Output Formats**: Support for text, JSON, and binary output formats
5052

5153
## Installation
5254

5355
### From Release
56+
5457
Binaries coming soon...
5558

5659
### From Cargo
@@ -62,6 +65,7 @@ cargo install ci
6265
```
6366

6467
### From Source
68+
6569
```bash
6670
git clone https://github.com/CodeInputCorp/cli.git
6771
cd cli
@@ -72,16 +76,19 @@ sudo cp target/release/ci /usr/local/bin/
7276
## Quick Start
7377

7478
1. **Parse your CODEOWNERS files** to build the cache:
79+
7580
```bash
7681
ci codeowners parse
7782
```
7883

7984
2. **List all files with their owners**:
85+
8086
```bash
8187
ci codeowners list-files
8288
```
8389

8490
3. **Find files owned by a specific team**:
91+
8592
```bash
8693
ci codeowners list-files --owners @frontend-team
8794
```
@@ -104,10 +111,12 @@ ci codeowners parse [PATH] [OPTIONS]
104111
```
105112

106113
**Options:**
114+
107115
- `--cache-file <FILE>`: Custom cache file location (default: `.codeowners.cache`)
108116
- `--format <FORMAT>`: Cache format - `bincode` or `json` (default: `bincode`)
109117

110118
**Examples:**
119+
111120
```bash
112121
# Parse current directory
113122
ci codeowners parse
@@ -128,13 +137,15 @@ ci codeowners list-files [PATH] [OPTIONS]
128137
```
129138

130139
**Options:**
140+
131141
- `--tags <LIST>`: Filter by tags (comma-separated)
132142
- `--owners <LIST>`: Filter by owners (comma-separated)
133143
- `--unowned`: Show only unowned files
134144
- `--show-all`: Show all files including unowned/untagged
135145
- `--format <FORMAT>`: Output format - `text`, `json`, or `bincode`
136146

137147
**Examples:**
148+
138149
```bash
139150
# List all owned files
140151
ci codeowners list-files
@@ -161,9 +172,11 @@ ci codeowners list-owners [PATH] [OPTIONS]
161172
```
162173

163174
**Options:**
175+
164176
- `--format <FORMAT>`: Output format - `text`, `json`, or `bincode`
165177

166178
**Examples:**
179+
167180
```bash
168181
# Show all owners with file counts
169182
ci codeowners list-owners
@@ -181,9 +194,11 @@ ci codeowners list-tags [PATH] [OPTIONS]
181194
```
182195

183196
**Options:**
197+
184198
- `--format <FORMAT>`: Output format - `text`, `json`, or `bincode`
185199

186200
**Examples:**
201+
187202
```bash
188203
# Show all tags with usage statistics
189204
ci codeowners list-tags
@@ -201,10 +216,12 @@ ci codeowners inspect <FILE_PATH> [OPTIONS]
201216
```
202217

203218
**Options:**
219+
204220
- `--repo <PATH>`: Repository path (default: current directory)
205221
- `--format <FORMAT>`: Output format - `text`, `json`, or `bincode`
206222

207223
**Examples:**
224+
208225
```bash
209226
# Inspect a specific file
210227
ci codeowners inspect src/main.rs
@@ -241,7 +258,11 @@ ci completion fish > ~/.config/fish/completions/codeinput.fish
241258

242259
## CODEOWNERS Format
243260

244-
The tool supports standard CODEOWNERS syntax with additional tag support:
261+
The tool supports two approaches for defining code ownership:
262+
263+
### 1. Traditional CODEOWNERS Files
264+
265+
Standard CODEOWNERS syntax with additional tag support:
245266

246267
```
247268
# Standard ownership
@@ -259,15 +280,83 @@ The tool supports standard CODEOWNERS syntax with additional tag support:
259280
* @default-team #general
260281
```
261282

283+
**Pattern Matching Rules:**
284+
285+
- `/path/to/dir/` - Matches all files and subdirectories recursively (GitHub compatible)
286+
- `/path/to/dir/*` - Matches direct files in the directory only
287+
- `/path/to/dir/**` - Matches all files and subdirectories recursively (explicit)
288+
- `*.ext` - Matches files with specific extension
289+
- `pattern` - Relative path matching
290+
291+
**Priority Rules:**
292+
293+
1. **Closest CODEOWNERS file**: Files in subdirectories take precedence over parent directories
294+
2. **Last match wins**: Later entries in the same CODEOWNERS file override earlier ones
295+
3. **Inline declarations**: Per-file inline ownership
296+
297+
### 2. Inline Per-File Ownership
298+
299+
For fine-grained control, declare ownership directly within individual files using the `!!!CODEOWNERS` marker:
300+
301+
**Rust Example:**
302+
303+
```rust
304+
// !!!CODEOWNERS @security-team @alice #security #critical
305+
use std::crypto;
306+
307+
fn encrypt_data() {
308+
// sensitive crypto code
309+
}
310+
```
311+
312+
**JavaScript/TypeScript Example:**
313+
314+
```javascript
315+
// !!!CODEOWNERS @frontend-team #ui #components
316+
export const Button = () => {
317+
return <button>Click me</button>;
318+
};
319+
```
320+
321+
**HTML Example:**
322+
323+
```html
324+
<!-- !!!CODEOWNERS @design-team #ui #templates -->
325+
<div class="hero-section">
326+
<h1>Welcome</h1>
327+
</div>
328+
```
329+
330+
**CSS Example:**
331+
332+
```css
333+
/* !!!CODEOWNERS @design-team #styles #branding */
334+
.brand-colors {
335+
--primary: #007bff;
336+
--secondary: #6c757d;
337+
}
338+
```
339+
340+
**Inline Format Rules:**
341+
342+
- Must appear within the first 50 lines of the file
343+
- Can be used in any comment style (`//`, `#`, `/**/`, `<!-- -->`)
344+
- Takes highest priority over all CODEOWNERS file patterns
345+
- Supports same owner and tag syntax as CODEOWNERS files
346+
- Only one inline declaration per file (first one found is used)
347+
262348
**Supported Owner Types:**
349+
263350
- **Users**: `@username`
264351
- **Teams**: `@org/team-name`
265352
- **Email**: `user@example.com`
266353

267354
**Tag Format:**
355+
268356
- Tags start with `#` and appear after owners
269357
- Multiple tags are supported: `#tag1 #tag2 #tag3`
270358
- Tags can contain letters, numbers, hyphens, and underscores
359+
- Comments after tags are ignored (e.g., `#tag1 # this is a comment`)
271360

272361
## How to Contribute
273362

0 commit comments

Comments
 (0)