Skip to content

Commit f413f2a

Browse files
fix: remove duplicated Automate This content, link back to examples page
The Automate This sections were duplicating the prompt already defined in frontmatter. Now use-case pages just have a simple card linking back to the automation examples page (with an anchor to the specific use case). The prompt content lives in one place only — the frontmatter — and the sync script copies it to examples.mdx. - Remove generated Automate This blocks and markers from use-case pages - Replace with a static Card linking to examples page anchor - Remove unused intro field from frontmatter - Simplify sync script to only generate the examples page Co-authored-by: openhands <openhands@all-hands.dev>
1 parent bd7d014 commit f413f2a

File tree

5 files changed

+28
-153
lines changed

5 files changed

+28
-153
lines changed

.github/scripts/sync_use_case_automations.py

Lines changed: 20 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,19 @@
44
55
Each use-case page under ``openhands/usage/use-cases/`` is the **source of
66
truth**. If a page's YAML frontmatter contains an ``automation:`` block, the
7-
script treats it as an automation-enabled use case and:
7+
script copies that content into the "Use Case Automations" section of
8+
``openhands/usage/automations/examples.mdx``.
89
9-
1. Generates the "Use Case Automations" card grid + Tabs section in
10-
``openhands/usage/automations/examples.mdx`` (between markers).
11-
2. Generates the "Automate This" section in the use-case page itself
12-
(between markers).
13-
14-
Marker format (JSX comments, ignored by Mintlify):
10+
The generated section lives between marker comments in examples.mdx:
1511
{/* BEGIN:use-case-automations */} … {/* END:use-case-automations */}
16-
{/* BEGIN:automate-this */} … {/* END:automate-this */}
1712
1813
Usage:
1914
python .github/scripts/sync_use_case_automations.py # write mode
2015
python .github/scripts/sync_use_case_automations.py --check # CI check
2116
2217
Exit codes:
23-
0 — all files are in sync (or were updated in write mode)
24-
1 — files are out of sync (check mode)
18+
0 — examples page is in sync (or was updated in write mode)
19+
1 — examples page is out of sync (check mode)
2520
"""
2621

2722
from __future__ import annotations
@@ -38,14 +33,12 @@
3833
EXAMPLES_PAGE = REPO_ROOT / "openhands" / "usage" / "automations" / "examples.mdx"
3934
USE_CASES_DIR = REPO_ROOT / "openhands" / "usage" / "use-cases"
4035

41-
# Frontmatter delimiters
4236
FRONTMATTER_RE = re.compile(r"\A---\n(.*?)\n---", re.DOTALL)
4337

4438

4539
# ── Frontmatter parsing ──────────────────────────────────────────────
4640

4741
def parse_frontmatter(text: str) -> dict:
48-
"""Extract YAML frontmatter from an MDX file."""
4942
m = FRONTMATTER_RE.match(text)
5043
if not m:
5144
return {}
@@ -64,7 +57,7 @@ def collect_use_cases() -> list[tuple[str, dict]]:
6457
return results
6558

6659

67-
# ── Generators ────────────────────────────────────────────────────────
60+
# ── Generator ─────────────────────────────────────────────────────────
6861

6962
def _indent(text: str, n: int = 4) -> str:
7063
return textwrap.indent(text, " " * n)
@@ -119,26 +112,6 @@ def generate_examples_section(use_cases: list[tuple[str, dict]]) -> str:
119112
return "\n".join(parts)
120113

121114

122-
def generate_automate_this(auto: dict) -> str:
123-
"""Generate the ``automate-this`` block for a single use-case page."""
124-
prompt = auto["prompt"].rstrip("\n")
125-
return (
126-
f"## Automate This\n"
127-
f"\n"
128-
f'{auto["intro"]}\n'
129-
f"\n"
130-
f"```\n"
131-
f"{prompt}\n"
132-
f"```\n"
133-
f"\n"
134-
f'<Card title="More Automation Templates" icon="clock" '
135-
f'href="/openhands/usage/automations/examples">\n'
136-
f" Browse all automation examples, including vulnerability scanning, "
137-
f"code review, monitoring, and more.\n"
138-
f"</Card>"
139-
)
140-
141-
142115
# ── Marker replacement ───────────────────────────────────────────────
143116

144117
def replace_marker_section(content: str, marker: str, new_body: str) -> str:
@@ -185,50 +158,26 @@ def main() -> int:
185158
print("No use-case pages with automation frontmatter found.")
186159
return 0
187160

188-
diffs: list[str] = []
189-
190-
# 1. Regenerate the examples page card section
191161
original = EXAMPLES_PAGE.read_text()
192162
generated = generate_examples_section(use_cases)
193163
updated = replace_marker_section(original, "use-case-automations", generated)
194164

195-
if updated != original:
196-
diffs.append(str(EXAMPLES_PAGE.relative_to(REPO_ROOT)))
197-
if not args.check:
198-
EXAMPLES_PAGE.write_text(updated)
199-
print(f" ✏️ Updated {EXAMPLES_PAGE.relative_to(REPO_ROOT)}")
165+
if updated == original:
166+
print("✅ Automation examples page is in sync.")
167+
return 0
200168

201-
# 2. Regenerate the "Automate This" section in each use-case page
202-
for slug, auto in use_cases:
203-
page = USE_CASES_DIR / f"{slug}.mdx"
204-
original = page.read_text()
205-
generated = generate_automate_this(auto)
206-
updated = replace_marker_section(original, "automate-this", generated)
207-
208-
if updated != original:
209-
rel = str(page.relative_to(REPO_ROOT))
210-
diffs.append(rel)
211-
if not args.check:
212-
page.write_text(updated)
213-
print(f" ✏️ Updated {rel}")
214-
215-
if diffs:
216-
if args.check:
217-
print(
218-
"\n❌ The automation examples page is out of sync with "
219-
"use-case frontmatter:"
220-
)
221-
for d in diffs:
222-
print(f" - {d}")
223-
print(
224-
"\nRun: python .github/scripts/sync_use_case_automations.py\n"
225-
"Then commit the updated files."
226-
)
227-
return 1
228-
print(f"\n✅ Updated {len(diffs)} file(s).")
229-
else:
230-
print("✅ All files are in sync.")
169+
if args.check:
170+
print(
171+
"❌ openhands/usage/automations/examples.mdx is out of sync "
172+
"with use-case frontmatter.\n"
173+
"\n"
174+
"Run: python .github/scripts/sync_use_case_automations.py\n"
175+
"Then commit the updated file."
176+
)
177+
return 1
231178

179+
EXAMPLES_PAGE.write_text(updated)
180+
print(f"✅ Updated {EXAMPLES_PAGE.relative_to(REPO_ROOT)}")
232181
return 0
233182

234183

openhands/usage/use-cases/code-review.mdx

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ automation:
77
card_description: >-
88
Review PRs automatically on every push. Pairs with the
99
[pr-review plugin](https://github.com/OpenHands/extensions/tree/main/plugins/pr-review).
10-
intro: >-
11-
Schedule daily code reviews with an OpenHands automation.
12-
Copy this prompt into a conversation:
1310
prompt: |
1411
Create an automation called "Daily Code Review" that runs every weekday at 9 AM.
1512
@@ -287,27 +284,12 @@ See real automated reviews in action on the OpenHands Software Agent SDK reposit
287284
</Accordion>
288285
</AccordionGroup>
289286

290-
{/* BEGIN:automate-this — auto-generated from frontmatter */}
291-
292287
## Automate This
293288

294-
Schedule daily code reviews with an OpenHands automation. Copy this prompt into a conversation:
295-
296-
```
297-
Create an automation called "Daily Code Review" that runs every weekday at 9 AM.
298-
299-
It should:
300-
1. Find all open PRs that have no reviews yet
301-
2. For each PR, review the diff for bugs, style issues, and security concerns
302-
3. Post a summary of findings as a comment on each PR
303-
```
304-
305-
<Card title="More Automation Templates" icon="clock" href="/openhands/usage/automations/examples">
306-
Browse all automation examples, including vulnerability scanning, code review, monitoring, and more.
289+
<Card title="Code Review Automation" icon="clock" href="/openhands/usage/automations/examples#automated-code-review">
290+
Run this use case as a scheduled automation — copy a ready-to-use prompt from the Automation Examples page.
307291
</Card>
308292

309-
{/* END:automate-this */}
310-
311293
## Related Resources
312294

313295
- [PR Review Workflow Reference](https://github.com/OpenHands/software-agent-sdk/tree/main/examples/03_github_workflows/02_pr_review) - Full workflow example and agent script

openhands/usage/use-cases/dependency-upgrades.mdx

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ automation:
66
icon: arrow-up-right-dots
77
card_description: >-
88
Check for outdated packages weekly and report available updates.
9-
intro: >-
10-
Schedule weekly dependency checks with an OpenHands automation.
11-
Copy this prompt into a conversation:
129
prompt: |
1310
Create an automation called "Dependency Checker" that runs every Monday at 8 AM.
1411
@@ -298,28 +295,12 @@ Create an upgrade plan that handles all these together,
298295
addressing breaking changes in the correct order.
299296
```
300297

301-
{/* BEGIN:automate-this — auto-generated from frontmatter */}
302-
303298
## Automate This
304299

305-
Schedule weekly dependency checks with an OpenHands automation. Copy this prompt into a conversation:
306-
307-
```
308-
Create an automation called "Dependency Checker" that runs every Monday at 8 AM.
309-
310-
It should:
311-
1. Scan all package.json and requirements.txt files
312-
2. Check for outdated dependencies
313-
3. Create a report listing packages with available updates (grouped by major/minor/patch)
314-
4. Post the report to #engineering
315-
```
316-
317-
<Card title="More Automation Templates" icon="clock" href="/openhands/usage/automations/examples">
318-
Browse all automation examples, including vulnerability scanning, code review, monitoring, and more.
300+
<Card title="Dependency Upgrades Automation" icon="clock" href="/openhands/usage/automations/examples#dependency-upgrades">
301+
Run this use case as a scheduled automation — copy a ready-to-use prompt from the Automation Examples page.
319302
</Card>
320303

321-
{/* END:automate-this */}
322-
323304
## Related Resources
324305

325306
- [Vulnerability Remediation](/openhands/usage/use-cases/vulnerability-remediation) - Fix security vulnerabilities

openhands/usage/use-cases/incident-triage.mdx

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ automation:
77
card_description: >-
88
Monitor APIs, analyze errors, and alert your team. Pairs with the
99
[Datadog debugging workflow](https://github.com/OpenHands/software-agent-sdk/tree/main/examples/03_github_workflows/04_datadog_debugging).
10-
intro: >-
11-
Set up continuous health monitoring with an OpenHands automation.
12-
Copy this prompt into a conversation:
1310
prompt: |
1411
Create an automation called "API Health Monitor" that runs every 30 minutes.
1512
@@ -277,26 +274,12 @@ Avoid these common incident response mistakes:
277274
For production incidents, always follow your organization's incident response procedures. OpenHands is a tool to assist your investigation, not a replacement for proper incident management.
278275
</Note>
279276

280-
{/* BEGIN:automate-this — auto-generated from frontmatter */}
281-
282277
## Automate This
283278

284-
Set up continuous health monitoring with an OpenHands automation. Copy this prompt into a conversation:
285-
286-
```
287-
Create an automation called "API Health Monitor" that runs every 30 minutes.
288-
289-
It should check https://api.example.com/health and:
290-
- If the response is not 200 OK, send an alert to #alerts with the status code and response body
291-
- If healthy, just log success without alerting anyone
292-
```
293-
294-
<Card title="More Automation Templates" icon="clock" href="/openhands/usage/automations/examples">
295-
Browse all automation examples, including vulnerability scanning, code review, monitoring, and more.
279+
<Card title="Incident Monitoring Automation" icon="clock" href="/openhands/usage/automations/examples#incident-monitoring">
280+
Run this use case as a scheduled automation — copy a ready-to-use prompt from the Automation Examples page.
296281
</Card>
297282

298-
{/* END:automate-this */}
299-
300283
## Related Resources
301284

302285
- [OpenHands SDK Repository](https://github.com/OpenHands/software-agent-sdk) - Build custom AI agents

openhands/usage/use-cases/vulnerability-remediation.mdx

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ automation:
77
card_description: >-
88
Scan dependencies for known CVEs and post a report. Pairs with the
99
[vulnerability-remediation plugin](https://github.com/OpenHands/extensions/tree/main/plugins/vulnerability-remediation).
10-
intro: >-
11-
Run vulnerability scans on a schedule with an OpenHands automation.
12-
Copy this prompt into a conversation:
1310
prompt: |
1411
Create an automation called "Security Scan" that runs daily at 3 AM.
1512
@@ -299,29 +296,12 @@ To build your own vulnerability remediation agent:
299296

300297
As agent capabilities continue to evolve, an increasing number of repetitive and time-consuming security tasks can be automated, enabling developers to focus on higher-level design, innovation, and problem-solving rather than routine maintenance.
301298

302-
{/* BEGIN:automate-this — auto-generated from frontmatter */}
303-
304299
## Automate This
305300

306-
Run vulnerability scans on a schedule with an OpenHands automation. Copy this prompt into a conversation:
307-
308-
```
309-
Create an automation called "Security Scan" that runs daily at 3 AM.
310-
311-
It should run a security audit:
312-
1. Check for known vulnerabilities in dependencies
313-
2. Scan for hardcoded secrets or API keys
314-
3. Look for common security misconfigurations
315-
316-
Create a detailed report and alert #security if any high or critical issues are found.
317-
```
318-
319-
<Card title="More Automation Templates" icon="clock" href="/openhands/usage/automations/examples">
320-
Browse all automation examples, including vulnerability scanning, code review, monitoring, and more.
301+
<Card title="Vulnerability Scan Automation" icon="clock" href="/openhands/usage/automations/examples#vulnerability-scan">
302+
Run this use case as a scheduled automation — copy a ready-to-use prompt from the Automation Examples page.
321303
</Card>
322304

323-
{/* END:automate-this */}
324-
325305
## Related Resources
326306

327307
- [Vulnerability Fixer Example](https://github.com/OpenHands/vulnerability-fixer) - Full implementation example

0 commit comments

Comments
 (0)