{"modulePath":"github.com/hex1n/sofarpc-cli","version":"v0.0.0-20261202072051-c67101320811","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package projectbootstrap\n\nPackage projectbootstrap owns the shared .sofarpc project-initialization workflow used by both CLI project setup and MCP init\\_project.\n\n## Variables\n\n```go\nvar (\n\tErrNoConfigFields      = errors.New(\"no project config fields resolved\")\n\tErrProfileNameRequired = errors.New(\"profile name is required\")\n\tErrProfileNoFields     = errors.New(\"profile has no target or invocation fields\")\n)\n```\n\n## Functions\n\n```go\nfunc HasConfigFields(cfg projectconfig.Config) bool\n```\n\n## Types\n\n```go\ntype ExistingConfigError struct {\n\tPath string\n}\n```\n\n```go\nfunc (e ExistingConfigError) Error() string\n```\n\n```go\ntype ExistingProfileError struct {\n\tPath string\n\tName string\n}\n```\nExistingProfileError 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.\n\n```go\nfunc (e ExistingProfileError) Error() string\n```\n\n```go\ntype GitignoreResult struct {\n\tPath        string\n\tEntry       string\n\tChanged     bool\n\tWouldChange bool\n}\n```\n\n```go\ntype Input struct {\n\tProjectRoot         string\n\tKind                projectconfig.Kind\n\tConfig              projectconfig.Config\n\tForce               bool\n\tDryRun              bool\n\tRequireConfigFields bool\n}\n```\n\n```go\ntype ProfileInput struct {\n\tProjectRoot string\n\tKind        projectconfig.Kind\n\tName        string\n\tProfile     projectconfig.ProfileConfig\n\tSetDefault  bool\n\tForce       bool\n\tDryRun      bool\n}\n```\nProfileInput 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.\n\n```go\ntype ProfileNotDefinedError struct {\n\tName      string\n\tAvailable []string\n}\n```\nProfileNotDefinedError signals that \\`profile use\\` (default selection) named a profile defined in neither config file. It never falls through to base.\n\n```go\nfunc (e ProfileNotDefinedError) Error() string\n```\n\n```go\ntype ProfileResult struct {\n\tProjectRoot    string\n\tKind           projectconfig.Kind\n\tName           string\n\tConfig         projectconfig.Config\n\tConfigPath     string\n\tConfigBody     []byte\n\tDryRun         bool\n\tFileExisted    bool\n\tProfileExisted bool\n\tWrote          bool\n\tSetDefault     bool\n\tGitignore      *GitignoreResult\n}\n```\n\n```go\nfunc WriteProfile(in ProfileInput) (ProfileResult, error)\n```\nWriteProfile 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.\n\n```go\ntype Result struct {\n\tProjectRoot string\n\tKind        projectconfig.Kind\n\tConfig      projectconfig.Config\n\tConfigPath  string\n\tConfigBody  []byte\n\tDryRun      bool\n\tExisting    bool\n\tWrote       bool\n\tOverwrote   bool\n\tGitignore   *GitignoreResult\n}\n```\n\n```go\nfunc Run(in Input) (Result, error)\n```\n\n```go\ntype UseProfileInput struct {\n\tProjectRoot string\n\tName        string\n\tDryRun      bool\n}\n```\nUseProfileInput 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).\n\n```go\ntype UseProfileResult struct {\n\tProjectRoot string\n\tName        string\n\tConfig      projectconfig.Config\n\tConfigPath  string\n\tConfigBody  []byte\n\tDryRun      bool\n\tWrote       bool\n\tAvailable   []string\n\tGitignore   *GitignoreResult\n}\n```\n\n```go\nfunc UseProfile(in UseProfileInput) (UseProfileResult, error)\n```\nUseProfile writes DefaultProfile=Name into config.local.json after verifying Name is defined across the shared and local files.\n\n","path":"github.com/hex1n/sofarpc-cli/internal/core/projectbootstrap","name":"projectbootstrap","synopsis":"Package projectbootstrap owns the shared .sofarpc project-initialization workflow used by both CLI project setup and MCP init_project.","isRedistributable":true}
