> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# anaconda repo policy

export const GCell = ({children, className}) => <div className={`grid-table-cell ${className || ""}`} role="cell">
    {children}
  </div>;

export const GTH = ({children, className}) => <div className={`grid-table-th ${className || ""}`} role="columnheader">
    {children}
  </div>;

export const GRow = ({children}) => <div className="grid-table-row" role="row">{children}</div>;

export const GBody = ({children}) => <div className="grid-table-body" role="rowgroup">{children}</div>;

export const GHead = ({children}) => <div className="grid-table-head" role="rowgroup">{children}</div>;

export const GTable = ({children, className, cols}) => <div className={`grid-table not-prose overflow-hidden rounded-2xl ${className || ""}`} style={{
  "--grid-table-cols": cols
}} role="table">
    {children}
  </div>;

export const Comments = ({children}) => {
  return <div class="my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border border-zinc-500/20 bg-zinc-50/50 dark:border-zinc-500/30 dark:bg-zinc-500/10" data-callout-type="comments">
      <div class="w-4">
        <svg width="14" height="14" viewBox="0 0 640 640" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" aria-label="Comments">
            <path d="M320 112C434.9 112 528 205.1 528 320C528 434.9 434.9 528 320 528C205.1 528 112 434.9 112 320C112 205.1 205.1 112 320 112zM320 576C461.4 576 576 461.4 576 320C576 178.6 461.4 64 320 64C178.6 64 64 178.6 64 320C64 461.4 178.6 576 320 576zM280 400C266.7 400 256 410.7 256 424C256 437.3 266.7 448 280 448L360 448C373.3 448 384 437.3 384 424C384 410.7 373.3 400 360 400L352 400L352 312C352 298.7 341.3 288 328 288L280 288C266.7 288 256 298.7 256 312C256 325.3 266.7 336 280 336L304 336L304 400L280 400zM320 256C337.7 256 352 241.7 352 224C352 206.3 337.7 192 320 192C302.3 192 288 206.3 288 224C288 241.7 302.3 256 320 256z" />
        </svg>
      </div>
      <div class="text-sm prose min-w-0 w-full">
        {children}
      </div>
    </div>;
};

## Usage

```bash theme={null}
anaconda repo policy [OPTIONS]
```

## Description

Manages policies for filtering and channel assignment. Policies define rules (platform, license, package name, CVE score and status, dependencies, signing, package creation date, and exclusions) and can be assigned to channels. Use `--list-all` to list policies, `--create` or `--edit` to define rules, and `--assign`/`--unassign` to link policies to channels.

## Options (main actions)

<GTable cols="25% 25% 50%">
  <GHead>
    <GRow>
      <GTH>Option</GTH>
      <GTH>Default</GTH>
      <GTH>Description</GTH>
    </GRow>
  </GHead>

  <GBody>
    <GRow>
      <GCell>`--channel <CHANNEL>`</GCell>

      <GCell />

      <GCell>Channel name (context for some actions)</GCell>
    </GRow>

    <GRow>
      <GCell>`--list-all`</GCell>

      <GCell />

      <GCell>List all policies</GCell>
    </GRow>

    <GRow>
      <GCell>`--create`</GCell>

      <GCell />

      <GCell>Create a new policy (use with --name, --description, and rule options)</GCell>
    </GRow>

    <GRow>
      <GCell>`--show <ID>`</GCell>

      <GCell />

      <GCell>Show a policy by ID</GCell>
    </GRow>

    <GRow>
      <GCell>`--edit <ID>`</GCell>

      <GCell />

      <GCell>Edit a policy by ID</GCell>
    </GRow>

    <GRow>
      <GCell>`--delete <ID>`</GCell>

      <GCell />

      <GCell>Delete a policy by ID</GCell>
    </GRow>

    <GRow>
      <GCell>`--assign <ID>`</GCell>

      <GCell />

      <GCell>Assign a policy to a channel</GCell>
    </GRow>

    <GRow>
      <GCell>`--unassign <ID>`</GCell>

      <GCell />

      <GCell>Unassign a policy from a channel</GCell>
    </GRow>

    <GRow>
      <GCell>`--name <NAME>`</GCell>

      <GCell />

      <GCell>Policy name (for create/edit)</GCell>
    </GRow>

    <GRow>
      <GCell>`--channel-name <CHANNEL>`</GCell>

      <GCell />

      <GCell>Channel name (for create/edit)</GCell>
    </GRow>

    <GRow>
      <GCell>`--description <TEXT>`</GCell>

      <GCell />

      <GCell>Policy description (for create/edit)</GCell>
    </GRow>

    <GRow>
      <GCell>`-h, --help`</GCell>

      <GCell />

      <GCell>Show full help including platform, license, CVE, and package rules</GCell>
    </GRow>
  </GBody>
</GTable>

## Options (policy rules)

Use these options with `--create` or `--edit` to define policy filtering rules.

<GTable cols="25% 25% 50%">
  <GHead>
    <GRow>
      <GTH>Option</GTH>
      <GTH>Default</GTH>
      <GTH>Description</GTH>
    </GRow>
  </GHead>

  <GBody>
    <GRow>
      <GCell>`--platform`</GCell>

      <GCell />

      <GCell>Platforms to include (comma-separated). Values: `linux-32`, `linux-64`, `linux-aarch64`, `linux-armv6l`, `linux-armv7l`, `linux-ppc64`, `linux-ppc64le`, `linux-s390x`, `osx-64`, `osx-arm64`, `win-32`, `win-64`, `zos-z`, `noarch`</GCell>
    </GRow>

    <GRow>
      <GCell>`--platform-not`</GCell>

      <GCell />

      <GCell>Platforms to exclude (comma-separated). Same values as `--platform`.</GCell>
    </GRow>

    <GRow>
      <GCell>`--license`</GCell>

      <GCell />

      <GCell>Licenses to include (comma-separated). Values: `agpl`, `gpl`, `gpl2`, `gpl3`, `lgpl`, `bsd`, `mit`, `apache`, `psf`, `Public-Domain`, `Proprietary`, `mozilla`, `other`, `none`, `cc`</GCell>
    </GRow>

    <GRow>
      <GCell>`--license-not`</GCell>

      <GCell />

      <GCell>Licenses to exclude (comma-separated). Same values as `--license`.</GCell>
    </GRow>

    <GRow>
      <GCell>`--package-name`</GCell>

      <GCell />

      <GCell>Package names to include (comma-separated)</GCell>
    </GRow>

    <GRow>
      <GCell>`--include-dependencies`</GCell>

      <GCell />

      <GCell>Include dependencies of matched packages</GCell>
    </GRow>

    <GRow>
      <GCell>`--exclude-dependencies`</GCell>

      <GCell />

      <GCell>Exclude dependencies of matched packages</GCell>
    </GRow>

    <GRow>
      <GCell>`--only-signed-packages [BOOL]`</GCell>

      <GCell />

      <GCell>Keep only signed packages</GCell>
    </GRow>

    <GRow>
      <GCell>`--keep-legacy-packages [BOOL]`</GCell>

      <GCell />

      <GCell>Keep only legacy packages</GCell>
    </GRow>

    <GRow>
      <GCell>`--package-created-from <DATE>`</GCell>

      <GCell />

      <GCell>Include packages created on or after this date</GCell>
    </GRow>

    <GRow>
      <GCell>`--package-created-to <DATE>`</GCell>

      <GCell />

      <GCell>Include packages created on or before this date</GCell>
    </GRow>

    <GRow>
      <GCell>`--cve-score <SCORE>`</GCell>

      <GCell />

      <GCell>Filter by CVE score threshold</GCell>
    </GRow>

    <GRow>
      <GCell>`--cve-score-comparator <OP>`</GCell>
      <GCell>`<=`</GCell>
      <GCell>Comparator for CVE score filter. Values: `==`, `<=`, `>=`, `<`, `>`. Must be quoted on the command line.</GCell>
    </GRow>

    <GRow>
      <GCell>`--cve-status`</GCell>

      <GCell />

      <GCell>CVE statuses to include (comma-separated). Values: `active`, `reported`, `mitigated`, `cleared`, `disputed`</GCell>
    </GRow>

    <GRow>
      <GCell>`--cve-link-status-and-score <LINK>`</GCell>
      <GCell>`and`</GCell>
      <GCell>Logical link between CVE status and score filters. Values: `and`, `or`</GCell>
    </GRow>

    <GRow>
      <GCell>`--cve-allowlist`</GCell>

      <GCell />

      <GCell>CVE IDs to allow (comma-separated). Format: `CVE-NNNN-NNNN`</GCell>
    </GRow>

    <GRow>
      <GCell>`--exclude-cve-status`</GCell>

      <GCell />

      <GCell>CVE statuses to exclude (comma-separated). Values: `active`, `reported`, `mitigated`, `cleared`, `disputed`</GCell>
    </GRow>

    <GRow>
      <GCell>`--exclude-package-name`</GCell>

      <GCell />

      <GCell>Package names to exclude (comma-separated)</GCell>
    </GRow>

    <GRow>
      <GCell>`--exclude-package-name-exception`</GCell>

      <GCell />

      <GCell>Package names to remove from the exclusion list (comma-separated). Accepts [matchspec](https://docs.conda.io/projects/conda/en/latest/dev-guide/api/conda/models/match_spec/index.html) syntax.</GCell>
    </GRow>
  </GBody>
</GTable>

## Examples

**List all policies**

```bash theme={null}
anaconda repo policy --list-all
```

**Show a policy**

```bash theme={null}
anaconda repo policy --show <POLICY_ID>
```

<Comments>
  Replace \<POLICY\_ID> with the ID of the policy to view.
</Comments>

**Create a policy and assign to a channel**

```bash theme={null}
anaconda repo policy --create --name "My policy" --channel-name my-channel
anaconda repo policy --assign <POLICY_ID> --channel my-channel
```

<Comments>
  Replace \<POLICY\_ID> with the ID returned by the --create command.
</Comments>

**Create a policy with filtering rules**

```bash theme={null}
anaconda repo policy --create --name "Secure packages" --channel-name my-channel \
  --platform linux-64,noarch \
  --license-not gpl3,agpl \
  --cve-score 7.0 --cve-score-comparator "<=" \
  --only-signed-packages
```
