Skip to content

Commit fbf2bbe

Browse files
tablackburnclaude
andcommitted
docs: address Copilot review feedback on repository-specific instructions
- Add Sign and Sign.Catalog rows to $PSBPreference sections table - Fix Invoke-Build alias examples to use Import-Module + dot-source pattern (matches README.md and tests/TestModule/.build.ps1) - Replace stale node_modules psake Include with -FromModule pattern from README - Add four signing task dependency variables to the dependency table - Add four signing tasks (SignModule, BuildCatalog, SignCatalog, Sign) and expand precondition note for Sign.Enabled and Windows-only cmdlet checks Addresses Copilot comments on PR #122. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 88c2c33 commit fbf2bbe

1 file changed

Lines changed: 35 additions & 14 deletions

File tree

instructions/repository-specific.instructions.md

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,16 @@ it, set values *before* loading the task file, or use `Set-Variable -Force`.
6464

6565
Sections:
6666

67-
| Section | Purpose |
68-
| --------- | --------------------------------------------------------------------------------------- |
69-
| `General` | ProjectRoot, SrcRootDir, ModuleName, ModuleVersion, ModuleManifestPath |
70-
| `Build` | OutDir, ModuleOutDir, CompileModule, CompileDirectories, CopyDirectories, Exclude |
71-
| `Test` | Enabled, RootDir, OutputFile/Format, ScriptAnalysis, CodeCoverage, ImportModule, etc. |
72-
| `Help` | UpdatableHelpOutDir, DefaultLocale, ConvertReadMeToAboutHelp |
73-
| `Docs` | RootDir, Overwrite, AlphabeticParamsOrder, ExcludeDontShow, UseFullTypeName |
74-
| `Publish` | PSRepository, PSRepositoryApiKey, PSRepositoryCredential |
67+
| Section | Purpose |
68+
| -------------- | ------------------------------------------------------------------------------------------------------------------ |
69+
| `General` | ProjectRoot, SrcRootDir, ModuleName, ModuleVersion, ModuleManifestPath |
70+
| `Build` | OutDir, ModuleOutDir, CompileModule, CompileDirectories, CopyDirectories, Exclude |
71+
| `Test` | Enabled, RootDir, OutputFile/Format, ScriptAnalysis, CodeCoverage, ImportModule, etc. |
72+
| `Help` | UpdatableHelpOutDir, DefaultLocale, ConvertReadMeToAboutHelp |
73+
| `Docs` | RootDir, Overwrite, AlphabeticParamsOrder, ExcludeDontShow, UseFullTypeName |
74+
| `Publish` | PSRepository, PSRepositoryApiKey, PSRepositoryCredential |
75+
| `Sign` | Enabled, CertificateSource, CertStoreLocation, Thumbprint, EnvVar/PfxFile sources, TimestampServer, HashAlgorithm, FilesToSign, Catalog |
76+
| `Sign.Catalog` | Enabled, Version, FileName |
7577

7678
### Module compilation modes
7779

@@ -108,6 +110,10 @@ Variables (pattern: `$PSB{TaskName}Dependency`):
108110
| `$PSBGenerateMAMLDependency` | `@('GenerateMarkdown')` |
109111
| `$PSBGenerateUpdatableHelpDependency` | `@('BuildHelp')` |
110112
| `$PSBPublishDependency` | `@('Test')` |
113+
| `$PSBSignModuleDependency` | `@('Build')` |
114+
| `$PSBBuildCatalogDependency` | `@('SignModule')` |
115+
| `$PSBSignCatalogDependency` | `@('BuildCatalog')` |
116+
| `$PSBSignDependency` | `@('SignCatalog')` |
111117

112118
## Public API (Exported Functions)
113119

@@ -138,7 +144,8 @@ the Invoke-Build dot-source pattern:
138144

139145
```powershell
140146
# In a consumer's .build.ps1 for Invoke-Build
141-
. ([IO.Path]::Combine((Split-Path (Get-Module PowerShellBuild).Path), 'PowerShellBuild.IB.Tasks'))
147+
Import-Module PowerShellBuild
148+
. PowerShellBuild.IB.Tasks
142149
```
143150

144151
## Build Workflows
@@ -196,11 +203,21 @@ These are the tasks consumer modules get when they import PowerShellBuild:
196203
| `BuildHelp` | GenerateMarkdown + GenerateMAML |
197204
| `GenerateUpdatableHelp` | CAB file for updatable help |
198205
| `Publish` | Publish to repository |
206+
| `SignModule` | Authenticode-sign module files (`*.psd1`, `*.psm1`, `*.ps1`) |
207+
| `BuildCatalog` | Create Windows catalog (`.cat`) for the built module |
208+
| `SignCatalog` | Authenticode-sign the module catalog file |
209+
| `Sign` | Meta task — runs the full signing chain |
199210

200211
Tasks with prerequisite modules (`Analyze`, `Pester`, `GenerateMarkdown`, `GenerateMAML`,
201212
`GenerateUpdatableHelp`) check that required modules are installed; they skip gracefully
202213
with a warning if the module is missing.
203214

215+
The signing tasks (`SignModule`, `BuildCatalog`, `SignCatalog`) have similar preconditions:
216+
they skip when `$PSBPreference.Sign.Enabled` is `$false` (catalog tasks also require
217+
`$PSBPreference.Sign.Catalog.Enabled = $true`) or when the required Windows-only cmdlets
218+
(`Set-AuthenticodeSignature`, `New-FileCatalog`) are not available — so signing safely
219+
no-ops on non-Windows.
220+
204221
## Dependencies
205222

206223
Defined in `requirements.psd1`, installed via **PSDepend** when `./build.ps1 -Bootstrap` runs:
@@ -271,19 +288,23 @@ don't replace them.
271288
```powershell
272289
# In consumer's psakeFile.ps1
273290
properties {
274-
# Override defaults BEFORE including the tasks
275-
$PSBPreference.Build.CompileModule = $true
276-
$PSBPreference.Test.CodeCoverage.Enabled = $true
291+
# These settings overwrite values supplied from the PowerShellBuild
292+
# module and govern how those tasks are executed
293+
$PSBPreference.Test.ScriptAnalysisEnabled = $false
294+
$PSBPreference.Test.CodeCoverage.Enabled = $true
277295
}
278296
279-
Include "$PSScriptRoot/node_modules/PowerShellBuild/psakeFile.ps1"
297+
task default -depends Build
298+
299+
task Build -FromModule PowerShellBuild -Version '0.1.0'
280300
```
281301

282302
### With Invoke-Build
283303

284304
```powershell
285305
# In consumer's .build.ps1
286-
. ([IO.Path]::Combine((Split-Path (Get-Module PowerShellBuild -ListAvailable).Path), 'PowerShellBuild.IB.Tasks'))
306+
Import-Module PowerShellBuild
307+
. PowerShellBuild.IB.Tasks
287308
288309
# Override configuration after dot-sourcing
289310
$PSBPreference.Build.CompileModule = $false

0 commit comments

Comments
 (0)