Scanning a non-default branch (branch-aware sync)

By default kospex is not branch-aware. kospex sync records the files and dependencies of whatever is currently checked out on disk, and it does not track every branch or every commit. If a client (or an environment) runs off a development branch rather than main, you can still get an accurate open source inventory with a small manual workflow.

This is a documented workaround until full branch awareness and all-commit tracking land.

The short version

For each repo, check out the branch you care about, then re-sync, then run the inventory:

# per repo
git checkout development
kospex sync .

# once every repo is on development and synced
krunner osi -all

After this, both halves of the inventory agree: the list of files scanned and the dependency versions reported are both taken from the development branch.

Why the re-sync is required

krunner osi gets its results from two places:

If you only switch branches without re-syncing, you get development versions for the files that already existed on main, but you miss any dependency files that only exist on development, and you may hit errors on files that development removed. Re-syncing rebuilds the file list from the branch you have checked out, so the two halves line up.

Good to know:

Caveats