Cursor rule
.cursor/rules/codeprotection.mdc[object Object]
Cursor rules
Quality
55/100
Scores the file, not the repository.Length
983 words
8 headings · 0 code blocksRepository
206
— · pushed 397 days agoLast changed
3 days ago
First indexed 3 days ago.1234567# CursorRIPER♦Ψ 1.0.189## 🛡️ Protection Syntax1011Ψ_syntax = {12 PROTECTED: "PROTECTED - DO NOT MODIFY",13 GUARDED: "GUARDED - ASK BEFORE MODIFYING",14 INFO: "INFO - CONTEXT NOTE",15 DEBUG: "DEBUG - DEBUGGING CODE",16 TEST: "TEST - TESTING CODE",17 CRITICAL: "CRITICAL - BUSINESS LOGIC",1819 // End markers20 END_PROTECTED: "END-P - PROTECTED REGION END",21 END_GUARDED: "END-G - GUARDED REGION END",22 END_INFO: "END-I - INFO REGION END",23 END_DEBUG: "END-D - DEBUG REGION END",24 END_TEST: "END-T - TEST REGION END",25 END_CRITICAL: "END-C - CRITICAL REGION END"26}2728## 💬 Language Comment Formats2930Ψ_language_syntax = {31 js: {prefix: "// ", suffix: ""},32 ts: {prefix: "// ", suffix: ""},33 jsx: {prefix: "// ", suffix: ""},34 tsx: {prefix: "// ", suffix: ""},35 py: {prefix: "# ", suffix: ""},36 html: {prefix: "<!-- ", suffix: " -->"},37 php: {prefix: "// ", suffix: ""},38 css: {prefix: "/* ", suffix: " */"},39 scss: {prefix: "/* ", suffix: " */"},40 java: {prefix: "// ", suffix: ""},41 rb: {prefix: "# ", suffix: ""},42 go: {prefix: "// ", suffix: ""},43 rs: {prefix: "// ", suffix: ""},44 c: {prefix: "// ", suffix: ""},45 cpp: {prefix: "// ", suffix: ""},46 cs: {prefix: "// ", suffix: ""},47 swift: {prefix: "// ", suffix: ""},48 kt: {prefix: "// ", suffix: ""},49 dart: {prefix: "// ", suffix: ""},50 md: {prefix: "<!-- ", suffix: " -->"},51 xml: {prefix: "<!-- ", suffix: " -->"},52 sh: {prefix: "# ", suffix: ""},53 bash: {prefix: "# ", suffix: ""},54 sql: {prefix: "-- ", suffix: ""}55}5657## ⌨️ Command Shortcuts5859Ψ_shorthand = {60 "!cp": apply_protection(PROTECTED),61 "!cg": apply_protection(GUARDED),62 "!ci": apply_protection(INFO),63 "!cd": apply_protection(DEBUG),64 "!ct": apply_protection(TEST),65 "!cc": apply_protection(CRITICAL)66}6768apply_protection(type) = {69 detect_language(current_file) ⟶ lang,70 get_comment_syntax(lang) ⟶ {prefix, suffix},71 selection = get_editor_selection(),7273 // Insert opening marker74 insert_at_selection_start(prefix + Ψ_syntax[type] + suffix),7576 // Insert end marker77 end_marker = Ψ_syntax["END_" + type],78 insert_at_selection_end(prefix + end_marker + suffix),7980 // Update protection registry81 Ψ_manage.add(current_file, selection.start_line, selection.end_line, type, "User-added protection")82}8384## 🔄 Protection Behaviors8586Ψ_behaviors = {87 PROTECTED: {88 Ω₁: acknowledge ∧ document,89 Ω₂: respect_boundaries ∧ alternate_approaches,90 Ω₃: plan_around ∧ never_include,91 Ω₄: refuse_modification ∧ report_attempts,92 Ω₅: verify_untouched ∧ validate93 },94 GUARDED: {95 Ω₁: acknowledge ∧ document,96 Ω₂: consider_changes ∧ document_rationale,97 Ω₃: plan_with_permission ∧ alternatives,98 Ω₄: request_explicit_permission ∧ detail_changes,99 Ω₅: document_changes ∧ justify100 },101 INFO: {102 Ω₁: acknowledge ∧ use_context,103 Ω₂: incorporate_context ∧ respect_intent,104 Ω₃: plan_with_awareness,105 Ω₄: careful_modification ∧ preserve_intent,106 Ω₅: verify_context_preserved107 },108 DEBUG: {109 Ω₁: note_debug_purpose,110 Ω₂: preserve_during_innovation,111 Ω₃: include_in_development_plan,112 Ω₄: maintain_during_dev ∧ consider_cleanup,113 Ω₅: evaluate_necessity114 },115 TEST: {116 Ω₁: document_test_coverage,117 Ω₂: maintain_test_integrity,118 Ω₃: ensure_test_coverage,119 Ω₄: update_with_implementation,120 Ω₅: verify_test_coverage121 },122 CRITICAL: {123 Ω₁: document_thoroughly,124 Ω₂: design_with_extreme_care,125 Ω₃: plan_impact_analysis,126 Ω₄: comprehensive_review ∧ careful_change,127 Ω₅: rigorous_validation128 }129}130131## 🔍 Protection Scanner132133Ψ_scan = {134 patterns: {135 auth: ["login", "authenticate", "credentials", "password", "token"],136 payment: ["payment", "transaction", "credit", "billing", "invoice"],137 security: ["encrypt", "decrypt", "hash", "salt", "secure"],138 core: ["critical", "essential", "main", "primary", "core"],139 api: ["api", "endpoint", "request", "response", "service"],140 data: ["database", "query", "record", "store", "retrieve"]141 },142143 detect(file) = {144 lang = detect_language(file),145 code = read_file(file),146 segments = parse(code, lang),147 analysis = []148149 // Track open markers and match with end markers150 open_markers = []151152 for segment in segments:153 // Check if this is an end marker154 end_marker_match = match_end_marker(segment)155 if end_marker_match:156 if open_markers.length > 0:157 // Close the most recent matching open marker158 close_marker(open_markers, end_marker_match, analysis)159 continue160161 // Check if this is an opening marker162 marker_type = match_protection_marker(segment)163 if marker_type:164 open_markers.push({165 type: marker_type,166 line: segment.line_number,167 content: segment168 })169 continue170171 // Regular code segment - check patterns if not in a marker172 if open_markers.length == 0:173 pattern_matches = match_patterns(segment, Ψ_scan.patterns)174 if pattern_matches:175 analysis.push({176 segment: segment,177 matches: pattern_matches,178 suggested_level: determine_level(pattern_matches)179 })180181 // Report any unclosed markers182 for marker in open_markers:183 analysis.push({184 segment: marker.content,185 warning: "Unclosed protection marker",186 suggested_action: "Add appropriate end marker"187 })188189 return analysis190 },191192 determine_level(matches) = {193 if matches.intersect(["security", "payment", "auth"]).length > 0:194 return "PROTECTED"195 else if matches.intersect(["core", "api"]).length > 0:196 return "CRITICAL"197 else if matches.intersect(["data"]).length > 0:198 return "GUARDED"199 else:200 return "INFO"201 },202203 match_end_marker(segment) = {204 for type in [PROTECTED, GUARDED, INFO, DEBUG, TEST, CRITICAL]:205 end_marker = "END-" + type.substr(0,1)206 if segment.includes(end_marker):207 return type208 return null209 },210211 close_marker(open_markers, end_type, analysis) = {212 // Find matching open marker213 matched_idx = -1214 for i = open_markers.length - 1; i >= 0; i--:215 if open_markers[i].type === end_type:216 matched_idx = i217 break218219 if matched_idx >= 0:220 // Remove the marker from the open list221 marker = open_markers.splice(matched_idx, 1)[0]222 // Process the protection block if needed223 // (no analysis needed for properly marked protection blocks)224 else:225 analysis.push({226 warning: "Unmatched end marker for " + end_type,227 suggested_action: "Add appropriate start marker"228 })229 }230}231232## 📊 Protection Management233234Ψ_manage = {235 add(file, start_line, end_line, level, rationale) = {236 entry = {237 file: file,238 start_line: start_line,239 end_line: end_line,240 level: level,241 added_date: now(),242 rationale: rationale243 },244 update(σ₆.protected_regions, entry)245 },246247 approve(file, start_line, end_line, changes) = {248 approval = {249 file: file,250 start_line: start_line,251 end_line: end_line,252 requested_date: now(),253 approved_date: now(),254 changes: changes255 },256 update(σ₆.guarded_approvals, approval)257 },258259 scan_project() = {260 results = [],261 files = list_project_files(),262263 for file in files:264 if is_code_file(file):265 scan_result = Ψ_scan.detect(file)266 if scan_result.length > 0:267 results.push({268 file: file,269 findings: scan_result270 })271272 update(σ₆.scan_history, {273 date: now(),274 files_scanned: files.length,275 protections_found: results.length276 })277278 return results279 }280}281282## 🔄 Protection Commands283284Ψ_commands = {285 "/protect-scan": Ψ_manage.scan_project,286 "/protect-status": report_protection_status,287 "/protect-add": add_protection_to_selection,288 "/protect-remove": remove_protection_with_confirmation,289 "/protect-approve": approve_guarded_modification290}291292report_protection_status() = {293 regions = read(σ₆.protected_regions),294 summary = summarize(regions),295 return format_report(summary)296}297298add_protection_to_selection(level) = {299 selection = get_editor_selection(),300 file = get_current_file(),301 lang = detect_language(file),302 syntax = Ψ_language_syntax[lang],303304 // Add start marker305 start_comment = syntax.prefix + Ψ_syntax[level] + syntax.suffix,306 insert_at_selection_start(start_comment),307308 // Add end marker309 end_comment = syntax.prefix + Ψ_syntax["END_" + level] + syntax.suffix,310 insert_at_selection_end(end_comment),311312 // Register the protected region313 Ψ_manage.add(file, selection.start_line, selection.end_line, level, "User-added protection")314}315316remove_protection_with_confirmation(region_id) = {317 region = find_region_by_id(region_id),318 confirm("Are you sure you want to remove protection from this code?"),319 if confirmed:320 // Remove both the start and end markers321 remove_protection_comment(region.file, region.start_line),322 remove_protection_comment(region.file, region.end_line),323 remove_from_registry(region_id)324}325326approve_guarded_modification(region_id, changes) = {327 region = find_region_by_id(region_id),328 if region.level != "GUARDED":329 return error("Only GUARDED code can be approved for modification")330 else:331 Ψ_manage.approve(region.file, region.start_line, region.end_line, changes)332}333
Also in johnpeterman72/CursorRIPER.sigma
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| johnpeterman72/CursorRIPER.sigma.cursor/rules/enterprise.mdc · 206 | Cursor rules | securitydeploymentdocs | 54/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/bmad-roles.mdc · 206 | Cursor rules | securitydeployment | 54/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/cursorriper-sigma-mcp.mdc · 206 | Cursor rules | setuptestapideployment+2 | 76/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/mcp-docker.mdc · 206 | Cursor rules | securitydeployment | 54/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/mcp-filesystem.mdc · 206 | Cursor rules | performance | 48/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/mcp-github.mdc · 206 | Cursor rules | setupgitdeployment | 50/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/mcp-puppeteer.mdc · 206 | Cursor rules | testdeployment | 66/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/mcp-websearch.mdc · 206 | Cursor rules | deploymentdo-not | 61/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/prd-system.mdc · 206 | Cursor rules | archdatabaseperformancedeployment | 58/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/quality-gates.mdc · 206 | Cursor rules | deployment | 54/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/ripersigma-mcp.mdc · 206 | Cursor rules | setuptestdatabaseapi+3 | 55/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/ripersigma1.mdc · 206 | Cursor rules | performance | 48/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/ripersigma101codeprotect.mdc · 206 | Cursor rules | performance | 48/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/ripersigma102.mdc · 206 | Cursor rules | performance | 48/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/ripersigma103.mdc · 206 | Cursor rules | securityperformance | 40/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/ripersigma104.mdc · 206 | Cursor rules | securityperformance | 40/100 | 3 days ago | |
| johnpeterman72/CursorRIPER.sigma.cursor/rules/ripersigma105.mdc · 206 | Cursor rules | securityperformance | 40/100 | 3 days ago |
Diff against .cursor/rules/enterprise.mdc Diff against .cursor/rules/bmad-roles.mdc Diff against .cursor/rules/cursorriper-sigma-mcp.mdc Diff against .cursor/rules/mcp-docker.mdc Diff against .cursor/rules/mcp-filesystem.mdc Diff against .cursor/rules/mcp-github.mdc Diff against .cursor/rules/mcp-puppeteer.mdc Diff against .cursor/rules/mcp-websearch.mdc Diff against .cursor/rules/prd-system.mdc Diff against .cursor/rules/quality-gates.mdc Diff against .cursor/rules/ripersigma-mcp.mdc Diff against .cursor/rules/ripersigma1.mdc Diff against .cursor/rules/ripersigma101codeprotect.mdc Diff against .cursor/rules/ripersigma102.mdc Diff against .cursor/rules/ripersigma103.mdc Diff against .cursor/rules/ripersigma104.mdc Diff against .cursor/rules/ripersigma105.mdc
