This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 0a22aeec908 [opt] add weekly report slack prompt (#3970)
0a22aeec908 is described below

commit 0a22aeec9089be5a925327faa68dc339dc50a542
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Tue Jul 7 13:54:53 2026 +0800

    [opt] add weekly report slack prompt (#3970)
---
 doc-tools/skills/weekly-report-slack/SKILL.md      |  73 +++++++++++++
 .../skills/weekly-report-slack/agents/openai.yaml  |   4 +
 .../scripts/generate_slack_post.py                 | 119 +++++++++++++++++++++
 3 files changed, 196 insertions(+)

diff --git a/doc-tools/skills/weekly-report-slack/SKILL.md 
b/doc-tools/skills/weekly-report-slack/SKILL.md
new file mode 100644
index 00000000000..f5387401e42
--- /dev/null
+++ b/doc-tools/skills/weekly-report-slack/SKILL.md
@@ -0,0 +1,73 @@
+---
+name: weekly-report-slack
+description: Generate an English Slack-ready post from an Apache Doris weekly 
community report MDX file. Use when the user invokes `$weekly-report-slack 
path/to/report.mdx` or asks to turn a Doris weekly report, especially 
`src/pages/community-report/_reports/YYYY-MM-DD.mdx`, into the standard Slack 
announcement format with date range, summary paragraph, highlights, and report 
link.
+---
+
+# Weekly Report Slack
+
+## Overview
+
+Create a concise English post for Slack from a weekly Apache Doris community 
report. The output follows the community announcement template and is meant to 
be pasted directly into Slack.
+
+## Input
+
+Require exactly one report path, usually:
+
+```shell
+$weekly-report-slack src/pages/community-report/_reports/2026-06-29.mdx
+```
+
+If no path is provided, ask for the report path. If multiple paths are 
provided, ask which single report to convert.
+
+The expected source format is the structured MDX generated by 
`community-radar`, with exports such as:
+
+- `export const label = "...";`
+- `export const report = { "summary": { ... } }`
+
+## Workflow
+
+1. Resolve the report path from the repository root.
+2. Run the bundled script:
+
+```shell
+python3 doc-tools/skills/weekly-report-slack/scripts/generate_slack_post.py 
<report-path>
+```
+
+3. Return the generated Slack post as the main answer. Do not wrap it in a 
code fence unless the user asks for a fenced block.
+4. If the report is unpublished, or the user provides a preview URL, pass it 
explicitly:
+
+```shell
+python3 doc-tools/skills/weekly-report-slack/scripts/generate_slack_post.py 
<report-path> --report-link <url>
+```
+
+## Output Rules
+
+Preserve this Slack formatting:
+
+```text
+📊 *Apache Doris Weekly Report — [DATE RANGE]*
+
+[One short summary paragraph]
+
+✨ *Highlights*
+• [Highlight 1]
+• [Highlight 2]
+• [Highlight 3]
+
+👉 Read the full weekly report:
+[REPORT LINK]
+
+Big thanks to everyone who contributed, reviewed, tested, reported issues, and 
shared feedback this week! 🙌
+```
+
+Use the report's `label` as `[DATE RANGE]`, `report.summary.lead` as the 
opening summary paragraph, and `report.summary.highlights` for the highlight 
bullets unless the user asks for a different tone or length.
+
+By default, the report link is 
`https://doris.apache.org/community-report#<filename-without-extension>`, 
because the website uses URL hashes to deep-link weekly reports.
+
+## Guardrails
+
+- Keep the post in English.
+- Keep exactly three highlight bullets unless the report has fewer than three 
highlights.
+- Prefer highlight titles over long narratives for the bullets.
+- Do not invent numbers, links, or highlights. If a required field is missing, 
report the missing field and stop.
+- Do not edit the source report file.
diff --git a/doc-tools/skills/weekly-report-slack/agents/openai.yaml 
b/doc-tools/skills/weekly-report-slack/agents/openai.yaml
new file mode 100644
index 00000000000..d05ee488c4b
--- /dev/null
+++ b/doc-tools/skills/weekly-report-slack/agents/openai.yaml
@@ -0,0 +1,4 @@
+interface:
+  display_name: "Weekly Report Slack"
+  short_description: "Create Doris weekly Slack posts."
+  default_prompt: "$weekly-report-slack 
src/pages/community-report/_reports/2026-06-29.mdx"
diff --git 
a/doc-tools/skills/weekly-report-slack/scripts/generate_slack_post.py 
b/doc-tools/skills/weekly-report-slack/scripts/generate_slack_post.py
new file mode 100755
index 00000000000..28cbdf84566
--- /dev/null
+++ b/doc-tools/skills/weekly-report-slack/scripts/generate_slack_post.py
@@ -0,0 +1,119 @@
+#!/usr/bin/env python3
+"""Generate an Apache Doris weekly report Slack post from structured MDX."""
+
+from __future__ import annotations
+
+import argparse
+import json
+import re
+import sys
+from pathlib import Path
+from typing import Any
+
+
+DEFAULT_SITE_URL = "https://doris.apache.org";
+
+
+class ReportError(RuntimeError):
+    pass
+
+
+def load_json_export(source: str, export_name: str) -> Any:
+    pattern = re.compile(rf"export\s+const\s+{re.escape(export_name)}\s*=")
+    match = pattern.search(source)
+    if not match:
+        raise ReportError(f"Missing export const {export_name}")
+
+    value_source = source[match.end() :].lstrip()
+    decoder = json.JSONDecoder()
+    try:
+        value, _ = decoder.raw_decode(value_source)
+    except json.JSONDecodeError as exc:
+        raise ReportError(f"Could not parse export const {export_name}: 
{exc}") from exc
+    return value
+
+
+def highlight_title(highlight: Any) -> str:
+    if isinstance(highlight, str):
+        return highlight.strip()
+    if isinstance(highlight, dict):
+        title = str(highlight.get("title", "")).strip()
+        if title:
+            return title
+        narrative = str(highlight.get("narrative", "")).strip()
+        if narrative:
+            return narrative
+    return ""
+
+
+def build_report_link(report_path: Path, report_link: str | None, site_url: 
str) -> str:
+    if report_link:
+        return report_link
+    report_id = report_path.stem
+    return f"{site_url.rstrip('/')}/community-report#{report_id}"
+
+
+def generate_post(report_path: Path, report_link: str | None, site_url: str) 
-> str:
+    source = report_path.read_text(encoding="utf-8")
+
+    label = load_json_export(source, "label")
+    report = load_json_export(source, "report")
+
+    summary = report.get("summary")
+    if not isinstance(summary, dict):
+        raise ReportError("Missing report.summary")
+
+    highlights_value = summary.get("highlights")
+    if not isinstance(highlights_value, list) or not highlights_value:
+        raise ReportError("Missing report.summary.highlights")
+
+    highlights = [title for title in (highlight_title(item) for item in 
highlights_value) if title]
+    if not highlights:
+        raise ReportError("No usable highlight titles found in 
report.summary.highlights")
+
+    lead = str(summary.get("lead", "")).strip()
+    if not lead:
+        raise ReportError("Missing report.summary.lead")
+
+    link = build_report_link(report_path, report_link, site_url)
+    bullets = "\n".join(f"• {title}" for title in highlights[:3])
+
+    return "\n".join(
+        [
+            f"📊 *Apache Doris Weekly Report — {label}*",
+            "",
+            lead,
+            "",
+            "✨ *Highlights*",
+            bullets,
+            "",
+            "👉 Read the full weekly report:",
+            link,
+            "",
+            "Big thanks to everyone who contributed, reviewed, tested, 
reported issues, and shared feedback this week! 🙌",
+        ]
+    )
+
+
+def main() -> int:
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument("report_path", type=Path, help="Path to the weekly 
report .md or .mdx file")
+    parser.add_argument("--report-link", help="Override the generated public 
report link")
+    parser.add_argument("--site-url", default=DEFAULT_SITE_URL, help=f"Site 
URL used for default links ({DEFAULT_SITE_URL})")
+    args = parser.parse_args()
+
+    if not args.report_path.is_file():
+        print(f"error: report file not found: {args.report_path}", 
file=sys.stderr)
+        return 2
+
+    try:
+        print(generate_post(args.report_path, args.report_link, args.site_url))
+    except ReportError as exc:
+        print(f"error: {exc}", file=sys.stderr)
+        return 1
+
+    return 0
+
+
+if __name__ == "__main__":
+    raise SystemExit(main())


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to