-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_cursor_rule.py
More file actions
35 lines (29 loc) · 1.13 KB
/
add_cursor_rule.py
File metadata and controls
35 lines (29 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
import sys
def main() -> None:
script_dir = os.path.dirname(os.path.abspath(__file__))
doc_path = os.path.join(script_dir, "LLM_DOC.md")
with open(doc_path, encoding="utf-8") as file:
documentation = file.read()
user_project_root = os.getcwd()
output_directory = os.path.join(user_project_root, ".cursor/rules")
output_file = os.path.join(output_directory, "nutrient-dws-doc.mdc")
try:
rule = f"""
---
description: This rule explains how to use the Nutrient DWS Python Client (`nutrient-dws`) for operations with document processing operations including conversion, merging, compression, watermarking, signage, and text extraction.
globs:
alwaysApply: false
---
{documentation}
"""
if not os.path.exists(output_directory):
os.makedirs(output_directory)
with open(output_file, "a", encoding="utf-8") as f:
f.write(rule)
print(
f"📄 Updated Cursor Rules to point to Nutrient DWS documentation at {output_file}."
)
except Exception as err:
print(f"Failed to update Cursor Rule: {err}", file=sys.stderr)
sys.exit(1)