azdcontext

package
v1.23.14 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigFileName = "config.json"
View Source
const ConfigFileVersion = 1
View Source
const DotEnvFileName = ".env"
View Source
const EnvironmentDirectoryName = ".azure"
View Source
const ProjectFileName = "azure.yaml"

Variables

View Source
var (
	ErrNoProject = errors.New("no project exists; to create a new project, run `azd init`")
)
View Source
var ProjectFileNames = []string{"azure.yaml", "azure.yml"}

ProjectFileNames lists all valid project file names, in order of preference

Functions

func ProjectName

func ProjectName(projectDirectory string) string

ProjectName returns a suitable project name from the given project directory.

Types

type AzdContext

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

func NewAzdContext

func NewAzdContext() (*AzdContext, error)

Creates context with project directory set to the nearest project file found by calling NewAzdContextFromWd on the current working directory.

func NewAzdContextFromWd

func NewAzdContextFromWd(wd string) (*AzdContext, error)

Creates context with project directory set to the nearest project file found.

The project file is first searched for in the working directory, if not found, the parent directory is searched recursively up to root. If no project file is found, errNoProject is returned.

func NewAzdContextWithDirectory

func NewAzdContextWithDirectory(projectDirectory string) *AzdContext

Creates context with project directory set to the desired directory.

func (*AzdContext) ClearCopilotSession

func (c *AzdContext) ClearCopilotSession() error

ClearCopilotSession removes the saved Copilot session.

func (*AzdContext) EnvironmentDirectory

func (c *AzdContext) EnvironmentDirectory() string

func (*AzdContext) EnvironmentRoot

func (c *AzdContext) EnvironmentRoot(name string) string

func (*AzdContext) GetCopilotSession

func (c *AzdContext) GetCopilotSession() *CopilotSession

GetCopilotSession returns the in-progress Copilot session, if any.

func (*AzdContext) GetDefaultEnvironmentName

func (c *AzdContext) GetDefaultEnvironmentName() (string, error)

GetDefaultEnvironmentName returns the name of the default environment. Returns an empty string if a default environment has not been set.

func (*AzdContext) GetEnvironmentWorkDirectory

func (c *AzdContext) GetEnvironmentWorkDirectory(name string) string

func (*AzdContext) ProjectDirectory

func (c *AzdContext) ProjectDirectory() string

func (*AzdContext) ProjectPath

func (c *AzdContext) ProjectPath() string

ProjectPath returns the path to the project file. If the context was created by searching for a project file, returns the actual file that was found. Otherwise, returns the default project file name joined with the project directory (useful when creating new projects).

func (*AzdContext) SetCopilotSession

func (c *AzdContext) SetCopilotSession(session *CopilotSession) error

SetCopilotSession saves a Copilot session ID for resume support.

func (*AzdContext) SetProjectDirectory

func (c *AzdContext) SetProjectDirectory(dir string)

func (*AzdContext) SetProjectState

func (c *AzdContext) SetProjectState(state ProjectState) error

SetProjectState persists the state of the project to the file system, like the default environment.

type CopilotSession

type CopilotSession struct {
	SessionID string `json:"sessionId"`
	Command   string `json:"command"`
	StartedAt string `json:"startedAt"`
}

CopilotSession tracks an in-progress Copilot agent session for resume support.

type ProjectState

type ProjectState struct {
	DefaultEnvironment string
}

ProjectState represents the state of the project.

Jump to

Keyboard shortcuts

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