This document defines the baseline development workflow for AI-Image-Composer before application scaffolding begins.
- One-command local setup.
- Consistent linting, formatting, testing, and security scanning.
- CI quality gates that match local commands.
- Clear contributor practices for predictable delivery.
- Package manager:
pnpm - Linting:
eslint - Formatting:
prettier - Testing:
vitest
- Environment and dependency manager:
uv - Linting and formatting:
ruff - Testing:
pytest - Security and dependency scanning:
bandit,pip-audit
- Platform: GitHub Actions
- Primary workflow: ci.yml
- Nightly security workflow: nightly-security.yml
- Trigger:
ci.yml: all pushes and pull requestsnightly-security.yml: nightly schedule and manual dispatch
Prerequisites:
- Node.js 20+
- Python 3.11+
pnpm(bootstrapped viacorepackornpmif missing)uv(bootstrapped viabrew,pipx, orcurlinstaller if missing)
Database defaults:
- Local Docker Postgres is exposed on host port
55432by default. - Override with
AIIC_POSTGRES_PORTin your shell or.env(see.env.example).
Run:
make installThen launch the full local stack with watchdog:
aiicThe default aiic behavior is detached/background startup. Use these operational commands:
aiic status
aiic logs manager
aiic logs api -f
aiic stopIf api, worker, or web exits repeatedly, aiic uses restart backoff and then marks that service as crash-loop to avoid infinite restart spam. Use aiic status and aiic logs <service> for diagnosis.
Use foreground mode only when actively debugging startup/shutdown behavior:
aiic runDirected 3-layer flow (current next-break implementation pass):
- Quick start from Projects: create project + first scene + overarching prompt.
- Generate scene-level blocking layer from editor.
- Add preset objects (
Person,Table,Birthday Cake). - Generate wireframes (single, cycle 2-5, or N variants), choose preferred candidate.
- Drag/place object on canvas and use
Anchor. - Tune palette/lighting/harmonization controls, then run
Render All Layers + CompositeorRender Full Scene + Refine.
Manual mode (without aiic):
make setup
make hooks-install
make lint
make format-check
make test
make secrets-check
make scanRun full gate locally:
make ciRun scaffold services:
make db-up
make db-migrate
pnpm run dev:api
pnpm run dev:worker
pnpm run dev:webRun full containerized stack:
make full-build
make full-up
docker compose -f docker-compose.full.yml run --rm api uv run alembic -c apps/api/alembic.ini upgrade headdev:worker runs in polling mode and processes queued jobs.
Supported fake job adapters currently generate placeholder PNGs for:
SKETCHOBJECT_RENDERFINAL_COMPOSITE
Export API OpenAPI schema:
make openapiArtifact storage:
- Local artifacts are stored under
.artifacts/by default. - Override with
ARTIFACTS_ROOT=/custom/path. - Enable write-once/read-only files with
AIIC_ARTIFACT_IMMUTABLE_MODE=true.
API abuse protection:
- In-memory per-client rate limiting is enabled by default.
- Configure with
AIIC_RATE_LIMIT_ENABLED,AIIC_RATE_LIMIT_WINDOW_SECONDS,AIIC_RATE_LIMIT_MAX_REQUESTS, andAIIC_RATE_LIMIT_EXEMPT_PATHS.
Operational logging:
- API and worker emit structured logs with request/job context.
- Every API response includes
X-Request-ID(propagates incomingx-request-idif provided). - Configure log verbosity with
AIIC_LOG_LEVEL.
Project archiving:
- Archive endpoint:
POST /projects/{project_id}/archive - Unarchive endpoint:
POST /projects/{project_id}/unarchive GET /projectsexcludes archived projects by default.- Use
GET /projects?include_archived=trueto include archived projects.
Secrets baseline:
make secrets-checkvalidates runtime secret policy.- In
AIIC_ENV=production|prod,AIIC_APP_SECRET_KEYis required and weak placeholder values are rejected. - Track key rotation with
AIIC_APP_SECRET_KEY_VERSIONand provider rotation bundles withAIIC_PROVIDER_KEYSET_VERSION.
All primary workflows are wrapped in scripts under /scripts and exposed via make and pnpm.
- setup.sh: install/prepare dependencies
- install.sh: prerequisite checks/install + alias setup
- aiic-watchdog.sh: aiic manager (
start/stop/restart/status/logs/run) with watchdog + graceful shutdown - lint.sh: JS + Python linting
- format.sh: format write/check
- test.sh: JS + Python tests
- secrets-check.sh: runtime secret baseline validation
- scan.sh: dependency + static security scans
- ci.sh: local CI gate
- hooks-install.sh: install local git hooks
- hooks-run.sh: run all hooks on demand
- iur-smoke.sh: baseline API smoke flow wrapper
- iur-happy-path.sh: smoke + worker processing + artifact validation
- iur-directed-3layer.sh: directed person/table/cake acceptance scenario
- iur_smoke.py: shared smoke runner with
mvpanddirected-3-layerscenarios - db-up.sh: start local Postgres
- db-down.sh: stop local Postgres
- db-migrate.sh: apply Alembic migrations
- db-downgrade.sh: roll back one migration
- backup-create.sh: create timestamped DB + artifact backup bundle
- backup-restore.sh: restore DB + artifacts from a backup bundle
Reference: Makefile
make setupmake installmake aiicmake aiic-startmake aiic-stopmake aiic-restartmake aiic-statusmake aiic-logsmake aiic-runmake db-upmake db-downmake db-migratemake db-downgrademake full-buildmake full-upmake full-downmake backup-createmake backup-restore BACKUP=/abs/path/to/aiic-backup.tar.gzmake lintmake formatmake format-checkmake testmake secrets-checkmake scanmake cimake hooks-installmake hooks-runmake iur-smokemake iur-happy-pathmake iur-directed-flowmake iur-directed-3layermake clean
The repository uses .pre-commit-config.yaml to enforce local quality gates.
pre-commithook runs: format check and lint.pre-pushhook runs: full test suite.
Install hooks:
make hooks-installRun hooks ad hoc:
make hooks-run- CODEOWNERS is configured in CODEOWNERS.
- PR template is configured in PULL_REQUEST_TEMPLATE.md.
- Issue forms are configured in:
- Dependabot is configured in dependabot.yml.
- It checks
npm,pip, andgithub-actionsdependencies weekly.
- Baseline container config is in devcontainer.json.
- The container installs Node 20 + Python 3.12 and runs
make setupafter creation.
- Open PRs for all non-trivial changes.
- Keep PRs focused and small enough to review quickly.
- Require CI to pass before merge.
- Lint must pass for JS and Python.
- Format checks must pass (no manual style drift).
- Tests should be added alongside new behavior.
- Security scan should be run before merge.
- Add at least one happy-path and one failure-path test for new logic.
- Prefer fast unit tests first; add integration tests for API/worker boundaries.
- Keep deterministic tests by controlling randomness/seeds.
Coverage thresholds are intentionally staged to avoid false gates before code scaffolding exists.
- Stage 1 (current): collect baseline tests with no enforced percentage threshold.
- Stage 2 (after
apps/apiandapps/webscaffolding): enforce minimum line coverage in CI for Python and JS. - Stage 3 (post-MVP stabilization): raise thresholds and add per-package/module thresholds.
- Pin major versions for core tooling.
- Run
make scanroutinely and before releases. - Upgrade dependencies in small batches to simplify rollback.
- Update docs when behavior or commands change.
- Keep
README.mdfor product overview andDEV_README.MDfor contributor workflow.
- Configure branch protection rules in GitHub repository settings to require CI checks and reviews.