CLI Feature Tag Utility (commands/feature-tags.ts)

composio · ts/packages/cli/src/commands/feature-tags.ts · typescript · MIT
infra, cli, analytics, lang:typescript, tag:visibility, tag:utility

Utility functions to tag CLI values with feature flags and filter them based on dev mode and experimental feature visibility, enabling conditional command exposure.

// Source: https://github.com/ComposioHQ/composio | License: MIT | Copyright 2025 Sampark Inc
// Provided via justclaw.it.com; keep this notice with the code.
export type CliFeatureTag = string;

export type TaggedValue<T> = {
  readonly value: T;
  readonly tags?: ReadonlyArray<CliFeatureTag>;
};

export type CommandVisibility = {
  readonly isDevModeEnabled: boolean;
  readonly isExperimentalFeatureEnabled: (feature: string) => boolean;
};

export const tagged = <T>(value: T, tags?: ReadonlyArray<CliFeatureTag>): TaggedValue<T> => ({
  value,
  tags,
});

export const experimental = <T>(feature: string, value: T): TaggedValue<T> => ({
  value,
  tags: [feature],
});

export const isTaggedValueVisible = <T>(
  entry: TaggedValue<T>,
  visibility: CommandVisibility
): boolean => {
  if (!e

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key