# Scratchpad — issue #387 updater simplification + Gitea wrapper repo context

- Objective: simplify updater behavior to `@mosaicstack/mosaic` only, and fix Gitea wrapper scripts so merge/CI/issue operations work reliably when tea needs explicit repo/login context.
- Scope:
  - `packages/mosaic/src/runtime/update-checker.ts`
  - `packages/mosaic/__tests__/update-checker.test.ts`
  - any package metadata/version bumps needed
  - repo-source git wrappers under `packages/mosaic/framework/tools/git/`
- Constraints:
  - Jason approved breaking changes; legacy `@mosaicstack/cli` support is out of scope.
  - Keep changes focused and mergeable.
- Acceptance:
  - updater only targets `@mosaicstack/mosaic`
  - wrapper path works on Gitea in this environment without manual repo guessing
  - PR merges squash-only after green CI

## Progress

### 2026-04-04

#### Update Checker Simplification (DONE)

- Removed `LEGACY_PKG`, `INSTALLED_PACKAGE_ORDER` constants — only `PKG = '@mosaicstack/mosaic'` remains
- `getInstalledVersion()` — removed loop over multiple packages, only checks `@mosaicstack/mosaic`
- `getLatestVersion()` — removed `installedPackage` parameter and candidate iteration; single query for `@mosaicstack/mosaic`
- `checkForUpdate()` — removed `currentPackage`-based cache key comparison; cache is now package-agnostic
- `RegistryCache` — removed `currentPackage` and `targetPackage` fields
- `formatUpdateNotice()` — removed `targetChanged` branch (package migration notice no longer relevant)
- All legacy fallback/compatibility logic removed

#### Test Updates (DONE)

- Removed legacy `@mosaicstack/cli` fallback test
- Removed cache cross-contamination test (was testing legacy→modern package transition)
- Added `does not query legacy @mosaicstack/cli package` test — asserts no `@mosaicstack/cli` npm commands are issued
- Added `returns empty result when package is not installed` test
- All 8 tests pass ✅

#### Gitea Wrapper Fixes (DONE)

- `pr-merge.sh`:
  - Added `OWNER=$(get_repo_owner)` / `REPO=$(get_repo_name)` before case block
  - tea merge command now includes `--repo $OWNER/$REPO --login ${GITEA_LOGIN:-mosaicstack}`
- `issue-close.sh`:
  - Added `OWNER=$(get_repo_owner)` / `REPO=$(get_repo_name)` after detect_platform
  - Both `tea issue comment` and `tea issue close` now include `--repo "$OWNER/$REPO" --login "${GITEA_LOGIN:-mosaicstack}"`
- `pr-ci-wait.sh`: No changes needed — uses curl API calls (not tea), already passes owner/repo correctly
- `detect-platform.sh`: No changes needed — provides the `get_repo_owner`/`get_repo_name` functions used by wrappers

#### Verification

- `vitest run` — 8/8 tests pass
- `tsc --noEmit` — no errors in update-checker.ts (pre-existing workspace dep errors unrelated)
- `eslint` — clean, no warnings
