bootstrap

package
v0.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 12 Imported by: 0

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

FS is the file system implementation used by this package. Override in tests with a testable.MockFileSystem.

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

func AppendAgentSnippet(repoPath string) (Action, error)

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) (Action, error)

GenerateConfig renders and writes .stringer.yaml to the repo root. Returns the Action taken ("created", "skipped").

func GenerateMCPConfig added in v0.6.0

func GenerateMCPConfig(repoPath string) (Action, error)

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

type GitHubRemote struct {
	Owner string
	Repo  string
}

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 InitConfig

type InitConfig struct {
	RepoPath string
	Force    bool
}

InitConfig holds the inputs for the init command.

type InitResult

type InitResult struct {
	Actions   []Action
	Language  string
	HasGitHub bool
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL