featureflags

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package featureflags implements MCP tools for GitLab feature flag operations.

The package wraps the GitLab Feature flags API:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionSpecs

func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec

ActionSpecs returns canonical specs for feature flag actions exposed as MCP tools. The list, get, create, update, and delete routes are projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004). Each spec carries non-generic discovery metadata (Usage, natural-language Aliases, RelatedActions, and a "Returns: … See also: …" individual-tool description) per the 1:1 audit R-META requirement.

func DeleteFeatureFlag

func DeleteFeatureFlag(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error

DeleteFeatureFlag deletes a feature flag.

func FormatFeatureFlagMarkdown

func FormatFeatureFlagMarkdown(out Output) string

FormatFeatureFlagMarkdown formats a single feature flag as markdown.

func FormatListFeatureFlagsMarkdown

func FormatListFeatureFlagsMarkdown(out ListOutput) string

FormatListFeatureFlagsMarkdown formats a list of feature flags as markdown.

Types

type CreateInput

type CreateInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	Name        string               `json:"name" jsonschema:"Feature flag name,required"`
	Description string               `json:"description,omitempty" jsonschema:"Feature flag description"`
	Version     string               `json:"version,omitempty" jsonschema:"Version of the feature flag (new_version_flag)"`
	Active      *bool                `json:"active,omitempty" jsonschema:"Whether the flag is active"`
	Strategies  []StrategyInput      `` /* 146-byte string literal not displayed */
}

CreateInput contains parameters for creating a feature flag.

type DeleteInput

type DeleteInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	Name      string               `json:"name" jsonschema:"Feature flag name,required"`
}

DeleteInput contains parameters for deleting a feature flag.

type GetInput

type GetInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	Name      string               `json:"name" jsonschema:"Feature flag name,required"`
}

GetInput contains parameters for getting a feature flag.

type ListInput

type ListInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	Scope     string               `json:"scope,omitempty" jsonschema:"Filter by scope (enabled or disabled)"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order results by (e.g. name, created_at, updated_at)"`
	Sort      string               `json:"sort,omitempty" jsonschema:"Sort direction (asc, desc)"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListInput contains parameters for listing feature flags.

type ListOutput

type ListOutput struct {
	toolutil.HintableOutput
	FeatureFlags []Output                  `json:"feature_flags"`
	Pagination   toolutil.PaginationOutput `json:"pagination"`
}

ListOutput represents a paginated list of feature flags.

func ListFeatureFlags

func ListFeatureFlags(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)

ListFeatureFlags lists feature flags for a project.

type Output

type Output struct {
	toolutil.HintableOutput
	Name        string           `json:"name"`
	Description string           `json:"description"`
	Active      bool             `json:"active"`
	Version     string           `json:"version"`
	CreatedAt   string           `json:"created_at,omitempty"`
	UpdatedAt   string           `json:"updated_at,omitempty"`
	Scopes      []ScopeOutput    `json:"scopes,omitempty"`
	Strategies  []StrategyOutput `json:"strategies,omitempty"`
}

Output represents a single project feature flag.

func CreateFeatureFlag

func CreateFeatureFlag(ctx context.Context, client *gitlabclient.Client, input CreateInput) (Output, error)

CreateFeatureFlag creates a new feature flag.

func GetFeatureFlag

func GetFeatureFlag(ctx context.Context, client *gitlabclient.Client, input GetInput) (Output, error)

GetFeatureFlag gets a single feature flag by name.

func UpdateFeatureFlag

func UpdateFeatureFlag(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)

UpdateFeatureFlag updates an existing feature flag.

type ScopeInput

type ScopeInput struct {
	EnvironmentScope string `` /* 137-byte string literal not displayed */
}

ScopeInput represents a scope for strategy options.

type ScopeOutput

type ScopeOutput struct {
	ID               int64  `json:"id"`
	EnvironmentScope string `json:"environment_scope"`
}

ScopeOutput represents a feature flag scope.

type StrategyInput

type StrategyInput struct {
	ID         int64                   `json:"id,omitempty" jsonschema:"Strategy ID (only for update operations referencing an existing strategy)"`
	Name       string                  `json:"name" jsonschema:"Strategy name (e.g. default, gradualRolloutUserId, userWithId, flexibleRollout)"`
	Parameters *StrategyParameterInput `json:"parameters,omitempty" jsonschema:"Strategy-specific parameters (group_id, user_ids, percentage, rollout, stickiness)"`
	Scopes     []ScopeInput            `json:"scopes,omitempty" jsonschema:"Environment scopes to which this strategy applies"`
}

StrategyInput represents a strategy for create/update operations.

type StrategyOutput

type StrategyOutput struct {
	ID         int64                    `json:"id"`
	Name       string                   `json:"name"`
	Parameters *StrategyParameterOutput `json:"parameters,omitempty"`
	Scopes     []ScopeOutput            `json:"scopes,omitempty"`
}

StrategyOutput represents a feature flag strategy.

type StrategyParameterInput

type StrategyParameterInput struct {
	GroupID    string `json:"group_id,omitempty" jsonschema:"Group ID for the gradualRolloutUserId strategy"`
	UserIDs    string `json:"user_ids,omitempty" jsonschema:"Comma-separated user IDs for the userWithId strategy"`
	Percentage string `json:"percentage,omitempty" jsonschema:"Percentage of users to include for the gradualRolloutUserId strategy (e.g. 25)"`
	Rollout    string `json:"rollout,omitempty" jsonschema:"Rollout duration (0-100) for the gradualRolloutUserId strategy"`
	Stickiness string `json:"stickiness,omitempty" jsonschema:"Stickiness attribute used to bucket users (default, user, session, cookie)"`
}

StrategyParameterInput represents strategy parameters for create/update.

type StrategyParameterOutput

type StrategyParameterOutput struct {
	GroupID    string `json:"group_id,omitempty"`
	UserIDs    string `json:"user_ids,omitempty"`
	Percentage string `json:"percentage,omitempty"`
	Rollout    string `json:"rollout,omitempty"`
	Stickiness string `json:"stickiness,omitempty"`
}

StrategyParameterOutput represents strategy parameters.

type UpdateInput

type UpdateInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	Name        string               `json:"name" jsonschema:"Current feature flag name,required"`
	NewName     string               `json:"new_name,omitempty" jsonschema:"New feature flag name"`
	Description string               `json:"description,omitempty" jsonschema:"Feature flag description"`
	Active      *bool                `json:"active,omitempty" jsonschema:"Whether the flag is active"`
	Strategies  []StrategyInput      `` /* 195-byte string literal not displayed */
}

UpdateInput contains parameters for updating a feature flag.

Jump to

Keyboard shortcuts

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