workspace

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package workspace loads the analysis inputs strictcode reconstructs from disk (DESIGN.md section 6.6): the rlsbl workspace file (.rlsbl-monorepo/workspace.toml) when present, the per-member manifests (pyproject.toml, package.json, go.mod), declared dependency scopes, and manifest-declared entry points. Nothing is passed at runtime by any caller; everything is read, not owned.

Without a workspace file, the root is a single-project scan: one synthesized member named "_" at path ".".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeclaredDep

type DeclaredDep struct {
	Name  string
	Scope DepScope
}

DeclaredDep is one manifest-declared dependency, as written (registry name) with its scope.

type DepScope

type DepScope string

DepScope is a declared dependency's scope (vocabulary enum dependency_scope).

const (
	ScopeRuntime  DepScope = "runtime"
	ScopeDev      DepScope = "dev"
	ScopePeer     DepScope = "peer"
	ScopeExplicit DepScope = "explicit"
)

func (DepScope) Optional

func (s DepScope) Optional() bool

Optional reports whether guards may satisfy this scope (lessons 1-2: only dev/peer deps are optional; runtime/explicit are hard).

type EntryPoint

type EntryPoint struct {
	// Form is a vocabulary entry_point_form value: script, gui_script,
	// export, bin, main_package.
	Form string
	// Name is the declared name (script key, bin key, export subpath, or
	// package path for Go main packages).
	Name string
	// Target is the raw declared target: "pkg.mod:func" for Python scripts,
	// a file path for npm entries.
	Target string
}

EntryPoint is one manifest-declared entry point.

type Manifest

type Manifest struct {
	Lang vocab.Lang
	// Path is the manifest file path relative to the workspace root.
	Path string
	// Name is the manifest-declared package name (the registry name):
	// pyproject [project.name], package.json name. Empty for go.mod.
	Name string
	// GoModulePath is the module path from go.mod (Go only).
	GoModulePath string
	Deps         []DeclaredDep
	EntryPoints  []EntryPoint
}

Manifest is one language's manifest within a member.

func ParseGoMod

func ParseGoMod(wsRoot, relPath string) (*Manifest, error)

ParseGoMod parses a go.mod at relPath (workspace-root-relative): module path and require directives (all runtime scope — Go has no dev-dependency concept in go.mod). Also used by the Go extractor for nested modules within a member.

type Member

type Member struct {
	// Name is the workspace member name ("_" for single-project scans).
	Name string
	// Path is the member root relative to the workspace root ("." allowed).
	Path       string
	Library    bool
	DevOnly    bool
	Releasable bool // belongs to a releasable group (published externally)
	// ImportName is the explicit Python import-name override from
	// workspace.toml (resolution order step 3).
	ImportName string
	// RegistryNameOverride is workspace.toml's registry_name, when set.
	RegistryNameOverride string
	// LintAllow is the per-member allow list for library-forbidden-imports.
	LintAllow []string
	// Manifests maps each language present in the member to its manifest.
	Manifests map[vocab.Lang]*Manifest
}

Member is one workspace member (or the synthesized single-project member).

func (*Member) RegistryName

func (m *Member) RegistryName(lang vocab.Lang) string

RegistryName returns the member's registry name for a language: the workspace override when set, else the manifest-declared name.

type Workspace

type Workspace struct {
	// Root is the absolute workspace root.
	Root string
	// Single is true for single-project scans (no workspace.toml).
	Single bool
	// Members in workspace declaration order (single synthesized member for
	// single-project scans).
	Members []*Member
}

Workspace is the loaded analysis input.

func Load

func Load(root string) (*Workspace, error)

Load reads the workspace at root. A missing workspace file means single-project mode; a malformed one is a hard error.

func (*Workspace) MemberByName

func (w *Workspace) MemberByName(name string) *Member

MemberByName returns the named member, or nil.

Jump to

Keyboard shortcuts

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