Files
Git-Skill/.cursor/skills/git-init/scripts/emit-commit-message.ps1
T
2026-08-20 23:42:02 +08:00

25 lines
661 B
PowerShell

# Agent-safe: build a commit message with required Co-authored-by trailers.
# Prints the full message only (no key=value). Never prints tokens.
param(
[Parameter(Mandatory = $true)]
[string]$Subject
)
$ErrorActionPreference = 'Stop'
. (Join-Path $PSScriptRoot 'common.ps1')
$gitProfile = Get-GitSkillsProfile
if ($null -eq $gitProfile) {
Write-Error 'profile_missing'
exit 1
}
$msg = Format-CommitMessageWithTrailers -Subject $Subject -GitProfile $gitProfile
# Use LF so Git trailers parse consistently on Windows.
$msg = $msg -replace "`r`n", "`n"
[Console]::Out.Write($msg)
if (-not $msg.EndsWith("`n")) {
[Console]::Out.Write("`n")
}