Task 0.5 of clean-analyst-bootstrap. Greenfield rewrite — no fallback, no aliases. Existing dev environments lose their cached PAT and must re-authenticate. Env var renames (hard cutover): - DA_CONFIG_DIR -> AGNES_CONFIG_DIR - DA_SERVER -> AGNES_SERVER - DA_SERVER_URL -> AGNES_SERVER_URL (test-only stale ref, not in spec) - DA_NO_UPDATE_CHECK -> AGNES_NO_UPDATE_CHECK - DA_LOCAL_DIR -> AGNES_LOCAL_DIR - DA_TOKEN -> AGNES_TOKEN - DA_STREAM_RETRIES -> AGNES_STREAM_RETRIES Config dir rename: ~/.config/da/ -> ~/.config/agnes/ (across code, comments, docstrings, error messages, install templates, dev scripts). Stale `da X` references in CLI source (and adjacent app/, tests/): swept docstrings, comments, help text, and error messages where the verb survives the rewrite (init, pull, push, catalog, status, diagnose, auth, admin, skills, query, schema, describe, explore, disk-info, snapshot, login, logout, whoami, server, setup) and replaced `da X` with `agnes X`. Intentionally kept `da sync`, `da fetch`, `da analyst`, `da metrics` — those verbs are removed in later tasks; the legacy strings will be detected by `_LEGACY_STRINGS` (added in Task 2). Test fixes: - TestCLIVersion now asserts output starts with `agnes ` (was `da `). Test results: 2675 passed, 25 skipped (full pytest run, excluding 9 pre-existing test_db.py / test_user_management.py / test_e2e_extract.py / test_cli_binary_rename.py failures unrelated to this rename).
37 lines
1.1 KiB
Markdown
37 lines
1.1 KiB
Markdown
# Notifications — How notifications work
|
|
|
|
## Architecture
|
|
1. User creates a Python script (locally or via Claude Code)
|
|
2. Script queries local DuckDB and produces output
|
|
3. Output is sent via Telegram bot or WebSocket gateway
|
|
|
|
## Creating a Notification Script
|
|
```python
|
|
# user/scripts/sales_alert.py
|
|
"""Sales alert - checks daily revenue."""
|
|
import duckdb
|
|
|
|
conn = duckdb.connect('user/duckdb/analytics.duckdb', read_only=True)
|
|
result = conn.execute("SELECT sum(amount) as revenue FROM orders WHERE date = current_date").fetchone()
|
|
print(f"Today's revenue: ${result[0]:,.2f}")
|
|
```
|
|
|
|
## Running Locally
|
|
```bash
|
|
da scripts run sales_alert # runs on your machine
|
|
```
|
|
|
|
## Deploying to Server
|
|
```bash
|
|
da scripts deploy sales_alert --schedule "0 8 * * MON" # every Monday 8 AM
|
|
```
|
|
|
|
## Delivery Channels
|
|
- **Telegram**: Link via `agnes auth telegram-link`
|
|
- **Desktop app**: Via WebSocket gateway (automatic if connected)
|
|
|
|
## Managing Scripts
|
|
```bash
|
|
da scripts list # all deployed scripts
|
|
da scripts undeploy <script-id> # remove from server
|
|
```
|