The first number is the count of modules that contain a package that imports this one.
The module count is a better indicator of popularity than the package count.
A module with 100 importing packages is counted only once instead of 100 times,
reflecting the fact that the choice to use the package was likely made only once,
not 100 times.
A '?' means that the value hasn't been computed yet.
AcquireInstanceLock takes an exclusive non-blocking flock on
`<dir>/shellboto.lock`, where dir is the parent of the configured
DB path. Returns the held *os.File — caller MUST keep it alive for
the process lifetime (closing it releases the lock). On conflict
(another instance holding the lock) returns an error with a clear
operator-facing message.
Without this, two shellboto processes pointed at the same
state.db would race on the audit hash chain — our `logMu` mutex
serializes audit writes within a process but not across processes.
Uses a dedicated lockfile rather than flock-ing state.db directly
to avoid interfering with SQLite's own POSIX advisory locks on the
DB file. Kernel auto-releases on process death (clean exit or
crash), so stale lockfiles are never a problem.
Migrate runs GORM's AutoMigrate across every model, plus a small set
of explicit one-off drops for columns that were renamed in earlier
schema changes. AutoMigrate itself is additive only (never drops);
the drops here are idempotent on fresh DBs.
Open creates or opens the SQLite DB, runs AutoMigrate for every model,
and returns the GORM handle. Callers build repositories on top of the
returned *gorm.DB.