internal

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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VsCodeAgentPrefix = "vscode:/extensions/ms-azuretools.azure-dev"
	// cspell: disable-next-line
	VsAgentPrefix = "vside:/webtools/azdev.publish"
	// cspell: disable-next-line
	VsCodeAzureCopilotAgentPrefix = "ms-azuretools.vscode-azure-github-copilot"
)

Well-known user agents prefixes.

View Source
const AzdUserAgentEnvVar = "AZURE_DEV_USER_AGENT"

Environment variable that identifies a user agent calling into azd. Any caller of azd can set this variable to identify themselves.

View Source
const EnvironmentNameFlagName string = "environment"

EnvironmentNameFlagName is the full name of the flag as it appears on the command line.

Variables

View Source
var (
	ErrNoEnvironmentsFound    = errors.New("no environments found")
	ErrKeyNotFound            = errors.New("key not found in environment values")
	ErrNoKeyNameProvided      = errors.New("no key name provided")
	ErrNoEnvValuesProvided    = errors.New("no environment values provided")
	ErrInvalidFlagCombination = errors.New("invalid flag combination")
)

Environment command errors

View Source
var (
	ErrInfraNotProvisioned  = errors.New("infrastructure has not been provisioned")
	ErrFromPackageWithAll   = errors.New("'--from-package' cannot be specified when '--all' is set")
	ErrFromPackageNoService = errors.New(
		"'--from-package' cannot be specified when deploying all services")
)

Deploy command errors

View Source
var (
	ErrCannotChangeSubscription = errors.New("cannot change subscription for existing environment")
	ErrCannotChangeLocation     = errors.New("cannot change location for existing environment")
	ErrPreviewMultipleLayers    = errors.New("--preview cannot be used when provisioning multiple layers")
)

Provision command errors

View Source
var (
	ErrBranchRequiresTemplate = errors.New(
		"using branch argument requires a template argument to be specified")
	ErrMultipleInitModes = errors.New(
		"only one of init modes: --template, --from-code, or --minimal should be set")
)

Init command errors

View Source
var (
	ErrNoArgsProvided     = errors.New("required arguments not provided")
	ErrInvalidArgValue    = errors.New("invalid argument value")
	ErrOperationCancelled = errors.New("operation cancelled by user")

	// ErrAbortedByUser indicates the user intentionally declined to proceed (e.g. preflight warnings).
	// This is not a failure — the CLI should exit with code 0.
	ErrAbortedByUser = errors.New("operation aborted by user")
)

Argument/flag validation errors

View Source
var (
	ErrExtensionNotFound     = errors.New("extension not found")
	ErrNoExtensionsAvailable = errors.New("no extensions available for operation")
	ErrExtensionTokenFailed  = errors.New("failed to generate extension token")
)

Extension errors

View Source
var (
	ErrServiceNotFound       = errors.New("service not found in project")
	ErrResourceNotConfigured = errors.New("required resource not configured")
)

Service/resource errors

View Source
var (
	ErrConfigKeyNotFound = errors.New("config key not found")
)

Config errors

View Source
var (
	ErrLoginDisabledDelegatedMode = errors.New(
		"'azd auth login' is disabled when the auth mode is delegated")
)

Auth command errors

View Source
var (
	ErrMcpToolsLoadFailed = errors.New("failed to load MCP host tools")
)

MCP errors

View Source
var (
	ErrUnsupportedOperation = errors.New("operation not supported")
)

Unsupported operation errors

View Source
var (
	ErrValidationFailed = errors.New("validation failed")
)

Validation errors

View Source
var Version = devVersionString

The version string, as printed by `azd version`.

This MUST be of the form "<semver> (commit <full commit hash>)"

The default value here is used for a version built directly by a developer when running either `go install` or `go build` without overriding the value at link time (the default behavior when build or install are run without arguments).

Official builds set this value based on the version and commit we are building, using `-ldflags`

Example:

-ldflags="-X 'github.com/azure/azure-dev/cli/azd/internal.Version=0.0.1-alpha.1 (commit 8a49ae5ae9ab13beeade35f91ad4b4611c2f5574)'"

This value is exported and not const so it can be mutated by certain tests. Instead of accessing this member directly, use VersionInfo which returns a structured version of this value.

nolint: lll

Functions

func IsDevVersion

func IsDevVersion() bool

func IsNonProdVersion

func IsNonProdVersion() bool

func UserAgent

func UserAgent() string

UserAgent() creates the user agent string for azd.

Examples:

  • azdev/1.0.0 (Go 1.18; windows/amd64)
  • azdev/1.0.0 (Go 1.18; windows/amd64) azd-caller/1.0.0

Types

type AzdVersionInfo

type AzdVersionInfo struct {
	Version semver.Version
	Commit  string
}

func VersionInfo

func VersionInfo() AzdVersionInfo

type EnvFlag

type EnvFlag struct {
	EnvironmentName string
	// contains filtered or unexported fields
}

EnvFlag is a flag that represents the environment name. Actions which inject an environment should also use this flag so the user can control what environment is loaded in a uniform way across all our commands.

func (*EnvFlag) Bind

func (e *EnvFlag) Bind(local *pflag.FlagSet, global *GlobalCommandOptions)

func (*EnvFlag) FromArg

func (e *EnvFlag) FromArg() bool

checks if the environment name was set from the command line

type ErrorWithSuggestion

type ErrorWithSuggestion = errorhandler.ErrorWithSuggestion

ErrorWithSuggestion is a type alias for errorhandler.ErrorWithSuggestion. The canonical type lives in pkg/errorhandler so it can be used by extensions.

type ErrorWithTraceId

type ErrorWithTraceId struct {
	TraceId string
	Err     error
}

ErrorWithTraceId is a custom error type that includes a trace ID for the current operation

func (*ErrorWithTraceId) Error

func (et *ErrorWithTraceId) Error() string

Error returns the error message

func (*ErrorWithTraceId) Unwrap

func (et *ErrorWithTraceId) Unwrap() error

Unwrap returns the wrapped error

type GlobalCommandOptions

type GlobalCommandOptions struct {
	// Cwd allows the user to override the current working directory, temporarily.
	// The root command will take care of cd'ing into that folder before your command
	// and cd'ing back to the original folder after the commands complete (to make testing
	// easier)
	Cwd string

	// EnableDebugLogging indicates you should turn on verbose/debug logging in your command any
	// launched tools. It's enabled with `--debug`, for any command.
	EnableDebugLogging bool

	// NoPrompt controls non-interactive mode. When true, interactive prompts should behave as
	// if the user selected the default value. If there is no default value the prompt returns
	// an error.
	//
	// Can be enabled via:
	//   - --no-prompt flag
	//   - --non-interactive flag (alias for --no-prompt)
	//   - AZD_NON_INTERACTIVE=true environment variable
	//   - Automatic agent detection (lowest priority)
	NoPrompt bool

	// EnvironmentName holds the value of `-e/--environment` parsed from the command line
	// before Cobra command tree construction. For extension commands (which use
	// DisableFlagParsing), this is the only reliable way to know what `-e` value
	// the user specified. It is empty when the user did not pass `-e` or when the
	// value was not a valid environment name (extensions may reuse `-e` for other
	// purposes such as URLs).
	EnvironmentName string

	// EnableTelemetry indicates if telemetry should be sent.
	// The rootCmd will disable this based if the environment variable
	// AZURE_DEV_COLLECT_TELEMETRY is set to 'no'.
	// Defaults to true.
	EnableTelemetry bool

	// Generates platform-agnostic help for use on static documentation sites
	// like learn.microsoft.com. This is set directly when calling NewRootCmd
	// and not bound to any command flags.
	GenerateStaticHelp bool
}

Directories

Path Synopsis
Package appdetect allows for detection of application projects.
Package appdetect allows for detection of application projects.
cmd
add
Package mapper provides a reflection-based type conversion framework.
Package mapper provides a reflection-based type conversion framework.
mcp
Package repository provides handling of files in the user's code repository.
Package repository provides handling of files in the user's code repository.
agentdetect
Package agentdetect provides functionality to detect when azd is invoked by known AI coding agents (Claude Code, GitHub Copilot, Gemini, OpenCode) and enables automatic adjustment of behavior (e.g., no-prompt mode).
Package agentdetect provides functionality to detect when azd is invoked by known AI coding agents (Claude Code, GitHub Copilot, Gemini, OpenCode) and enables automatic adjustment of behavior (e.g., no-prompt mode).
Package telemetry provides functionality for emitting telemetry in azd.
Package telemetry provides functionality for emitting telemetry in azd.
baggage
Package baggage provides an implementation of storing trace-level context data, i.e.
Package baggage provides an implementation of storing trace-level context data, i.e.
events
Package events provides definitions and functions related to the definition of telemetry events.
Package events provides definitions and functions related to the definition of telemetry events.
fields
Package fields provides definitions and functions related to the definition of telemetry fields.
Package fields provides definitions and functions related to the definition of telemetry fields.
resource
Package resource provides application-level resource attributes for telemetry purposes.
Package resource provides application-level resource attributes for telemetry purposes.
Package vsrpc provides the RPC server that Visual Studio uses to interact with azd programmatically.
Package vsrpc provides the RPC server that Visual Studio uses to interact with azd programmatically.

Jump to

Keyboard shortcuts

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