feat: add official Qodo skills and codebase intelligence (#428)

This commit is contained in:
Guy Vago
2026-02-23 23:34:24 +02:00
committed by GitHub
parent 226b520131
commit 1ff1fd6bc7
7 changed files with 879 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
# Formatting and Outputting Rules
## Output Structure
Print the following header:
```
# 📋 Qodo Rules Loaded
Scope: `{QUERY_SCOPE}`
Rules loaded: **{TOTAL_RULES}** (universal, org level, repo level, and path level rules)
These rules must be applied during code generation based on severity:
```
## Grouping by Severity
Group rules into three sections and print each non-empty section:
**ERROR** (`severity == "error"`):
```
## ❌ ERROR Rules (Must Comply) - {count}
- **{name}** ({category}): {description}
```
**WARNING** (`severity == "warning"`):
```
## ⚠️ WARNING Rules (Should Comply) - {count}
- **{name}** ({category}): {description}
```
**RECOMMENDATION** (`severity == "recommendation"`):
```
## 💡 RECOMMENDATION Rules (Consider) - {count}
- **{name}** ({category}): {description}
```
End output with `---`.

View File

@@ -0,0 +1,33 @@
# Fetching Rules with Pagination
The API returns rules in pages of 50. All pages must be fetched to ensure no rules are missed.
## Algorithm
1. Start with `page=1`, `page_size=50`, accumulate results in an empty list
2. Request: `GET {API_URL}/rules?scopes={ENCODED_SCOPE}&state=active&page={PAGE}&page_size=50`
- Header: `Authorization: Bearer {API_KEY}`
3. On non-200 response, handle the error and exit gracefully:
- `401` — invalid/expired API key
- `403` — access forbidden
- `404` — endpoint not found (check `QODO_ENVIRONMENT_NAME`)
- `429` — rate limit exceeded
- `5xx` — API temporarily unavailable
- connection error — check internet connection
4. Parse `rules` array from JSON response body
5. Append page rules to accumulated list
6. If rules returned on this page < 50 → last page, stop
7. Otherwise increment page and repeat from step 2
8. Safety limit: stop after 100 pages (5000 rules max)
## API URL
Construct `{API_URL}` from `ENVIRONMENT_NAME` (read from `~/.qodo/config.json`):
| `ENVIRONMENT_NAME` | `{API_URL}` |
|---|---|
| set (e.g. `staging`) | `https://qodo-platform.staging.qodo.ai/rules/v1` |
## After Fetching
If total rules == 0, inform the user no rules are configured for the repository scope and exit gracefully.

View File

@@ -0,0 +1,26 @@
# Repository Scope Detection
## Extracting Repository Scope from Git Remote URL
Parse the `origin` remote URL to derive the scope path. Both URL formats are supported:
- SSH: `git@github.com:org/repo.git``/org/repo/`
- HTTPS: `https://github.com/org/repo.git``/org/repo/`
If no remote is found, exit silently. If the URL cannot be parsed, inform the user and exit gracefully.
## Module-Level Scope Detection
If the current working directory is inside a `modules/*` subdirectory relative to the repository root, use it as the query scope:
- `modules/rules/src/service.py` → query scope: `/org/repo/modules/rules/`
- repository root or any other path → query scope: `/org/repo/`
## Scope Hierarchy
The API returns all rules matching the query scope via prefix matching:
| Query scope | Rules returned |
|---|---|
| `/org/repo/modules/rules/` | universal + org + repo + path-level rules |
| `/org/repo/` | universal + org + repo-level rules |