3.8 KiB
Admin Operations Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Add complete moderation, logs, analytics, DevOps, and online-user administration verticals.
Architecture: Port each reference vertical independently, adapt its data access to EpicNext's Prisma/schema conventions, and enforce ACL at both route and mutation boundaries. Reuse shared admin components and semantic admin theme tokens.
Tech Stack: Next.js 16, React 19, TypeScript, Prisma/MariaDB, Vitest, RCON.
Global Constraints
- Work directly on
main; no worktree or subagents. - Preserve and never stage the local
package.jsonchange. - Do not copy generated Prisma code.
- Every page/action/API must use its documented ACL permission.
- Missing optional emulator tables render unavailable states instead of crashing the admin shell.
Task 1: Define route, ACL, and theme contracts
Files:
-
Create:
src/lib/admin-operations-contract.test.ts -
Assert all moderation, log, analytics, DevOps, and online routes exist.
-
Assert mutations and APIs contain the matching
PERMSguard. -
Assert new sources contain no forbidden public structural theme tokens.
-
Run the contract and confirm it fails because routes are absent.
-
Commit with
test: define admin operations contracts.
Task 2: Moderation and calls for help
Files:
-
Create:
src/actions/moderation.ts -
Create:
src/app/admin/moderation/** -
Modify:
src/app/admin/layout.tsx -
Port moderation validation tests and confirm failure.
-
Add dashboard, actions, CFH list/detail, and team pages.
-
Adapt user/ban/CFH queries and protect reads/edits with moderation ACL.
-
Log actions and separate RCON failures from database results.
-
Run contract, moderation tests, and typecheck; commit
feat: add admin moderation operations.
Task 3: Detailed administration logs
Files:
-
Create:
src/app/admin/logs/{audit,chat,commands,trades}/** -
Modify:
src/app/admin/logs/page.tsx -
Add failing route/filter contract coverage.
-
Port paginated read-only tables using EpicNext log models or compatible raw queries.
-
Protect every route with
admin.logs.viewand use semantic admin status colors. -
Run log tests and typecheck; commit
feat: add detailed admin logs.
Task 4: Analytics and export
Files:
-
Create:
src/app/admin/analytics/** -
Create:
src/app/api/admin/analytics/export/route.ts -
Add failing ACL/export contract checks.
-
Port overview, activity, and economy aggregates.
-
Guard reads with
admin.analytics.viewand export withadmin.analytics.export. -
Ensure export excludes secrets and fields absent from the visible tables.
-
Run analytics contracts and typecheck; commit
feat: add admin analytics.
Task 5: DevOps health and online users
Files:
-
Create:
src/app/admin/devops/** -
Create:
src/app/api/admin/devops/health/route.ts -
Create:
src/app/admin/online/** -
Add failing route, redaction, and ACL checks.
-
Port health/errors/online pages and adapt queries to EpicNext models.
-
Redact credentials, connection strings, environment variables, and stack details from API responses.
-
Guard DevOps with
admin.devops.view/editand online users withadmin.users.view. -
Run contracts and typecheck; commit
feat: add devops and online operations.
Task 6: Verify and publish
- Run
git diff --check origin/main...HEAD. - Run
pnpm test,pnpm typecheck, andpnpm build. - Confirm only
package.jsonremains modified. - Fetch
origin/main, verify it is an ancestor ofHEAD, and pushmainwithout force.