project

package
v0.1.0-rc.41 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: BSD-3-Clause Imports: 31 Imported by: 0

Documentation

Overview

Package projectconfig finds, loads, and validates project configuration. it also runs TypeScript configuration files.

Index

Constants

View Source
const MaxSnapshotBytes = 1 << 20

Variables

This section is empty.

Functions

func ConfigNames

func ConfigNames() []string

ConfigNames returns the supported project configuration filenames in discovery order.

func NormalizeGitRemote

func NormalizeGitRemote(value string) (string, error)

func ServiceWorktreeLabel

func ServiceWorktreeLabel(service string, worktree Worktree) string

ServiceWorktreeLabel returns the built-in hostname label for one service.

func SharedProjectIdentity

func SharedProjectIdentity(worktree Worktree, projectRoot string) string

SharedProjectIdentity is the checkout-independent local state key.

func SharedProjectLabel

func SharedProjectLabel(role string, worktree Worktree, projectRoot string, salt [32]byte) string

SharedProjectLabel gives linked worktrees one label for project integration URLs.

func TypeScriptKeyMappings

func TypeScriptKeyMappings() map[string]string

TypeScriptKeyMappings returns the static-to-TypeScript property mappings used by evaluation and declaration generation.

Types

type LocalPublicationIdentity

type LocalPublicationIdentity struct {
	Key         string
	Fingerprint string
}

LocalPublicationIdentity identifies configured development services in this canonical project directory. Git initialization, origin changes and branches do not change it. it is not a portable source identity for apply or workloads.

type Project

type Project struct {
	Selection Selection
	Config    config.TNL
	Declared  *config.TNL
	Worktree  Worktree
	Root      string
}

Project is a selected and resolved project configuration.

func ReadSnapshot

func ReadSnapshot(input io.Reader) (Project, error)

func Resolve

func Resolve(ctx context.Context, selection Selection, cwd string, salt [32]byte) (Project, error)

Resolve loads a selected project configuration and resolves its worktree and configuration. an empty selection still resolves cwd as a project so commands without a configuration file share the same identity.

func (Project) AppService

func (p Project) AppService(cwd, selected string) (string, error)

AppService selects a configured app target. cwd identifies the project only; when more than one app is configured, the caller must select one by name.

func (Project) CaptureServiceTrust

func (p Project) CaptureServiceTrust(ctx context.Context, cache *targettrust.Cache, name, target string) (*targettrust.Snapshot, error)

CaptureServiceTrust captures trust for a service's resolved target. the caller compares it with control's approved metadata before mutations.

func (Project) CaptureTargetTrust

func (p Project) CaptureTargetTrust(ctx context.Context, cache *targettrust.Cache, name, discovered string) (*TargetTrustSnapshot, error)

CaptureTargetTrust reads the declared CA source at apply time. source paths and bundle URLs never enter the resulting declaration or remote worker.

func (Project) ComposeFile

func (p Project) ComposeFile(name string) (string, error)

ComposeFile resolves a configured Compose file and rejects symlink escapes. the runtime receives an absolute file path for its explicit project command.

func (Project) ComposeProject

func (p Project) ComposeProject(name string) (string, error)

ComposeProject derives a worktree-specific Compose project name unless the target explicitly selects an existing project.

func (Project) EffectiveService

func (p Project) EffectiveService(name string) (config.TNL, error)

EffectiveService merges one named service over the root defaults.

func (Project) Found

func (p Project) Found() bool

Found reports whether the project has a selected configuration file.

func (Project) GitHubRepository

func (p Project) GitHubRepository(ctx context.Context) (string, error)

GitHubRepository infers only github.com origins. source identity remains a separate checkout-independent contract and never carries job credentials.

func (Project) LocalPublicationIdentity

func (p Project) LocalPublicationIdentity() LocalPublicationIdentity

func (Project) LocalWorktreeKey

func (p Project) LocalWorktreeKey() string

LocalWorktreeKey identifies this project directory without sending local paths to control. server, team and source identity remain separate scope checks.

func (Project) ResolvePublish

func (p Project) ResolvePublish(name, discovered string) (*config.Publish, error)

ResolvePublish finishes private discovery and resolves a relative target CA path against the selected configuration's directory, independent of cwd.

func (Project) Snapshot

func (p Project) Snapshot() ([]byte, string, error)

Snapshot transfers an already evaluated configuration to a native owner. it stays in the private process pipe; metadata and journals never contain it.

func (Project) SourceIdentity

func (p Project) SourceIdentity(ctx context.Context) (SourceIdentity, error)

func (Project) StaticMap

func (p Project) StaticMap() (map[string]any, error)

StaticMap returns the validated snake_case configuration shape for consumers that map declarations into control APIs. it contains configured selectors, never AWS discovery results. callers resolve source identity separately.

type ProjectContext

type ProjectContext struct {
	RelativeDirectory string `json:"relativeDirectory"`
}

type Selection

type Selection struct {
	Path     string
	Explicit bool
}

func SelectProjectConfig

func SelectProjectConfig(ctx context.Context, cwd, flagPath, environmentPath string, disabled bool) (Selection, error)

SelectProjectConfig applies explicit selection before nearest-file discovery.

type SourceIdentity

type SourceIdentity struct {
	Key         string
	Fingerprint string
	Label       string
}

SourceIdentity is independent of checkout directory, branch and client state. the full fingerprint lets control reject a project-key collision.

type TargetTrustSnapshot

type TargetTrustSnapshot struct {
	Hostname string
	CAPEM    []byte
	Digest   string
}

TargetTrustSnapshot is portable publisher-to-target trust for every protocol. its CA-only material adds to system roots, independently of visitor TLS.

func (TargetTrustSnapshot) TargetTrust

func (s TargetTrustSnapshot) TargetTrust() (*targettrust.Snapshot, error)

TargetTrust uses the same verifier for applied and local target trust.

func (TargetTrustSnapshot) Validate

func (s TargetTrustSnapshot) Validate() error

type Worktree

type Worktree struct {
	Root  string        `json:"root"`
	Name  string        `json:"name"`
	Label WorktreeLabel `json:"label"`
	IsGit bool          `json:"isGit"`
	// contains filtered or unexported fields
}

func ApplyWorktreeHashSalt

func ApplyWorktreeHashSalt(worktree Worktree, projectRoot string, salt [32]byte) Worktree

func ResolveWorktree

func ResolveWorktree(ctx context.Context, cwd string) (Worktree, error)

ResolveWorktree returns project facts and falls back to cwd when Git is unavailable or cwd is not inside a worktree. ApplyWorktreeHashSalt adds the client-state-specific label used in public hostnames.

func (Worktree) PrimaryCheckoutRoot

func (w Worktree) PrimaryCheckoutRoot() string

PrimaryCheckoutRoot returns the primary Git checkout shared by linked worktrees.

type WorktreeLabel

type WorktreeLabel struct {
	Project   string `json:"project"`
	Checkout  string `json:"checkout,omitempty"`
	ID        string `json:"id"`
	FullLabel string `json:"fullLabel"`
}

WorktreeLabel exposes the DNS-safe pieces used in the finished label. the primary checkout has no checkout component.

Directories

Path Synopsis
package githubmetadata resolves immutable repository metadata during trusted apply.
package githubmetadata resolves immutable repository metadata during trusted apply.
package projectinit owns project initialization planning, safe edits, and project-local dependency installation.
package projectinit owns project initialization planning, safe edits, and project-local dependency installation.
Package projectmeta validates and writes browser-safe project metadata.
Package projectmeta validates and writes browser-safe project metadata.
package resolve composes project selection with client state and current server facts.
package resolve composes project selection with client state and current server facts.
package sourcestate records bounded Git identifiers without saving source files.
package sourcestate records bounded Git identifiers without saving source files.
package workloadmanifest owns the nonsecret build-to-runtime workload context.
package workloadmanifest owns the nonsecret build-to-runtime workload context.

Jump to

Keyboard shortcuts

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