Skip to content

Commit 8dec010

Browse files
authored
Merge pull request #37 from botingw/codex/add-cli-command-for-ratings-and-reviews
feat: add ruleset rating command
2 parents ac7d2f2 + dc1b916 commit 8dec010

7 files changed

Lines changed: 62 additions & 2 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# Rulebook-AI: Universal Rules Template for AI Coding Assistants
55

66
* Bugs or ideas → open an **Issue** in the repo (run `rulebook-ai bug-report`)
7+
* Rate or review rule sets → run `rulebook-ai rate-ruleset`
8+
* See rule set reviews before installing → run `rulebook-ai list-rules` and follow the link
79
* Anonymous feedback: [Go to the Google Form](https://docs.google.com/forms/d/e/1FAIpQLSeW57QtPEWIRhHY1iOb8f5KQZTGLSeeb_PN2iZLd0Aw_pVYxw/viewform?usp=header)
810

911
## Quick Start with uv/uvx
@@ -107,6 +109,7 @@ This template repository serves as the central source for master rule sets. To u
107109
108110
1. **List Available Rule Sets (Optional):**
109111
* Use the `list-rules` command to see which rule sets are available for installation from this Source Template Repo.
112+
* **Note:** The command also prints a link to the ratings & reviews wiki so you can read feedback before installing.
110113
* **Command:**
111114
```bash
112115
rulebook-ai list-rules
@@ -146,6 +149,9 @@ uvx rulebook-ai doctor
146149
# Clean up rules
147150
uvx rulebook-ai clean-rules --project-dir /path/to/your/project
148151
152+
# Rate or review rule sets
153+
uvx rulebook-ai rate-ruleset
154+
149155
# Report a bug in rulebook-ai
150156
uvx rulebook-ai bug-report
151157
```

memory/docs/features/manage_rules/manage_rules_script_design.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,18 @@ This document outlines the design for a new Python script, `src/manage_rules.py`
5858
* **`list-rules`**
5959
* **Action:** Scans the Source Repository's `rule_sets/` directory. It lists all subdirectories found within `rule_sets/`, as each subdirectory represents an available rule set.
6060
* **Use Case:** Allows users to quickly see which rule sets are available for installation without needing to manually inspect the `rule_sets/` directory in the source framework.
61-
* **Output:** Prints a header like "Available rule sets:" followed by the name of each discovered rule set, one per line. If no rule sets are found, it prints an appropriate message.
61+
* **Output:** Prints a header like "Available rule sets:" followed by the name of each discovered rule set, one per line. If no rule sets are found, it prints an appropriate message. The command also shows a link to the Ratings & Reviews wiki so users can read or leave feedback.
6262

6363
* **`bug-report`**
6464
* **Action:** Prints the GitHub issue tracker URL and attempts to open it in the user's default browser.
6565
* **Use Case:** Provides a quick way for users to report problems with the tool.
6666
* **Output:** Shows the issue tracker link.
6767

68+
* **`rate-ruleset`**
69+
* **Action:** Prints the ratings and reviews wiki URL and attempts to open it in the user's default browser.
70+
* **Use Case:** Directs users to rate existing rule sets or read community feedback.
71+
* **Output:** Shows the ratings and reviews link.
72+
6873
**5. Implementation Notes**
6974

7075
* Use Python's `argparse` library.

memory/docs/features/manage_rules/refactoring_plan.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,8 @@ Following the refactor, the specification was extended to include Claude Code, C
5959

6060
An additional enhancement introduced a `bug-report` CLI command that links users to the project's issue tracker for submitting problems.
6161

62+
Another enhancement added a `rate-ruleset` CLI command that opens the Ratings & Reviews wiki, encouraging community feedback on rule sets.
63+
64+
An additional improvement surfaces the Ratings & Reviews wiki link within the `list-rules` command so users can read feedback before installing a ruleset.
65+
6266
A subsequent enhancement introduced support for mode-based assistants (Kilo Code, Roo Code), which required adding a `has_modes` flag to the `AssistantSpec` and extending the `RuleManager` engine. This demonstrated the extensibility of the refactored architecture.

memory/docs/features/manage_rules/task_plan.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,14 @@ This plan is a historical record of the tasks completed, based on the final desi
6464
| **E8** | Update unit and integration tests to verify the new mode-based logic and assistant support. | P1 | Completed | E7 |
6565
| **E9** | Enhance integration tests to check for multiple sub-modes and files within them. | P2 | Completed | E8 |
6666
| **E10** | Update design documents to reflect Kilo Code and Warp support. | P2 | Completed | E7 |
67+
68+
### Enhancement: Ratings & Reviews Command
69+
70+
**Description:** Introduced a utility command that directs users to the project's Ratings & Reviews wiki for rule sets.
71+
72+
| Task ID | Description | Importance | Status | Dependencies |
73+
|:--------|:------------|:-----------|:-------|:-------------|
74+
| **E11** | Add `rate-ruleset` CLI command linking to the ratings wiki. | P3 | Completed | - |
75+
| **E12** | Update design docs and tests for ratings command. | P3 | Completed | E11 |
76+
| **E13** | Surface ratings wiki link in `list-rules` output. | P3 | Completed | E11 |
77+
| **E14** | Update docs and tests for ratings link in `list-rules`. | P3 | Completed | E13 |

src/rulebook_ai/cli.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,16 @@ def create_parser() -> argparse.ArgumentParser:
4949
clean_all_parser.add_argument("--project-dir", "-p", help="Target project directory (default: current directory)")
5050

5151
# --- Utility Commands ---
52-
subparsers.add_parser("list-rules", help="List available rule sets.")
52+
subparsers.add_parser(
53+
"list-rules",
54+
help="List available rule sets and show ratings link.",
55+
)
5356
subparsers.add_parser("doctor", help="Check environment and setup for issues.")
5457
subparsers.add_parser("bug-report", help="Open the project issue tracker to report a bug.")
58+
subparsers.add_parser(
59+
"rate-ruleset",
60+
help="Open the ratings & reviews wiki page for rulesets.",
61+
)
5562

5663
return parser
5764

@@ -102,6 +109,9 @@ def handle_command(args: argparse.Namespace) -> int:
102109
elif command == "bug-report":
103110
return rule_manager.report_bug()
104111

112+
elif command == "rate-ruleset":
113+
return rule_manager.rate_ruleset()
114+
105115
return 1
106116

107117

src/rulebook_ai/core.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
SOURCE_REQUIREMENTS_TXT_FILE = "requirements.txt"
3030

3131
BUG_REPORT_URL = "https://github.com/botingw/rulebook-ai/issues"
32+
RATINGS_REVIEWS_URL = (
33+
"https://github.com/botingw/rulebook-ai/wiki/Ratings-%26-Reviews-(Rulesets)"
34+
)
3235

3336

3437
class RuleManager:
@@ -297,6 +300,7 @@ def list_rules(self) -> None:
297300
print("Available rule sets:")
298301
for p in sorted([p.name for p in self.source_rules_dir.iterdir() if p.is_dir() and not p.name.startswith('.')]):
299302
print(f" - {p}")
303+
print(f"\nFor ratings and reviews of these rule sets, visit {RATINGS_REVIEWS_URL}")
300304

301305
def report_bug(self) -> int:
302306
"""Provide the project issue tracker URL for reporting bugs."""
@@ -306,3 +310,12 @@ def report_bug(self) -> int:
306310
except Exception:
307311
pass
308312
return 0
313+
314+
def rate_ruleset(self) -> int:
315+
"""Open the ratings and reviews wiki page for rulesets."""
316+
print(f"For ratings and reviews, please visit {RATINGS_REVIEWS_URL}")
317+
try:
318+
webbrowser.open(RATINGS_REVIEWS_URL)
319+
except Exception:
320+
pass
321+
return 0

tests/integration/test_cli_commands.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ def test_list_rules(script_runner):
223223
assert "Available rule sets:" in stdout
224224
assert "- heavy-spec" in stdout
225225
assert "- light-spec" in stdout
226+
assert "https://github.com/botingw/rulebook-ai/wiki/Ratings-%26-Reviews-(Rulesets)" in stdout
226227

227228

228229
def test_install_with_specific_assistant_flags(script_runner, tmp_path):
@@ -333,3 +334,13 @@ def test_bug_report_command(script_runner):
333334
result = script_runner(["bug-report"])
334335
assert result.returncode == 0, f"Command failed. STDERR:\n{result.stderr}"
335336
assert "https://github.com/botingw/rulebook-ai/issues" in result.stdout
337+
338+
339+
def test_rate_ruleset_command(script_runner):
340+
"""Verify the rate-ruleset command opens the ratings page URL."""
341+
result = script_runner(["rate-ruleset"])
342+
assert result.returncode == 0, f"Command failed. STDERR:\n{result.stderr}"
343+
assert (
344+
"https://github.com/botingw/rulebook-ai/wiki/Ratings-%26-Reviews-(Rulesets)"
345+
in result.stdout
346+
)

0 commit comments

Comments
 (0)