Skip to content

Commit b17d710

Browse files
Add support for copilot
1 parent 39e99ae commit b17d710

35 files changed

Lines changed: 1701 additions & 25 deletions

CLAUDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ src/aidocs_cli/
6363
### Key Components
6464

6565
- **CLI (cli.py)**: Uses Typer with Rich for terminal UI. Entry point is `app()`.
66-
- **Installer**: Copies command/workflow templates to target project's `.claude/` directory (or `.cursor/` for Cursor).
66+
- **Installer**: Copies command/workflow templates to target project's `.claude/` or `.cursor/` directory. For GitHub Copilot, installs skills to `~/.copilot/skills/` (global installation).
6767
- **Chunker**: Creates `.chunks.json` files alongside markdown, tracks changes via `docs/.chunks/manifest.json`.
6868
- **Coverage**: Analyzes codebase for routes/components/models, matches against docs, reports coverage with visual progress bars.
6969
- **Embeddings**: Calls OpenAI API (text-embedding-3-small, 1536 dimensions), outputs `docs/.chunks/sync.sql` for pgvector import.
@@ -72,7 +72,8 @@ src/aidocs_cli/
7272
### Slash Commands Flow
7373

7474
When `aidocs init` runs:
75-
1. Templates from `src/aidocs_cli/templates/` are copied to project's `.claude/commands/docs/` and `.claude/workflows/docs/`
75+
1. **For Claude/Cursor**: Templates from `src/aidocs_cli/templates/` are copied to project's `.claude/commands/docs/` and `.claude/workflows/docs/` (or `.cursor/` for Cursor)
76+
2. **For Copilot**: Skills from `src/aidocs_cli/copilot-templates/skills/` are copied to `~/.copilot/skills/` (global installation)
7677
2. Each command (e.g., `generate.md`) references a workflow that defines the multi-step process
7778
3. Workflows use Playwright MCP for browser automation when needed
7879

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,19 +180,22 @@ aidocs init . --force # Reinstall commands in project
180180
Initialize the docs module in a project.
181181

182182
```bash
183-
aidocs init . # Current directory
184-
aidocs init my-project # New directory
183+
aidocs init . # Current directory (Claude)
184+
aidocs init my-project # New directory (Claude)
185185
aidocs init . --force # Overwrite existing
186-
aidocs init . --ai cursor # Use with Cursor
186+
aidocs init . --ai cursor # Use with Cursor IDE
187+
aidocs init . --ai copilot # Use with GitHub Copilot (installs to ~/.copilot)
187188
```
188189

189190
**Options:**
190191
| Option | Description |
191192
|--------|-------------|
192-
| `--ai` | AI assistant: `claude`, `cursor`, `copilot` (default: `claude`) |
193+
| `--ai` | AI assistant: `claude` (project-local), `cursor` (project-local), `copilot` (global ~/.copilot) - default: `claude` |
193194
| `--force, -f` | Overwrite existing files |
194195
| `--no-git` | Skip git initialization |
195196

197+
**Note:** Copilot mode installs skills globally to `~/.copilot/skills/` instead of the project directory.
198+
196199
### `aidocs check`
197200

198201
Check for required tools and dependencies.

src/aidocs_cli/cli.py

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,16 @@ def init(
7676
"""Initialize docs module in a project.
7777
7878
Examples:
79-
aidocs init . # Current directory
80-
aidocs init my-project # New directory
81-
aidocs init . --force # Overwrite existing
79+
aidocs init . # Current directory (Claude)
80+
aidocs init my-project # New directory (Claude)
81+
aidocs init . --ai cursor # For Cursor IDE
82+
aidocs init . --ai copilot # For GitHub Copilot (installs to ~/.copilot)
83+
aidocs init . --force # Overwrite existing
8284
"""
83-
if project_name is None or project_name == ".":
85+
if ai == "copilot":
86+
# For copilot, target_dir is not used (installs to ~/.copilot)
87+
console.print(f"[blue]Installing Copilot skills to ~/.copilot...[/blue]")
88+
elif project_name is None or project_name == ".":
8489
target_dir = Path.cwd()
8590
console.print(f"[blue]Initializing docs module in current directory...[/blue]")
8691
else:
@@ -89,20 +94,39 @@ def init(
8994
target_dir.mkdir(parents=True)
9095
console.print(f"[blue]Created directory: {project_name}[/blue]")
9196
console.print(f"[blue]Initializing docs module in {project_name}...[/blue]")
97+
98+
# Set target_dir to current directory if not set (for copilot case)
99+
if 'target_dir' not in locals():
100+
target_dir = Path.cwd()
92101

93102
try:
94103
install_docs_module(target_dir, ai=ai, force=force, no_git=no_git)
95104

96105
console.print()
97-
console.print(Panel.fit(
98-
"[green]Docs module installed successfully![/green]\n\n"
99-
"[bold]Next steps:[/bold]\n"
100-
"1. Run [cyan]/docs:init[/cyan] in Claude Code to configure your project\n"
101-
"2. Run [cyan]/docs:generate <url>[/cyan] to document a page\n\n"
102-
"[dim]Requires Playwright MCP for browser automation.[/dim]",
103-
title="Success",
104-
border_style="green",
105-
))
106+
if ai == "copilot":
107+
console.print(Panel.fit(
108+
"[green]Copilot skills installed successfully![/green]\n\n"
109+
"[bold]Location:[/bold] ~/.copilot/skills/\n\n"
110+
"[bold]Available skills:[/bold]\n"
111+
"• /docs-generate - Generate documentation from URL\n"
112+
"• /docs-init - Initialize documentation structure\n"
113+
"• /docs-analyze - Analyze documentation coverage\n"
114+
"• /docs-flow - Document user flows\n"
115+
"• And more...\n\n"
116+
"[dim]Use these skills in GitHub Copilot CLI with / prefix[/dim]",
117+
title="Success",
118+
border_style="green",
119+
))
120+
else:
121+
console.print(Panel.fit(
122+
"[green]Docs module installed successfully![/green]\n\n"
123+
"[bold]Next steps:[/bold]\n"
124+
"1. Run [cyan]/docs:init[/cyan] in Claude Code to configure your project\n"
125+
"2. Run [cyan]/docs:generate <url>[/cyan] to document a page\n\n"
126+
"[dim]Requires Playwright MCP for browser automation.[/dim]",
127+
title="Success",
128+
border_style="green",
129+
))
106130
except Exception as e:
107131
console.print(f"[red]Error: {e}[/red]")
108132
raise typer.Exit(1)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
for file in *.skill.md; do
3+
name="${file%.skill.md}"
4+
mkdir -p "$name"
5+
6+
# Add YAML frontmatter and move content
7+
{
8+
echo "---"
9+
echo "name: $name"
10+
echo "description: |"
11+
# Extract first few lines as description
12+
head -10 "$file" | sed 's/^/ /'
13+
echo "tags: [documentation]"
14+
echo "---"
15+
echo ""
16+
cat "$file"
17+
} > "$name/SKILL.md"
18+
19+
echo "Created: $name/SKILL.md"
20+
done
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Documentation Analysis Skill
2+
3+
Analyze codebase for documentation coverage and specific routes/components.
4+
5+
## What this skill does:
6+
7+
1. Analyzes existing documentation coverage
8+
2. Identifies undocumented code areas
9+
3. Performs pure code analysis without requiring browser
10+
4. Analyzes specific routes or components on request
11+
12+
## Instructions:
13+
14+
Load and execute the workflow from: `.copilot/workflows/docs/analyze/workflow.md` in the project repository.
15+
16+
Follow the workflow instructions exactly as specified in that file.
17+
18+
## Usage Patterns:
19+
20+
The user might say:
21+
- "analyze documentation coverage"
22+
- "check what's documented"
23+
- "analyze the campaigns route"
24+
- "analyze this component"
25+
26+
## Arguments:
27+
28+
```
29+
analyze <route>
30+
analyze --codebase ./src
31+
analyze app/Http/Controllers/CampaignController.php
32+
```
33+
34+
## Output:
35+
36+
- Coverage statistics
37+
- List of undocumented areas
38+
- Suggestions for improvement
39+
- Priority recommendations
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
name: docs:analyze
3+
description: |
4+
# Documentation Analysis Skill
5+
6+
Analyze codebase for documentation coverage and specific routes/components.
7+
8+
## What this skill does:
9+
10+
1. Analyzes existing documentation coverage
11+
2. Identifies undocumented code areas
12+
3. Performs pure code analysis without requiring browser
13+
4. Analyzes specific routes or components on request
14+
tags: [documentation]
15+
---
16+
17+
# Documentation Analysis Skill
18+
19+
Analyze codebase for documentation coverage and specific routes/components.
20+
21+
## What this skill does:
22+
23+
1. Analyzes existing documentation coverage
24+
2. Identifies undocumented code areas
25+
3. Performs pure code analysis without requiring browser
26+
4. Analyzes specific routes or components on request
27+
28+
## Instructions:
29+
30+
Load and execute the workflow from: `.copilot/workflows/docs/analyze/workflow.md` in the project repository.
31+
32+
Follow the workflow instructions exactly as specified in that file.
33+
34+
## Usage Patterns:
35+
36+
The user might say:
37+
- "analyze documentation coverage"
38+
- "check what's documented"
39+
- "analyze the campaigns route"
40+
- "analyze this component"
41+
42+
## Arguments:
43+
44+
```
45+
analyze <route>
46+
analyze --codebase ./src
47+
analyze app/Http/Controllers/CampaignController.php
48+
```
49+
50+
## Output:
51+
52+
- Coverage statistics
53+
- List of undocumented areas
54+
- Suggestions for improvement
55+
- Priority recommendations
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Documentation Batch Processing Skill
2+
3+
Generate documentation for multiple pages from a list.
4+
5+
## What this skill does:
6+
7+
1. Batch processes multiple URLs or files
8+
2. Generates documentation for all items in the list
9+
3. Handles authentication if needed
10+
4. Organizes output systematically
11+
12+
## Instructions:
13+
14+
Load and execute the workflow from: `.copilot/workflows/docs/batch/workflow.md` in the project repository.
15+
16+
Follow the workflow instructions exactly as specified in that file.
17+
18+
## Usage Patterns:
19+
20+
The user might say:
21+
- "batch document these pages"
22+
- "generate docs for all these URLs"
23+
- "document multiple pages at once"
24+
- "batch process this list"
25+
26+
## Arguments:
27+
28+
```
29+
batch <urls-file-or-list>
30+
batch urls.txt --auth user:pass
31+
batch --output ./docs
32+
```
33+
34+
## Input Format:
35+
36+
Can accept:
37+
- File containing URLs (one per line)
38+
- Comma-separated list of URLs
39+
- JSON array of URLs
40+
41+
## Output:
42+
43+
- Documentation for each URL/file
44+
- Summary report
45+
- Progress tracking
46+
- Error reporting for failed items
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
name: docs:batch
3+
description: |
4+
# Documentation Batch Processing Skill
5+
6+
Generate documentation for multiple pages from a list.
7+
8+
## What this skill does:
9+
10+
1. Batch processes multiple URLs or files
11+
2. Generates documentation for all items in the list
12+
3. Handles authentication if needed
13+
4. Organizes output systematically
14+
tags: [documentation]
15+
---
16+
17+
# Documentation Batch Processing Skill
18+
19+
Generate documentation for multiple pages from a list.
20+
21+
## What this skill does:
22+
23+
1. Batch processes multiple URLs or files
24+
2. Generates documentation for all items in the list
25+
3. Handles authentication if needed
26+
4. Organizes output systematically
27+
28+
## Instructions:
29+
30+
Load and execute the workflow from: `.copilot/workflows/docs/batch/workflow.md` in the project repository.
31+
32+
Follow the workflow instructions exactly as specified in that file.
33+
34+
## Usage Patterns:
35+
36+
The user might say:
37+
- "batch document these pages"
38+
- "generate docs for all these URLs"
39+
- "document multiple pages at once"
40+
- "batch process this list"
41+
42+
## Arguments:
43+
44+
```
45+
batch <urls-file-or-list>
46+
batch urls.txt --auth user:pass
47+
batch --output ./docs
48+
```
49+
50+
## Input Format:
51+
52+
Can accept:
53+
- File containing URLs (one per line)
54+
- Comma-separated list of URLs
55+
- JSON array of URLs
56+
57+
## Output:
58+
59+
- Documentation for each URL/file
60+
- Summary report
61+
- Progress tracking
62+
- Error reporting for failed items
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Documentation Discovery Skill
2+
3+
Scan and discover all modules and structure in the JobMatix-API codebase.
4+
5+
## What this skill does:
6+
7+
1. Scans backend for models, controllers, routes
8+
2. Scans frontend for pages, components
9+
3. Identifies relationships between modules
10+
4. Saves analysis to `docs/.knowledge/` directory
11+
12+
## Instructions:
13+
14+
Load and execute the workflow from: `.copilot/workflows/docs/discover/workflow.md` in the project repository.
15+
16+
Follow the workflow instructions exactly as specified in that file.
17+
18+
## Usage Patterns:
19+
20+
The user might say:
21+
- "discover all modules"
22+
- "scan the codebase"
23+
- "map out the application structure"
24+
- "analyze the project structure"
25+
26+
## Output Structure:
27+
28+
Creates the following in `docs/.knowledge/`:
29+
```
30+
docs/.knowledge/
31+
├── _meta/
32+
│ ├── project.json
33+
│ └── modules-index.json
34+
└── modules/
35+
├── {module-name}/
36+
│ ├── entity.json
37+
│ ├── routes.json
38+
│ ├── components.json
39+
│ └── flows/
40+
```
41+
42+
## Next Steps:
43+
44+
After discovery, suggest running:
45+
- `/docs:plan` to create documentation plan
46+
- `/docs:generate` to generate docs for specific modules

0 commit comments

Comments
 (0)