Skip to content

Commit 159f966

Browse files
authored
Merge pull request #51 from reacher-z/star-prompt
Add Star-us prompts across TUI, CLI, and README
2 parents 9af827f + f3b5f32 commit 159f966

6 files changed

Lines changed: 114 additions & 76 deletions

File tree

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,27 @@ If you use ClawBench in your research, please cite:
546546
</tr>
547547
</table>
548548

549+
## Support ClawBench
550+
551+
If ClawBench is useful for your research or product work,
552+
the single most helpful thing you can do is **[star the repo](https://github.com/reacher-z/ClawBench)**
553+
it surfaces the benchmark to other AI-agent researchers and helps us justify
554+
continued dataset curation.
555+
556+
<p align="center">
557+
<a href="https://github.com/reacher-z/ClawBench">
558+
<img src="https://img.shields.io/badge/%E2%98%85%20Star%20this%20repo-181717?style=for-the-badge&logo=github&logoColor=white" alt="Star this repo">
559+
</a>
560+
</p>
561+
562+
Open to contributions — new test cases, bug fixes, or evaluation submissions for a model we haven't scored yet. See [`CONTRIBUTING.md`](CONTRIBUTING.md).
563+
564+
<p align="center">
565+
<a href="https://github.com/reacher-z/ClawBench/graphs/contributors">
566+
<img src="https://contrib.rocks/image?repo=reacher-z/ClawBench" alt="Contributors">
567+
</a>
568+
</p>
569+
549570
## Star History
550571

551572
<a href="https://star-history.com/#reacher-z/ClawBench&Date">

README.zh-CN.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,26 @@ uv run --project test-driver test-driver/batch.py --all-models --case-range 1-50
546546
</tr>
547547
</table>
548548

549+
## 支持 ClawBench
550+
551+
如果 ClawBench 对你的研究或产品工作有帮助,
552+
最有用的支持就是**[给仓库点一个 Star](https://github.com/reacher-z/ClawBench)** ——
553+
这能让更多 AI agent 研究者发现这个 benchmark,也帮我们持续投入数据集维护。
554+
555+
<p align="center">
556+
<a href="https://github.com/reacher-z/ClawBench">
557+
<img src="https://img.shields.io/badge/%E2%98%85%20Star%20this%20repo-181717?style=for-the-badge&logo=github&logoColor=white" alt="Star this repo">
558+
</a>
559+
</p>
560+
561+
欢迎贡献 —— 新的 test case、bug 修复,或者是我们还没评测过的模型结果提交。参见 [`CONTRIBUTING.md`](CONTRIBUTING.md)
562+
563+
<p align="center">
564+
<a href="https://github.com/reacher-z/ClawBench/graphs/contributors">
565+
<img src="https://contrib.rocks/image?repo=reacher-z/ClawBench" alt="Contributors">
566+
</a>
567+
</p>
568+
549569
## Star 历史
550570

551571
<a href="https://star-history.com/#reacher-z/ClawBench&Date">

src/clawbench/batch.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,9 @@ def on_signal() -> None:
594594
hf_env,
595595
)
596596

597+
from clawbench.support import print_star_prompt
598+
print_star_prompt()
599+
597600
has_errors = any(j.status == "error" for j in jobs)
598601
return 1 if has_errors else 0
599602

src/clawbench/run.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,8 @@ def handle_sigint(sig, frame):
998998

999999
if intercepted:
10001000
print(f"\nINTERCEPTED — results in {output_dir}")
1001+
from clawbench.support import print_star_prompt
1002+
print_star_prompt()
10011003
else:
10021004
print(f"\nNOT INTERCEPTED — results in {output_dir}")
10031005
sys.exit(1)

src/clawbench/support.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""User-facing 'support us' prompts shared across run / batch / tui.
2+
3+
A benchmark repo lives or dies by community reach. The cost of a one-line
4+
star prompt at end-of-run is trivial; the star rate from a user who just
5+
saw their run succeed is the highest we'll ever get.
6+
"""
7+
8+
from __future__ import annotations
9+
10+
import os
11+
import sys
12+
13+
_STAR_URL = "https://github.com/reacher-z/ClawBench"
14+
15+
16+
def star_prompt_enabled() -> bool:
17+
"""Honor ``NO_COLOR``-style opt-out for non-interactive or CI use."""
18+
if os.environ.get("CLAWBENCH_NO_STAR"):
19+
return False
20+
if not sys.stdout.isatty():
21+
return False
22+
return True
23+
24+
25+
def print_star_prompt() -> None:
26+
"""Plain-stdout variant — used from run.py / batch.py after completion."""
27+
if not star_prompt_enabled():
28+
return
29+
print()
30+
print(f" If ClawBench helped, please star us: {_STAR_URL}")
31+
32+
33+
def rich_star_prompt(console) -> None:
34+
"""Rich-console variant — used from the TUI so it themes correctly."""
35+
if not star_prompt_enabled():
36+
return
37+
console.print()
38+
console.print(
39+
f" [dim]If ClawBench helped, please [bold]star us[/]: "
40+
f"[link={_STAR_URL}]{_STAR_URL}[/][/]"
41+
)

src/clawbench/tui.py

Lines changed: 27 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -665,97 +665,41 @@ def mode_configure() -> None:
665665

666666

667667
# ---------------------------------------------------------------------------
668-
# Mode: Configure secrets
668+
# Mode: Star on GitHub
669669
# ---------------------------------------------------------------------------
670670

671-
_SECRET_KEYS: list[tuple[str, str]] = [
672-
("PURELY_MAIL_API_KEY", "PurelyMail API key"),
673-
("PURELY_MAIL_DOMAIN", "PurelyMail domain"),
674-
("HF_TOKEN", "HuggingFace token (optional)"),
675-
("HF_REPO_ID", "HuggingFace dataset repo id (optional)"),
676-
]
677-
678-
679-
def _redact_secret(v: str) -> str:
680-
if len(v) <= 4:
681-
return "****"
682-
return v[:2] + "****" + v[-2:]
683-
684-
685-
def _read_secrets_file(path: Path) -> dict[str, str]:
686-
out: dict[str, str] = {}
687-
if not path.exists():
688-
return out
689-
for line in path.read_text().splitlines():
690-
line = line.strip()
691-
if not line or line.startswith("#") or "=" not in line:
692-
continue
693-
k, v = line.split("=", 1)
694-
out[k.strip()] = v.strip().strip('"').strip("'")
695-
return out
671+
_STAR_URL = "https://github.com/reacher-z/ClawBench"
696672

697673

698-
def mode_configure_secrets() -> None:
699-
"""Prompt for PurelyMail + HF credentials and persist to secrets.env.
674+
def _open_star_page() -> None:
675+
"""Open the repo page in the user's default browser and print the URL.
700676
701-
Mirrors ``clawbench configure --secrets`` so TUI users have the same
702-
capability without dropping to the CLI. Blank answers keep the existing
703-
value; shipped defaults are shown in the clear so a new user can accept
704-
them by hitting enter.
677+
Browser-open is best-effort (headless VMs, SSH sessions, locked-down
678+
kiosks) — we always print the URL so the user can click it from a
679+
modern terminal emulator that auto-linkifies http URLs.
705680
"""
706-
# Import here — ``clawbench.run`` pulls heavier deps we don't want at
707-
# TUI startup, and this screen is cold-path.
708-
from clawbench.run import DEFAULT_SECRETS
709-
710-
target = _paths.user_secrets_path()
711-
existing = _read_secrets_file(target)
681+
import webbrowser
712682

713683
console.print()
714684
console.print(Panel(
715685
Text.assemble(
716-
Text("Configure secrets", style="bold"),
717-
"\n",
718-
Text(f"Writes to {target}", style="dim"),
686+
Text("Thanks for using ClawBench", style="bold"),
719687
"\n",
720-
Text("Leave blank to keep the current value.", style="dim"),
688+
Text("Stars help other AI-agent researchers find the benchmark.",
689+
style="dim"),
690+
"\n\n",
691+
Text(_STAR_URL, style="bold"),
721692
),
722693
))
723694
console.print()
724-
725-
updated: dict[str, str] = dict(existing)
726-
for key, label in _SECRET_KEYS:
727-
cur = existing.get(key, "")
728-
default = DEFAULT_SECRETS.get(key, "")
729-
if cur:
730-
hint = f" [current: {_redact_secret(cur)}]"
731-
elif default:
732-
hint = f" [default: {default}]"
733-
else:
734-
hint = ""
735-
val = questionary.text(
736-
f"{label}{hint}",
737-
default="",
738-
style=STYLE,
739-
).ask()
740-
if val is None:
741-
console.print("\n[dim]Cancelled.[/]")
742-
return
743-
val = val.strip()
744-
if val:
745-
updated[key] = val
746-
elif not cur and default:
747-
updated[key] = default
748-
749-
lines = ["# claw-bench secrets — chmod 600", ""]
750-
lines += [f'{k}="{v}"' for k, v in updated.items()]
751-
target.write_text("\n".join(lines) + "\n", encoding="utf-8")
752695
try:
753-
target.chmod(stat.S_IRUSR | stat.S_IWUSR)
754-
except OSError:
755-
pass
756-
757-
console.print()
758-
console.print(f" [green]Wrote {len(updated)} key(s) to {target}[/]")
696+
opened = webbrowser.open(_STAR_URL)
697+
except Exception:
698+
opened = False
699+
if opened:
700+
console.print(" [dim]Opened in your default browser.[/]")
701+
else:
702+
console.print(" [dim]Copy the link above to open it manually.[/]")
759703
console.print()
760704

761705

@@ -1602,15 +1546,22 @@ def main() -> None:
16021546
questionary.Choice("Configure models", value="configure"),
16031547
questionary.Choice("Configure secrets", value="configure_secrets"),
16041548
questionary.Choice("Change theme", value="theme"),
1549+
questionary.Choice("Star us on GitHub", value="star"),
16051550
questionary.Choice("Exit", value="exit"),
16061551
],
16071552
style=STYLE,
16081553
).ask()
16091554

16101555
if mode is None or mode == "exit":
1556+
from clawbench.support import rich_star_prompt
1557+
rich_star_prompt(console)
16111558
console.print("\n[dim]Bye.[/]")
16121559
return
16131560

1561+
if mode == "star":
1562+
_open_star_page()
1563+
continue
1564+
16141565
if mode == "theme":
16151566
theme = _pick_theme()
16161567
STYLE = _make_style(theme)

0 commit comments

Comments
 (0)