Commit Graph

20 Commits

Author SHA1 Message Date
claude-timemachine b31fdd023a rename: cloud sync -> instance sync; cloud -> Timemachine Network; drop Tk
CI / test (3.10) (push) Successful in 7s
CI / test (3.11) (push) Successful in 7s
CI / test (3.12) (push) Successful in 7s
CI / build-pyz (push) Successful in 4s
CI / release (push) Has been skipped
Product / UI / CLI / docs rebrand. Internal package, repo, and
on-disk dir names stay 'cloud_sync' / 'cloud-sync' / '.cloud-sync/'
to avoid breaking existing installs; a future commit can do the
file-system rename when the cost is worth paying.

User-facing changes:
  CLI prog name:        cloud-sync     -> instance-sync
  CLI description:      cloud-svc URL  -> Timemachine Network endpoint
  Dialog title:         CLOUD SYNC     -> INSTANCE SYNC
  Dialog title:         CLOUD CONFLICT -> INSTANCE CONFLICT
  Dialog title:         CONNECT CLOUD SAVE -> CONNECT TO THE NETWORK
  Card label:           Cloud Save     -> Remote Save
  Skip button:          Skip cloud sync -> Skip instance sync
  Body copy:            'the cloud'    -> 'the Timemachine Network'
  Window titles:        Cloud sync — ... -> Instance sync — ...
  Log prefix:           cloud-sync:    -> instance-sync:
  Error prose:          'cloud-sync token' -> 'instance-sync token'

Backend changes:
  restic --host tag:    cloud-sync     -> instance-sync
  State.host_tag dflt:  cloud-sync     -> instance-sync
  (Existing snapshots with the old tag still pull fine; we use 'latest'.)

Drop tkinter fallback: ui.py now offers Qt OR Headless. tkinter is
unnecessary given we already maintain Qt + headless; one less code
path to keep styled, smaller pyz. make_progress() picks Qt first,
falls through to HeadlessProgress on ImportError with a stderr hint
to 'pip install PySide6'.

README: rebrand title + prose; note repo/dir rename deferred; call
out the PySide6 install step. Conflict/login dialogs are now Qt-only;
without Qt, conflict aborts (defensive) and login tells the user to
paste the token manually.

52 tests green; no test-file label changes needed since they only
exercise internal APIs.
2026-06-05 01:14:02 +02:00
claude-timemachine f1cb9f4b86 feat(ui): inline SVG icons across all three dialogs
CI / test (3.10) (push) Successful in 6s
CI / test (3.11) (push) Successful in 7s
CI / test (3.12) (push) Successful in 6s
CI / build-pyz (push) Successful in 4s
CI / release (push) Has been skipped
New module cloud_sync/icons.py:
  - CLOUD_SVG, STORAGE_SVG: card glyphs (Material Icons, Apache-2.0)
  - WARNING_BADGE_SVG, PLUS_BADGE_SVG, SYNC_BADGE_SVG: header badges
    (hand-rolled — circle + vector primitives, no glyph font dependency)
  - svg_pixmap(svg, size): QSvgRenderer-backed rasteriser; dual-binding
    helper falls back from PySide6 to PyQt6.QtSvg.

Wired into ui_qt.py:
  - Conflict dialog: warning badge SVG (light disc + dark !), cloud
    card SVG, storage card SVG. Drops the QSS circle hack — entire
    badge is one pixmap now.
  - Login dialog: plus badge SVG (Prism-green disc + dark +).
  - Progress window: sync arrow badge SVG (Prism-green disc + circular
    arrow + head).

QSS shed: no more bg/border-radius/font-size acrobatics for badges
since the SVG includes the disc. Card icons are crisp at any DPI.

52 tests still green; pyz grows ~5 KB for the SVG strings + the new
icons module.
2026-06-05 01:05:54 +02:00
claude-timemachine 7c9d33f952 feat(sync): wire state.json + divergence detection + dialogs
CI / test (3.10) (push) Successful in 3m16s
CI / test (3.11) (push) Failing after 3m25s
CI / test (3.12) (push) Failing after 3m25s
CI / build-pyz (push) Has been skipped
CI / release (push) Has been skipped
state.py: per-instance sync state. <pack>/.cloud-sync/state.json
(mode 600) records last_pulled_snapshot_id + last_pulled_at +
host_tag. Versioned schema. clear() on remote-empty.

sync.pull decision tree (replaces the unconditional restore):

  no token file
    → prompt_login_qt; on Skip return 0 (don't block launch)
  no state + remote empty
    → no-op
  no state + remote non-empty
    → restore (first-run on this machine)
  state.id == remote.id
    → skip restore (up to date)
  state.id != remote.id, no in-scope local edits since state.at
    → restore (fast-forward)
  state.id != remote.id, in-scope local edits since state.at
    → prompt_conflict_qt
      keep_local  → don't restore; push will overwrite cloud
      use_remote  → restore + update state
      cancel      → exit 1

sync.push: --json output parsed for snapshot_id; state.json updated
to that id after a successful backup. Skips silently if no token.

_find_modified_in_scope: walks include roots, filters via
_matches_any (restic-style globs: dir/, **/dir/, **/*.glob).
Stops at 50 hits; we only need 'any' + a sample for the dialog.

_format_dt: hand-rolled (no GNU-vs-Windows strftime quirks) →
'Thursday, October 21, 2021 at 7:12 PM'.

Restic JSON parsing helpers: _parse_snapshots, _parse_restic_time
(handles nanosecond precision), _parse_backup_summary.

tests/test_state.py: 19 new tests covering state read/write, scope-
aware mtime walk, exclude glob matching, restic output parsers.
Total: 52 green.
2026-06-05 00:20:40 +02:00
claude-timemachine fa04fade74 style(ui): progress window matches conflict + login
CI / test (3.10) (push) Successful in 7s
CI / test (3.11) (push) Successful in 7s
CI / test (3.12) (push) Successful in 7s
CI / build-pyz (push) Successful in 4s
CI / release (push) Has been skipped
Same skeleton: Prism-green badge ('↻') + uppercase title in the
header row, status text under it, indeterminate progress bar (dark
inset with Prism-green chunk), Cancel button bottom-right styled
as the shared 'secondary' button.

Bumped from 440x160 to 520x240 so the header reads at the same
weight as the other two dialogs. title.upper() applied in run_with
so callers can keep passing 'Cloud sync — pulling' without manual
uppercasing.

Three dialogs now share one visual language: Prism dark surface
(#313131), Prism-green accent (#96db59), monospace for code/data,
circled badge in the top-left of every header.
2026-06-04 23:34:50 +02:00
claude-timemachine aba6472292 style(ui): login dialog matches Steam-layout in Prism dark
CI / test (3.10) (push) Successful in 7s
CI / test (3.11) (push) Successful in 7s
CI / test (3.12) (push) Successful in 7s
CI / build-pyz (push) Successful in 5s
CI / release (push) Has been skipped
Same skeleton as the conflict dialog: header (Prism-green badge +
uppercase title), body copy, content, foot row.

Specifics:
  - badge: '+' on Prism-green circle (vs the conflict's '!' on
    light gray) — green reads as 'setup / new', not warning
  - command callout: monospace, green text, dark inset card
  - token input: monospace, dark inset, green focus border, green
    selection highlight
  - 'Skip cloud sync' = secondary (dark surface, green hover border)
  - 'Save and continue' = primary (Prism-green fill, black text)

Same Enter-to-submit + format validation behavior as before;
on-screen error reuses Prism's BrightText red.
2026-06-04 23:32:32 +02:00
claude-timemachine 016c88f60f style(ui): conflict dialog in Prism dark palette
CI / test (3.10) (push) Successful in 7s
CI / test (3.11) (push) Successful in 8s
CI / test (3.12) (push) Successful in 8s
CI / build-pyz (push) Successful in 4s
CI / release (push) Has been skipped
Same Steam-Cloud-Conflict layout (header glyph + uppercase title +
two card-buttons + Cancel) but recolored to Prism's palette:

  background       #313131 (Prism Window)
  cards            #2a2a2a (Prism AlternateBase)
  card hover       #383838 + #96db59 border (Prism Highlight green)
  cancel button    #303030 + #96db59 border on hover

Warning glyph keeps the light circle (#d6dde6) for high contrast
against the dark surface — gives the same 'pay attention' weight
without forcing a different theme just for one dialog.
2026-06-04 23:23:47 +02:00
claude-timemachine 98c63a261b feat(ui): Steam-style conflict dialog
CI / test (3.10) (push) Successful in 7s
CI / test (3.11) (push) Successful in 7s
CI / test (3.12) (push) Successful in 7s
CI / build-pyz (push) Successful in 4s
CI / release (push) Has been skipped
Replaces the radio+continue layout with a Steam Cloud Conflict
lookalike: uppercase title with circled-! glyph, three-line body
copy, two large card-buttons (Cloud Save / Local Save) each showing
icon + label + 'Modified <date>', Cancel bottom-right. Card click
commits the choice and dismisses — no separate Continue button.

Background switched to Steam-blue (#1b2838) instead of Prism dark
so the dialog reads as a 'pay attention' moment rather than another
status pane.

Card glyphs are unicode placeholders (☁ / ▢) — easy SVG swap later
if we want crisp HDD/cloud icons.

API change:
  prompt_conflict_qt(local_summary, remote_summary)
    → prompt_conflict_qt(local_modified, remote_modified, save_label)
  Caller now passes pre-formatted timestamp strings + an optional
  noun phrase ('Minecraft save').
2026-06-04 23:22:26 +02:00
claude-timemachine ff96bf4b70 build: exclude __pycache__ from pyz (-68 KB)
CI / test (3.10) (push) Successful in 8s
CI / test (3.11) (push) Successful in 7s
CI / test (3.12) (push) Successful in 7s
CI / build-pyz (push) Successful in 4s
CI / release (push) Has been skipped
Switch from 'cp -r cloud_sync' to 'cp cloud_sync/*.py' so .pyc files
from a prior dev run don't get embedded. Pyz shrinks 112 KB -> 44 KB.
2026-06-04 23:20:02 +02:00
claude-timemachine d4c76a4e37 feat(ui): login + conflict dialogs (Qt)
CI / test (3.10) (push) Successful in 7s
CI / test (3.11) (push) Successful in 7s
CI / test (3.12) (push) Successful in 8s
CI / build-pyz (push) Successful in 4s
CI / release (push) Has been skipped
Login dialog (prompt_login_qt):
  Modal asking for a discord_id:password token. Echo masked. Validates
  format before accepting. 'Skip cloud sync' returns None so caller can
  bypass sync without blocking the launch.

Conflict dialog (prompt_conflict_qt):
  Modal with three radio options — keep_local, use_remote, cancel.
  Shown when local files were modified since the last pulled snapshot
  AND the remote has a newer snapshot from another host (divergence
  state.json detection happens in sync.pull; not wired yet).

Both reuse the Prism dark palette via _apply_prism_dark. Tk fallbacks
not implemented — Qt is the path most players will hit.

Next: state.json (last_pulled_snapshot_id), divergence detection in
sync.pull, integration with these dialogs.
2026-06-04 23:19:25 +02:00
claude-timemachine fe26ed309c feat(ui): Qt progress window with Prism-Launcher-inspired dark palette
CI / test (3.10) (push) Successful in 8s
CI / test (3.11) (push) Successful in 6s
CI / test (3.12) (push) Successful in 7s
CI / build-pyz (push) Successful in 4s
CI / release (push) Has been skipped
cloud-sync now ships a real Qt UI alongside the tkinter fallback.

Architecture:
  - HeadlessProgress: --no-gui path, plain stdout
  - TkProgressWindow: stdlib fallback when Qt isn't installed
  - QtProgressWindow: preferred path; supports both PySide6 and PyQt6
    (interchangeable APIs for our subset)

The factory in ui.py picks Qt → tkinter → headless. Tk stays so the
zipapp still works on bare Python with no extras.

Threading: QApplication runs on the main thread (started by run_with
via QDialog.exec). The restic worker runs on a daemon threading.Thread.
Cross-thread UI updates go via a Signal on a bridge QObject so Qt
auto-marshals them onto the main thread via a queued connection.

Cancellation: WM close + Cancel button both set a flag. sync.pull/push
pass ui.is_cancelled as restic.run's cancel_check; the subprocess gets
killed and returns -1 → exit 1.

Theme: Fusion style + Prism's dark palette (RGB values copied as facts
from PrismLauncher's DarkTheme.cpp). Override with PRISM_THEME=off.

Pyz size went 20 KB → 36 KB (added ui.py + ui_qt.py).
33 tests still green.
2026-06-04 23:12:58 +02:00
claude-timemachine 49d1cb3280 drop restic repo encryption; rely on TLS + append-only + LUKS
CI / test (3.10) (push) Successful in 8s
CI / test (3.11) (push) Successful in 8s
CI / test (3.12) (push) Successful in 7s
CI / build-pyz (push) Successful in 4s
CI / release (push) Has been skipped
User credentials now serve HTTP basic auth only. Repos init with
--insecure-no-password. Removes:
  - RESTIC_PASSWORD env in client subprocess
  - Per-repo password coordination story
  - Multi-key restic setup (user key + operator-master key)
  - Two-password recovery edge cases

Operator-side prune now runs over the filesystem path (-r /srv/.../<user>/)
which bypasses rest-server's HTTP-layer append-only enforcement. No
password needed at all.

Protection model stays:
  - TLS in transit (reverse proxy)
  - HTTP basic per-user (htpasswd) for read/write authorization
  - --private-repos for per-user URL isolation
  - --append-only for client-side delete protection
  - LUKS / disk-level for at-rest encryption (operator's responsibility)

Verified end-to-end on john: pull → push → restore round-trip works,
DELETE on bogus snapshot still returns 403 (append-only intact),
operator can read repo via filesystem path (prune-mode access works).

33 pytest still green.
2026-06-04 22:23:40 +02:00
claude-timemachine ffdfb1f9b6 pivot to Python: replace Kotlin/JVM with stdlib zipapp
CI / test (3.10) (push) Successful in 40s
CI / test (3.11) (push) Successful in 19s
CI / test (3.12) (push) Successful in 23s
CI / build-pyz (push) Successful in 4s
CI / release (push) Has been skipped
Reasons stacked up:
  - AV: unsigned JARs that auto-download binaries + upload files trigger
    Windows Defender false-positives more often than Python scripts
    invoked by code-signed python.exe.
  - Qt UI option: PySide6 opens a path to a real Qt UI (matching Prism's
    look) if needed later. JVM Qt bindings are abandoned.
  - frazclient already needs Python; inlining as 'import cloud_sync' is
    zero overhead vs the launcher always shelling out to java.

Implementation:
  - cloud_sync package: cli.py (argparse), creds.py, scope.py,
    restic.py (binary discovery + auto-download + sha256 verify),
    sync.py (pull/push subprocess restic).
  - pyproject.toml with hatchling backend; pip-installable.
  - Makefile builds cloud-sync.pyz via python -m zipapp (~53 KB).
  - 33 pytest tests, stdlib only on runtime.
  - CI workflow runs pytest matrix (3.10/3.11/3.12) + builds pyz.
  - DESIGN.md + README.md updated to reflect Python.

E2E verified against local restic-rest-server:
  pull empty → push initial → rm -rf local → pull restores → modify+push
  creates second snapshot → client forget --prune blocked by --append-only.

Throws away ~565 LOC of Kotlin (and 18 jar tests) committed earlier in
this same session. Net result is ~250 LOC Python + 33 tests = smaller
and more aligned with the rest of the stack.
2026-06-03 01:11:47 +02:00
claude-timemachine 171ea8f47a feat(sync): embed basic-auth credentials in restic URL
CI / build (push) Failing after 3s
CI / release (push) Has been skipped
2026-06-02 22:47:43 +02:00
claude-timemachine 31062e98b9 feat: CLI parser, restic discovery+download, pull/push via restic CLI
CI / build (push) Failing after 2s
CI / release (push) Has been skipped
- Args.kt: parses --url, --pack-folder, --token-file, --restic-binary,
    --no-download, -g/--no-gui. Inline and space-separated value forms.
  - Restic.kt: locates restic via 1) --restic-binary override, 2) cached
    <pack-folder>/.cloud-sync/restic-<ver>, 3) system PATH (version match),
    4) auto-download from github releases + sha256 verify against SHA256SUMS.
    bz2 decompression via commons-compress (bzcat fallback).
  - Scope.kt: per-distribution cloud-scope.json with sensible defaults
    (options.txt, config/, journeymap/data/, screenshots/). Auto-excludes
    .cloud-sync/ so we never leak our own credentials.
  - Sync.kt: pull = restic restore latest --target <pack-folder>;
    push = restic backup --files-from <generated> --exclude-file <generated>.
    Empty repos handled (pull is no-op when no snapshots yet).
  - 18 tests pass. Fat jar grew to 6 MB (commons-compress).
2026-06-02 22:41:00 +02:00
claude-timemachine df02f8a441 design: lock client on-disk layout under <pack-folder>/.cloud-sync/
CI / build (push) Failing after 2s
CI / release (push) Has been skipped
Per-instance isolation (different Discord accounts for different MC
instances), auto-excluded from cloud sync, single 'rm -rf' reset.
Restic binary discovery probes pinned path → $PATH → upstream download.
2026-06-02 22:33:25 +02:00
claude-timemachine 14a6c5004b design: lock all pre-implementation decisions
CI / build (push) Failing after 3s
CI / release (push) Has been skipped
- Server-side prune via per-repo operator master key (restic key add at provision time)
- Auto-download restic on first run (packwiz-installer-bootstrap pattern)
- Nightly prune at 04:00 UTC via in-process time.Ticker
- Per-caller provisioning tokens (CLOUD_PROVISIONING_TOKENS_<NAME>) for audit attribution; NOT shared
2026-06-02 21:35:56 +02:00
claude-timemachine d9a6057c75 design: reshape cloud-svc as control plane (two-port split)
CI / build (push) Failing after 3s
CI / release (push) Has been skipped
Earlier draft archived cloud-svc entirely. Better shape: keep it as a
control plane for the restic backend. Two listeners in one process:

  - provisioning :9091 on automc-net (called by discord-bot)
  - operator     :9092 on 127.0.0.1 (called by automc-setup wizard)

Players still hit restic-rest-server (data plane) directly with their
per-user password. cloud-svc never sits in the player data path —
limits its public exposure to zero.
2026-06-02 21:19:45 +02:00
claude-timemachine 698a7a037c design: pivot to restic-rest-server as the backend
CI / build (push) Failing after 3s
CI / release (push) Has been skipped
cloud-svc was a worse re-implementation of what restic-rest-server
already does (--private-repos + --append-only + native retention +
chunk-level dedup). Pivoting before either ships in production.

cloud-sync.jar becomes a restic CLI wrapper. ~200 LOC instead of
~2000+ in the custom-server path. Server-side prune via operator
master password (option 1 — multi-key per repo).

Open questions flagged at end of doc for confirmation.
2026-06-02 20:44:48 +02:00
claude-timemachine ed4115cba8 rename: cloud-installer → cloud-sync
CI / build (push) Failing after 3s
CI / release (push) Has been skipped
'installer' implied one-way install (matching packwiz-installer); this
tool is bidirectional sync (pull on launch, push on exit). Aligns with
the existing automc <scope>-<role> pattern: cloud-svc ↔ cloud-sync,
matching mc-router, mc-wrapper, gate-waker.

Gitea repo renamed via API (id 2974 preserved); jar filename now
cloud-sync-<version>.jar. Build verified post-rename.
2026-06-02 20:25:27 +02:00
claude-timemachine 6ab43a168e initial: Kotlin/Gradle skeleton for cloud-installer
CI / build (push) Failing after 24s
CI / release (push) Has been skipped
Compiles to a 3.4 MB fat jar via shadow plugin.
Entrypoint with CLI dispatch (pull/push subcommands) + FlatLaf init.
Real sync logic stubbed; lands in subsequent commits per task plan.

Build via containerized gradle (8.10.2 + jdk21) to sidestep the
Kotlin 2.1 + JDK 26 compiler crash. Documented in README.

CI workflow tags-only release artifact upload prepared (needs
RELEASE_TOKEN secret in repo settings before first tag).
2026-06-02 20:16:40 +02:00