{"modulePath":"github.com/chainloop-dev/chainloop","version":"v1.138.0","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package cmd\n\n## Constants\n\n```go\nconst NotSet = \"[NOT SET]\"\n```\n\n```go\nconst UserWithNoOrganizationMsg = \"you are not part of any organization, please run \\\"chainloop organization create --name ORG_NAME\\\" to create one\"\n```\n\n## Variables\n\n```go\nvar (\n\tVersion = devVersion\n\tEdition = ossEdition\n)\n```\n\n```go\nvar (\n\tActionOpts *action.ActionsOpts\n)\n```\n\n```go\nvar ErrAttestationAlreadyExist = errors.New(\"attestation already initialized, to override it use the --replace flag`\")\n```\n\n```go\nvar ErrAttestationNotInitialized = errors.New(\"attestation not yet initialized, execute the init command first\")\n```\n\n```go\nvar ErrAttestationTokenRequired = errors.New(\"chainloop Token required, please provide it via --token flag or CHAINLOOP_TOKEN environment variable\")\n```\n\n```go\nvar ErrKeylessNotSupported = errors.New(\"keyless signing not supported, please provide a private key reference with --key instead\")\n```\n\n```go\nvar (\n\tGracefulExit bool\n)\n```\n\n## Functions\n\n```go\nfunc CalculateEnvVarName(key string) string\n```\nthis could have been done using automatic + prefix but we want to have control and know the values\n\n\tviper.AutomaticEnv()\n\tviper.SetEnvPrefix(envPrefix)\n\tviper.SetEnvKeyReplacer(strings.NewReplacer(\"-\", \"_\", \".\", \"_\"))\n\n```go\nfunc CloseHookLog()\n```\nCloseHookLog closes the trace log file opened by InitHookLogger and points the root logger back at stderr, so a later log line never writes to a closed file. main calls it right before the process exits.\n\n```go\nfunc Execute(rootCmd *cobra.Command) error\n```\n\n```go\nfunc InitHookLogger()\n```\nInitHookLogger reconfigures the root logger for git/agent hook commands: colorless output, all levels written to the trace state's log.txt, and Warn+ (or Debug, with --debug) written to stderr. Colorless matters because the hook's output is interleaved with git's during a commit or push, and main reads the same logger for its final error line.\n\nIf trace state cannot be located or the file cannot be opened, the logger falls back to colorless stderr-only output so the rest of the hook still runs with consistent formatting. The log file is closed by CloseHookLog, not by the hook command: main logs a failed command's error after RunE returns.\n\n```go\nfunc LogColorDisabled() bool\n```\nLogColorDisabled reports whether colorized log output should be disabled. It follows the same approach as the supports-color/chalk family: honor the NO\\_COLOR / FORCE\\_COLOR conventions, then enable color on an interactive terminal or in a CI system known to render ANSI escape codes.\n\n```go\nfunc Logger() zerolog.Logger\n```\nLogger returns the root logger. Hook commands swap it in place (see InitHookLogger), and main reads it for its final error line so that line shares the hook's colorless formatting during a git commit or push.\n\n```go\nfunc NewGateError(policyName string) error\n```\n\n```go\nfunc NewRootCmd(l zerolog.Logger) *cobra.Command\n```\n\n```go\nfunc NewVersionCmd() *cobra.Command\n```\n\n```go\nfunc ParseAndValidateOpts(opts []string, schema *action.JSONSchema) (map[string]any, error)\n```\n\n```go\nfunc ParseKeyValOpts(opts []string, propertiesMap sdk.SchemaPropertiesMap) (map[string]any, error)\n```\nParseKeyValOpts performs two steps 1 - Split the options into key/value pairs 2 - Cast the values to the expected type defined in the schema\n\n```go\nfunc RenderSchemaRaw(tableTitle string, s string) error\n```\nrender raw JSON schema document\n\n```go\nfunc RenderSchemaTable(tableTitle string, properties sdk.SchemaPropertiesMap) error\n```\nrender de-normalized schema format\n\n```go\nfunc WorkflowListTableOutput(workflowListResult *action.WorkflowListResult) error\n```\n\n## Types\n\n```go\ntype GateError struct {\n\tPolicyName string\n}\n```\n\n```go\nfunc (e *GateError) Error() string\n```\n\n```go\ntype GracefulError struct {\n\t// contains filtered or unexported fields\n}\n```\nGracefulError represents an error that has been marked as gracefully handled In some parts of our code, we want to raise errors but we don't want the CLI to fail because of the flakiness or active development of the tool\n\n```go\nfunc (e GracefulError) Error() string\n```\n\n```go\nfunc (e GracefulError) Unwrap() error\n```\n\n```go\ntype RepositoryOrganizationError struct {\n\tOrganization string\n\tPath         string\n\tErr          error\n}\n```\nRepositoryOrganizationError preserves the repository source through the CLI's final error formatting while retaining the control-plane cause.\n\n```go\nfunc (e *RepositoryOrganizationError) Error() string\n```\n\n```go\nfunc (e *RepositoryOrganizationError) Unwrap() error\n```\n\n","path":"github.com/chainloop-dev/chainloop/app/cli/cmd","name":"cmd","synopsis":"","isRedistributable":true}
