Skip to content

Commit c10fa12

Browse files
committed
feat(#194): enhance agentic guidance and documentation
- Add reviewer agent content to improve review processes - Include implement prompt content for better implementation guidance - Update coding standards to clarify file and function ownership rules
1 parent 5850fe0 commit c10fa12

24 files changed

Lines changed: 150 additions & 25 deletions

.codescene/code-health-rules.json

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,88 @@
6060
],
6161
"rule_sets": [
6262
{
63-
"thresholds": [],
63+
"thresholds": [
64+
{
65+
"name": "constructor_max_arguments",
66+
"value": 5
67+
},
68+
{
69+
"name": "file_lines_of_code_for_alert",
70+
"value": 5000
71+
},
72+
{
73+
"name": "file_lines_of_code_for_critical_alert",
74+
"value": 10000
75+
},
76+
{
77+
"name": "file_lines_of_code_for_warning",
78+
"value": 1000
79+
},
80+
{
81+
"name": "file_mean_cyclomatic_complexity_warning",
82+
"value": 4
83+
},
84+
{
85+
"name": "file_primitive_obsession_percentage_for_warning",
86+
"value": 0.3
87+
},
88+
{
89+
"name": "function_bumpy_road_bumps_for_warning",
90+
"value": 2
91+
},
92+
{
93+
"name": "function_bumpy_road_nesting_level_depth",
94+
"value": 2
95+
},
96+
{
97+
"name": "function_complex_conditional_branches_alert",
98+
"value": 10
99+
},
100+
{
101+
"name": "function_complex_conditional_branches_warning",
102+
"value": 2
103+
},
104+
{
105+
"name": "function_cyclomatic_complexity_alert",
106+
"value": 100
107+
},
108+
{
109+
"name": "function_cyclomatic_complexity_warning",
110+
"value": 9
111+
},
112+
{
113+
"name": "function_embedded_content_lines_of_code_alert",
114+
"value": "-"
115+
},
116+
{
117+
"name": "function_embedded_content_lines_of_code_warning",
118+
"value": "-"
119+
},
120+
{
121+
"name": "function_lines_of_code_alert",
122+
"value": 500
123+
},
124+
{
125+
"name": "function_lines_of_code_warning",
126+
"value": 70
127+
},
128+
{
129+
"name": "function_max_arguments",
130+
"value": 4
131+
},
132+
{
133+
"name": "function_nesting_depth_warning",
134+
"value": 4
135+
},
136+
{
137+
"name": "unit_test_consecutive_asserts_for_large_block",
138+
"value": 4
139+
},
140+
{
141+
"name": "unit_test_suite_number_of_large_assertion_blocks",
142+
"value": 4
143+
}
144+
],
64145
"thresholds_doc": "The thresholds let you redefine the details of the code health issues. For example, specifying what a Complex Method means to you. Be restrictive with overrides.",
65146
"matching_content_path": "**/tests/**",
66147
"matching_content_path_doc": "Specify a glob pattern relative to this repository root.",

.github/agents/powershell-developer.agent.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Implement PowerShell command and helper changes in the NovaModuleTools style.
1515
- Keep public files delegating and internal helpers domain-aligned.
1616
- Preserve Nova's `project.json`-driven build model; do not add hand-written source `.psm1` or module `.psd1` files.
1717
- Read `project.json` `Manifest.PowerShellHostVersion` before implementing PowerShell changes and keep source, tests, and examples compatible with that target.
18+
- Keep one externally called function per file and match the file name to that function. In `src/private/`, additional functions may stay only as same-file support helpers called by that file's entry function.
1819
- Add or update source-mirrored tests and PlatyPS-compatible help docs for the changed behavior.
1920
- Before handoff, review every changed or generated text file and normalize it to exactly one trailing newline with no extra blank lines at the bottom.
2021

@@ -44,6 +45,7 @@ Implement PowerShell command and helper changes in the NovaModuleTools style.
4445

4546
- Production code and tests both reflect the intended behavior.
4647
- Build output still comes from Nova-generated `dist/` files, not hand-authored module files in `src/`.
48+
- Public/private file ownership still follows the one externally called function per file rule.
4749
- Any ScriptAnalyzer findings reported by `run.ps1` or `Invoke-ScriptAnalyzerCI.ps1` are resolved.
4850
- Every changed or generated text file has been checked and ends with exactly one trailing newline and no extra blank lines at the bottom.
4951
- Docs/changelog review is complete.

.github/agents/reviewer.agent.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Review changes for correctness, maintainability, test coverage, workflow safety,
2020
- Check that Nova projects still use generated `dist/` module files instead of hand-written source `.psm1` or module `.psd1` files.
2121
- Check changed PowerShell code, tests, and examples against `project.json` `Manifest.PowerShellHostVersion`; flag PowerShell 7.x-only constructs in projects that target `5.1` unless the change explicitly adds guarded compatibility handling.
2222
- Check that public commands/classes have matching PlatyPS-compatible help and that new source files have source-mirrored tests.
23+
- Flag public files that do not keep exactly one top-level function, and flag private files that group multiple externally called functions instead of limiting extra functions to same-file support helpers. Also flag file/function name mismatches for public commands or externally called private helpers.
2324
- Flag broad catch-all test files when focused source-mirrored tests would make ownership clearer.
2425
- Flag any PSScriptAnalyzer rule excludes or suppressions; the code should be fixed instead.
2526
- Flag unresolved ScriptAnalyzer findings from `run.ps1` or `Invoke-ScriptAnalyzerCI.ps1`; they should be fixed instead of deferred.

.github/copilot-instructions.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ For new or not-yet-scoped work, start with `.github/agents/architect.agent.md` a
2323
## Repository map
2424

2525
- `src/public/` - public PowerShell command surface; one top-level function per file
26-
- `src/private/` - internal helpers grouped by domain (`build/`, `cli/`, `package/`, `quality/`, `release/`, `scaffold/`, `shared/`, `update/`)
26+
- `src/private/` - internal helpers grouped by domain (`build/`, `cli/`, `package/`, `quality/`, `release/`, `scaffold/`, `shared/`, `update/`); keep one externally called helper per file and limit any extra functions to same-file support helpers
2727
- `tests/` - Pester tests and shared test-support scripts
2828
- `scripts/build/` - local analyzer and build helpers
2929
- `scripts/build/ci/` - CI coverage, CodeScene, and artifact helpers
@@ -44,6 +44,7 @@ For new or not-yet-scoped work, start with `.github/agents/architect.agent.md` a
4444
- Do not exclude or suppress PSScriptAnalyzer rules in repository analyzer helpers; fix the code that violates analyzer rules instead.
4545
- Keep `run.ps1` as the local quality loop: run ScriptAnalyzer first, then `Invoke-NovaBuild`, then `Test-NovaBuild`.
4646
- If `run.ps1` or `./scripts/build/Invoke-ScriptAnalyzerCI.ps1` reports ScriptAnalyzer findings, fix them before review, handoff, or commit. Do not treat a failing local quality loop as an acceptable stopping point.
47+
- Keep file/function ownership explicit: `src/public/` files should own exactly one top-level function each, and `src/private/` files should expose at most one externally called function per file. Additional private functions may stay only as support helpers used from the same file, and the file name should match the function that owns the file.
4748
- Review `README.md`, `CONTRIBUTING.md`, `CHANGELOG.md`, and `RELEASE_NOTE.md` after every meaningful change.
4849
- Update tests when behavior changes.
4950
- Prefer existing helpers and support files over ad hoc duplication.

.github/instructions/powershell-coding-standards.instructions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ Use this file when changing `src/public/`, `src/private/`, or PowerShell build/r
1212

1313
- Keep public command files small and delegating.
1414
- Keep exactly one top-level public function per file in `src/public/`.
15+
- Match the file name to that top-level public function name.
1516
- Public mutating commands should support PowerShell `ShouldProcess` semantics.
1617
- Preserve existing naming and command model conventions such as `Invoke-Nova*`, `Get-Nova*`, `Update-Nova*`, and the `nova` CLI routing model.
1718
- Do not create or maintain hand-written module `.psm1` or module `.psd1` files in source. Nova generates the built module root and manifest under `dist/<ProjectName>/` from `project.json` and `src/**/*.ps1`.
1819

1920
## Internal structure rules
2021

2122
- Put internal helpers in the correct domain folder under `src/private/`.
23+
- In `src/private/`, keep at most one externally called function per file and match the file name to that entry function.
24+
- Additional functions in a private file are allowed only as support helpers called from that same file.
25+
- If two private functions are both called from outside their file, split them into separate same-named files.
2226
- Reuse existing adapters and shared helpers before adding new infrastructure calls.
2327
- Keep direct environment access, Git execution, upload requests, and self-update execution in their approved helper locations. `tests/ArchitectureGuardrails.Tests.ps1` is authoritative.
2428
- Prefer explicit workflow-context objects (`[pscustomobject]` / ordered hashtables) for multi-step flows.

.github/prompts/implement-issue.prompt.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ Implement the issue in the NovaModuleTools repository using the repository-local
1919
7. Implement the smallest maintainable fix.
2020
8. Do not add PSScriptAnalyzer excluded rules or suppressions; fix analyzer findings in the code.
2121
9. If `run.ps1` or `Invoke-ScriptAnalyzerCI.ps1` reports ScriptAnalyzer findings, fix them before handoff instead of only reporting the failure.
22-
10. Before handoff, review every changed or generated text file and normalize it to exactly one trailing newline with no extra blank lines at the bottom.
23-
11. Add or update the matching source-mirrored Pester file for every changed `src/**/*.ps1` file; if the behavior is genuinely cross-cutting, document which integration/guardrail test owns it and why a mirrored unit test is not practical.
24-
12. Add or update PlatyPS-compatible help under `docs/<ProjectName>/en-US/` when public commands or public classes change.
25-
13. Review `README.md`, `CONTRIBUTING.md`, `CHANGELOG.md`, `RELEASE_NOTE.md`, help docs, and `docs/*.html` as applicable.
26-
14. If a commit message is requested, derive it from `$GIT_BRANCH_NAME` and the implemented change using the repository's Conventional Commit rules.
27-
15. Run the relevant validation, then summarize what changed, why, and how it was verified.
28-
16. If that summary is returned as Markdown or copy-ready UI output, format it according to the `markdown-authoring` skill (`.github/skills/markdown-authoring/SKILL.md`).
22+
10. Keep file/function ownership explicit: one externally called function per file, with private-file extras limited to same-file support helpers, and keep the file name aligned to the entry function.
23+
11. Before handoff, review every changed or generated text file and normalize it to exactly one trailing newline with no extra blank lines at the bottom.
24+
12. Add or update the matching source-mirrored Pester file for every changed `src/**/*.ps1` file; if the behavior is genuinely cross-cutting, document which integration/guardrail test owns it and why a mirrored unit test is not practical.
25+
13. Add or update PlatyPS-compatible help under `docs/<ProjectName>/en-US/` when public commands or public classes change.
26+
14. Review `README.md`, `CONTRIBUTING.md`, `CHANGELOG.md`, `RELEASE_NOTE.md`, help docs, and `docs/*.html` as applicable.
27+
15. If a commit message is requested, derive it from `$GIT_BRANCH_NAME` and the implemented change using the repository's Conventional Commit rules.
28+
16. Run the relevant validation, then summarize what changed, why, and how it was verified.
29+
17. If that summary is returned as Markdown or copy-ready UI output, format it according to the `markdown-authoring` skill (`.github/skills/markdown-authoring/SKILL.md`).
2930

3031
## Repository-specific reminders
3132

.github/skills/powershell-module-development/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Use this skill when changing public commands, private helpers, CLI routing suppo
2929
- Read `project.json` `Manifest.PowerShellHostVersion` before changing PowerShell code, tests, or examples, and keep new work compatible with that target. A `5.1` project must not receive PowerShell 7.x-only syntax, cmdlets, parameters, or APIs unless the change explicitly adds guarded compatibility handling.
3030
- Do not create or maintain hand-written module `.psm1` or module `.psd1` files in source; Nova generates those files under `dist/<ProjectName>/`.
3131
- Preserve native PowerShell semantics and Nova naming patterns.
32+
- Keep one externally called function per file and match the file name to that function. In `src/private/`, additional functions may stay only as same-file support helpers called by that file's entry function.
3233
- Reuse existing workflow-context helpers and shared adapters.
3334
- Follow the repository's PowerShell style rules: 4-space indentation, same-line opening braces, restrained blank lines, full cmdlet names, and readable operator spacing.
3435
- Keep ScriptAnalyzer strict: do not add excluded rules, suppression attributes, or settings that hide analyzer findings.
@@ -45,6 +46,7 @@ Use this skill when changing public commands, private helpers, CLI routing suppo
4546
- Calling `git`, `Invoke-WebRequest`, `Update-Module`, or `$env:` from the wrong layer
4647
- Replacing explicit warning opt-ins with generic force semantics
4748
- Creating a root module `.psm1` or module manifest `.psd1` by hand instead of letting Nova generate them from `project.json`
49+
- Grouping two externally called private helpers in one file instead of splitting them into separate same-named files
4850
- Ignoring the project's `Manifest.PowerShellHostVersion` target and introducing PowerShell 7.x-only features into a `5.1` project
4951
- Excluding PSScriptAnalyzer rules instead of fixing the code that violates them
5052

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
1515
- The generated architect/design prompt now requires final design packages and issue/work item drafts to be returned as copy-ready Markdown using the project Markdown authoring guidance.
1616
- The generated guidance now explicitly keeps Agentic Copilot projects on the Nova build model, treats `.psm1` / `.psd1` files as generated `dist` output, requires PlatyPS-compatible help for public commands/classes, expects one focused source-mirrored test file for every new or changed `src/**/*.ps1` file, tells agents to honor `project.json` `Manifest.PowerShellHostVersion` when writing PowerShell code and tests, and now asks for a short project name so placeholders such as `Invoke-<ShortName>*` can be replaced in the generated starter files.
1717
- The generated guidance now keeps local `run.ps1` quality loops ordered as ScriptAnalyzer, `Invoke-NovaBuild`, then `Test-NovaBuild`, and tells agents to fix ScriptAnalyzer findings reported by `run.ps1` instead of excluding, suppressing, or handing them off unresolved.
18+
- The generated PowerShell guidance now requires public files to keep one top-level function per file, requires private files to keep at most one externally called function per file, and keeps any extra private functions limited to same-file support helpers whose file names match the owning function.
1819
- The generated PowerShell guidance now requires agents to review every changed or generated text file before handoff and normalize the file ending to exactly one trailing newline with no extra blank lines at the bottom.
1920

2021
### Changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ Packaged resources that ship with the module, including:
506506
- the packaged example project under `src/resources/example/`
507507
- the Agentic Copilot starter package under `src/resources/agentic-copilot/`
508508

509-
The example project is both a shipped resource and a maintained working reference. The Agentic Copilot starter package is generated from Nova's repository-local agentic guidance, including Nova build/test/package expectations, `project.json` `Manifest.PowerShellHostVersion` compatibility guidance, generated `dist` module files, command-help ownership, source-mirrored test guidance, guidance that ScriptAnalyzer findings reported by `run.ps1` must be fixed before handoff, and a strict file-ending rule for changed or generated text files. When the init flow adds that starter package, it also asks for a short project name so scaffolded guidance can replace placeholders such as `Invoke-<ShortName>*`. Run
509+
The example project is both a shipped resource and a maintained working reference. The Agentic Copilot starter package is generated from Nova's repository-local agentic guidance, including Nova build/test/package expectations, `project.json` `Manifest.PowerShellHostVersion` compatibility guidance, generated `dist` module files, command-help ownership, source-mirrored test guidance, guidance that ScriptAnalyzer findings reported by `run.ps1` must be fixed before handoff, explicit public/private PowerShell file ownership rules, and a strict file-ending rule for changed or generated text files. When the init flow adds that starter package, it also asks for a short project name so scaffolded guidance can replace placeholders such as `Invoke-<ShortName>*`. Run
510510
`./scripts/build/Sync-AgenticCopilotScaffold.ps1` after changing `.github/agents/`, `.github/instructions/`,
511511
`.github/skills/`, `.github/prompts/`, or `.github/copilot-instructions.md` so future scaffolds and `dist` stay in sync.
512512

RELEASE_NOTE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This file summarizes public cmdlet, CLI, configuration, and migration changes fo
1212
- Generated architect/design guidance now requires final design packages and issue/work item drafts to be returned as copy-ready Markdown using the project Markdown authoring guidance.
1313
- Generated implementation/test guidance now keeps projects on Nova build/test/package workflows, treats `.psm1` / `.psd1` files as generated output, calls out PlatyPS help plus one focused source-mirrored test file for every new or changed `src/**/*.ps1` file, tells agents to honor `project.json` `Manifest.PowerShellHostVersion` when writing PowerShell code and tests, and now asks for a short project name so placeholders such as `Invoke-<ShortName>*` can be replaced in the generated starter files.
1414
- Generated quality-loop guidance now keeps ScriptAnalyzer first and tells agents to fix ScriptAnalyzer findings reported by `run.ps1` instead of excluding, suppressing, or handing them off unresolved.
15+
- Generated PowerShell guidance now requires public files to keep one top-level function per file, requires private files to keep at most one externally called function per file, and keeps any extra private functions limited to same-file support helpers whose file names match the owning function.
1516
- Generated PowerShell guidance now requires agents to review every changed or generated text file before handoff and normalize the file ending to exactly one trailing newline with no extra blank lines at the bottom.
1617

1718
### Changed

0 commit comments

Comments
 (0)