Skip to content

Commit 4af729a

Browse files
committed
feat(#146): enhance Nova version bump behavior with major-zero advisory
- Implement tests for major-zero advisory messages during version bumps - Update CHANGELOG.md to reflect new warning behavior for stable 0.y.z bumps - Modify CLI output to include guidance on setting 1.0.0 once stable
1 parent 1b216b4 commit 4af729a

15 files changed

Lines changed: 535 additions & 189 deletions

.github/prompts/markdown.promt.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Markdown Wrapper Enforcer (Strict)
2+
3+
## Purpose
4+
5+
Force ALL output to be wrapped in a Markdown code block using this exact format:
6+
7+
~~~markdown
8+
<content>
9+
~~~
10+
11+
## Rules (strict)
12+
13+
1. The response MUST start with exactly:
14+
15+
~~~markdown
16+
17+
2. The response MUST end with exactly:
18+
~~~
19+
20+
3. There MUST be no text before or after the wrapper.
21+
22+
4. The entire response MUST be inside the wrapper.
23+
24+
5. If the format cannot be followed, DO NOT answer.
25+
26+
Inner content rules
27+
28+
- Inside the outer ~~~markdown block:
29+
- Use triple backticks (```) for code examples.
30+
- Always include language hints when relevant.
31+
32+
33+
34+
Example (correct nesting)
35+
36+
## Example Section
37+
38+
Run the build:
39+
40+
```zsh
41+
% nova build
42+
```
43+
44+
Or in PowerShell:
45+
46+
```powershell
47+
PS> Invoke-NovaBuild
48+
```
49+
50+
Self-check
51+
52+
Before returning:
53+
54+
-Starts with ~~~markdown?
55+
-Ends with ~~~?
56+
-Code blocks use triple backticks?
57+
58+
If any check fails → regenerate.
59+
60+
Expected behavior
61+
62+
- Safe nested Markdown (no fence collisions)
63+
- Copy/paste ready
64+
- Consistent formatting across all generated content
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
markdown
2+
3+
# NovaModuleTools PR Description Generator
4+
5+
## Purpose
6+
7+
Generate a complete, high-quality pull request description for NovaModuleTools based on a change summary, commits, or
8+
diff.
9+
10+
The output MUST follow the NovaModuleTools PR template exactly and be concise, precise, and reviewer-focused.
11+
12+
---
13+
14+
## Inputs
15+
16+
- Change description, commit messages, or diff (required)
17+
- Optional: issue number, workflow touched, commands affected
18+
19+
---
20+
21+
## Instructions
22+
23+
Analyze the provided input and:
24+
25+
1. Infer the intent of the change (bugfix, feature, refactor, CI, docs, etc.)
26+
2. Identify impacted areas (CLI, PowerShell, CI/CD, packaging, docs, etc.)
27+
3. Detect validation steps performed (or infer what should have been run)
28+
4. Highlight reviewer entry points (key files, workflows, or commands)
29+
5. Identify risks, breaking changes, or follow-ups
30+
31+
Be pragmatic: if information is missing, make reasonable assumptions but call them out briefly.
32+
33+
---
34+
35+
## Output format
36+
37+
You MUST return the PR description using this exact structure:
38+
39+
---
40+
41+
## Summary
42+
43+
- What changed?
44+
- Why was this change needed?
45+
- Link the issue, discussion, or follow-up work (for example `Closes #123`).
46+
47+
---
48+
49+
## Affected area
50+
51+
Select all relevant:
52+
53+
- [ ] `nova` CLI or command routing
54+
- [ ] Public PowerShell cmdlet behavior
55+
- [ ] Scaffolding or `project.json` handling
56+
- [ ] Build, test, analyzer, coverage, or CI helper flow
57+
- [ ] Package, raw upload, or package metadata workflow
58+
- [ ] Publish, release, semantic-release, or GitHub Actions automation
59+
- [ ] Self-update or notification preference behavior
60+
- [ ] Contributor documentation (`README.md`, `CONTRIBUTING.md`, repository workflow docs)
61+
- [ ] End-user docs (`docs/*.html`)
62+
- [ ] Command help (`docs/NovaModuleTools/en-US/*.md`)
63+
- [ ] `src/resources/example/`
64+
- [ ] Dependency or manifest changes (`package.json`, workflow dependencies, release tooling)
65+
- [ ] Security-sensitive change
66+
- [ ] Documentation-only change
67+
- [ ] Other
68+
69+
---
70+
71+
## Review guidance
72+
73+
- Highlight the main code path or workflow reviewers should start with.
74+
- Call out the primary files or folders changed (for example `src/public/`, `src/private/cli/`, `scripts/build/ci/`,
75+
`.github/workflows/`, `docs/`, or `src/resources/example/`).
76+
- Call out any trade-offs, follow-up work, or known limitations.
77+
78+
---
79+
80+
## Validation
81+
82+
Mark relevant checks:
83+
84+
- [ ] `Invoke-NovaBuild`
85+
- [ ] `Test-NovaBuild`
86+
- [ ] `./scripts/build/Invoke-ScriptAnalyzerCI.ps1`
87+
- [ ] `./scripts/build/ci/Invoke-NovaModuleToolsCI.ps1`
88+
- [ ] Targeted Nova workflow validated (`% nova build`, `% nova test`, `% nova merge`, `% nova deploy`,
89+
`% nova publish`,
90+
`% nova release`, `% nova update`, `% nova notification`, or `% nova init` as relevant)
91+
- [ ] Docs/example only; executable validation not needed
92+
93+
Validation notes:
94+
95+
```
96+
<Fill with commands, outputs, or justification>
97+
```
98+
99+
---
100+
101+
## Documentation and release follow-up
102+
103+
- [ ] `README.md` reviewed and updated if needed
104+
- [ ] `CONTRIBUTING.md` reviewed and updated if needed
105+
- [ ] `CHANGELOG.md` reviewed and updated if relevant
106+
- [ ] Command help updated if CLI or cmdlets changed
107+
- [ ] End-user docs updated if workflows changed
108+
- [ ] Examples updated if real usage changed
109+
- [ ] No documentation updates needed
110+
111+
---
112+
113+
## Maintainability, compatibility, and risk
114+
115+
- [ ] Code Health / maintainability impact considered
116+
- [ ] No breaking change
117+
- [ ] Breaking change
118+
- [ ] Security-sensitive change
119+
- [ ] CI, workflow, or release-pipeline impact
120+
- [ ] Dependency-review impact
121+
122+
Risk, rollout, or rollback notes:
123+
124+
```
125+
<Describe impact, migration, rollback, or follow-up>
126+
```
127+
128+
---
129+
130+
## Style rules
131+
132+
- Be concise and technical (no fluff)
133+
- Prefer bullet points over paragraphs
134+
- Be explicit about workflows (especially CI/CD and release flow)
135+
- Always think like a reviewer: "Where do I start reading?"
136+
- Never leave sections empty — infer or justify
137+
138+
---
139+
140+
## Example invocation
141+
142+
Generate PR description from:
143+
144+
- Commit: "fix: resolve ambiguous -w CLI parameter parsing"
145+
- Files changed: `src/private/cli/Invoke-NovaCli.ps1`
146+
147+
---
148+
149+
## Expected behavior
150+
151+
The output should be ready to paste directly into a GitHub PR without edits.

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Keep stable `Update-NovaModuleVersion` / `% nova bump` releases on the SemVer major-zero development line.
1515
- When the current stable version is `0.y.z` and commit history implies a breaking change, Nova now plans the next
1616
minor version instead of auto-jumping to `1.0.0`.
17-
- The bump result still reports the detected `Major` label and now prints guidance about manually setting `1.0.0`
18-
once the software is stable.
17+
- Stable `0.y.z` bump results now print one warning about manually setting `1.0.0` once the software is stable,
18+
while breaking-change bumps still report the detected `Major` label.
1919
- `-Preview` behavior is unchanged.
2020

2121
### Deprecated

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ These switches keep the behavior explicit and opt-in:
218218
- `Invoke-NovaRelease -ContinuousIntegration` forwards that CI intent through the nested build/bump boundaries and then
219219
restores the built module again after publish
220220

221-
When Nova reports that a breaking-change bump was detected while the current stable version is still `0.y.z`, it also
222-
prints guidance about manually setting `1.0.0` once the software is stable. Preview bumps keep their current behavior
223-
and are not remapped by this rule.
221+
When the current stable version is still `0.y.z`, Nova also prints one warning that major version zero is still the
222+
initial-development line and that `1.0.0` must be set manually once the software is stable. Preview bumps keep their
223+
current behavior and are not remapped by this rule.
224224

225225
Useful local helper:
226226

docs/NovaModuleTools/en-US/Update-NovaModuleVersion.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,16 @@ Re-imports the built `dist/<ProjectName>/<ProjectName>.psd1` first and then runs
173173
PS> Update-NovaModuleVersion -WhatIf
174174
175175
What if: Performing the operation "Update module version using Major release label" on target "project.json".
176-
WARNING: Major version zero (0.y.z) is for initial development, so Nova keeps breaking-change bumps on the 0.y.z line and plans the next minor version instead of 1.0.0. Set 1.0.0 manually once the software is stable; after that, automatic major-version bumps work normally.
176+
WARNING: Major version zero (0.y.z) is for initial development, so Nova keeps stable bumps on the 0.y.z line and plans breaking-change bumps as the next minor version instead of 1.0.0. Set 1.0.0 manually once the software is stable; after that, automatic major-version bumps work normally.
177177
178178
PreviousVersion: 0.1.0
179179
NewVersion: 0.2.0
180180
Label: Major
181181
CommitCount: 34
182182
```
183183

184-
Shows how breaking-change commits stay on the `0.y.z` initial-development line for stable bumps, while still warning
185-
that `1.0.0` should be set manually when the API becomes stable.
184+
Shows how stable `0.y.z` bumps still warn that `1.0.0` must be set manually when the API becomes stable, while
185+
breaking-change commits on that line continue to plan the next minor version instead of jumping straight to `1.0.0`.
186186

187187
## PARAMETERS
188188

docs/versioning-and-updates.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,12 @@ <h3>How Nova chooses the bump label</h3>
166166
<li><strong>Patch</strong> for <code>fix:</code> commits and all other cases</li>
167167
</ul>
168168
<p>While your project is still on a stable <code>0.y.z</code> version, Nova treats SemVer major zero as
169-
the initial-development phase. A breaking-change bump still reports the detected
170-
<strong>Major</strong> label, but the planned stable version stays on the <code>0.y.z</code> line by
171-
advancing to the next minor version instead of jumping to <code>1.0.0</code>. Nova also prints a
172-
reminder to set <code>1.0.0</code> manually once the API is stable. Preview mode stays unchanged.
169+
the initial-development phase. Stable bumps stay on the <code>0.y.z</code> line, and a
170+
breaking-change
171+
bump still reports the detected <strong>Major</strong> label while advancing to the next minor
172+
version
173+
instead of jumping to <code>1.0.0</code>. Nova prints one warning that you should set
174+
<code>1.0.0</code> manually once the API is stable. Preview mode stays unchanged.
173175
</p>
174176
<pre><code>0.0.1 + Patch -> 0.0.2
175177
0.1.0 + Minor -> 0.2.0

src/private/cli/FormatNovaCliCommandResult.ps1

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,7 @@ function Format-NovaCliVersionUpdateResult {
4747
'Version plan:'
4848
}
4949

50-
$summary = "$summaryPrefix $( $Result.PreviousVersion ) -> $( $Result.NewVersion ) | Label: $( $Result.Label ) | Commits: $( $Result.CommitCount )"
51-
$advisoryMessage = Get-NovaCliVersionUpdateAdvisoryMessage -Result $Result
52-
if ( [string]::IsNullOrWhiteSpace($advisoryMessage)) {
53-
return $summary
54-
}
55-
56-
return @(
57-
$summary
58-
$advisoryMessage
59-
) -join [Environment]::NewLine
60-
}
61-
62-
function Get-NovaCliVersionUpdateAdvisoryMessage {
63-
[CmdletBinding()]
64-
param(
65-
[Parameter(Mandatory)][object]$Result
66-
)
67-
68-
if ($Result.PSObject.Properties.Name -notcontains 'AdvisoryMessage') {
69-
return $null
70-
}
71-
72-
return $Result.AdvisoryMessage
50+
return "$summaryPrefix $( $Result.PreviousVersion ) -> $( $Result.NewVersion ) | Label: $( $Result.Label ) | Commits: $( $Result.CommitCount )"
7351
}
7452

7553
function Format-NovaCliCommandResult {

src/private/cli/InvokeNovaCliCommandRoute.ps1

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,34 +45,55 @@ function Invoke-NovaCliBumpCommand {
4545
[Parameter(Mandatory)][pscustomobject]$InvocationContext
4646
)
4747

48+
$commandOutput = @(Invoke-NovaCliParsedCommand -InvocationContext $InvocationContext -ParserCommand 'ConvertFrom-NovaBumpCliArgument' -ActionCommand 'Update-NovaModuleVersion' 3>&1)
49+
$capturedOutput = Read-NovaCliCapturedOutput -OutputRecords $commandOutput
50+
Write-NovaCliCapturedWarning -WarningMessages $capturedOutput.WarningMessages
51+
return $capturedOutput.Result
52+
}
53+
54+
function Read-NovaCliCapturedOutput {
55+
[CmdletBinding()]
56+
param(
57+
[object[]]$OutputRecords = @()
58+
)
59+
4860
$warningMessages = @()
49-
$result = Invoke-NovaCliParsedCommand -InvocationContext $InvocationContext -ParserCommand 'ConvertFrom-NovaBumpCliArgument' -ActionCommand 'Update-NovaModuleVersion' -WarningAction SilentlyContinue -WarningVariable warningMessages
50-
Write-NovaCliCapturedWarning -WarningMessages $warningMessages -SkippedMessage (Get-NovaCliVersionUpdateAdvisoryMessage -Result $result)
51-
return $result
61+
$result = $null
62+
foreach ($outputRecord in @($OutputRecords)) {
63+
if ($outputRecord -is [System.Management.Automation.WarningRecord]) {
64+
$warningMessages += $outputRecord
65+
continue
66+
}
67+
68+
$result = $outputRecord
69+
}
70+
71+
return [pscustomobject]@{
72+
Result = $result
73+
WarningMessages = @($warningMessages)
74+
}
5275
}
5376

5477
function Write-NovaCliCapturedWarning {
5578
[CmdletBinding()]
5679
param(
57-
[object[]]$WarningMessages = @(),
58-
[string]$SkippedMessage
80+
[object[]]$WarningMessages = @()
5981
)
6082

61-
foreach ($message in (Get-NovaCliReplayWarningMessage -WarningMessages $WarningMessages -SkippedMessage $SkippedMessage)) {
83+
foreach ($message in (Get-NovaCliReplayWarningMessage -WarningMessages $WarningMessages)) {
6284
Write-Warning $message
6385
}
6486
}
6587

6688
function Get-NovaCliReplayWarningMessage {
6789
[CmdletBinding()]
6890
param(
69-
[object[]]$WarningMessages = @(),
70-
[string]$SkippedMessage
91+
[object[]]$WarningMessages = @()
7192
)
7293

7394
$messages = foreach ($warningMessage in @($WarningMessages)) {
7495
$text = ConvertTo-NovaCliWarningMessageText -WarningMessage $warningMessage
75-
if ([string]::IsNullOrWhiteSpace($text) -or $text -eq $SkippedMessage) {
96+
if ( [string]::IsNullOrWhiteSpace($text)) {
7697
continue
7798
}
7899

0 commit comments

Comments
 (0)