Skip to main content

Module bootstrap

Module bootstrap 

Source
Expand description

First-startup install + post-upgrade refresh hooks for the plugin marketplace layer.

Two distinct user journeys land here:

  1. Fresh install — atomcode runs for the first time on a host that has never run it. The marker file $ATOMCODE_HOME/.plugin_bootstrap_v1 does not exist. We git clone the default atomcode-skills marketplace and touch the marker. Failure (no network, no git on PATH, upstream down) is logged and swallowed — startup proceeds without skills.

  2. Existing user, just upgradedapply_pending_upgrade re-exec’d into the new binary and set ATOMCODE_UPGRADED_FROM. We git pull --ff-only every installed marketplace so the skills track the new binary. Same swallowed-failure semantics.

The marker file makes (1) a one-time event. If the user later runs /plugin uninstall atomcode-skills, the marker stays and we respect their intent — no re-install on subsequent startups. To force a re-bootstrap, the user can rm $ATOMCODE_HOME/.plugin_bootstrap_v1.

Both functions are best-effort and never propagate errors — atomcode must remain usable on offline machines, in air-gapped corporate environments, on systems without git, etc.

Constants§

DEFAULT_SKILLS_URL
Public git URL for the default skills marketplace. The plugin installer dispatches on the SOURCE field (the URL we cloned from), so this string is the identity of the “default skills” entry.

Functions§

run_startup_hooks
Entry point for both Plan A (auto-install default skills) and Plan B (auto-update marketplaces after upgrade). Call once at startup AFTER Config::load and AFTER any pending self-upgrade has re-exec’d. Synchronous — runs git subprocesses inline; budget roughly 1-3 s on a warm path, longer on first install.