initcmd¶
import "github.com/jbcom/radioactive-ralph/internal/initcmd"
Package initcmd implements `radioactive_ralph init` — the per-repo setup wizard.
Responsibilities:
Resolve operator preferences for each capability bias category (review, security review, docs query, brainstorm, debugging). Single-candidate slots auto-select; multi-candidate slots defer to the caller-provided Resolver (interactive prompts in the CLI, scripted answers in tests).
Write .radioactive-ralph/config.toml (committed) and local.toml (gitignored) with frontmatter comments naming alternatives for later review.
Scaffold .radioactive-ralph/plans/ with a starter index.md so non-Fixit variants have the plans structure they refuse to run without.
Append .radioactive-ralph/local.toml to the repo’s .gitignore.
Refuse to clobber an existing config unless Force is true; support –refresh to re-discover capabilities while preserving the operator’s choices.
Index¶
type Options¶
Options drives Init.
type Options struct {
// RepoRoot is the absolute path to the operator's repo. The
// .radioactive-ralph/ tree is created directly under it.
RepoRoot string
// Inventory is the pre-discovered capability snapshot. Callers can
// pass inventory.Discover(...).
Inventory inventory.Inventory
// Resolver handles multi-candidate category questions. If nil and
// any category has multiple candidates, Init returns an error
// rather than silently dropping the ambiguity.
Resolver Resolver
// Force overwrites an existing config.toml. Without this, Init
// refuses to clobber prior operator work.
Force bool
// Refresh rewrites config.toml from scratch but preserves existing
// operator choices from any prior config.toml that loaded cleanly.
Refresh bool
}
type Resolver¶
Resolver is the side-channel that asks the operator to pick between multiple candidate skills when a category has more than one install. The CLI wires it to stdin prompts; tests wire it to a deterministic map lookup.
Called once per multi-candidate category. Returning “” marks that category as “no preference”; returning a value that isn’t in candidates is treated as “disabled” (added to DisabledBiases).
type Resolver func(category variant.BiasCategory, candidates []string) (string, error)
type Result¶
Result summarizes what Init did.
type Result struct {
ConfigPath string
LocalPath string
PlansPath string
GitIgnore string
Choices map[variant.BiasCategory]string
Disabled []string
}
func Init¶
func Init(opts Options) (Result, error)
Init runs the wizard against Options. Returns a Result describing the paths it touched and the resolved choices.
Generated by gomarkdoc