Skip to content

Commit c7e6bc2

Browse files
fix: rename discover_cursor_rules to enable_cursor_rules
1 parent d6b2721 commit c7e6bc2

6 files changed

Lines changed: 16 additions & 16 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ review:
115115
| `context.reserved_output_tokens` | Tokens reserved for the model's response (default: `4096`) |
116116
| `context.tokenizer_model` | Tiktoken encoding used for token counting (default: `o200k_base`) |
117117
| `context.model_limits` | Per-model context window and max output token settings |
118-
| `context.discover_cursor_rules` | When `true`, also read `AGENTS.md` and `.cursor/rules/*.mdc` (rules with `alwaysApply: true`, or no `globs`/`alwaysApply` frontmatter at all) from the reviewed repo as additional project context. Default: `false` |
118+
| `context.enable_cursor_rules` | When `true`, also read `AGENTS.md` and `.cursor/rules/*.mdc` (rules with `alwaysApply: true`, or no `globs`/`alwaysApply` frontmatter at all) from the reviewed repo as additional project context. Default: `false` |
119119

120120
### 4. Build
121121

@@ -194,7 +194,7 @@ go install ./cmd/codestrike
194194
ln -s "$(pwd)" ~/.cursor/plugins/local/codestrike
195195
```
196196

197-
Reload Cursor (`Developer: Reload Window`) and confirm `pr-review` appears under **Customize → Skills**. codestrike's own review pipeline can also read Cursor-native project instructions (`AGENTS.md`, `.cursor/rules/*.mdc`) from the reviewed repo — see `context.discover_cursor_rules` above. See [`docs/cursor-integration.md`](docs/cursor-integration.md) for details and planned follow-up work (an MCP server).
197+
Reload Cursor (`Developer: Reload Window`) and confirm `pr-review` appears under **Customize → Skills**. codestrike's own review pipeline can also read Cursor-native project instructions (`AGENTS.md`, `.cursor/rules/*.mdc`) from the reviewed repo — see `context.enable_cursor_rules` above. See [`docs/cursor-integration.md`](docs/cursor-integration.md) for details and planned follow-up work (an MCP server).
198198

199199
## Development
200200

internal/config/assets/default.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ review:
2424
# Set to true to also read AGENTS.md and .cursor/rules/*.mdc (rules with
2525
# alwaysApply: true, or no globs/alwaysApply frontmatter at all) from the
2626
# reviewed repo as additional project context. Off by default.
27-
# discover_cursor_rules: true
27+
# enable_cursor_rules: true
2828
model_limits:
2929
gpt-4o:
3030
context_window: 128000

internal/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type ContextConfig struct {
3232
ReservedOutputTokens int `yaml:"reserved_output_tokens"`
3333
TokenizerModel string `yaml:"tokenizer_model"`
3434
ModelLimits map[string]ModelLimit `yaml:"model_limits"`
35-
DiscoverCursorRules bool `yaml:"discover_cursor_rules"`
35+
EnableCursorRules bool `yaml:"enable_cursor_rules"`
3636
}
3737

3838
type ModelLimit struct {

internal/context/cursorrules.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ func isUnconditionallyApplicable(fm cursorRuleFrontmatter) bool {
5959
return strings.TrimSpace(fm.Globs) == ""
6060
}
6161

62-
// DiscoverCursorContext reads AGENTS.md and applicable .cursor/rules/*.mdc
62+
// LoadCursorContext reads AGENTS.md and applicable .cursor/rules/*.mdc
6363
// files from repoRoot (root level only, not recursive) and returns their
6464
// concatenated content formatted as "### <name>" sections, consistent with
6565
// how project context_files are rendered.
66-
func DiscoverCursorContext(repoRoot string) string {
66+
func LoadCursorContext(repoRoot string) string {
6767
var sb strings.Builder
6868

6969
if data, err := os.ReadFile(filepath.Join(repoRoot, "AGENTS.md")); err == nil {

internal/context/cursorrules_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
appcontext "github.com/CrowdStrike/codestrike/internal/context"
1010
)
1111

12-
func TestDiscoverCursorContext_ReadsAgentsMdAndAlwaysApplyRules(t *testing.T) {
12+
func TestLoadCursorContext_ReadsAgentsMdAndAlwaysApplyRules(t *testing.T) {
1313
dir := t.TempDir()
1414
writeFile(t, dir, "AGENTS.md", "# Project Instructions\nUse snake_case.\n")
1515

@@ -20,7 +20,7 @@ func TestDiscoverCursorContext_ReadsAgentsMdAndAlwaysApplyRules(t *testing.T) {
2020
writeFile(t, rulesDir, "always.mdc", "---\nalwaysApply: true\n---\n\nAlways follow this rule.\n")
2121
writeFile(t, rulesDir, "no-frontmatter-fields.mdc", "---\ndescription: agent decides\n---\n\nAgent-decided rule body.\n")
2222

23-
got := appcontext.DiscoverCursorContext(dir)
23+
got := appcontext.LoadCursorContext(dir)
2424

2525
if !strings.Contains(got, "### AGENTS.md") || !strings.Contains(got, "Use snake_case.") {
2626
t.Errorf("expected AGENTS.md content in output, got: %q", got)
@@ -33,7 +33,7 @@ func TestDiscoverCursorContext_ReadsAgentsMdAndAlwaysApplyRules(t *testing.T) {
3333
}
3434
}
3535

36-
func TestDiscoverCursorContext_SkipsGlobScopedAndDisabledRules(t *testing.T) {
36+
func TestLoadCursorContext_SkipsGlobScopedAndDisabledRules(t *testing.T) {
3737
dir := t.TempDir()
3838
rulesDir := filepath.Join(dir, ".cursor", "rules")
3939
if err := os.MkdirAll(rulesDir, 0755); err != nil {
@@ -43,7 +43,7 @@ func TestDiscoverCursorContext_SkipsGlobScopedAndDisabledRules(t *testing.T) {
4343
writeFile(t, rulesDir, "disabled.mdc", "---\nalwaysApply: false\n---\n\nManual only.\n")
4444
writeFile(t, rulesDir, "not-a-rule.md", "not an mdc file\n")
4545

46-
got := appcontext.DiscoverCursorContext(dir)
46+
got := appcontext.LoadCursorContext(dir)
4747

4848
if strings.Contains(got, "scoped.mdc") || strings.Contains(got, "Only for tsx files.") {
4949
t.Errorf("expected glob-scoped rule to be excluded, got: %q", got)
@@ -56,25 +56,25 @@ func TestDiscoverCursorContext_SkipsGlobScopedAndDisabledRules(t *testing.T) {
5656
}
5757
}
5858

59-
func TestDiscoverCursorContext_MissingDirReturnsEmptyNoError(t *testing.T) {
59+
func TestLoadCursorContext_MissingDirReturnsEmptyNoError(t *testing.T) {
6060
dir := t.TempDir()
6161

62-
got := appcontext.DiscoverCursorContext(dir)
62+
got := appcontext.LoadCursorContext(dir)
6363

6464
if got != "" {
6565
t.Errorf("expected empty result for repo with no AGENTS.md/.cursor/rules, got: %q", got)
6666
}
6767
}
6868

69-
func TestDiscoverCursorContext_SkipsFileWithoutFrontmatter(t *testing.T) {
69+
func TestLoadCursorContext_SkipsFileWithoutFrontmatter(t *testing.T) {
7070
dir := t.TempDir()
7171
rulesDir := filepath.Join(dir, ".cursor", "rules")
7272
if err := os.MkdirAll(rulesDir, 0755); err != nil {
7373
t.Fatal(err)
7474
}
7575
writeFile(t, rulesDir, "plain.mdc", "Just plain text, no frontmatter delimiters.\n")
7676

77-
got := appcontext.DiscoverCursorContext(dir)
77+
got := appcontext.LoadCursorContext(dir)
7878

7979
if got != "" {
8080
t.Errorf("expected file without frontmatter to be skipped, got: %q", got)

internal/review/pipeline.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,13 @@ func (p *Pipeline) loadProjectContext() string {
366366
var sb strings.Builder
367367
sb.WriteString(p.loadContextFiles())
368368

369-
if p.config.Review.Context.DiscoverCursorRules {
369+
if p.config.Review.Context.EnableCursorRules {
370370
cwd, err := os.Getwd()
371371
if err != nil {
372372
p.logger.Debug().Err(err).Msg("could not determine working directory for cursor rule discovery")
373373
return sb.String()
374374
}
375-
sb.WriteString(appcontext.DiscoverCursorContext(cwd))
375+
sb.WriteString(appcontext.LoadCursorContext(cwd))
376376
}
377377

378378
return sb.String()

0 commit comments

Comments
 (0)