Address Coderabbit items.

This commit is contained in:
Adam Outler
2026-01-25 23:03:23 +00:00
parent 72c29a0d2d
commit 67b307f0e7
6 changed files with 26 additions and 8 deletions

View File

@@ -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` |

View File

@@ -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

View File

@@ -1,5 +1,5 @@
---
name: netalertx-idempotentsetup
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.
---

View File

@@ -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

View File

@@ -41,7 +41,7 @@ NetAlertX uses a frontendbackend 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`

View File

@@ -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