๐ Gittxt API Plugin¶
The Gittxt API Plugin exposes a RESTful interface for programmatic scanning and artifact retrieval. It's ideal for integrating Gittxt functionality into frontend dashboards, automation workflows, or other dev tools.
๐ Quick Start¶
Run the API server:
gittxt plugin run gittxt-api
Once running, visit Swagger UI:
http://localhost:8000/docs
๐ Route Prefix¶
All endpoints are available under:
/v1/
POST /v1/scan
๐ง Key Features¶
- Versioned REST API (
/v1/...
) - Full scan options:
docs_only
,lite
,create_zip
,tree_depth
,skip_tree
- Glob-based
include_patterns
,exclude_patterns
,exclude_dirs
- Support for scanning uploaded ZIP files
- Summary JSON, downloadable artifacts, structured cleanup
- Built-in CORS support (for frontend integration)
๐ฅ Upload & Scan¶
Use the /v1/upload
endpoint to scan compressed .zip
archives:
Request
POST /v1/upload?lite=true
Content-Type: multipart/form-data
.zip
file with your repo.
Response
{
"status": "success",
"message": "Upload & scan completed",
"data": {
"scan_id": "...",
"repo_name": "...",
"num_textual_files": 14,
"num_non_textual_files": 3
}
}
๐ก Full Scan Example¶
POST /v1/scan
Content-Type: application/json
Payload:
{
"repo_path": "https://github.com/user/repo",
"branch": "main",
"exclude_dirs": ["tests"],
"include_patterns": ["**/*.py"],
"exclude_patterns": ["*.log"],
"lite": false,
"create_zip": true,
"tree_depth": 3,
"docs_only": false,
"sync_ignore": true,
"skip_tree": false
}
Response: Returns scan ID, summary, artifact paths, and file counts.
๐ฆ Artifacts & Downloads¶
Use /v1/download/{scan_id}?format=txt|json|md|zip
to fetch outputs.
Use /v1/summary/{scan_id}
to get structured report metadata.
Use /v1/cleanup/{scan_id}
to delete the generated folder and all artifacts.
๐ Security Notes¶
- CORS is enabled for all domains by default.
- No authentication is applied โ lock down via reverse proxy or key-based auth in production.
๐ Developer Notes¶
This plugin is built with FastAPI, structured as:
src/plugins/gittxt_api/
โโโ api/v1/endpoints/...
โโโ core/services/...
โโโ cli_api.py
โโโ main.py
Dependencies are declared in requirements.txt
. Running gittxt plugin run gittxt-api
will install them automatically.
Back: Plugins Overview | Next: Streamlit Plugin โก