Help us shape the future of Go! Take the 2026 Go Developer Survey

workspace

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

README

internal/workspace/

Workspace parsing + safe file IO.

Current baseline responsibilities:

  • validate absolute workspace root path
  • require workspace.yaml in workspace root
  • parse workspace.yaml
  • run semantic checks: duplicate names, version, path|git_url invariants
  • apply defaults (docs.imports_path)
  • protect filesystem scope to workspace root (Resolve, ReadFile, WriteFile)
  • create fixed MVP workspace layout (EnsureLayout)

Documentation

Index

Constants

View Source
const (
	BaselineBundleManifestPath = "skills/bundle-manifest.json"
)
View Source
const ManifestFileName = "workspace.yaml"

Variables

View Source
var (
	ErrPathTraversal = errors.New("path escapes workspace root")
	ErrPathAbsolute  = errors.New("absolute paths are not allowed for workspace-relative operations")
)
View Source
var (
	ErrWorkspaceRequired = errors.New("workspace path is required")
	ErrWorkspaceAbsolute = errors.New("workspace path must be absolute")
	ErrWorkspaceNotDir   = errors.New("workspace path must point to a directory")
	ErrManifestMissing   = errors.New("workspace.yaml is required in workspace root")
)

Functions

func BaselinePromptPack

func BaselinePromptPack(name string) (string, bool)

func BaselineSubagentsContent

func BaselineSubagentsContent() []byte

func RenderManifest

func RenderManifest(manifest Manifest) ([]byte, error)

Types

type BaselineBundleManifest

type BaselineBundleManifest struct {
	SchemaVersion        int                         `json:"schema_version"`
	BundleVersion        int                         `json:"bundle_version"`
	PromptSurfacePolicy  BaselinePromptSurfacePolicy `json:"prompt_surface_policy"`
	PromptPacks          []string                    `json:"prompt_packs,omitempty"`
	ReferenceOnlyPrompts []string                    `json:"reference_only_prompts,omitempty"`
	EditableArtifacts    []BaselineEditableArtifact  `json:"editable_artifacts,omitempty"`
}

func EmbeddedBaselineBundleManifest

func EmbeddedBaselineBundleManifest() BaselineBundleManifest

type BaselineEditableArtifact

type BaselineEditableArtifact struct {
	Path        string `json:"path"`
	Label       string `json:"label"`
	Category    string `json:"category"`
	PromptUsage string `json:"prompt_usage,omitempty"`
}

type BaselinePromptSurfacePolicy

type BaselinePromptSurfacePolicy struct {
	LiveHeadlessSource   string `json:"live_headless_source"`
	ReferenceOnlyPattern string `json:"reference_only_pattern"`
}

type Diagnostic

type Diagnostic struct {
	Level      DiagnosticLevel `json:"level"`
	Code       string          `json:"code"`
	Message    string          `json:"message"`
	Repo       string          `json:"repo,omitempty"`
	Path       string          `json:"path,omitempty"`
	Suggestion string          `json:"suggestion,omitempty"`
}

type DiagnosticLevel

type DiagnosticLevel string
const (
	DiagnosticError   DiagnosticLevel = "error"
	DiagnosticWarning DiagnosticLevel = "warning"
)

type DocsConfig

type DocsConfig struct {
	ImportsPath string `yaml:"imports_path,omitempty" json:"imports_path,omitempty"`
}

type GitExecutor

type GitExecutor interface {
	EnsureAvailable() error
	Run(ctx context.Context, dir string, args ...string) (string, error)
}

type Manifest

type Manifest struct {
	Version int            `yaml:"version" json:"version"`
	Repos   []RepoSource   `yaml:"repos" json:"repos"`
	Docs    DocsConfig     `yaml:"docs" json:"docs"`
	Runtime *RuntimeConfig `yaml:"runtime,omitempty" json:"runtime,omitempty"`
}

func LoadManifest

func LoadManifest(path string) (Manifest, error)

func ParseManifest

func ParseManifest(raw []byte) (Manifest, error)

type RepoAnalysisConfig

type RepoAnalysisConfig struct {
	Include []string `yaml:"include,omitempty" json:"include,omitempty"`
	Exclude []string `yaml:"exclude,omitempty" json:"exclude,omitempty"`
}

func (*RepoAnalysisConfig) IsZero

func (cfg *RepoAnalysisConfig) IsZero() bool

type RepoSource

type RepoSource struct {
	Name     string              `yaml:"name" json:"name"`
	Path     string              `yaml:"path,omitempty" json:"path,omitempty"`
	GitURL   string              `yaml:"git_url,omitempty" json:"git_url,omitempty"`
	Ref      string              `yaml:"ref,omitempty" json:"ref,omitempty"`
	Analysis *RepoAnalysisConfig `yaml:"analysis,omitempty" json:"analysis,omitempty"`
}

type ResolveOptions

type ResolveOptions struct {
	FetchGit   bool
	VerifyRefs bool
	Git        GitExecutor
}

type ResolvedRepo

type ResolvedRepo struct {
	Name   string `json:"name"`
	Source string `json:"source"`
	Path   string `json:"path"`
	Ref    string `json:"ref,omitempty"`
}

type Root

type Root struct {
	Path         string
	ManifestPath string
	Manifest     Manifest
}

func Open

func Open(root string) (Root, error)

func (Root) EffectiveBaselineBundleManifest

func (r Root) EffectiveBaselineBundleManifest() (BaselineBundleManifest, []Diagnostic)

func (Root) EnsureBaselineBundle

func (r Root) EnsureBaselineBundle() error

func (Root) EnsureBaselineSupportBundle

func (r Root) EnsureBaselineSupportBundle() error

func (Root) EnsureLayout

func (r Root) EnsureLayout() error

func (Root) ReadFile

func (r Root) ReadFile(relPath string) ([]byte, error)

func (Root) Resolve

func (r Root) Resolve(relPath string) (string, error)

func (Root) ResolveRepoSources

func (r Root) ResolveRepoSources(ctx context.Context, options ResolveOptions) ([]ResolvedRepo, []Diagnostic)

func (Root) Validate

func (r Root) Validate(ctx context.Context, options ValidateOptions) ValidationReport

func (Root) WriteFile

func (r Root) WriteFile(relPath string, content []byte) error

type RuntimeConfig

type RuntimeConfig struct {
	Profile *RuntimeProfileConfig `yaml:"profile,omitempty" json:"profile,omitempty"`
}

func (*RuntimeConfig) IsZero

func (cfg *RuntimeConfig) IsZero() bool

type RuntimeExecutionConfig

type RuntimeExecutionConfig struct {
	Strategy       string                       `yaml:"strategy,omitempty" json:"strategy,omitempty"`
	MaxParallel    *int                         `yaml:"max_parallel_tasks,omitempty" json:"max_parallel_tasks,omitempty"`
	FailurePolicy  string                       `yaml:"failure_policy,omitempty" json:"failure_policy,omitempty"`
	ShardDiscovery *RuntimeShardDiscoveryConfig `yaml:"shard_discovery,omitempty" json:"shard_discovery,omitempty"`
}

func (*RuntimeExecutionConfig) IsZero

func (cfg *RuntimeExecutionConfig) IsZero() bool

type RuntimePermissionsConfig added in v0.1.1

type RuntimePermissionsConfig struct {
	Mode            string `yaml:"mode,omitempty" json:"mode,omitempty"`
	ApprovalChannel string `yaml:"approval_channel,omitempty" json:"approval_channel,omitempty"`
}

func (*RuntimePermissionsConfig) IsZero added in v0.1.1

func (cfg *RuntimePermissionsConfig) IsZero() bool

type RuntimeProfileConfig

type RuntimeProfileConfig struct {
	Timeouts    *RuntimeTimeoutsConfig    `yaml:"timeouts,omitempty" json:"timeouts,omitempty"`
	Execution   *RuntimeExecutionConfig   `yaml:"execution,omitempty" json:"execution,omitempty"`
	Steps       *RuntimeStepsConfig       `yaml:"steps,omitempty" json:"steps,omitempty"`
	Permissions *RuntimePermissionsConfig `yaml:"permissions,omitempty" json:"permissions,omitempty"`
}

func (*RuntimeProfileConfig) IsZero

func (cfg *RuntimeProfileConfig) IsZero() bool

type RuntimeShardDiscoveryConfig

type RuntimeShardDiscoveryConfig struct {
	Mode string `yaml:"mode,omitempty" json:"mode,omitempty"`
}

type RuntimeStepConfig

type RuntimeStepConfig struct {
	Provider string `yaml:"provider,omitempty" json:"provider,omitempty"`
}

func (*RuntimeStepConfig) IsZero

func (cfg *RuntimeStepConfig) IsZero() bool

type RuntimeStepsConfig

type RuntimeStepsConfig struct {
	Step0Constitution *RuntimeStepConfig `yaml:"step0_constitution,omitempty" json:"step0_constitution,omitempty"`
	Step1Collect      *RuntimeStepConfig `yaml:"step1_collect,omitempty" json:"step1_collect,omitempty"`
	Step2AsIs         *RuntimeStepConfig `yaml:"step2_as_is,omitempty" json:"step2_as_is,omitempty"`
	Step3Findings     *RuntimeStepConfig `yaml:"step3_findings,omitempty" json:"step3_findings,omitempty"`
	Step4Proposals    *RuntimeStepConfig `yaml:"step4_proposals,omitempty" json:"step4_proposals,omitempty"`
	QA                *RuntimeStepConfig `yaml:"qa,omitempty" json:"qa,omitempty"`
}

func (*RuntimeStepsConfig) IsZero

func (cfg *RuntimeStepsConfig) IsZero() bool

type RuntimeTimeoutsConfig

type RuntimeTimeoutsConfig struct {
	StepTimeoutSec         *int `yaml:"step_timeout_sec,omitempty" json:"step_timeout_sec,omitempty"`
	HeartbeatSec           *int `yaml:"heartbeat_sec,omitempty" json:"heartbeat_sec,omitempty"`
	PipelineTimeoutSec     *int `yaml:"pipeline_timeout_sec,omitempty" json:"pipeline_timeout_sec,omitempty"`
	PipelineKillGraceSec   *int `yaml:"pipeline_kill_grace_sec,omitempty" json:"pipeline_kill_grace_sec,omitempty"`
	APIReadyTimeoutSec     *int `yaml:"api_ready_timeout_sec,omitempty" json:"api_ready_timeout_sec,omitempty"`
	APIInitTimeoutSec      *int `yaml:"api_init_timeout_sec,omitempty" json:"api_init_timeout_sec,omitempty"`
	UIInitPollTimeoutSec   *int `yaml:"ui_init_poll_timeout_sec,omitempty" json:"ui_init_poll_timeout_sec,omitempty"`
	UICancelPollTimeoutSec *int `yaml:"ui_cancel_poll_timeout_sec,omitempty" json:"ui_cancel_poll_timeout_sec,omitempty"`
}

func (*RuntimeTimeoutsConfig) IsZero

func (cfg *RuntimeTimeoutsConfig) IsZero() bool

type ValidateOptions

type ValidateOptions struct {
	ResolveRepos bool
	FetchGit     bool
	VerifyRefs   bool
}

type ValidationReport

type ValidationReport struct {
	Workspace     string         `json:"workspace"`
	OK            bool           `json:"ok"`
	Errors        []Diagnostic   `json:"errors,omitempty"`
	Warnings      []Diagnostic   `json:"warnings,omitempty"`
	ResolvedRepos []ResolvedRepo `json:"resolved_repos,omitempty"`
}

func (ValidationReport) Error

func (r ValidationReport) Error() string

Jump to

Keyboard shortcuts

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