Repository navigation
feat(connect): give Cursor users a project rule to copy #2670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // @ts-nocheck | ||
| // The Cursor project rule and the one-click link appear twice: on the Connect | ||
| // page (from these modules) and in docs-site/agents/connect.mdx (a hand copy, | ||
| // because Mintlify can't import app code). The copies must not drift. | ||
| import fs from 'fs'; | ||
| import path from 'path'; | ||
| import cursorMcpInstallLink from '../utils/cursorMcpInstallLink'; | ||
| import { CURSOR_PROJECT_RULE, CURSOR_PROJECT_RULE_PATH } from '../utils/cursorProjectRule'; | ||
|
|
||
| const ROOT = path.join(__dirname, '..', '..', '..', '..'); | ||
| const connectDoc = fs.readFileSync(path.join(ROOT, 'docs-site/agents/connect.mdx'), 'utf8'); | ||
|
|
||
| describe('Cursor project rule', () => { | ||
| test('docs carry the same rule, at the same path, as the Connect page', () => { | ||
| expect(connectDoc).toContain(`\`\`\`markdown\n${CURSOR_PROJECT_RULE}\`\`\``); | ||
| expect(connectDoc).toContain(`\`${CURSOR_PROJECT_RULE_PATH}\``); | ||
| }); | ||
|
|
||
| test('docs one-click link is the hosted instance link the app builds', () => { | ||
| expect(connectDoc).toContain(`(${cursorMcpInstallLink('https://api.commonly.me')})`); | ||
| }); | ||
|
|
||
| test('the rule is a valid always-on Cursor rule naming real Commonly MCP tools', () => { | ||
| expect(CURSOR_PROJECT_RULE).toMatch(/^---\ndescription: .+\nalwaysApply: true\n---\n/); | ||
| const tools = fs.readFileSync(path.join(ROOT, 'commonly-mcp/src/tools.js'), 'utf8'); | ||
| const named = CURSOR_PROJECT_RULE.match(/commonly_[a-z_]+/g); | ||
| expect(named.length).toBeGreaterThan(0); | ||
| named.forEach((tool) => expect(tools).toContain(`name: '${tool}'`)); | ||
| }); | ||
|
|
||
| test('the rule keeps its context, handoff and key-safety instructions', () => { | ||
| expect(CURSOR_PROJECT_RULE).toMatch(/call `commonly_get_context` with that pod's id before you start/); | ||
| expect(CURSOR_PROJECT_RULE).toMatch(/post a short result or handoff[^.]*`commonly_post_message`/); | ||
| expect(CURSOR_PROJECT_RULE).toMatch(/Keep agent keys out of pod messages, URLs, logs and committed files/); | ||
| }); | ||
|
|
||
| test('the rule does not claim Cursor answers @mentions or point at this repo', () => { | ||
| expect(CURSOR_PROJECT_RULE).toMatch(/does not wake Cursor for @mentions/); | ||
| expect(CURSOR_PROJECT_RULE).not.toMatch(/AGENTS\.md|REVIEW\.md/); | ||
| expect(CURSOR_PROJECT_RULE).not.toMatch(/cm_agent_/); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // A Cursor project rule a user drops into their own repository. This is not | ||
| // the repo's own .cursor/rules/commonly.mdc, which points contributors at | ||
| // AGENTS.md. docs-site/agents/connect.mdx carries a copy, and a test keeps the | ||
| // two identical. | ||
| export const CURSOR_PROJECT_RULE_PATH = '.cursor/rules/commonly.mdc'; | ||
|
|
||
| export const CURSOR_PROJECT_RULE = `--- | ||
| description: Use the team's Commonly pod for shared context and handoffs | ||
| alwaysApply: true | ||
| --- | ||
|
|
||
| When a task names a Commonly pod, call \`commonly_get_context\` with that pod's id before you start, so you have the team's current priorities and recent messages. Use \`commonly_get_messages\` when you need more history. | ||
|
|
||
| When the work is done, post a short result or handoff to the same pod with \`commonly_post_message\`. Don't post step-by-step progress. | ||
|
|
||
| This MCP connection lets Cursor use Commonly's tools while a session is open. It does not wake Cursor for @mentions, so never say you are listening for them. | ||
|
|
||
| Keep agent keys out of pod messages, URLs, logs and committed files. | ||
| `; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔎 Supported by static analysis
Script executed:
Repository: Team-Commonly/commonly
Length of output: 41656
Assert the rule's required instructions.
The tool-name check only requires that at least one
commonly_*name in the rule exists incommonly-mcp/src/tools.js. Removing thecommonly_get_contextsentence leavescommonly_get_messagesandcommonly_post_message, so the test still passes. Removing the result-or-handoff sentence leavescommonly_get_contextandcommonly_get_messages, so the test still passes. Removing the agent-key sentence leaves the negativecm_agent_check passing, because that check only confirms the string is absent.Add assertions that fail when each instruction is removed:
Suggested test addition