-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpresets.go
More file actions
499 lines (483 loc) · 14.3 KB
/
presets.go
File metadata and controls
499 lines (483 loc) · 14.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
// presets.go provides built-in [LayoutSchema] factories for each supported
// AI-agent platform: GitHub Copilot, Cursor, Windsurf, and Claude.
// Each function returns an opinionated default that mirrors the platform's
// published conventions; callers may further customize the returned schema.
package repogov
// DefaultRootLayout returns a [LayoutSchema] for the repository root directory.
// It recognizes common root-level files shared across GitHub and GitLab
// conventions, and marks well-known subdirectories as managed so their contents
// do not produce unexpected-file warnings. No files are required; all entries
// are optional. Use -agent root to validate or scaffold the root layout.
func DefaultRootLayout() LayoutSchema {
return LayoutSchema{
Root: ".",
Required: []string{},
Optional: []string{
".editorconfig",
".gitattributes",
".gitignore",
"AGENTS.md",
"CHANGELOG.md",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.md",
"LICENSE",
"Makefile",
"README.md",
"SECURITY.md",
},
Dirs: map[string]DirRule{
// AI-agent platform dirs — managed by their own layout schemas.
".aiassistant": {Description: "JetBrains AI Assistant configuration", NoCreate: true},
".claude": {Description: "Claude Code configuration", NoCreate: true},
".clinerules": {Description: "Cline rule files", NoCreate: true},
".continue": {Description: "Continue.dev configuration", NoCreate: true},
".cursor": {Description: "Cursor AI configuration", NoCreate: true},
".github": {Description: "GitHub configuration", NoCreate: true},
".gitlab": {Description: "GitLab configuration", NoCreate: true},
".kiro": {Description: "Kiro CLI configuration", NoCreate: true},
".roo": {Description: "Roo Code configuration", NoCreate: true},
".windsurf": {Description: "Windsurf AI configuration", NoCreate: true},
// Common project subdirectories.
"bin": {Description: "Compiled binaries", NoCreate: true},
"build": {Description: "Build output", NoCreate: true},
"cmd": {Description: "Main entry points", NoCreate: true},
"dist": {Description: "Distribution output", NoCreate: true},
"docs": {Description: "Documentation", NoCreate: true},
"internal": {Description: "Private packages", NoCreate: true},
"lib": {Description: "Library code", NoCreate: true},
"node_modules": {Description: "Node.js dependencies", NoCreate: true},
"pkg": {Description: "Public packages", NoCreate: true},
"scripts": {Description: "Helper scripts", NoCreate: true},
"src": {Description: "Source code", NoCreate: true},
"target": {Description: "Build target (Rust/Maven)", NoCreate: true},
"test": {Description: "Test code", NoCreate: true},
"testdata": {Description: "Test fixtures", NoCreate: true},
"tests": {Description: "Test code", NoCreate: true},
"vendor": {Description: "Vendored dependencies", NoCreate: true},
".vscode": {Description: "VS Code workspace settings", NoCreate: true},
},
Naming: NamingRule{
Case: "lowercase",
Exceptions: []string{
"AGENTS.md",
"CHANGELOG.md",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.md",
"GEMINI.md",
"LICENSE",
"Makefile",
"README.md",
"SECURITY.md",
},
},
}
}
// DefaultCopilotLayout returns a [LayoutSchema] matching GitHub Copilot
// repository conventions. It expects a .github/ directory with agent
// instruction files, Copilot instructions, and funding configuration.
func DefaultCopilotLayout() LayoutSchema {
return LayoutSchema{
Root: ".github",
Required: []string{
"copilot-instructions.md",
},
Optional: []string{
"CODE_OF_CONDUCT.md",
"CODEOWNERS",
"CONTRIBUTING.md",
"FUNDING.yml",
"ISSUE_TEMPLATE.md",
"PULL_REQUEST_TEMPLATE.md",
"SECURITY.md",
"SUPPORT.md",
"dependabot.yml",
"pull_request_template.md",
"repogov-config.json",
"repogov-config.yaml",
"repogov-config.yml",
},
Dirs: map[string]DirRule{
"ISSUE_TEMPLATE": {
Glob: "",
Min: 0,
Description: "GitHub issue templates",
NoCreate: true,
},
"PULL_REQUEST_TEMPLATE": {
Glob: "",
Min: 0,
Description: "GitHub pull request templates",
NoCreate: true,
},
"instructions": {
Glob: "*.md",
Min: 0,
Description: "Scoped instruction files",
Frontmatter: []string{"applyTo"},
},
"rules": {
Glob: "*.md",
Min: 0,
Description: "Copilot scoped rule files",
Frontmatter: []string{"applyTo"},
},
"workflows": {
Glob: "",
Min: 0,
Description: "GitHub Actions workflows (recognized; contents not enforced)",
NoCreate: true,
},
},
Naming: NamingRule{
Case: "lowercase",
Exceptions: []string{
"CODE_OF_CONDUCT.md",
"CODEOWNERS",
"CONTRIBUTING.md",
"FUNDING.yml",
"ISSUE_TEMPLATE",
"ISSUE_TEMPLATE.md",
"PULL_REQUEST_TEMPLATE",
"PULL_REQUEST_TEMPLATE.md",
"SECURITY.md",
"SUPPORT.md",
},
},
}
}
// DefaultCursorLayout returns a [LayoutSchema] matching Cursor AI repository
// conventions. It expects a .cursor/ directory with a rules/ subdirectory
// containing scoped rule files. Cursor supports both .md and .mdc extensions;
// .mdc files support frontmatter (description, globs, alwaysApply) for
// fine-grained scoping.
func DefaultCursorLayout() LayoutSchema {
return LayoutSchema{
Root: ".cursor",
Required: []string{},
Optional: []string{},
Dirs: map[string]DirRule{
"rules": {
Glob: "",
Min: 0,
Description: "Cursor scoped rule files (.md and .mdc)",
},
},
Naming: NamingRule{
Case: "lowercase",
},
}
}
// DefaultWindsurfLayout returns a [LayoutSchema] matching Windsurf AI repository
// conventions. It expects a .windsurf/ directory with a rules/ subdirectory
// containing scoped rule files (*.md).
func DefaultWindsurfLayout() LayoutSchema {
return LayoutSchema{
Root: ".windsurf",
Required: []string{},
Optional: []string{},
Dirs: map[string]DirRule{
"rules": {
Glob: "*.md",
Min: 0,
Description: "Windsurf scoped rule files",
},
},
Naming: NamingRule{
Case: "lowercase",
},
}
}
// DefaultGitHubLayout returns a [LayoutSchema] matching GitHub repository
// platform conventions. It expects a .github/ directory with subdirectories
// for issue templates, pull request templates, and workflows. This schema
// validates the platform-level structure (templates, CI, community health
// files); use [DefaultCopilotLayout] for Copilot-specific instruction files.
func DefaultGitHubLayout() LayoutSchema {
return LayoutSchema{
Root: ".github",
Required: []string{},
Optional: []string{
"CODE_OF_CONDUCT.md",
"CODEOWNERS",
"CONTRIBUTING.md",
"FUNDING.yml",
"ISSUE_TEMPLATE.md",
"PULL_REQUEST_TEMPLATE.md",
"SECURITY.md",
"SUPPORT.md",
"dependabot.yml",
"pull_request_template.md",
"repogov-config.json",
"repogov-config.yaml",
"repogov-config.yml",
},
Dirs: map[string]DirRule{
"ISSUE_TEMPLATE": {
Glob: "",
Min: 0,
Description: "GitHub issue templates",
NoCreate: true,
},
"PULL_REQUEST_TEMPLATE": {
Glob: "",
Min: 0,
Description: "GitHub pull request templates",
NoCreate: true,
},
"workflows": {
Glob: "",
Min: 0,
Description: "GitHub Actions workflows",
NoCreate: true,
},
},
Naming: NamingRule{
Case: "lowercase",
Exceptions: []string{
"CODE_OF_CONDUCT.md",
"CODEOWNERS",
"CONTRIBUTING.md",
"FUNDING.yml",
"ISSUE_TEMPLATE",
"ISSUE_TEMPLATE.md",
"PULL_REQUEST_TEMPLATE",
"PULL_REQUEST_TEMPLATE.md",
"SECURITY.md",
"SUPPORT.md",
},
},
}
}
// DefaultGitLabLayout returns a [LayoutSchema] matching GitLab repository
// conventions. It expects a .gitlab/ directory with subdirectories for issue
// and merge request templates, and an optional CODEOWNERS file. Note that
// .gitlab-ci.yml lives at the repository root and is outside the scope of this
// layout schema; enforce its size via the limits config if needed.
func DefaultGitLabLayout() LayoutSchema {
return LayoutSchema{
Root: ".gitlab",
Required: []string{},
Optional: []string{
"CODEOWNERS",
},
Dirs: map[string]DirRule{
"issue_templates": {
Glob: "",
Min: 0,
Description: "GitLab issue templates",
},
"merge_request_templates": {
Glob: "",
Min: 0,
Description: "GitLab merge request templates",
},
},
Naming: NamingRule{
Case: "lowercase",
Exceptions: []string{
"CODEOWNERS",
},
},
}
}
// DefaultBitbucketLayout returns a [LayoutSchema] for Bitbucket repository
// conventions. Bitbucket does not use a dedicated configuration directory;
// its CI pipeline is defined by bitbucket-pipelines.yml at the repository
// root (outside the scope of this layout schema). This schema validates
// common Bitbucket community health and configuration files at the root.
func DefaultBitbucketLayout() LayoutSchema {
return LayoutSchema{
Root: ".",
Required: []string{},
Optional: []string{
"bitbucket-pipelines.yml",
"CONTRIBUTING.md",
"LICENSE",
"README.md",
},
Dirs: map[string]DirRule{},
Naming: NamingRule{
Case: "lowercase",
Exceptions: []string{
"CONTRIBUTING.md",
"LICENSE",
"README.md",
},
},
}
}
// DefaultClaudeLayout returns a [LayoutSchema] matching Claude Code (Anthropic)
// repository conventions. It expects a .claude/ directory with subdirectories
// for rules and subagent definitions. CLAUDE.md is the primary instruction file,
// analogous to copilot-instructions.md for GitHub Copilot. Hooks are configured
// inside settings.json, not as a directory.
func DefaultClaudeLayout() LayoutSchema {
return LayoutSchema{
Root: ".claude",
Required: []string{
"CLAUDE.md",
},
Optional: []string{
"settings.json",
"settings.local.json",
},
Dirs: map[string]DirRule{
"rules": {
Glob: "*.md",
Min: 0,
Description: "Scoped instruction files (paths frontmatter)",
},
"agents": {
Glob: "*.md",
Min: 0,
Description: "Claude subagent definitions",
},
},
Naming: NamingRule{
Case: "lowercase",
Exceptions: []string{
"CLAUDE.md",
},
},
}
}
// DefaultKiroLayout returns a [LayoutSchema] matching Kiro CLI repository
// conventions. It expects a .kiro/ directory with a steering/ subdirectory
// containing project context files (*.md). Kiro uses steering files to
// provide persistent context to the AI agent across sessions.
func DefaultKiroLayout() LayoutSchema {
return LayoutSchema{
Root: ".kiro",
Required: []string{},
Optional: []string{},
Dirs: map[string]DirRule{
"steering": {
Glob: "*.md",
Min: 0,
Description: "Kiro steering files (project context)",
},
},
Naming: NamingRule{
Case: "lowercase",
},
}
}
// DefaultGeminiLayout returns a [LayoutSchema] matching Gemini CLI repository
// conventions. Gemini CLI reads a single GEMINI.md file at the repository root
// as its primary instruction file. No platform-specific subdirectory is used.
func DefaultGeminiLayout() LayoutSchema {
return LayoutSchema{
Root: ".",
Required: []string{
"GEMINI.md",
},
Optional: []string{},
Dirs: map[string]DirRule{},
Naming: NamingRule{
Case: "lowercase",
Exceptions: []string{
"GEMINI.md",
},
},
}
}
// DefaultContinueLayout returns a [LayoutSchema] matching Continue.dev repository
// conventions. It expects a .continue/ directory with a rules/ subdirectory
// containing scoped rule files (*.md).
func DefaultContinueLayout() LayoutSchema {
return LayoutSchema{
Root: ".continue",
Required: []string{},
Optional: []string{},
Dirs: map[string]DirRule{
"rules": {
Glob: "*.md",
Min: 0,
Description: "Continue.dev scoped rule files",
},
},
Naming: NamingRule{
Case: "lowercase",
},
}
}
// DefaultClineLayout returns a [LayoutSchema] matching Cline repository
// conventions. Cline reads rule files directly from the .clinerules/ directory
// at the repository root; no subdirectory structure is used. The "." DirRule
// matches all *.md files placed directly under .clinerules/.
func DefaultClineLayout() LayoutSchema {
return LayoutSchema{
Root: ".clinerules",
Required: []string{},
Optional: []string{},
Dirs: map[string]DirRule{
".": {
Glob: "*.md",
Min: 0,
Description: "Cline rule files",
},
},
Naming: NamingRule{
Case: "lowercase",
},
}
}
// DefaultRooCodeLayout returns a [LayoutSchema] matching Roo Code repository
// conventions. It expects a .roo/ directory with a rules/ subdirectory
// containing scoped rule files (*.md).
func DefaultRooCodeLayout() LayoutSchema {
return LayoutSchema{
Root: ".roo",
Required: []string{},
Optional: []string{},
Dirs: map[string]DirRule{
"rules": {
Glob: "*.md",
Min: 0,
Description: "Roo Code scoped rule files",
},
},
Naming: NamingRule{
Case: "lowercase",
},
}
}
// DefaultJetBrainsLayout returns a [LayoutSchema] matching JetBrains AI
// Assistant repository conventions. It expects a .aiassistant/ directory with
// a rules/ subdirectory containing scoped rule files (*.md).
func DefaultJetBrainsLayout() LayoutSchema {
return LayoutSchema{
Root: ".aiassistant",
Required: []string{},
Optional: []string{},
Dirs: map[string]DirRule{
"rules": {
Glob: "*.md",
Min: 0,
Description: "JetBrains AI Assistant scoped rule files",
},
},
Naming: NamingRule{
Case: "lowercase",
},
}
}
// DefaultZedLayout returns a [LayoutSchema] matching Zed AI repository
// conventions. Zed reads a single project-level rules file at the root;
// its preferred filename is .rules (first in Zed's priority list). If .rules
// is absent, Zed falls back to AGENTS.md, CLAUDE.md, GEMINI.md, and others
// that are seeded by other agents' inits, so all Zed users benefit from any
// existing agent init without needing the .rules file specifically.
func DefaultZedLayout() LayoutSchema {
return LayoutSchema{
Root: ".",
Required: []string{
".rules",
},
Optional: []string{},
Dirs: map[string]DirRule{},
Naming: NamingRule{
Case: "lowercase",
},
}
}