# v0.52

*Upgrading from*: v0.51.*

## What changed from v0.51.*

Starting in v0.52, the CLI flags that previously overrode codegen behavior are removed.

This is the final step of a migration that started in earlier releases:

1. v0.49.0 deprecated most generation flags in favor of CUE config (`config` block) ([grafana-app-sdk#1130](https://github.com/grafana/grafana-app-sdk/pull/1130))
2. v0.52 removes the deprecated flags and fails fast with a migration error if they are still used ([grafana-app-sdk#1278](https://github.com/grafana/grafana-app-sdk/pull/1278))
3. Grafana migrated all affected Makefile invocations by moving flag values into `kinds/config.cue` ([grafana/grafana#119543](https://github.com/grafana/grafana/pull/119543))

The migration goal is simple:

- Keep CLI commands focused on *where to read from* (`--source`, `--config`)
- Keep generation behavior in CUE (`config: { ... }`)

## Removed flags and replacement config keys

The following flags are no longer accepted and must be represented in CUE config. Defaults are from [`codegen/cuekind/def.cue`](../../codegen/cuekind/def.cue):

| Removed flag | Config field | Default |
| --- | --- | --- |
| `--manifest` | `manifestSelectors` | `["manifest"]` |
| `--genoperatorstate` | `codegen.enableOperatorStatusGeneration` | `true` |
| `--gogenpath`, `-g` | `codegen.goGenPath` | `"pkg/generated/"` |
| `--tsgenpath`, `-t` | `codegen.tsGenPath` | `"plugin/src/generated/"` |
| `--defencoding` | `definitions.encoding` | `"json"` |
| `--defpath` | `definitions.path` | `"definitions"` |
| `--grouping` | `kinds.grouping` | `"kind"` |
| `--postprocess` | `codegen.enableK8sPostProcessing` | `false` |
| `--noschemasinmanifest` | `definitions.manifestSchemas` | `true` |
| `--gomodule` | `codegen.goModule` | `""` |
| `--gomodgenpath` | `codegen.goModGenPath` | `""` |
| `--useoldmanifestkinds` | `kinds.perKindVersion` | `false` |
| `--crdmanifest` | `definitions.manifestVersion` | `"v1alpha2"` |

Special behavior change:

- `--defencoding=none` is removed. Replace it with:
  - `definitions.genManifest: false`
  - `definitions.genCRDs: false`

## Migration steps

1. Create a dedicated CUE config file (recommended path: `kinds/config.cue`).
2. Define (or update) a `config` block with all non-default generation settings.
3. Remove deprecated flags from scripts/Makefiles/CI commands.
4. Keep only supported selector/path flags in commands (`--source`, optional `--config`).
5. Run generation and verify outputs match previous behavior.

## Before and after examples

### Example 1: Common Makefile target

Before:

```bash
grafana-app-sdk generate --source kinds \
  --gogenpath pkg/generated/ \
  --tsgenpath plugin/src/generated/ \
  --grouping kind \
  --defpath definitions \
  --defencoding json \
  --postprocess=false \
  --genoperatorstate=true
```

After command:

```bash
grafana-app-sdk generate --source kinds
```

After CUE (`kinds/config.cue`):

```cue
package kinds

config: {
  definitions: {
    path:            "definitions"
    encoding:        "json"
    manifestSchemas: true
    manifestVersion: "v1alpha2"
    genManifest:     true
    genCRDs:         true
  }

  kinds: {
    grouping:       "kind"
    perKindVersion: false
  }

  codegen: {
    goGenPath:                      "pkg/generated/"
    tsGenPath:                      "plugin/src/generated/"
    enableK8sPostProcessing:        false
    enableOperatorStatusGeneration: true
  }
}
```

### Example 2: Legacy no-definition output (`--defencoding=none`)

Before:

```bash
grafana-app-sdk generate --source kinds --defencoding none
```

After:

```cue
package kinds

config: {
  definitions: {
    genManifest: false
    genCRDs:     false
    // encoding is irrelevant when both outputs are disabled
  }
}
```

### Example 3: Legacy CRD-compatible manifest (`--crdmanifest`)

Before:

```bash
grafana-app-sdk generate --source kinds --crdmanifest
```

After:

```cue
package kinds

config: {
  definitions: {
    manifestVersion: "v1alpha1"
  }
}
```

## Using non-default config selectors

If your config object is not named `config`, continue using `--config`:

```bash
grafana-app-sdk generate --source kinds --config myConfig
```

```cue
package kinds

myConfig: {
  // same fields as `config`
}
```

If you previously passed `--manifest`, move that value into `manifestSelectors`.

## Validation and troubleshooting

When a removed flag is present, the CLI now exits with a migration error describing each removed flag and its replacement CUE key.

Checklist:

1. Search the repository for removed flags in Makefiles, scripts, CI, and docs.
2. Ensure each removed flag value has an equivalent `config` field.
3. Re-run `grafana-app-sdk generate --source <path>`.
4. Inspect generated artifacts under your configured paths.

## References

- [grafana-app-sdk#1278](https://github.com/grafana/grafana-app-sdk/pull/1278)
- [grafana-app-sdk#1130](https://github.com/grafana/grafana-app-sdk/pull/1130)
- [grafana/grafana#119543](https://github.com/grafana/grafana/pull/119543)
- [`codegen/cuekind/def.cue`](../../codegen/cuekind/def.cue)
