Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/copilot-commit-message-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: `<type>(<scope>): <subject>`

`<scope>` is optional

## Example

```
feat: add hat wobble
^--^ ^------------^
| |
| +-> Summary in present tense.
|
+-------> Type: chore, docs, feat, fix, refactor, style, or test.
```

More Examples:

- `feat`: (new feature for the user, not a new feature for build script)
- `fix`: (bug fix for the user, not a fix to a build script)
- `docs`: (changes to the documentation)
- `style`: (formatting, missing semi colons, etc; no production code change)
- `refactor`: (refactoring production code, eg. renaming a variable)
- `test`: (adding missing tests, refactoring tests; no production code change)
- `chore`: (updating grunt tasks etc; no production code change)

References:

- https://www.conventionalcommits.org/
- https://seesparkbox.com/foundry/semantic_commit_messages
- http://karma-runner.github.io/1.0/dev/git-commit-msg.html
44 changes: 44 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copilot Instructions

## Powershell Modules Code Instructions

### PowerShell Functions Instructions

Every powershell function will contain the `CmdletBinding` attribute and the `parm`iven if there are no parameters.
If the function is on the public folder of the module, we will add the Èxport-ModuleFunction` statement in the same line as the closing `}` of the function

Sample of function will be:

```powershell

function Get-UserName{
[CmdletBinding()]
param()

#Logic of the function
} Export-ModuleFunction -FunctionName 'Get-UserName'
```

### PowerShell Test Instructions

Every public function on the Test module will have the following format

- Name will start with `Test_` will follow the name of the function that we are testing with no '-'. It will follow the intention of the test splited with a '_'
- Every time we create a new function with no body we will add the `Assert-NotImplemented` statement at the end
- We will add the 3 sections as with comments `Arrange`, `Act` and `Assert` to make the test more readable.
- Sample of a test function to test `Get-UserName` function will be `Test_GetUserName_UserNotFound`

Full sample will be as follows

```powershell
function Test_GetUserName_UserNotFound{

# Arrange

# Act

# Assert

Assert-NotImplemented
}
```
42 changes: 42 additions & 0 deletions .github/copilot-pull-request-description-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Pull Request Code Instructions

## PR TITLE

Follow this guidelines to construct the title of your pull request.

Format: `<type>(<scope>): <subject>`

`<scope>` is optional

## Example

```
feat: add hat wobble
^--^ ^------------^
| |
| +-> Summary in present tense.
|
+-------> Type: chore, docs, feat, fix, refactor, style, or test.
```

More Examples:

- `feat`: (new feature for the user, not a new feature for build script)
- `fix`: (bug fix for the user, not a fix to a build script)
- `docs`: (changes to the documentation)
- `style`: (formatting, missing semi colons, etc; no production code change)
- `refactor`: (refactoring production code, eg. renaming a variable)
- `test`: (adding missing tests, refactoring tests; no production code change)
- `chore`: (updating grunt tasks etc; no production code change)

References:

- https://www.conventionalcommits.org/
- https://seesparkbox.com/foundry/semantic_commit_messages
- http://karma-runner.github.io/1.0/dev/git-commit-msg.html

## Pull Reques description

- Add a summery of the intention of the PR. Use the title and the messages of the commits to create a summary.
- Add a list with all the commit messages in the PR.

70 changes: 70 additions & 0 deletions public/getCommitPrompt.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
function Get-AiMessageForCommit{

Check notice

Code scanning / PSScriptAnalyzer

The cmdlet 'Get-AiMessageForCommit' does not have a help comment. Note

The cmdlet 'Get-AiMessageForCommit' does not have a help comment.
[CmdletBinding()]
[alias("aicm")]
param(
[Parameter()]$Model = "openai/gpt-4.1",
[Parameter()]$Prompt
)

$gitdifff = git diff --staged

if ([string]::IsNullOrWhiteSpace($gitdifff)) {
Write-Host "No staged changes found. Please stage your changes before generating a commit message." -ForegroundColor Yellow

Check warning

Code scanning / PSScriptAnalyzer

File 'getCommitPrompt.ps1' uses Write-Host. Avoid using Write-Host because it might not work in all hosts, does not work when there is no host, and (prior to PS 5.0) cannot be suppressed, captured, or redirected. Instead, use Write-Output, Write-Verbose, or Write-Information. Warning

File 'getCommitPrompt.ps1' uses Write-Host. Avoid using Write-Host because it might not work in all hosts, does not work when there is no host, and (prior to PS 5.0) cannot be suppressed, captured, or redirected. Instead, use Write-Output, Write-Verbose, or Write-Information.
return $null
}

$instructions = Get-Instructions -Type CommitMessage

if ($null -eq $instructions) {
Write-Verbose "No instructions found at .github/$instFileName. Using default commit message format."
} else {
Write-Verbose "Instructions: .github [$($instructions.Length)] characters."
}

$p = @()
$p += "Follow these instructions: [ $instructions ]"
$sysPrompt = $p -join "`n"

Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace
$p = @()
$p += "Propose a git commit message."
$p += "Output just the message."
$p += "Make the message a single line."
$p += "Result of git diff --staged: [ $gitdifff ]"
$p += "User description of the changes: [ $Prompt ]"
$usrprompt = $p -join "`n"

Write-Verbose "Module: $Model"
Write-Verbose "SysPrompt: $sysPrompt"
Write-Verbose "UsrPrompt: $usrprompt"

$message = gh models run $Model "$usrprompt" --system-prompt $sysPrompt

$global:message = $message | Out-String

Check warning

Code scanning / PSScriptAnalyzer

Found global variable 'global:message'. Warning

Found global variable 'global:message'.

return $message

} Export-ModuleMember -Function Get-AiMessageForCommit -Alias aicm

function Get-Instructions{

Check warning

Code scanning / PSScriptAnalyzer

The cmdlet 'Get-Instructions' uses a plural noun. A singular noun should be used instead. Warning

The cmdlet 'Get-Instructions' uses a plural noun. A singular noun should be used instead.
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[ValidateSet("CommitMessage", "CodeInstructions", "PrDescription")]
[string]$Type

)
switch ($Type) {
CommitMessage { $instFileName = "copilot-commit-message-instructions.md" ; break }
CodeInstructions { $instFileName = "copilot-instructions.md" ; break }
PrDescription { $instFileName = "copilot-pull-request-description-instructions.md" ; break }
}

$instructionsPath = ".github" | Join-Path -ChildPath $instFileName

if (Test-Path $instructionsPath) {
$content = Get-Content -Path $instructionsPath -Raw
return $content
}

Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace
return $null
}
34 changes: 0 additions & 34 deletions sync.ps1

This file was deleted.

62 changes: 0 additions & 62 deletions tools/sync.Helper.ps1

This file was deleted.