# Abacus → Kimai Firefox extension: grab worked hours from MyAbacus, then create Kimai timesheets so that every day matches 100%. ## Install (dev) `about:debugging#/runtime/this-firefox` → *Load Temporary Add-on…* → pick `manifest.json`. Or `npx web-ext run` from this folder. ## Setup 1. Dashboard → **Settings**: Kimai URL + API token (Kimai 2: *My profile → API access*). Click **Test**, which also loads projects/activities. 2. Pick a **default project / activity**: everything not covered by a rule goes there. 3. **Recurring rules**: e.g. `Weekly meeting`, 1h, Mon, start 09:00 → Customer X / Project Y, activity A. - Leave *hours* empty for a "remainder" rule: e.g. Fridays rest goes to an internal project instead of the default. - *Every N weeks* + *anchor* for bi-weekly stuff, *valid from/to* for temporary ones. ## Usage 1. Open MyAbacus on the **Gestion des temps** card, click the toolbar icon, pick *From / To*, **Read days from MyAbacus**. It clicks ‹ / › day by day, reads every *Arrivée / Départ* pair (and *Total heures*), and saves as it goes (popup can be closed, there's a *Stop* button). Days with an open clock-in (no *Départ*) are skipped and flagged. *Generic extraction* (under "Other pages") is the old table/text scraper, for other layouts. 2. Dashboard opens with one line per day (editable): ``` 2026-10-05 08:00-12:00 13:00-17:24 # stamped intervals 2026-10-06 8:24 # total only ``` If extraction fails, select the table in Abacus, copy, and use *Paste raw text*. 3. **Compare with Kimai & plan**: for each day it computes `Abacus - existing Kimai`, then fills the gap: fixed rules first (at their start time if free), then remainder rule / default. Entries go into the Abacus intervals, never overlapping existing Kimai entries. 4. Review, untick days you don't want, **Create entries in Kimai**. It re-checks afterwards; matched days show `✓ 100%`. Re-running is safe: existing Kimai time counts toward the total, so only the missing part is created. ## Extraction tuning Settings → *Abacus extraction*: - **Row selector**: default `tr, [role="row"]`. If nothing dated is found, falls back to page text lines. - **Time mode**: `ranges` (`08:00 - 12:00`), `pairs` (in/out in separate columns), `duration` (only totals). - **Duration column**: which duration in a row is the worked time (`0` first, `-1` last), useful when rows also show target/balance. The raw text read during the last extraction is visible on the Sync tab, to help tweak those. ## Files - `lib/parse.js`: Abacus text → days - `lib/planner.js`: days + existing Kimai + rules → entries to create - `lib/kimai.js`: REST client - `lib/abacus-crawl.js`: day-by-day reader for the MyAbacus card (injected in the page) - `popup/`: extraction from the active tab - `app/`: dashboard (sync, rules, settings)