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 ¶
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 ¶
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 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 ¶
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
}
type UseProfileInput ¶
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.