# Development Environment ## Scope The repository is currently prepared for v3 `S0-1`. Prepared: - AstrBot plugin root files and v3 configuration placeholders. - v3 top-level module layout: `adapters`, `core`, `engines`, `backend`, `database`, `assets_builtin`, `frontend`, `pages`, `web`, and `data`. - Database helper foundation with SQLite default and optional PostgreSQL selection from `config.yaml`. - Frontend source skeleton for Plugin Page UI and Standalone Web UI. - Runtime data directories with `.gitkeep` files only. - Generated data, local virtual environments, node modules, and build artifacts are ignored. Not implemented yet: - AstrBot adapter registration. - Repositories and business services. - P0 API routes. - Real UI screens beyond scaffold placeholders. ## Local Tools On this machine, PowerShell blocks `npm.ps1`; use `npm.cmd` when needed. Codex bundled tools are also available: ```text C:\Users\Administrator\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe C:\Users\Administrator\.cache\codex-runtimes\codex-primary-runtime\dependencies\bin\pnpm.cmd ``` ## First Tasks Follow `imagestudio_codex_hermes_dev_flow_v3.md` and continue with: ```text S0-2 实现 common response DTO S0-3 实现 request_id / audit logger 基础工具 S1-1 实现 character_profiles 表、Repository、Service S1-2 实现 profile_workflows 和 workflow_nodes S1-3 实现 generation_images ``` ## P0 Frozen API Checklist P0 must implement these before expanding into advanced flows: ```text ui/bootstrap dashboard/summary profiles GET/POST/GET_ONE/PUT profiles/quick-draft profiles/{profile_id}/workflows GET/POST workflows/{workflow_id} workflows/{workflow_id}/nodes nodes/{node_id}/generate nodes/{node_id}/images images/{image_id} images/{image_id}/select jobs jobs/{task_id} settings/schema settings/current storage/status media/sign ``` Do not start a separate FastAPI, Flask, or Vite production port for the plugin. Dev servers may only be used for local frontend development before build output is copied into AstrBot static paths. ## Database Backend Default behavior: ```text database.backend = auto postgresql.enabled = false selected backend = sqlite ``` When PostgreSQL is configured: ```yaml database: backend: auto postgresql: enabled: true host: 127.0.0.1 port: 5432 database: imagestudio user: imagestudio password: "" ``` With `backend: auto`, enabling a complete PostgreSQL config makes PostgreSQL the selected backend. Use `backend: sqlite` to force SQLite even when PostgreSQL fields exist, or `backend: postgresql` to fail fast when PG config/driver is missing. PostgreSQL support is optional and only imports `psycopg` when the PG backend is selected.