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

repository

package
v1.36.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 46 Imported by: 0

Documentation

Overview

Package repository provides handling of files in the user's code repository.

Index

Constants

View Source
const InitGenTemplateId = "azd-init"

Variables

View Source
var (
	// ErrArchivedTemplateDeclined indicates that the user chose not to initialize from an archived repository.
	ErrArchivedTemplateDeclined = errors.New("archived template repository declined by user")
)

Functions

func InitEnvFileValues

func InitEnvFileValues() (map[string]string, error)

Types

type EntryKind

type EntryKind string
const (
	EntryKindDetected EntryKind = "detection"
	EntryKindManual   EntryKind = "manual"
	EntryKindModified EntryKind = "modified"
)

type Initializer

type Initializer struct {
	// contains filtered or unexported fields
}

Initializer handles the initialization of a local repository.

func NewInitializer

func NewInitializer(
	console input.Console,
	gitCli *git.Cli,
	dotnetCli *dotnet.Cli,
	features *alpha.FeatureManager,
	lazyEnvManager *lazy.Lazy[environment.Manager],
) *Initializer

func NewInitializerWithRepositoryStatusChecker added in v1.33.0

func NewInitializerWithRepositoryStatusChecker(
	console input.Console,
	gitCli *git.Cli,
	dotnetCli *dotnet.Cli,
	features *alpha.FeatureManager,
	lazyEnvManager *lazy.Lazy[environment.Manager],
	statusChecker RepositoryStatusChecker,
) *Initializer

NewInitializerWithRepositoryStatusChecker creates an initializer that checks repository metadata before cloning.

func (*Initializer) InitFromApp

func (i *Initializer) InitFromApp(
	ctx context.Context,
	azdCtx *azdcontext.AzdContext,
	initializeEnv func() (*environment.Environment, error),
	initializeMinimal func() error,
	envSpecified bool) error

InitFromApp initializes the infra directory and project file from the current existing app.

func (*Initializer) Initialize

func (i *Initializer) Initialize(
	ctx context.Context,
	azdCtx *azdcontext.AzdContext,
	template *templates.Template,
	templateBranch string) error

Initializes a local repository in the project directory from a remote repository or local template directory.

A confirmation prompt is displayed for any existing files to be overwritten.

func (*Initializer) InitializeMinimal

func (i *Initializer) InitializeMinimal(ctx context.Context, azdCtx *azdcontext.AzdContext) error

Initializes a minimal azd project.

func (*Initializer) PromptIfNonEmpty

func (i *Initializer) PromptIfNonEmpty(ctx context.Context, azdCtx *azdcontext.AzdContext) error

PromptIfNonEmpty prompts the user for confirmation if the project directory to initialize in is non-empty. Returns error if an error occurred while prompting, or if the user declines confirmation.

type RepositoryStatus added in v1.33.0

type RepositoryStatus struct {
	Archived bool
}

RepositoryStatus contains hosting-provider metadata relevant to template initialization.

type RepositoryStatusChecker added in v1.33.0

type RepositoryStatusChecker interface {
	// Check returns nil when the repository host is not supported.
	Check(ctx context.Context, repositoryURL string) (*RepositoryStatus, error)
}

RepositoryStatusChecker retrieves repository metadata when the hosting provider supports it.

func NewGitHubRepositoryStatusChecker added in v1.33.0

func NewGitHubRepositoryStatusChecker(transport policy.Transporter) RepositoryStatusChecker

NewGitHubRepositoryStatusChecker creates a checker for GitHub-hosted repositories.

Jump to

Keyboard shortcuts

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