4.3 KiB
4.3 KiB
AGENTS for OpenCode
Keep this file minimal and high-signal: only include facts an agent would otherwise miss.
- Repo purpose (one line)
- This repository bundles an ActivityWatch Server deployment, RU WebUI patch, Windows collectors (PowerShell), and small Python utilities for aggregation and monitoring.
- Highest-value entrypoints & commands
- Read README.md and docs/preparation.md first (they are the authoritative onboarding flow).
- Create a Proxmox CT:
proxmox/create-ct.sh [ /path/to/deploy.secrets.env ](reads secrets/deploy.secrets.env). - Push server artifacts to an existing CT:
proxmox/push-aw-artifacts.sh [ /path/to/deploy.secrets.env ]. - Install AW server on the CT (runs inside CT):
aw-server/install_aw_server.sh(requires/etc/activitywatch/aw-server.env). - Apply RU WebUI patch (must run on the CT and after webui is present):
aw-server/apply_webui_ru_patch.sh. - Run the Windows ensemble deploy from a Windows admin host:
windows/deploy-ensemble.ps1(see its parameters; it callsdeploy-domain-users.ps1). - Quick DLP aggregation (local):
python3 scripts/aggregate_dlp_events.py.
- Exact env/secrets behavior agents often miss
- Secrets live in
secrets/deploy.secrets.env(actual file is intentionally local-only). Many scripts default to that path if no arg provided. Never add real secrets to commits. Use.examplefiles as templates. - The CT bootstrap workflow expects
/etc/activitywatch/aw-server.envon the CT (pushed by push-aw-artifacts when AW_SERVER_* variables are set).install_aw_server.shsources that exact path.
- CI / quality checks the repo enforces
- GitHub CI runs shellcheck for
*.shand PSScriptAnalyzer for PowerShell inwindows/*.ps1(see .github/workflows/ci.yml). - Local quality gate:
scripts/quality-gate.shperforms bash-n, (optional) shellcheck, pwsh parse checks, and ansible syntax checks. Run this before PRs.
- File locations and toolchain quirks
- AW server binary is installed under
/opt/activitywatch/releasesand symlinked from/opt/activitywatch/bin/aw-server-rustbyinstall_aw_server.sh. - RU WebUI patching expects JS assets in
$AW_SERVER_WEBUI_DIR(default/opt/activitywatch/webui-ru). The patch script writesjs/ru-patch-v5.jsand editsindex.htmlin-place (it makes backups with .bak timestamps). proxmox/create-ct.shandproxmox/push-aw-artifacts.shsource the same deploy.secrets.env and require many CT_* / AW_SERVER_* variables; missing vars cause immediate exit.
- Monorepo boundaries / responsibilities
- aw-server/: server install & systemd unit + RU webui patching.
- proxmox/: create CT and push artifacts scripts (requires Proxmox
pctCLI and CT preconditions). - windows/: PowerShell collectors and deployment automation (Target: Windows admin hosts; validated via
validate-deployment.ps1). - grafana-1c/, pfsense/: monitoring stacks and pollers (separate deploys, not part of aw-server install).
- scripts/: small utilities and
quality-gate.shused by contributors.
- Common gotchas
- Do NOT commit secrets (secrets/ are local-only; PRs must not contain real secrets).
- Many scripts assume they run on the target CT or on a Linux admin host with
pctavailable. Don't try to run them on macOS without adapting dependencies. aw-server/install_aw_server.shexpects network access to download the AW release URL provided by AW_SERVER_DOWNLOAD_URL.aw-server/apply_webui_ru_patch.shmust run after AW webui files are present; it will fail if required bootstrap files under/root/bootstrapare missing.- When pushing AW_SERVER env via
push-aw-artifacts.shthe script will only write/etc/activitywatch/aw-server.envif all AW_SERVER_* variables are set; otherwise it warns and skips.
- PR / commit checklist for agents
- Run
scripts/quality-gate.shlocally (or ensure CI covers changed files). - Ensure no secrets (.env with real values) are staged.
- If changing PowerShell, ensure PSScriptAnalyzer rules pass (CI enforces this).
- Where to find more instructions (preserve these files)
- README.md, docs/preparation.md, docs/deployment.md, docs/runbook.md, docs/operations.md, docs/codebase-onboarding.md — read these when doing infra or deployment work.
If you need me to add step-by-step repros or automate one of the tasks above (create CT, push artifacts, run install on CT), say which one and I will implement the helper or run the checked commands.