# JS Module Split 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:** Split `public/app.js` (1025 lines, single file) into 9 ES modules under `public/js/` with no build step, converting `var` to `const`/`let` throughout.
**Architecture:** Shared mutable state lives in a single exported `state` object in `state.js`; all modules import and mutate it directly. The one circular dependency (`api.js` → `auth.js`) is broken via a `session-expired` custom DOM event. The HTML `
```
To:
```html
```
- [ ] **Step 3: Clear Symfony cache**
```bash
cd /srv/http/zieltracker && php bin/console cache:clear
```
- [ ] **Step 4: Open browser and run through the checklist**
Open http://dudi.local/ and verify each of these works without console errors:
- [ ] App loads, goals are displayed
- [ ] Login form appears when logged out; login works
- [ ] "+" button opens new goal sheet; creating a goal works
- [ ] Logging a set (entering a number, pressing Enter or tapping +) works
- [ ] Collapsing/expanding a goal card works
- [ ] Renaming a goal (pencil icon) works
- [ ] Data menu opens (gear icon); locale switch (DE/EN/PL) re-renders UI correctly
- [ ] Stopwatch ticks; "fill" button inserts time into the nearest input
- [ ] Password change flow works
- [ ] Invite generation works (if admin invite button visible)
- [ ] Reloading the page re-fetches goals
- [ ] No errors in browser console
- [ ] **Step 5: Delete old file and commit**
```bash
rm /srv/http/zieltracker/public/app.js
git add -A
git commit -m "Switch to ES module structure, remove monolithic app.js"
```