init

package
v0.1.0-rc.50 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: BSD-3-Clause Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

package projectinit owns project initialization planning, safe edits, and project-local dependency installation. callers provide artifact generation and diagnostic presentation without exposing command or publisher state.

Index

Constants

View Source
const LocalIgnoreRule = "/.tnl/local/"

Variables

This section is empty.

Functions

func RelativePath

func RelativePath(root, path string) string

RelativePath names a file from the project root. Git may supply an ignore file on another volume, which requires its full path.

Types

type FileChange

type FileChange struct {
	Path   string `json:"path"`
	Status string `json:"status"`
}

type Install

type Install struct {
	Command string
	Manual  bool
	// contains filtered or unexported fields
}

Install describes what init would run or ask the user to run.

type Options

type Options struct {
	NoInstall bool
	// Generate writes portable artifacts for the selected configuration. init
	// calls it after safe source edits and before wiring Python and TypeScript.
	Generate func(ctx context.Context, root, configurationPath string) ([]meta.ArtifactOutcome, error)
}

type Plan

type Plan struct {
	Root                 string
	PackageManager       string
	MissingPackages      []string
	ConfigurationPath    string
	NewConfiguration     []byte
	Framework            string
	FrameworkPath        string
	NewFrameworkConfig   []byte
	ServerPath           string
	ServerSource         []byte
	ServerReplacement    []byte
	Actions              []string
	InstallBlocked       bool
	GeneratedAppService  bool
	NeedsAppRegistration bool
}

Plan records the detected project and the edits init can safely make. planning reads files but does not install dependencies or write project state.

func NewPlan

func NewPlan(ctx context.Context, cwd string, actionForFailure func(error) string) (Plan, error)

NewPlan uses actionForFailure only for recoverable detection diagnostics. the caller supplies their presentation; fatal errors retain their causes.

func (Plan) Apply

func (plan Plan) Apply(ctx context.Context, options Options) (Result, error)

func (Plan) PackageInstall

func (plan Plan) PackageInstall(noInstall bool) Install

func (Plan) Preview

func (plan Plan) Preview(ctx context.Context, noInstall bool) (Report, error)

Preview uses the same edit decisions as Apply without running installers, evaluating the project configuration or writing files.

func (Plan) PythonInstall

func (plan Plan) PythonInstall(noInstall bool) (Install, error)

uv records an editable project-local dependency so runtime imports and type checkers resolve the same generated package. it never installs a global tnl.

type Report

type Report struct {
	Files []FileChange `json:"files"`
	Steps []Step       `json:"steps"`
}

type Result

type Result struct {
	Root                 string
	ConfigurationPath    string
	ConfigurationCreated bool
	InstalledPackages    []string
	UpdatedPaths         []string
	DeclarationsPath     string
	PythonPackagePath    string
	PythonInstalled      bool
	Actions              []string
	Changed              bool
	Report               Report
}

Result contains operation facts in their existing presentation order.

type Step

type Step struct {
	Kind    string   `json:"kind"`
	Status  string   `json:"status"`
	Path    string   `json:"path,omitempty"`
	Argv    []string `json:"argv,omitempty"`
	Message string   `json:"message,omitempty"`
}

Jump to

Keyboard shortcuts

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