Skip to content

Conversation

@gorkem
Copy link
Member

@gorkem gorkem commented Dec 4, 2025

No description provided.

@gorkem gorkem requested review from amisevsk and Copilot December 4, 2025 21:23
Copilot finished reviewing on behalf of gorkem December 4, 2025 21:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds support for recognizing prompt and agent files during Kitfile generation. The changes ensure that specific files (like AGENTS.md, SKILL.md, CLAUDE.md) and files with .prompt in their names are automatically classified as code files rather than documentation or metadata files.

Key Changes

  • Added promptFilePatterns variable containing agent file names (AGENTS.md, SKILL.md, CLAUDE.md)
  • Modified determineFileType() function to check for exact agent file matches and .prompt substring patterns before checking other file extensions
  • Added comprehensive test coverage with 27 test cases covering prompt files, agent files, edge cases, and regular file types

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 10 comments.

File Description
pkg/lib/kitfile/generate/generate.go Added prompt/agent file detection logic in determineFileType() function and new promptFilePatterns variable
pkg/lib/kitfile/generate/generate_test.go New test file with table-driven tests for determineFileType() covering prompt files, agent files, and edge cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +282 to +283
for _, pattern := range promptFilePatterns {
if baseName == strings.ToLower(pattern) {
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider converting promptFilePatterns to lowercase once at initialization rather than calling strings.ToLower(pattern) on every iteration. This would avoid repeated string conversions. For example, you could create a var promptFilePatternsLower []string at package level that contains the lowercase versions, or directly store them as lowercase in the original slice.

Suggested change
for _, pattern := range promptFilePatterns {
if baseName == strings.ToLower(pattern) {
for _, pattern := range promptFilePatternsLower {
if baseName == pattern {

Copilot uses AI. Check for mistakes.
Comment on lines +288 to +289
// Check for .prompt pattern (substring match)
if strings.Contains(baseName, ".prompt") {
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The substring check strings.Contains(baseName, ".prompt") may match unintended files. For example, files like "system.prompts.md" or "my.prompter.config" would also be matched because they contain ".prompt" as a substring. Consider using a more specific pattern, such as checking if the basename ends with ".prompt" or contains ".prompt." (with a trailing dot), or use strings.HasPrefix after splitting on dots to ensure ".prompt" is a complete segment.

Suggested change
// Check for .prompt pattern (substring match)
if strings.Contains(baseName, ".prompt") {
// Check for .prompt as a complete segment or suffix
if strings.HasSuffix(baseName, ".prompt") || strings.Contains(baseName, ".prompt.") {

Copilot uses AI. Check for mistakes.
Comment on lines 88 to 91
name: "file ending with .prompt should match",
filename: "system.prompt",
expectedType: fileTypeCode,
},
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case is a duplicate of the "prompt file without extension" test on lines 31-34 (both test "system.prompt"). Consider removing this duplicate or testing a different filename to add value.

Suggested change
name: "file ending with .prompt should match",
filename: "system.prompt",
expectedType: fileTypeCode,
},

Copilot uses AI. Check for mistakes.
Comment on lines +70 to +74
var promptFilePatterns = []string{
"AGENTS.md",
"SKILL.md",
"CLAUDE.md",
}
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name promptFilePatterns is misleading since it contains agent-related files (AGENTS.md, SKILL.md, CLAUDE.md) that aren't necessarily prompt files. Consider renaming to something more inclusive like agentAndPromptFilePatterns or codeFilePatterns to better reflect its purpose of identifying files that should be treated as code.

Copilot uses AI. Check for mistakes.
Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant