mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-03-30 23:03:03 -07:00
Address Coderabbit items.
This commit is contained in:
5
.github/copilot-instructions.md
vendored
5
.github/copilot-instructions.md
vendored
@@ -16,7 +16,8 @@ Network monitoring & alerting. Provides inventory, awareness, insight, categoriz
|
||||
## Architecture
|
||||
|
||||
- **Backend (Python):** `server/__main__.py`, `server/plugin.py`, `server/api_server/api_server_start.py`
|
||||
- **Data (SQLite):** `db/app.db`; helpers in `server/db/*`
|
||||
- **Backend Config:** `/data/config/app.conf`
|
||||
- **Data (SQLite):** `/data/db/app.db`; helpers in `server/db/*`
|
||||
- **Frontend (Nginx + PHP + JS):** `front/`
|
||||
- **Plugins (Python):** `front/plugins/*` with `config.json` manifests
|
||||
|
||||
@@ -32,7 +33,7 @@ Procedural knowledge lives in `.github/skills/`. Load the appropriate skill when
|
||||
| Load sample devices | `sample-data` |
|
||||
| Build Docker images | `docker-build` |
|
||||
| Reprovision devcontainer | `devcontainer-setup` |
|
||||
| Create or run plugins | `plugin-development` |
|
||||
| Create or run plugins | `plugin-run-development` |
|
||||
| Analyze PR comments | `pr-analysis` |
|
||||
| Clean Docker resources | `docker-prune` |
|
||||
| Generate devcontainer configs | `devcontainer-configs` |
|
||||
|
||||
13
.github/skills/api-development/SKILL.md
vendored
13
.github/skills/api-development/SKILL.md
vendored
@@ -38,7 +38,15 @@ Retrieve token via `get_setting_value('API_TOKEN')`.
|
||||
|
||||
**MANDATORY:** All responses must include `"success": true|false`
|
||||
|
||||
On failure, include error message:
|
||||
```python
|
||||
return {"success": False, "error": "Description of what went wrong"}
|
||||
```
|
||||
|
||||
On success:
|
||||
|
||||
```python
|
||||
return {"success": True, "data": result}
|
||||
```
|
||||
|
||||
```python
|
||||
return {"success": False, "error": "Description of what went wrong"}
|
||||
@@ -50,6 +58,9 @@ On success:
|
||||
return {"success": True, "data": result}
|
||||
```
|
||||
|
||||
|
||||
**Exception:** The legacy `/device/<mac>` GET endpoint does not follow this contract to maintain backward compatibility with the UI.
|
||||
|
||||
## Adding New Endpoints
|
||||
|
||||
1. Add route in `server/api_server/` directory
|
||||
|
||||
2
.github/skills/devcontainer-setup/SKILL.md
vendored
2
.github/skills/devcontainer-setup/SKILL.md
vendored
@@ -1,5 +1,5 @@
|
||||
---
|
||||
name: netalertx-idempotent—setup
|
||||
name: netalertx-idempotent-setup
|
||||
description: Reprovision and reset the devcontainer environment. Use this when asked to re-run startup, reprovision, setup devcontainer, fix permissions, or reset runtime state.
|
||||
---
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ Ensure `sys.path` includes `/app/front/plugins` and `/app/server` (as in the tem
|
||||
|
||||
## Plugin Structure
|
||||
|
||||
```
|
||||
```text
|
||||
front/plugins/<code_name>/
|
||||
├── config.json # Manifest with settings
|
||||
├── script.py # Main script
|
||||
|
||||
2
.github/skills/project-navigation/SKILL.md
vendored
2
.github/skills/project-navigation/SKILL.md
vendored
@@ -41,7 +41,7 @@ NetAlertX uses a frontend–backend architecture: the frontend runs on **PHP + N
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Use these instead of hardcoding paths:
|
||||
Use these NETALERTX_* instead of hardcoding paths. Examples:
|
||||
|
||||
- `NETALERTX_DB`
|
||||
- `NETALERTX_LOG`
|
||||
|
||||
10
.github/skills/testing-workflow/SKILL.md
vendored
10
.github/skills/testing-workflow/SKILL.md
vendored
@@ -25,9 +25,15 @@ Use VS Code's testing interface or the `runTests` tool with appropriate paramete
|
||||
|
||||
Tests live in `test/` directory. App code is under `server/`.
|
||||
|
||||
PYTHONPATH is preconfigured to include:
|
||||
PYTHONPATH is preconfigured to include the following which should meet all needs:
|
||||
- `/app` # the primary location where python runs in the production system
|
||||
- `/app/server` # symbolic link to /wprkspaces/NetAlertX/server
|
||||
- `/app/front/plugins` # symbolic link to /workspaces/NetAlertX/front/plugins
|
||||
- `/opt/venv/lib/pythonX.Y/site-packages`
|
||||
- `/workspaces/NetAlertX/test`
|
||||
- `/workspaces/NetAlertX/server`
|
||||
- `/workspaces/NetAlertX`
|
||||
- `/opt/venv/lib/python3.12/site-packages`
|
||||
- `/usr/lib/pythonX.Y/site-packages`
|
||||
|
||||
## Authentication in Tests
|
||||
|
||||
|
||||
Reference in New Issue
Block a user