projectbootstrap

package
v0.0.0-...-c671013 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package projectbootstrap owns the shared .sofarpc project-initialization workflow used by both CLI project setup and MCP init_project.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoConfigFields      = errors.New("no project config fields resolved")
	ErrProfileNameRequired = errors.New("profile name is required")
	ErrProfileNoFields     = errors.New("profile has no target or invocation fields")
)

Functions

func HasConfigFields

func HasConfigFields(cfg projectconfig.Config) bool

Types

type ExistingConfigError

type ExistingConfigError struct {
	Path string
}

func (ExistingConfigError) Error

func (e ExistingConfigError) Error() string

type ExistingProfileError

type ExistingProfileError struct {
	Path string
	Name string
}

ExistingProfileError signals that a same-named profile already exists in the target file and force was not set. Adding a new profile is never destructive, so only an overwrite trips this.

func (ExistingProfileError) Error

func (e ExistingProfileError) Error() string

type GitignoreResult

type GitignoreResult struct {
	Path        string
	Entry       string
	Changed     bool
	WouldChange bool
}

type Input

type Input struct {
	ProjectRoot         string
	Kind                projectconfig.Kind
	Config              projectconfig.Config
	Force               bool
	DryRun              bool
	RequireConfigFields bool
}

type ProfileInput

type ProfileInput struct {
	ProjectRoot string
	Kind        projectconfig.Kind
	Name        string
	Profile     projectconfig.ProfileConfig
	SetDefault  bool
	Force       bool
	DryRun      bool
}

ProfileInput describes a merge-into-existing write of a single named Target Profile. Force is required only to overwrite a pre-existing same-named profile; adding a new profile (even to an existing file) is non-destructive.

type ProfileNotDefinedError

type ProfileNotDefinedError struct {
	Name      string
	Available []string
}

ProfileNotDefinedError signals that `profile use` (default selection) named a profile defined in neither config file. It never falls through to base.

func (ProfileNotDefinedError) Error

func (e ProfileNotDefinedError) Error() string

type ProfileResult

type ProfileResult struct {
	ProjectRoot    string
	Kind           projectconfig.Kind
	Name           string
	Config         projectconfig.Config
	ConfigPath     string
	ConfigBody     []byte
	DryRun         bool
	FileExisted    bool
	ProfileExisted bool
	Wrote          bool
	SetDefault     bool
	Gitignore      *GitignoreResult
}

func WriteProfile

func WriteProfile(in ProfileInput) (ProfileResult, error)

WriteProfile reads the project config file of the given kind, sets profiles[Name]=Profile (optionally DefaultProfile=Name), and rewrites the file preserving every other field — the base target settings, other profiles, and an explicit allowedServices. An unparseable existing file is an error rather than being clobbered.

type Result

type Result struct {
	ProjectRoot string
	Kind        projectconfig.Kind
	Config      projectconfig.Config
	ConfigPath  string
	ConfigBody  []byte
	DryRun      bool
	Existing    bool
	Wrote       bool
	Overwrote   bool
	Gitignore   *GitignoreResult
}

func Run

func Run(in Input) (Result, error)

type UseProfileInput

type UseProfileInput struct {
	ProjectRoot string
	Name        string
	DryRun      bool
}

UseProfileInput describes the `profile use` operation: set the persisted DefaultProfile to an already-defined profile. The default always lands in config.local.json (a personal selection), and the named profile must be defined in either file or it errors rather than persisting an undefined default (which would only resurface as a hard error at resolve time).

type UseProfileResult

type UseProfileResult struct {
	ProjectRoot string
	Name        string
	Config      projectconfig.Config
	ConfigPath  string
	ConfigBody  []byte
	DryRun      bool
	Wrote       bool
	Available   []string
	Gitignore   *GitignoreResult
}

func UseProfile

func UseProfile(in UseProfileInput) (UseProfileResult, error)

UseProfile writes DefaultProfile=Name into config.local.json after verifying Name is defined across the shared and local files.

Jump to

Keyboard shortcuts

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