# Agentic upgrade instructions

This file contains structured instructions for AI assistants helping consumers upgrade to this version of the package.

## Automated migrations

Run the automated migration tool first to apply all available codemods for this release:

```bash
dt-app update @dynatrace/strato-components
```

Sections marked **Automated by codemod** below have already been applied — verify the result rather than applying them manually. Sections marked **Opt-in feature** are new features that need a decision from the consumer. All other sections require manual code changes.

## Modes

Assume unattended mode unless the consumer is clearly present in the session.

**Unattended.** Apply the codemod results and the required migrations. Skip every section whose first line starts with `> **Opt-in feature:**`. Do not make decisions for the consumer.

**Attended.** Finish the codemod results and the required migrations first. Then handle each opt-in section in turn:

1. Run the section's **Detect** step over the consumer's repository.
2. If nothing matches, mention the section in one line and move on.
3. If there are matches, show the section title and the match count. List each match with `file:line` and the proposed diff from the **Propose** step, then ask the question from the **Ask** step.
4. Do not edit anything before the consumer answers. Apply only the changes they accept.

End with a summary that lists the sections applied, declined, uncertain and without matches. Do not write declined sections to the repository.

---

Each section below corresponds to a change in this release that requires consumer attention. Sections are separated by `---`.

## Opt-in features in this release

1. Actions menu for CodeEditor and DQLEditor
2. SecretInput for write-only secrets

---

> **Opt-in feature:** Actions menu for CodeEditor and DQLEditor. No existing code requires migration.

**Detect.** Find every `CodeEditor` and `DQLEditor` from `@dynatrace/strato-components/editors` and list the sites that place their own copy or download button next to the editor, for example a `Button` that calls `navigator.clipboard.writeText` or creates a file download from the editor value. Include aliased imports and local wrappers. Skip editors without such buttons. If you cannot tell that a button acts on the editor value, list it as uncertain and do not propose a change.

**Propose.** Add the `ActionsMenu` slot as a direct child of the editor and remove the custom button. By itself it shows a Copy button. Add the `Download` slot for a download action, and `Menu` items such as `Menu.Item` for custom actions. The `Download` slot takes an optional `fileName` and `onDownload`. A name without an extension gets the one of the editor language.

```tsx
import { CodeEditor } from '@dynatrace/strato-components/editors';

<CodeEditor value={value} onChange={setValue} language="json">
  <CodeEditor.ActionsMenu>
    <CodeEditor.Download fileName="config" />
  </CodeEditor.ActionsMenu>
</CodeEditor>;
```

**Ask.** For each match, show `file:line` and the diff. Tell the consumer that the editor now renders its own Copy button or menu trigger, and that screenshot tests of that screen will change. If the custom button does more than copy or download, for example tracking or a custom file format, flag that and keep that part as a custom menu item. Ask whether to apply the change to all matches, to selected ones, or to none.

---

> **Opt-in feature:** SecretInput for write-only secrets. No existing code requires migration.

**Detect.** Find every `PasswordInput` from `@dynatrace/strato-components/forms` that collects a secret the app stores and never shows again, for example an API token or client secret. Include aliased imports and local wrappers. Skip password fields for logins and fields where the user must be able to read the stored value. Also find hand-built "Replace" buttons that mask an existing secret next to an input. If you cannot tell whether the value is write-only, list the site as uncertain and do not propose a change.

**Propose.** Use `SecretInput` from `@dynatrace/strato-components/forms`. Pass `null` as `value` or `defaultValue` when a secret is already stored. The input then shows a fixed mask with a **Replace** button. After a click on **Replace**, the user enters a new value and `onChange` receives the string. Pass an empty string or `undefined` when no secret is stored.

```tsx
import { SecretInput } from '@dynatrace/strato-components/forms';

<SecretInput
  name="apiToken"
  defaultValue={hasStoredToken ? null : ''}
  onChange={setToken}
/>;
```

**Ask.** For each match, show `file:line` and the diff. Tell the consumer that the stored secret can no longer be shown or revealed, and that the code must treat an unchanged mask as "keep the stored secret" on submit. Ask whether to apply the change to all matches, to selected ones, or to none.
