module

Smith

Constants

VERSION = "0.4.0"

Class methods

git_root(start_dir : String = Dir.current) : String | Nil

The git root at or above start_dir, or nil outside a checkout.

The boundary two upward walks share — the one that looks for .smith/config.toml and the one that collects SMITH.md / AGENTS.md — so they cannot disagree about where the project ends.

Source
git_root?(dir : String) : Bool

Whether this directory is the root of a git checkout.

File.exists? rather than Dir.exists?, and that is the whole point: in a normal clone .git is a directory, but in a worktree and in a submodule it is a regular file holding a gitdir: line. Asking for a directory says "no" there, and a walk that stops at the git root would run past the project and up to the filesystem root — collecting another project's instructions and config on the way.

Source
home_dir

Root directory for all of smith's user-level state: global instructions, the skills catalog, saved sessions and the global config file.

Overridable via SMITH_HOME, which is what the specs use to stay clear of a developer's real ~/.smith.

Source

Nested types