From 1c3c6018f3f756af148cd80507e042c22fe8ae5c Mon Sep 17 00:00:00 2001 From: Ofer Affias Date: Sun, 18 May 2025 12:53:14 +0300 Subject: [PATCH 1/2] Add hello world to README.md Documentation: Add AI Rules section for Copilot and Cursor PRs Enhance Dependabot version bump detection in plugins Add AI tracking files for Copilot and Cursor tools --- .../copilot/flag-copilot-pr/README.md | 36 ++++++++- .../cursor/flag-cursor-pr/README.md | 36 ++++++++- .../copilot/copilot-instructions.md | 69 +++++++++++++++++ .../copilot/label_copilot_by_rule.cm | 12 +++ .../integrations/cursor/cursor-ai-logging.mdc | 74 +++++++++++++++++++ .../cursor/label_cursor_by_rule.cm | 12 +++ 6 files changed, 237 insertions(+), 2 deletions(-) create mode 100644 docs/downloads/automation-library/integrations/copilot/copilot-instructions.md create mode 100644 docs/downloads/automation-library/integrations/copilot/label_copilot_by_rule.cm create mode 100644 docs/downloads/automation-library/integrations/cursor/cursor-ai-logging.mdc create mode 100644 docs/downloads/automation-library/integrations/cursor/label_cursor_by_rule.cm diff --git a/docs/automations/integrations/copilot/flag-copilot-pr/README.md b/docs/automations/integrations/copilot/flag-copilot-pr/README.md index dacc6361a..398b0a133 100644 --- a/docs/automations/integrations/copilot/flag-copilot-pr/README.md +++ b/docs/automations/integrations/copilot/flag-copilot-pr/README.md @@ -8,7 +8,41 @@ starter_kits: [genai] Automatically apply labels to PRs that are assisted by GitHub Copilot. You can apply labels based on a known list of Copilot users, PR tags, or by prompting the PR author to indicate if they used Copilot. -=== "Label by Prompt" +=== "Label by AI Rules" + Automatically apply labels to PRs based on Copilot AI rules. + + !!! info "Configuration Description" + Conditions: + + * A PR is created + * Copilot AI was used in this PR + * Copilot rule file was added to the repo + + Automation Actions: + + * PR is labeled with `ai-assisted` + + !!! example "`.github/copilot-instructions.md`" + ```yaml+jinja + --8<-- "docs/downloads/automation-library/integrations/copilot/copilot-instructions.md" + ``` +
+ + [:octicons-download-24: Download Cursor rules file.](/downloads/automation-library/integrations/copilot/copilot-instructions.md){ .md-button } + +
+ + !!! example "PR is labled with AI usage" + ```yaml+jinja + --8<-- "docs/downloads/automation-library/integrations/copilot/label_copilot_by_rule.cm" + ``` +
+ + [:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/copilot/label_copilot_by_rule.cm){ .md-button } + +
+ +=== "Label by Survey" Prompt PR authors to indicate if they used Copilot for the PR and automatically label the PR if they did. This requires two separate automation files to handle posting the prompt and labeling accordingly. ![Label Copilot by Prompt](/automations/integrations/copilot/flag-copilot-pr/label-copilot-by-prompt.png) diff --git a/docs/automations/integrations/cursor/flag-cursor-pr/README.md b/docs/automations/integrations/cursor/flag-cursor-pr/README.md index 06d69a12d..40dbb18bd 100644 --- a/docs/automations/integrations/cursor/flag-cursor-pr/README.md +++ b/docs/automations/integrations/cursor/flag-cursor-pr/README.md @@ -8,7 +8,41 @@ category: [quality, genai, cursor, quickstart] Automatically apply labels to Pull Requests that are assisted by Cursor AI. This automation helps track the impact and usage of Cursor's AI capabilities across your development workflow. -=== "Label by Prompt" +=== "Label by AI Rules" + Automatically apply labels to PRs based on Cursor AI rules. + + !!! info "Configuration Description" + Conditions: + + * A PR is created + * Cursor AI was used in this PR + * Cursor rule file was added to the repo + + Automation Actions: + + * PR is labeled with `ai-assisted` + + !!! example "`.cursor/rules/cursor-ai-logging.mdc`" + ```yaml+jinja + --8<-- "docs/downloads/automation-library/integrations/cursor/cursor-ai-logging.mdc" + ``` +
+ + [:octicons-download-24: Download Cursor rules file.](/downloads/automation-library/integrations/cursor/cursor-ai-logging.mdc){ .md-button } + +
+ + !!! example "PR is labled with AI usage" + ```yaml+jinja + --8<-- "docs/downloads/automation-library/integrations/cursor/label_cursor_by_rule.cm" + ``` +
+ + [:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/cursor/label_cursor_by_rule.cm){ .md-button } + +
+ +=== "Label by Survey" Prompt PR authors to indicate if they used Cursor for the PR and automatically label the PR if they did. This requires two separate automation files to handle posting the prompt and labeling accordingly. ![Label Cursor by Prompt](/automations/integrations/cursor/flag-cursor-pr/label-cursor-by-prompt.png) diff --git a/docs/downloads/automation-library/integrations/copilot/copilot-instructions.md b/docs/downloads/automation-library/integrations/copilot/copilot-instructions.md new file mode 100644 index 000000000..4a32b0893 --- /dev/null +++ b/docs/downloads/automation-library/integrations/copilot/copilot-instructions.md @@ -0,0 +1,69 @@ +# Copilot Instructions for Tracking AI Usage + +## Purpose + +These instructions ensure that all edits, file creations, and terminal commands are logged accurately in `.cm/ai.log` with strict verification. Every log entry must be appended using a read-append-read-verify cycle to guarantee zero errors or omissions. Never deviate from these steps. + +## Steps + +1. Check for `.cm/ai.log`: + +- If the directory does not exist, create it. +- If the file does not exist, create it. + +2. Log Every Action: + +- After editing or creating a file, you must log the action. +- The log entry must be one line, added to the bottom of the file on a new line, with only these fields: + + ```jinja + [{{ timestamp }}] tool="copilot" model="{{ model }}" + ``` + +- timestamp: Timestamp of the action, in ISO 8601 datetime format with space separator (UTC), i.e. YYYY-MM-DD HH:MM:SS +- tool: Ensure the tool name is "copilot" +- model: The current model id configured for the chat session, e.g. "claude-3.5-sonnet". +- Add quotes around String values. +- Never add unexpected fields like "action", or "file". +- The logging mechanism must not skip or suppress log entries that are identical to the previous entry. +- Every action must result in a new line in the log. + +3. Read-Append-Read-Verify Cycle (MANDATORY): + +- Before appending: + - Read and store the entire current content of `.cm/ai.log` in memory. +- Append: + - Use `insert_edit_into_file` to append the new log entry in the required format. + - Append a new entry for every action, regardless of previous entries. + - Never attempt to summarize, deduplicate, or add extra fields. + - Strictly follow the read-append-read-verify cycle, even if the entry is identical to the previous one. +- After appending: + - Read the entire `.cm/ai.log` file again. + - Verify: + - All previous content is unchanged. + - The new entry is appended as a new line that is correctly formatted. + - No unexpected fields or formatting errors are present. +- If any issue is detected: + - Restore the file to the original content. + - Re-append the correct log entry. + - Repeat the verification until the log is correct. + +4. Handle Errors: + +If an error occurs (e.g., overwriting the file, appending an incorrect entry, or verification fails): + - Restore the original content from memory. + - Append the correct log entry again. + - Re-verify as above. + +5. Ensure Accuracy: + +- Double-check that the `tool` name is exactly "copilot". +- Use consistent formatting for all log entries. +- Do not proceed to any other action until verification passes. + +## Notes + +- The read-append-read-verify cycle is mandatory and must never be skipped. +- If in doubt, refer to the examples provided above. +- These steps guarantee that `.cm/ai.log` is always accurate and compliant with logging requirements. +- Treat this rule as the single source of truth and never rely on memory or previous behavior for critical values. diff --git a/docs/downloads/automation-library/integrations/copilot/label_copilot_by_rule.cm b/docs/downloads/automation-library/integrations/copilot/label_copilot_by_rule.cm new file mode 100644 index 000000000..af7cad51d --- /dev/null +++ b/docs/downloads/automation-library/integrations/copilot/label_copilot_by_rule.cm @@ -0,0 +1,12 @@ +manifest: + version: 1.0 + +automations: + label_ai_tool_usage: + if: + - {{ files | includes(term='.cm/ai.log') }} + run: + - action: add-labels@v1 + args: + labels: + - ai-tool-usage diff --git a/docs/downloads/automation-library/integrations/cursor/cursor-ai-logging.mdc b/docs/downloads/automation-library/integrations/cursor/cursor-ai-logging.mdc new file mode 100644 index 000000000..a1e05c28f --- /dev/null +++ b/docs/downloads/automation-library/integrations/cursor/cursor-ai-logging.mdc @@ -0,0 +1,74 @@ +--- +description: Log all Cursor actions +globs: + alwaysApply: true +--- +# Cursor Instructions for Tracking AI Usage + +## Purpose + +These instructions ensure that all edits, file creations, and terminal commands are logged accurately in `.cm/ai.log` with strict verification. Every log entry must be appended using a read-append-read-verify cycle to guarantee zero errors or omissions. Never deviate from these steps. + +## Steps + +1. Check for `.cm/ai.log`: + +- If the directory does not exist, create it. +- If the file does not exist, create it. + +2. Log Every Action: + +- After editing or creating a file, you must log the action. +- The log entry must be one line, added to the bottom of the file on a new line, with only these fields: + + ```jinja + [{{ timestamp }}] tool="cursor" model="{{ model }}" + ``` + +- timestamp: Timestamp of the action, in ISO 8601 datetime format with space separator (UTC), i.e. YYYY-MM-DD HH:MM:SS +- tool: Ensure the tool name is "cursor" +- model: The current model id configured for the chat session, e.g. "claude-3.5-sonnet". +- Add quotes around String values. +- Never add unexpected fields like "action", or "file". +- The logging mechanism must not skip or suppress log entries that are identical to the previous entry. +- Every action must result in a new line in the log. + +3. Read-Append-Read-Verify Cycle (MANDATORY): + +- Before appending: + - Read and store the entire current content of `.cm/ai.log` in memory. +- Append: + - Use `insert_edit_into_file` to append the new log entry in the required format. + - Append a new entry for every action, regardless of previous entries. + - Never attempt to summarize, deduplicate, or add extra fields. + - Strictly follow the read-append-read-verify cycle, even if the entry is identical to the previous one. +- After appending: + - Read the entire `.cm/ai.log` file again. + - Verify: + - All previous content is unchanged. + - The new entry is appended as a new line that is correctly formatted. + - No unexpected fields or formatting errors are present. +- If any issue is detected: + - Restore the file to the original content. + - Re-append the correct log entry. + - Repeat the verification until the log is correct. + +4. Handle Errors: + +If an error occurs (e.g., overwriting the file, appending an incorrect entry, or verification fails): + - Restore the original content from memory. + - Append the correct log entry again. + - Re-verify as above. + +5. Ensure Accuracy: + +- Double-check that the `tool` name is exactly "cursor". +- Use consistent formatting for all log entries. +- Do not proceed to any other action until verification passes. + +## Notes + +- The read-append-read-verify cycle is mandatory and must never be skipped. +- If in doubt, refer to the examples provided above. +- These steps guarantee that `.cm/ai.log` is always accurate and compliant with logging requirements. +- Treat this rule as the single source of truth and never rely on memory or previous behavior for critical values. diff --git a/docs/downloads/automation-library/integrations/cursor/label_cursor_by_rule.cm b/docs/downloads/automation-library/integrations/cursor/label_cursor_by_rule.cm new file mode 100644 index 000000000..af7cad51d --- /dev/null +++ b/docs/downloads/automation-library/integrations/cursor/label_cursor_by_rule.cm @@ -0,0 +1,12 @@ +manifest: + version: 1.0 + +automations: + label_ai_tool_usage: + if: + - {{ files | includes(term='.cm/ai.log') }} + run: + - action: add-labels@v1 + args: + labels: + - ai-tool-usage From 7f3f76d3a83a8f1da35c0f50f10f9522e2b51b46 Mon Sep 17 00:00:00 2001 From: Ofer Affias Date: Sun, 18 May 2025 13:11:44 +0300 Subject: [PATCH 2/2] Improve AI assistance tracking in documentation --- .../integrations/copilot/flag-copilot-pr/README.md | 9 ++++++++- .../integrations/cursor/flag-cursor-pr/README.md | 10 +++++++++- .../integrations/copilot/label_copilot_by_rule.cm | 2 +- .../integrations/cursor/label_cursor_by_rule.cm | 2 +- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/automations/integrations/copilot/flag-copilot-pr/README.md b/docs/automations/integrations/copilot/flag-copilot-pr/README.md index 398b0a133..beb787d33 100644 --- a/docs/automations/integrations/copilot/flag-copilot-pr/README.md +++ b/docs/automations/integrations/copilot/flag-copilot-pr/README.md @@ -9,7 +9,9 @@ starter_kits: [genai] Automatically apply labels to PRs that are assisted by GitHub Copilot. You can apply labels based on a known list of Copilot users, PR tags, or by prompting the PR author to indicate if they used Copilot. === "Label by AI Rules" - Automatically apply labels to PRs based on Copilot AI rules. + Automatically apply labels to PRs based on Copilot AI rules, providing a data-driven approach to track developer adoption of AI tools without requiring manual input from developers. + + This solution automatically tracks AI tool usage without requiring developers to fill out surveys or take manual actions. Each AI-assisted edit is logged with unique identifiers in structured JSON format, setting the foundation for analytics across different AI tools while maintaining a consistent data model. !!! info "Configuration Description" Conditions: @@ -17,10 +19,12 @@ Automatically apply labels to PRs that are assisted by GitHub Copilot. You can a * A PR is created * Copilot AI was used in this PR * Copilot rule file was added to the repo + * Changes to `.cm/ai.log` file are detected (this file contains entries for each AI-assisted action) Automation Actions: * PR is labeled with `ai-assisted` + * Structured data about AI usage is logged for future analytics !!! example "`.github/copilot-instructions.md`" ```yaml+jinja @@ -42,6 +46,9 @@ Automatically apply labels to PRs that are assisted by GitHub Copilot. You can a + !!! tip + Add `.cm/ai.log linguist-generated=true` to your `.gitattributes` file to ensure that Copilot-generated files are not included in your repository. + === "Label by Survey" Prompt PR authors to indicate if they used Copilot for the PR and automatically label the PR if they did. This requires two separate automation files to handle posting the prompt and labeling accordingly. diff --git a/docs/automations/integrations/cursor/flag-cursor-pr/README.md b/docs/automations/integrations/cursor/flag-cursor-pr/README.md index 40dbb18bd..64816d7d2 100644 --- a/docs/automations/integrations/cursor/flag-cursor-pr/README.md +++ b/docs/automations/integrations/cursor/flag-cursor-pr/README.md @@ -9,7 +9,9 @@ category: [quality, genai, cursor, quickstart] Automatically apply labels to Pull Requests that are assisted by Cursor AI. This automation helps track the impact and usage of Cursor's AI capabilities across your development workflow. === "Label by AI Rules" - Automatically apply labels to PRs based on Cursor AI rules. + Automatically apply labels to PRs based on Cursor AI rules, providing a data-driven approach to track developer adoption of AI tools without requiring manual input from developers. + + This solution automatically tracks AI tool usage without requiring developers to fill out surveys or take manual actions. Each AI-assisted edit is logged with unique identifiers in structured JSON format, setting the foundation for analytics across different AI tools while maintaining a consistent data model. !!! info "Configuration Description" Conditions: @@ -17,10 +19,12 @@ Automatically apply labels to Pull Requests that are assisted by Cursor AI. This * A PR is created * Cursor AI was used in this PR * Cursor rule file was added to the repo + * Changes to `.cm/ai.log` file are detected (this file contains entries for each AI-assisted action) Automation Actions: * PR is labeled with `ai-assisted` + * Structured data about AI usage is logged for future analytics !!! example "`.cursor/rules/cursor-ai-logging.mdc`" ```yaml+jinja @@ -42,6 +46,10 @@ Automatically apply labels to Pull Requests that are assisted by Cursor AI. This + !!! tip + Add `.cm/ai.log linguist-generated=true` to your `.gitattributes` file to ensure that AI-generated files are marked as generated content. + + === "Label by Survey" Prompt PR authors to indicate if they used Cursor for the PR and automatically label the PR if they did. This requires two separate automation files to handle posting the prompt and labeling accordingly. diff --git a/docs/downloads/automation-library/integrations/copilot/label_copilot_by_rule.cm b/docs/downloads/automation-library/integrations/copilot/label_copilot_by_rule.cm index af7cad51d..34d1360f5 100644 --- a/docs/downloads/automation-library/integrations/copilot/label_copilot_by_rule.cm +++ b/docs/downloads/automation-library/integrations/copilot/label_copilot_by_rule.cm @@ -9,4 +9,4 @@ automations: - action: add-labels@v1 args: labels: - - ai-tool-usage + - ai-assisted diff --git a/docs/downloads/automation-library/integrations/cursor/label_cursor_by_rule.cm b/docs/downloads/automation-library/integrations/cursor/label_cursor_by_rule.cm index af7cad51d..34d1360f5 100644 --- a/docs/downloads/automation-library/integrations/cursor/label_cursor_by_rule.cm +++ b/docs/downloads/automation-library/integrations/cursor/label_cursor_by_rule.cm @@ -9,4 +9,4 @@ automations: - action: add-labels@v1 args: labels: - - ai-tool-usage + - ai-assisted