Skip to content

Commit f5cf210

Browse files
Refactor Update-MDSection to improve error handling; replace warnings with exceptions for missing markers. Update AGENTS.md references to point to canonical guidance in PSModule/docs.
1 parent d6cda49 commit f5cf210

3 files changed

Lines changed: 8 additions & 25 deletions

File tree

.github/actions/update-index/src/Helper.psm1

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -98,35 +98,18 @@ function Update-MDSection {
9898
$startSegment = "<!-- $Name`_START -->"
9999
$endSegment = "<!-- $Name`_END -->"
100100

101-
function Write-UpdateWarning {
102-
param([string] $Message)
103-
104-
Write-Warning $Message
105-
if ($env:GITHUB_ACTIONS -eq 'true') {
106-
Write-Output "::warning::$Message"
107-
}
108-
}
109-
110-
if (-not (Test-Path -Path $Path)) {
111-
Write-UpdateWarning "[$Name] Skipping update because target file was not found: $Path"
112-
return
113-
}
114-
115101
$currentContent = Get-Content -Path $Path
116102
$startIndex = $currentContent.IndexOf($startSegment)
117103
$endIndex = $currentContent.IndexOf($endSegment)
118104

119105
if ($startIndex -lt 0) {
120-
Write-UpdateWarning "[$Name] Skipping update because the start marker was not found in: $Path"
121-
return
106+
throw "[$Name] The start comment segment was not found in the file."
122107
}
123108
if ($endIndex -lt 0) {
124-
Write-UpdateWarning "[$Name] Skipping update because the end marker was not found in: $Path"
125-
return
109+
throw "[$Name] The end comment segment was not found in the file."
126110
}
127111
if ($endIndex -lt $startIndex) {
128-
Write-UpdateWarning "[$Name] Skipping update because marker order is invalid in: $Path"
129-
return
112+
throw "[$Name] The end comment segment was found before the start comment segment."
130113
}
131114

132115
$updatedContent = $currentContent[0..$startIndex] + $Content + $currentContent[($endIndex)..($currentContent.Length - 1)]
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Import-Module -Name (Join-Path $PSScriptRoot 'Helper.psm1')
22

33
Show-RepoList
4-
Update-ActionList
5-
Update-FunctionAppList
4+
# Update-ActionList
5+
# Update-FunctionAppList
66
Update-ModuleList

src/docs/Modules/Repository-Defaults.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Module repositories use the PSModule framework layout:
6868
| `SECURITY.md` | Security support policy and private vulnerability reporting instructions. |
6969
| `SUPPORT.md` | Support expectations and where users ask for help. |
7070
| `CODE_OF_CONDUCT.md` | Community conduct expectations. |
71-
| `AGENTS.md` | Agent onboarding entry point. Points agents to the PSModule and MSX documentation for the why, how, and what. |
71+
| `AGENTS.md` | Agent onboarding entry point. Points agents to the canonical guidance in `PSModule/docs`. |
7272
| `CLAUDE.md` | Claude Code entry point. Imports `AGENTS.md` so Claude reads the same instructions. |
7373
| `.github/copilot-instructions.md` | VS Code and GitHub Copilot repository instructions. Points to the same documentation. |
7474
| `.github/PSModule.yml` | Module workflow configuration overrides. |
@@ -111,7 +111,7 @@ Required baseline files for module repositories:
111111
| `SECURITY.md` | Private vulnerability reporting and latest-version support policy. |
112112
| `SUPPORT.md` | Support channel and issue-routing expectations. |
113113
| `CODE_OF_CONDUCT.md` | Community participation rules. |
114-
| `AGENTS.md` | Cross-tool agent instructions pointing to the PSModule and MSX documentation. |
114+
| `AGENTS.md` | Cross-tool agent instructions pointing to the canonical guidance in `PSModule/docs`. |
115115
| `CLAUDE.md` | Claude Code entry point that imports `AGENTS.md`. |
116116
| `.github/copilot-instructions.md` | VS Code and GitHub Copilot repository instructions pointing to the documentation. |
117117
| `.github/dependabot.yml` | Supply-chain maintenance for GitHub Actions and PowerShell dependencies. |
@@ -132,7 +132,7 @@ Each repository must stand on its own. It carries its own copy of every file abo
132132

133133
Every repository must be usable by an agent that has never seen it before, without special configuration. Each repository carries its own agent entry points that point to the authoritative documentation instead of restating it:
134134

135-
- `AGENTS.md`: the cross-tool entry point, read by the GitHub Copilot coding agent, VS Code, and other AGENTS.md-aware tools. It names what the repository is in a line or two and points to the PSModule documentation (`https://psmodule.io`, source in [`PSModule/docs`](https://github.com/PSModule/docs)) for the module's why/how/what, and to the MSX documentation (`https://msxorg.github.io/docs`, source in [`MSXOrg/docs`](https://github.com/MSXOrg/docs)) for organization-level principles and ways of working.
135+
- `AGENTS.md`: the cross-tool entry point, read by the GitHub Copilot coding agent, VS Code, and other AGENTS.md-aware tools. It names what the repository is in a line or two and points to the canonical agent guidance in [`PSModule/docs`](https://github.com/PSModule/docs).
136136
- `CLAUDE.md`: a thin file that imports `AGENTS.md` with `@AGENTS.md` so Claude Code reads the same instructions. Claude-specific notes, if any, go below the import.
137137
- `.github/copilot-instructions.md`: repository instructions for VS Code and GitHub Copilot that point to the same documentation.
138138

0 commit comments

Comments
 (0)