Documentation
¶
Overview ¶
Package bootstrap implements the `stringer init` command, which detects repository characteristics and generates a starter configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var FS testable.FileSystem = testable.DefaultFS
FS is the file system implementation used by this package. Override in tests with a testable.MockFileSystem.
var GitOpener testable.GitOpener = testable.DefaultGitOpener
GitOpener is the opener used to access git repositories in the bootstrap package. Defaults to testable.DefaultGitOpener. Tests can replace this to inject mocks.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
File string // e.g. ".stringer.yaml", "AGENTS.md"
Operation string // "created", "updated", "skipped"
Description string // human-readable detail
}
Action records a single file operation performed during init.
func AppendAgentSnippet ¶
AppendAgentSnippet appends the stringer integration snippet to AGENTS.md. It uses marker comments for idempotency:
- If AGENTS.md has the markers: skip (already present)
- If AGENTS.md exists, no markers: append snippet
- If no AGENTS.md: create minimal file with snippet
func GenerateConfig ¶
func GenerateConfig(repoPath string, hasGitHub bool, force bool, wizard *WizardResult) (Action, error)
GenerateConfig renders and writes .stringer.yaml to the repo root. If wizard is non-nil, uses wizard selections; otherwise uses auto-detected defaults. Returns the Action taken ("created", "skipped").
func GenerateMCPConfig ¶ added in v0.6.0
GenerateMCPConfig generates or updates .mcp.json with a stringer MCP server entry. It only acts when Claude Code is detected (presence of .claude/ directory).
type GitHubRemote ¶
GitHubRemote holds the parsed owner/repo from a GitHub remote URL.
func DetectGitHubRemote ¶
func DetectGitHubRemote(repoPath string) *GitHubRemote
DetectGitHubRemote opens the git repository at repoPath and checks whether the origin remote points to GitHub. Returns nil (not an error) when the directory is not a git repo or the remote is not GitHub.
type HTTPClient ¶ added in v0.9.0
HTTPClient is an interface for HTTP requests, allowing test injection.
type InitConfig ¶
type InitConfig struct {
RepoPath string
Force bool
Interactive bool // Run the interactive wizard.
Stdin io.Reader // For wizard prompts (required if Interactive).
Stdout io.Writer // For wizard output (required if Interactive).
}
InitConfig holds the inputs for the init command.
type InitResult ¶
InitResult holds the outcome of an init run.
func Run ¶
func Run(cfg InitConfig) (*InitResult, error)
Run orchestrates the init process: detect repo characteristics, generate config, and append the AGENTS.md snippet.