Skip to content

Commit b672ec6

Browse files
committed
✨feat: add Codacy instructions for AI behavior and update .gitignore to exclude the instructions file
1 parent 1471524 commit b672ec6

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
description: Configuration for AI behavior when interacting with Codacy's MCP Server
3+
applyTo: '**'
4+
---
5+
---
6+
# Codacy Rules
7+
Configuration for AI behavior when interacting with Codacy's MCP Server
8+
9+
## using any tool that accepts the arguments: `provider`, `organization`, or `repository`
10+
- ALWAYS use:
11+
- provider: gl
12+
- organization: SamErde
13+
- repository: maester-monitoring
14+
- Avoid calling `git remote -v` unless really necessary
15+
16+
## CRITICAL: After ANY successful `edit_file` or `reapply` operation
17+
- YOU MUST IMMEDIATELY run the `codacy_cli_analyze` tool from Codacy's MCP Server for each file that was edited, with:
18+
- `rootPath`: set to the workspace path
19+
- `file`: set to the path of the edited file
20+
- `tool`: leave empty or unset
21+
- If any issues are found in the new edits, propose and apply fixes for them.
22+
- > NOTE: Failure to follow this rule is considered a critical error.
23+
24+
## After every response
25+
- If you made any file edits in this conversation, verify you ran `codacy_cli_analyze` tool from Codacy's MCP Server
26+
27+
## When there are no Codacy MCP Server tools available, or the MCP Server is not reachable
28+
- Suggest the user the following troubleshooting steps:
29+
- Try to reset the MCP on the extension
30+
- If the user is using VSCode, suggest them to review their Copilot > MCP settings in Github, under their organization or personal account. Refer them to Settings > Copilot > Enable MCP servers in Copilot. Suggested URL (https://github.com/settings/copilot/features) or https://github.com/organizations/{organization-name}/settings/copilot/features (This can only be done by their organization admins / owners)
31+
- If none of the above steps work, suggest the user to contact Codacy support
32+
33+
## Trying to call a tool that needs a rootPath as a parameter
34+
- Always use the standard, non-URL-encoded file system path
35+
36+
## CRITICAL: Dependencies and Security Checks
37+
- IMMEDIATELY after ANY of these actions:
38+
- Running npm/yarn/pnpm install
39+
- Adding dependencies to package.json
40+
- Adding requirements to requirements.txt
41+
- Adding dependencies to pom.xml
42+
- Adding dependencies to build.gradle
43+
- Any other package manager operations
44+
- You MUST run the `codacy_cli_analyze` tool with:
45+
- `rootPath`: set to the workspace path
46+
- `tool`: set to "trivy"
47+
- `file`: leave empty or unset
48+
- If any vulnerabilities are found because of the newly added packages:
49+
- Stop all other operations
50+
- Propose and apply fixes for the security issues
51+
- Only continue with the original task after security issues are resolved
52+
- EXAMPLE:
53+
- After: npm install react-markdown
54+
- Do: Run codacy_cli_analyze with trivy
55+
- Before: Continuing with any other tasks
56+
57+
## General
58+
- Repeat the relevant steps for each modified file.
59+
- "Propose fixes" means to both suggest and, if possible, automatically apply the fixes.
60+
- You MUST NOT wait for the user to ask for analysis or remind you to run the tool.
61+
- Do not run `codacy_cli_analyze` looking for changes in duplicated code or code complexity metrics.
62+
- Do not run `codacy_cli_analyze` looking for changes in code coverage.
63+
- Do not try to manually install Codacy CLI using either brew, npm, npx, or any other package manager.
64+
- If the Codacy CLI is not installed, just run the `codacy_cli_analyze` tool from Codacy's MCP Server.
65+
- When calling `codacy_cli_analyze`, only send provider, organization and repository if the project is a git repository.
66+
67+
## Whenever a call to a Codacy tool that uses `repository` or `organization` as a parameter returns a 404 error
68+
- Offer to run the `codacy_setup_repository` tool to add the repository to Codacy
69+
- If the user accepts, run the `codacy_setup_repository` tool
70+
- Do not ever try to run the `codacy_setup_repository` tool on your own
71+
- After setup, immediately retry the action that failed (only retry once)
72+
---

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,7 @@ $RECYCLE.BIN/
9494
.codacy/*
9595

9696
# End of https://www.toptal.com/developers/gitignore/api/linux,macos,windows,powershell,visualstudiocode
97+
98+
99+
#Ignore vscode AI rules
100+
.github\instructions\codacy.instructions.md

0 commit comments

Comments
 (0)