# DOX — packages/automation-plugin

Files in this directory. One row per source file.

| File | Purpose |
|------|---------|
| `README.md` | Package overview. Schedule-triggered background agent runs. Reads automation defs: per-folder `<repo>/.pi/automation/<name>/automation.yaml`, global `~/.pi/automation/<name>/automation.yaml`. Server-owned scheduler arms triggers (phase 1 cron `schedule`). Fire → spawns pi session `kind="automation"` (model, action `prompt`\|`skill`, mode, sandbox). Runs watchable in Automation view. Results → `<scope>/.pi/automation/runs/<date>-<name>/result.md`. Keeps last 100 per automation. |
| `vitest.config.ts` | Vitest config for automation-plugin package. jsdom env, `pool: "forks"`, `maxWorkers: PARALLEL_MAX_WORKERS`, includes `src/**/__tests__/**/*.test.{ts,tsx}`. globalSetup imports `@blackbelt-technology/pi-dashboard-shared/test-support/setup-home.ts`. `testTimeout` 30_000 — real plugin + engine boot + async run-store writes blew the 5s default under fork contention. See change: contention-harden-real-process-tests. `resolve.alias` maps `dashboard-plugin-runtime` (+ `/server`,`/context`,`/test-support`,`/manifest-validator` subpaths BEFORE the bare key) + `pi-dashboard-shared` to worktree-local src — hoisted-workspace symlink escapes to the main checkout and `usePluginConfigOf` existed only in this worktree until landing. See change: model-picker-everywhere-favorites. |
| `src/i18n.ts` | Plugin i18n `catalog` (unprefixed keys, merged under `plugin.automation.*`). `zh-CN` + `hu` blocks, identical key sets (scripts/i18n-parity). English at call sites via `useT(key, vars, fallback)`. `defaultModelPlaceholder` reworded to picker copy; new `defaultModelClear` key. See change: make-all-ui-text-i18n, model-picker-everywhere-favorites. Wave 2: settings keys reworded (kit labels/hints) + new groupRuns/groupScan/groupModel, retention*, scan*Hint*, defaultModelHint*/NoModels. See change: retro-ux-plugin-settings-wave-2. |
| `src/__tests__/AutomationSettings.test.tsx` | L1 tests for the picker-backed automation default model (test-plan E8–E12, F4, F5, X1, X2): stub `ui:model-selector` under `PluginContextProvider` + `CurrentPluginLayer` + `SettingsDraftProvider`; asserts write payload, clear→`""`/`current` undefined, reactive catalogue, no `<label>` wrapper, empty-catalogue safety. See change: model-picker-everywhere-favorites. Retention BVA `""`/`0` invalid, `1` valid; owned-key commit; kit switches; group titles (test-plan E12). See change: retro-ux-plugin-settings-wave-2. |
