Skip to content

Commit 76f0c17

Browse files
committed
skills: ask user for output directory before running commands
Without this, the agent picks an output directory on its own (e.g. odf/namespace-application) and the user has no way to change it. Add a "Pick an output directory" step to the validate-application, gather-application, test-run, and test-clean skills. The validate-clusters skill already had this step but used a vague <env> placeholder. All skills now suggest a unique name with a timestamp including hours and minutes (e.g., out/clusters-2026-07-20-19-46). This ensures consistent naming across runs and avoids reusing an existing directory, which causes output files with numeric suffixes (-2, -3) that confuse the agent when inspecting results. Also rename <output-dir> to <output-directory> to match the step heading and reinforce that the agent should use the directory chosen in the previous step. Assisted-by: Cursor/Claude Opus 4.6 Signed-off-by: Nir Soffer <nsoffer@redhat.com>
1 parent 168597b commit 76f0c17

5 files changed

Lines changed: 55 additions & 41 deletions

File tree

pkg/skills/templates/skills/gather-application.tmpl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,34 @@ argocd appset-deploy-rbd 69m dr1 dr2 Re
3535
Present the list and let the user choose which application to gather
3636
data for.
3737

38-
### Step 2: Run gather application
38+
### Step 2: Pick an output directory
3939

40-
Use `<env>/<namespace>-<app-name>` for the output directory, e.g., `myenv/myns-myapp`.
40+
Ask the user where to store the output. Suggest a unique name like
41+
`out/<drpc-namespace>-<drpc-name>-<%Y-%m-%d-%H-%M>`, e.g.,
42+
`out/myns-myapp-2026-07-20-19-46`.
43+
44+
### Step 3: Run gather application
4145

4246
```console
43-
$ {{.Command.Name}} gather application --name <drpc-name> --namespace <namespace> -o <output-dir>
47+
$ {{.Command.Name}} gather application --name <drpc-name> --namespace <namespace> -o <output-directory>
4448
```
4549

4650
Use `--config <file>` if the config file is not the default `config.yaml`.
4751

4852
The command takes a few seconds on local clusters and about a minute on
4953
remote clusters.
5054

51-
### Step 3: Check the result
55+
### Step 4: Check the result
5256

5357
On success the command ends with:
5458

5559
```console
5660
✅ Gather completed
5761
```
5862

59-
On failure, check `<output-dir>/gather-application.log` for details.
63+
On failure, check `<output-directory>/gather-application.log` for details.
6064

61-
### Step 4: Inspect gathered data
65+
### Step 5: Inspect gathered data
6266

6367
The output directory contains:
6468

@@ -76,7 +80,7 @@ resources. Ramen operator logs are gathered under
7680
`namespaces/ramen-system/pods/`.
7781

7882
```console
79-
$ tree -L3 <output-dir>/gather-application.data
83+
$ tree -L3 <output-directory>/gather-application.data
8084
gather-application.data/
8185
├── dr1/
8286
│ ├── cluster/

pkg/skills/templates/skills/test-clean.tmpl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,23 @@ Delete resources created by `{{.Command.Name}} test run`.
2323

2424
## Workflow
2525

26-
### Step 1: Run test clean
26+
### Step 1: Pick an output directory
2727

28-
Use the same output directory and config file as the test run:
28+
Ask the user where to store the report. Suggest using the same output
29+
directory as the test run, but a different directory also works.
30+
31+
### Step 2: Run test clean
2932

3033
```console
31-
$ {{.Command.Name}} test clean -o <output-dir>
34+
$ {{.Command.Name}} test clean -o <output-directory>
3235
```
3336

3437
Use `--config <file>` if the config file is not the default `config.yaml`.
3538

3639
The command unprotects and undeploys test applications, then cleans the
3740
test environment (channels, namespaces).
3841

39-
### Step 2: Check the result
42+
### Step 3: Check the result
4043

4144
**On success:**
4245

pkg/skills/templates/skills/test-run.tmpl

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ in the configuration file.
2222

2323
## Workflow
2424

25-
### Step 1: Run the test
25+
### Step 1: Pick an output directory
2626

27-
Use `<env>/test` for the output directory, e.g., `myenv/test`.
27+
Ask the user where to store the report. Suggest a unique name like
28+
`out/test-<%Y-%m-%d-%H-%M>`, e.g., `out/test-2026-07-20-19-46`.
29+
30+
### Step 2: Run the test
2831

2932
```console
30-
$ {{.Command.Name}} test run -o <output-dir>
33+
$ {{.Command.Name}} test run -o <output-directory>
3134
```
3235

3336
Use `--config <file>` if the config file is not the default `config.yaml`.
@@ -38,7 +41,7 @@ deploy, protect, failover, relocate, unprotect, undeploy.
3841
**This typically takes 15-20 minutes per test case.** Multiple test cases
3942
run in parallel.
4043

41-
### Step 2: Check the result
44+
### Step 3: Check the result
4245

4346
**On success:**
4447

@@ -53,7 +56,7 @@ clusters and S3 into `test-run.data/`:
5356
❌ failed (N passed, M failed, 0 skipped)
5457
```
5558

56-
### Step 3: Inspect the report
59+
### Step 4: Inspect the report
5760

5861
The output directory contains:
5962

@@ -68,25 +71,25 @@ Useful commands:
6871
Overall status:
6972

7073
```console
71-
$ yq '.status' < <output-dir>/test-run.yaml
74+
$ yq '.status' < <output-directory>/test-run.yaml
7275
```
7376

7477
Individual step status and durations:
7578

7679
```console
77-
$ yq '.steps[-1].items' < <output-dir>/test-run.yaml
80+
$ yq '.steps[-1].items' < <output-directory>/test-run.yaml
7881
```
7982

8083
Test events from the log:
8184

8285
```console
83-
$ grep -E '(INFO|ERROR).+<app-name>' <output-dir>/test-run.log
86+
$ grep -E '(INFO|ERROR).+<app-name>' <output-directory>/test-run.log
8487
```
8588

8689
The `test-run.yaml` report contains the config used, each test step with
8790
its status and duration, and a summary with pass/fail/skip counts.
8891

89-
### Step 4: Handle failures
92+
### Step 5: Handle failures
9093

9194
If the test failed:
9295

@@ -98,7 +101,7 @@ If the test failed:
98101
4. Fix the underlying issue
99102
5. **Always clean up** before re-running (see {{.Command.Slug}}-test-clean skill)
100103

101-
### Step 5: Clean up
104+
### Step 6: Clean up
102105

103106
Ask the user if they want to clean up. Do not clean up without an
104107
explicit request — failed test resources are evidence for debugging.

pkg/skills/templates/skills/validate-application.tmpl

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ Present the list and let the user choose which application to validate.
3838
The `NAME` and `NAMESPACE` columns map to the `--name` and `--namespace`
3939
flags.
4040

41-
### Step 2: Run validate application
41+
### Step 2: Pick an output directory
4242

43-
Use `<env>/<namespace>-<app-name>` for the output directory, e.g., `myenv/myns-myapp`.
43+
Ask the user where to store the report. Suggest a unique name like
44+
`out/<drpc-namespace>-<drpc-name>-<%Y-%m-%d-%H-%M>`, e.g.,
45+
`out/myns-myapp-2026-07-20-19-46`.
46+
47+
### Step 3: Run validate application
4448

4549
```console
46-
$ {{.Command.Name}} validate application --name <drpc-name> --namespace <namespace> -o <output-dir> --interactive=false
50+
$ {{.Command.Name}} validate application --name <drpc-name> --namespace <namespace> -o <output-directory> --interactive=false
4751
```
4852

4953
`--interactive=false` prevents {{.Command.Name}} from opening a browser—you open the
@@ -54,7 +58,7 @@ Use `--config <file>` if the config file is not the default `config.yaml`.
5458
The command takes a few seconds on local clusters and about a minute on
5559
remote clusters.
5660

57-
### Step 3: Check the result
61+
### Step 4: Check the result
5862

5963
**On success:**
6064

@@ -73,16 +77,16 @@ there are problems **in** that report. If the command **fails before** a
7377
report is written (early error), there may be no HTML—use the log and console
7478
output instead.
7579

76-
### Step 4: Open the HTML report
80+
### Step 5: Open the HTML report
7781

78-
If `<output-dir>/validate-application.html` exists, open it in the
82+
If `<output-directory>/validate-application.html` exists, open it in the
7983
browser using `open <path>` (macOS), `xdg-open <path>` (Linux), or
8084
`cmd /c start "" <path>` (Windows). Do not skip unless the user asks
8185
to skip.
8286

8387
The report may not exist if the command failed before writing it.
8488

85-
### Step 5: Inspect the report
89+
### Step 6: Inspect the report
8690

8791
The output directory contains:
8892

@@ -96,13 +100,13 @@ The output directory contains:
96100
Read the application status:
97101

98102
```console
99-
$ yq '.applicationStatus' < <output-dir>/validate-application.yaml
103+
$ yq '.applicationStatus' < <output-directory>/validate-application.yaml
100104
```
101105

102106
#### Gathered data structure
103107

104108
```console
105-
$ tree -L3 <output-dir>/validate-application.data
109+
$ tree -L3 <output-directory>/validate-application.data
106110
validate-application.data/
107111
├── <cluster>/
108112
│ ├── cluster/
@@ -117,7 +121,7 @@ validate-application.data/
117121
└── <app-namespace>/
118122
```
119123

120-
### Step 6: Troubleshoot problems
124+
### Step 7: Troubleshoot problems
121125

122126
This section is an **initial draft** — DR troubleshooting is hard and
123127
needs more playbooks over time (for example a future analyze skill).
@@ -134,20 +138,20 @@ Useful commands for inspecting gathered data:
134138
Check VRG status:
135139

136140
```console
137-
$ yq '.status' < <output-dir>/validate-application.data/<cluster>/namespaces/<ns>/ramendr.openshift.io/volumereplicationgroups/<name>.yaml
141+
$ yq '.status' < <output-directory>/validate-application.data/<cluster>/namespaces/<ns>/ramendr.openshift.io/volumereplicationgroups/<name>.yaml
138142
```
139143

140144
Search ramen operator logs for errors related to the app:
141145

142146
```console
143-
$ grep -E 'ERROR.+<app-name>' <output-dir>/validate-application.data/<cluster>/namespaces/ramen-system/pods/*/manager/current.log
147+
$ grep -E 'ERROR.+<app-name>' <output-directory>/validate-application.data/<cluster>/namespaces/ramen-system/pods/*/manager/current.log
144148
```
145149

146-
### Step 7: Suggest validate clusters
150+
### Step 8: Suggest validate clusters
147151

148152
After completing the application validation, suggest also running
149153
`{{.Command.Name}} validate clusters` into a sibling output directory such as
150-
`<env>/clusters`. When they agree (or you run it for them), follow the
154+
`out/clusters`. When they agree (or you run it for them), follow the
151155
**{{.Command.Slug}}-validate-clusters** skill end to end.
152156

153157
Why this helps: the application report covers one DRPC, its namespaces, and

pkg/skills/templates/skills/validate-clusters.tmpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ resources from all clusters, and checking that S3 endpoints are accessible.
2222

2323
### Step 1: Pick an output directory
2424

25-
Ask the user where to store the report. Suggest `<env>/clusters` or
26-
`<env>-<date>/clusters`, e.g., `myenv/clusters`.
25+
Ask the user where to store the report. Suggest a unique name like
26+
`out/clusters-<%Y-%m-%d-%H-%M>`, e.g., `out/clusters-2026-07-20-19-46`.
2727

2828
### Step 2: Run validate clusters
2929

3030
```console
31-
$ {{.Command.Name}} validate clusters -o <output-dir> --interactive=false
31+
$ {{.Command.Name}} validate clusters -o <output-directory> --interactive=false
3232
```
3333

3434
`--interactive=false` prevents {{.Command.Name}} from opening a browser—you open the
@@ -61,7 +61,7 @@ output instead.
6161

6262
### Step 4: Open the HTML report
6363

64-
If `<output-dir>/validate-clusters.html` exists, open it in the
64+
If `<output-directory>/validate-clusters.html` exists, open it in the
6565
browser using `open <path>` (macOS), `xdg-open <path>` (Linux), or
6666
`cmd /c start "" <path>` (Windows). Do not skip unless the user asks
6767
to skip.
@@ -82,13 +82,13 @@ The output directory contains:
8282
Read the YAML report to understand the status:
8383

8484
```console
85-
$ yq '.clustersStatus' < <output-dir>/validate-clusters.yaml
85+
$ yq '.clustersStatus' < <output-directory>/validate-clusters.yaml
8686
```
8787

8888
#### Gathered data structure
8989

9090
```console
91-
$ tree -L3 <output-dir>/validate-clusters.data
91+
$ tree -L3 <output-directory>/validate-clusters.data
9292
validate-clusters.data/
9393
├── <cluster>/
9494
│ ├── cluster/

0 commit comments

Comments
 (0)