enforcing style rules (#32)
* Fixing line endings and removing dead code * Missing descriptions due to line endings * Enforcing that the line endings should be LF * Potential fix for code scanning alert no. 18: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Fixing readme generator --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
parent
99fb7e177e
commit
04c5757e2c
34
.editorconfig
Normal file
34
.editorconfig
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# EditorConfig is awesome: https://EditorConfig.org
|
||||||
|
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# All files
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
# Markdown files
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
max_line_length = off
|
||||||
|
|
||||||
|
# JSON files
|
||||||
|
[*.json]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
# JavaScript files
|
||||||
|
[*.js]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
# Shell scripts
|
||||||
|
[*.sh]
|
||||||
|
end_of_line = lf
|
||||||
|
|
||||||
|
# Windows scripts
|
||||||
|
[*.{cmd,bat}]
|
||||||
|
end_of_line = crlf
|
||||||
28
.gitattributes
vendored
Normal file
28
.gitattributes
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Set default behavior to automatically normalize line endings.
|
||||||
|
* text=auto eol=lf
|
||||||
|
|
||||||
|
# Explicitly declare text files to be normalized and converted to native line endings on checkout.
|
||||||
|
*.md text eol=lf
|
||||||
|
*.txt text eol=lf
|
||||||
|
*.js text eol=lf
|
||||||
|
*.json text eol=lf
|
||||||
|
*.yml text eol=lf
|
||||||
|
*.yaml text eol=lf
|
||||||
|
*.html text eol=lf
|
||||||
|
*.css text eol=lf
|
||||||
|
*.scss text eol=lf
|
||||||
|
*.ts text eol=lf
|
||||||
|
*.sh text eol=lf
|
||||||
|
|
||||||
|
# Windows-specific files that should retain CRLF line endings
|
||||||
|
*.bat text eol=crlf
|
||||||
|
*.cmd text eol=crlf
|
||||||
|
|
||||||
|
# Binary files that should not be modified
|
||||||
|
*.png binary
|
||||||
|
*.jpg binary
|
||||||
|
*.jpeg binary
|
||||||
|
*.gif binary
|
||||||
|
*.ico binary
|
||||||
|
*.zip binary
|
||||||
|
*.pdf binary
|
||||||
29
.github/workflows/check-line-endings.yml
vendored
Normal file
29
.github/workflows/check-line-endings.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
name: Check Line Endings
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-line-endings:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Check for CRLF line endings in markdown files
|
||||||
|
run: |
|
||||||
|
! grep -l $'\r' $(find . -name "*.md")
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "✅ No CRLF line endings found in markdown files"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "❌ CRLF line endings found in markdown files"
|
||||||
|
echo "Files with CRLF line endings:"
|
||||||
|
grep -l $'\r' $(find . -name "*.md")
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
node_modules
|
node_modules
|
||||||
*.orig
|
*.orig
|
||||||
|
[Cc]opilot-[Pp]rocessing.md
|
||||||
|
|||||||
6
.vscode/extensions.json
vendored
Normal file
6
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"editorconfig.editorconfig",
|
||||||
|
"davidanson.vscode-markdownlint"
|
||||||
|
]
|
||||||
|
}
|
||||||
15
.vscode/settings.json
vendored
15
.vscode/settings.json
vendored
@ -7,5 +7,20 @@
|
|||||||
},
|
},
|
||||||
"chat.instructionsFilesLocations": {
|
"chat.instructionsFilesLocations": {
|
||||||
"instructions": true
|
"instructions": true
|
||||||
|
},
|
||||||
|
"files.eol": "\n",
|
||||||
|
"files.insertFinalNewline": true,
|
||||||
|
"files.trimTrailingWhitespace": true,
|
||||||
|
"[markdown]": {
|
||||||
|
"files.trimTrailingWhitespace": false,
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"editor.rulers": [
|
||||||
|
100
|
||||||
|
],
|
||||||
|
"files.associations": {
|
||||||
|
"*.chatmode.md": "markdown",
|
||||||
|
"*.instructions.md": "markdown",
|
||||||
|
"*.prompt.md": "markdown"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
14
README.md
14
README.md
@ -55,8 +55,8 @@ Ready-to-use prompt templates for specific development scenarios and tasks, defi
|
|||||||
- [Product Manager Assistant: Feature Identification and Specification](prompts/gen-specs-as-issues.prompt.md) - This workflow guides you through a systematic approach to identify missing features, prioritize them, and create detailed specifications for implementation.
|
- [Product Manager Assistant: Feature Identification and Specification](prompts/gen-specs-as-issues.prompt.md) - This workflow guides you through a systematic approach to identify missing features, prioritize them, and create detailed specifications for implementation.
|
||||||
- [Javascript Typescript Jest](prompts/javascript-typescript-jest.prompt.md) - Best practices for writing JavaScript/TypeScript tests using Jest, including mocking strategies, test structure, and common patterns.
|
- [Javascript Typescript Jest](prompts/javascript-typescript-jest.prompt.md) - Best practices for writing JavaScript/TypeScript tests using Jest, including mocking strategies, test structure, and common patterns.
|
||||||
- [Multi Stage Dockerfile](prompts/multi-stage-dockerfile.prompt.md) - Create optimized multi-stage Dockerfiles for any language or framework
|
- [Multi Stage Dockerfile](prompts/multi-stage-dockerfile.prompt.md) - Create optimized multi-stage Dockerfiles for any language or framework
|
||||||
- [My Issues](prompts/my-issues.prompt.md)
|
- [My Issues](prompts/my-issues.prompt.md) - List my issues in the current repository
|
||||||
- [My Pull Requests](prompts/my-pull-requests.prompt.md)
|
- [My Pull Requests](prompts/my-pull-requests.prompt.md) - List my pull requests in the current repository
|
||||||
|
|
||||||
> 💡 **Usage**: Use `/prompt-name` in VS Code chat, run `Chat: Run Prompt` command, or hit the run button while you have a prompt open.
|
> 💡 **Usage**: Use `/prompt-name` in VS Code chat, run `Chat: Run Prompt` command, or hit the run button while you have a prompt open.
|
||||||
|
|
||||||
@ -79,6 +79,16 @@ Custom chat modes define specific behaviors and tools for GitHub Copilot Chat, e
|
|||||||
- [Custom Chat Modes](https://code.visualstudio.com/docs/copilot/chat/chat-modes) - Advanced chat configuration
|
- [Custom Chat Modes](https://code.visualstudio.com/docs/copilot/chat/chat-modes) - Advanced chat configuration
|
||||||
- [VS Code Settings](https://code.visualstudio.com/docs/getstarted/settings) - General VS Code configuration guide
|
- [VS Code Settings](https://code.visualstudio.com/docs/getstarted/settings) - General VS Code configuration guide
|
||||||
|
|
||||||
|
## 🛠️ Development Configuration
|
||||||
|
|
||||||
|
This repository uses various configuration files to ensure consistent code style and avoid issues with line endings:
|
||||||
|
|
||||||
|
- [`.editorconfig`](.editorconfig) - Defines coding styles across different editors and IDEs
|
||||||
|
- [`.gitattributes`](.gitattributes) - Ensures consistent line endings in text files
|
||||||
|
- [`.vscode/settings.json`](.vscode/settings.json) - VS Code-specific settings for this repository
|
||||||
|
- [`.vscode/extensions.json`](.vscode/extensions.json) - Recommended VS Code extensions
|
||||||
|
|
||||||
|
> 💡 **Note**: All markdown files in this repository use LF line endings (Unix-style) to avoid mixed line endings issues. The repository is configured to automatically handle line endings conversion.
|
||||||
|
|
||||||
## 📄 License
|
## 📄 License
|
||||||
|
|
||||||
|
|||||||
9
scripts/fix-line-endings.sh
Executable file
9
scripts/fix-line-endings.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Script to fix line endings in all markdown files
|
||||||
|
|
||||||
|
echo "Normalizing line endings in markdown files..."
|
||||||
|
|
||||||
|
# Find all markdown files and convert CRLF to LF
|
||||||
|
find . -name "*.md" -type f -exec sed -i 's/\r$//' {} \;
|
||||||
|
|
||||||
|
echo "Done! All markdown files now have LF line endings."
|
||||||
@ -49,6 +49,16 @@ Custom chat modes define specific behaviors and tools for GitHub Copilot Chat, e
|
|||||||
- [Custom Chat Modes](https://code.visualstudio.com/docs/copilot/chat/chat-modes) - Advanced chat configuration
|
- [Custom Chat Modes](https://code.visualstudio.com/docs/copilot/chat/chat-modes) - Advanced chat configuration
|
||||||
- [VS Code Settings](https://code.visualstudio.com/docs/getstarted/settings) - General VS Code configuration guide
|
- [VS Code Settings](https://code.visualstudio.com/docs/getstarted/settings) - General VS Code configuration guide
|
||||||
|
|
||||||
|
## 🛠️ Development Configuration
|
||||||
|
|
||||||
|
This repository uses various configuration files to ensure consistent code style and avoid issues with line endings:
|
||||||
|
|
||||||
|
- [\`.editorconfig\`](.editorconfig) - Defines coding styles across different editors and IDEs
|
||||||
|
- [\`.gitattributes\`](.gitattributes) - Ensures consistent line endings in text files
|
||||||
|
- [\`.vscode/settings.json\`](.vscode/settings.json) - VS Code-specific settings for this repository
|
||||||
|
- [\`.vscode/extensions.json\`](.vscode/extensions.json) - Recommended VS Code extensions
|
||||||
|
|
||||||
|
> 💡 **Note**: All markdown files in this repository use LF line endings (Unix-style) to avoid mixed line endings issues. The repository is configured to automatically handle line endings conversion.
|
||||||
|
|
||||||
## 📄 License
|
## 📄 License
|
||||||
|
|
||||||
@ -353,78 +363,6 @@ function generateChatModesSection(chatmodesDir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return `${TEMPLATES.chatmodesSection}\n\n${chatmodesContent}\n${TEMPLATES.chatmodesUsage}`;
|
return `${TEMPLATES.chatmodesSection}\n\n${chatmodesContent}\n${TEMPLATES.chatmodesUsage}`;
|
||||||
|
|
||||||
if (chatmodesSection) {
|
|
||||||
let chatmodesListContent = "\n\n";
|
|
||||||
|
|
||||||
// Always regenerate the entire list to ensure descriptions are included
|
|
||||||
for (const file of chatmodeFiles.sort()) {
|
|
||||||
const filePath = path.join(chatmodesDir, file);
|
|
||||||
const title = extractTitle(filePath);
|
|
||||||
const link = encodeURI(`chatmodes/${file}`);
|
|
||||||
|
|
||||||
// Check if there's a description in the frontmatter
|
|
||||||
const customDescription = extractDescription(filePath);
|
|
||||||
|
|
||||||
if (customDescription && customDescription !== "null") {
|
|
||||||
// Use the description from frontmatter
|
|
||||||
chatmodesListContent += `- [${title}](${link}) - ${customDescription}\n`;
|
|
||||||
} else {
|
|
||||||
// Just add a link without description
|
|
||||||
chatmodesListContent += `- [${title}](${link})\n`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Replace the current chat modes section with the updated one
|
|
||||||
const newChatmodesSection =
|
|
||||||
"## 🧩 Custom Chat Modes\n\nCustom chat modes define specific behaviors and tools for GitHub Copilot Chat, enabling enhanced context-aware assistance for particular tasks or workflows." +
|
|
||||||
chatmodesListContent +
|
|
||||||
"\n> 💡 **Usage**: Create new chat modes using the command `Chat: Configure Chat Modes...`, then switch your chat mode in the Chat input from _Agent_ or _Ask_ to your own mode.";
|
|
||||||
|
|
||||||
return currentReadme.replace(chatmodesSection[0], newChatmodesSection);
|
|
||||||
} else {
|
|
||||||
// Chat modes section doesn't exist yet but we have chat mode files
|
|
||||||
console.log(
|
|
||||||
"Creating new chat modes section with all available chat modes."
|
|
||||||
);
|
|
||||||
|
|
||||||
const chatmodesListContent = chatmodeFiles
|
|
||||||
.sort()
|
|
||||||
.map((file) => {
|
|
||||||
const filePath = path.join(chatmodesDir, file);
|
|
||||||
const title = extractTitle(filePath);
|
|
||||||
const link = `chatmodes/${file}`;
|
|
||||||
const customDescription = extractDescription(filePath);
|
|
||||||
|
|
||||||
if (customDescription) {
|
|
||||||
return `- [${title}](${link}) - ${customDescription}`;
|
|
||||||
} else {
|
|
||||||
return `- [${title}](${link})`;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.join("\n");
|
|
||||||
|
|
||||||
const newChatmodesSection =
|
|
||||||
"## 🧩 Custom Chat Modes\n\n" +
|
|
||||||
"Custom chat modes define specific behaviors and tools for GitHub Copilot Chat, enabling enhanced context-aware assistance for particular tasks or workflows.\n\n" +
|
|
||||||
chatmodesListContent +
|
|
||||||
"\n\n> 💡 **Usage**: Create new chat modes using the command `Chat: Configure Chat Modes...`, then switch your chat mode in the Chat input from _Agent_ or _Ask_ to your own mode.\n";
|
|
||||||
|
|
||||||
// Insert before Additional Resources section
|
|
||||||
const additionalResourcesPos = currentReadme.indexOf(
|
|
||||||
"## 📚 Additional Resources"
|
|
||||||
);
|
|
||||||
if (additionalResourcesPos !== -1) {
|
|
||||||
return (
|
|
||||||
currentReadme.slice(0, additionalResourcesPos) +
|
|
||||||
newChatmodesSection +
|
|
||||||
"\n" +
|
|
||||||
currentReadme.slice(additionalResourcesPos)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return currentReadme;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user