You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(index): offline-first build + mcpp index status (WS3) (#155)
* feat(index): offline-first — fetch index only when entry missing, not on TTL
ensure_official_package_index_fresh no longer runs a network `xlings
update` merely because a TTL expired. It now fetches ONLY when the local
index entry for the package is MISSING (first run / never-seen package),
so steady-state commands (mcpp build) work offline once init succeeded.
Routine refresh is the user's explicit `mcpp index update`.
Fixes the Termux first-run/build hang where every build git-synced
several index repos and stalled for minutes on slow/blocked networks.
* feat(index): add offline `mcpp index status` diagnostic
A read-only, network-free snapshot of the local indexes (xim + mcpplibs):
presence, freshness vs the search TTL, age since last refresh, and on-disk
path. When an index is missing it points at the explicit `mcpp index
update`; otherwise it confirms the local copy is usable offline.
Rounds out the offline-first model: build never auto-fetches on a TTL
(prior commit), and users get a cheap way to check/refresh on demand
instead of every command hitting the network.
- src/xlings.cppm: exported IndexStatus + {default,official}_index_status
(read-only; reuses the existing refresh-marker logic).
- src/pm/index_management.cppm: index_status() formats the table + hint.
- src/cli{,/cmd_registry}.cppm: wire `mcpp index status`.
- tests/e2e/75_index_status_offline.sh: guards presence-after-init +
the offline re-run invariant.
* docs(index): record WS3 offline-first progress (P0②③ done)
* feat(index): miss-triggered refresh — fetch once when a dep isn't local
Refine the offline-first gate per review: fully offline is too strict. Keep
the common case zero-network (dependency present in the local index), but
when a requested dependency is NOT in the local index, refresh once to fetch
it — instead of failing offline.
- Announce it: the build path now calls with quiet=false, printing
'Refreshing package index — `<pkg>` not found locally (one-time)' so a
rare one-time network pause doesn't look like a silent hang. Steady-state
builds (deps present) still print nothing.
- Guard against thrash: if the index was refreshed <120s ago and the package
is still missing, upstream genuinely lacks it — don't re-run the heavy
`xlings update` per missing package in one build.
src/xlings.cppm: rework ensure_official_package_index_fresh.
src/pm/package_fetcher.cppm: quiet=false at the call site.
docs: correct the '稳态不再联网' wording to 'present→offline, missing→refresh once'.
0 commit comments