From ff0eb34a2b351357a5aacb81c036240f856e0b48 Mon Sep 17 00:00:00 2001 From: sanjeed5 Date: Mon, 3 Mar 2025 23:26:25 +0530 Subject: [PATCH] Add source of truth documentation for rules.json in cursor-rules-cli - Create README.md in cursor-rules-cli to explain rules.json origin - Enhance logging for rules.json copying process - Clarify that rules.json is automatically managed and should not be edited directly --- src/generate_mdc_files.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/generate_mdc_files.py b/src/generate_mdc_files.py index 515f8c0..4b7e654 100644 --- a/src/generate_mdc_files.py +++ b/src/generate_mdc_files.py @@ -743,6 +743,7 @@ def main(): logger.info("MDC generation completed successfully!") # Copy rules.json to cursor-rules-cli folder + # This is the source of truth - the CLI package will use this during setup cursor_rules_cli_dir = Path(SCRIPT_DIR).parent / "cursor-rules-cli" cursor_rules_cli_dir.mkdir(exist_ok=True) @@ -750,7 +751,20 @@ def main(): try: shutil.copy2(rules_json_path, target_rules_json) - logger.info(f"Successfully copied rules.json to {target_rules_json}") + logger.info(f"Successfully copied rules.json (source of truth) to {target_rules_json}") + + # Add a comment file to explain the source of truth + with open(cursor_rules_cli_dir / "RULES_JSON_README.md", "w") as f: + f.write("""# About rules.json + +This rules.json file is automatically copied from the project root. +It is the source of truth for library detection rules. + +DO NOT EDIT THIS FILE DIRECTLY. +Instead, edit the main rules.json in the project root and run the generate_mdc_files.py script. +""") + logger.info("Created RULES_JSON_README.md to document the source of truth") + except Exception as e: logger.error(f"Failed to copy rules.json to cursor-rules-cli folder: {str(e)}")