|
| 1 | +--- |
| 2 | +name: psmodule-template-reconciliation |
| 3 | +description: Compare or reconcile a PSModule repository with the current Template-PSModule baseline while preserving repository-owned code, tests, settings, and content. Use for one-repository audits and fleet-wide template alignment. |
| 4 | +--- |
| 5 | + |
| 6 | +# Reconcile a PSModule repository with Template-PSModule |
| 7 | + |
| 8 | +Use this skill when checking or updating an established PowerShell module |
| 9 | +repository against the standard files in |
| 10 | +[`PSModule/Template-PSModule`](https://github.com/PSModule/Template-PSModule). |
| 11 | +Use the same procedure for one repository or as the repository-level operation |
| 12 | +inside a fleet campaign. |
| 13 | + |
| 14 | +## Authority and precedence |
| 15 | + |
| 16 | +Apply sources in this order: |
| 17 | + |
| 18 | +1. The [MSX Repository Standard](https://msx.no/docs/Ways-of-Working/Repository-Standard/) |
| 19 | + owns enterprise policy. |
| 20 | +2. The [PSModule Repository Standard](https://psmodule.io/docs/reference/repository-standard/) |
| 21 | + adds or overrides requirements for PowerShell module repositories. |
| 22 | +3. The default branch of `PSModule/Template-PSModule` owns the executable |
| 23 | + implementation of those requirements. |
| 24 | +4. The target repository owns its module code, tests, documentation content, |
| 25 | + settings, secrets, and justified additions. |
| 26 | + |
| 27 | +Resolve and record the template default-branch commit before comparing files. |
| 28 | +Use that one commit throughout the run. Do not embed a snapshot of template |
| 29 | +file contents in this skill. |
| 30 | + |
| 31 | +When a higher-precedence standard and the template disagree, do not propagate |
| 32 | +the discrepancy. Correct the template first, then reconcile consumers against |
| 33 | +the corrected template commit. When prose and template implementation merely |
| 34 | +express the same requirement differently, use the template as the byte-level |
| 35 | +source. |
| 36 | + |
| 37 | +## Modes |
| 38 | + |
| 39 | +- **Audit** reports drift without changing the target. |
| 40 | +- **Reconcile** applies confirmed template-owned changes to one target |
| 41 | + repository. |
| 42 | +- **Maintain the template** changes `Template-PSModule` itself when the |
| 43 | + executable baseline does not satisfy the governing standards. |
| 44 | + |
| 45 | +State the selected mode before editing. A fleet run invokes Audit or Reconcile |
| 46 | +once per repository; it does not combine many repositories into one branch or |
| 47 | +pull request. |
| 48 | + |
| 49 | +## Inventory |
| 50 | + |
| 51 | +Before comparing: |
| 52 | + |
| 53 | +1. Read the target repository's local guidance, README, workflow, settings, |
| 54 | + documentation configuration, tests, and validation commands. |
| 55 | +2. Confirm that the target is a PowerShell module repository. Do not force the |
| 56 | + module template onto framework, documentation, action, archive, or other |
| 57 | + repository types. |
| 58 | +3. Resolve the current default branch and commit of `Template-PSModule`. |
| 59 | +4. Inventory every template path, including hidden files. |
| 60 | +5. Inventory every target path and any explicit local ownership or exception. |
| 61 | +6. Record the Process-PSModule caller version, Pester requirement, and |
| 62 | + documentation configuration. |
| 63 | + |
| 64 | +## Classify before comparing |
| 65 | + |
| 66 | +Classify every template path. Never infer that every template file can safely |
| 67 | +overwrite an established repository. |
| 68 | + |
| 69 | +| Class | Treatment | |
| 70 | +| --- | --- | |
| 71 | +| Template-owned standard | Compare with the template and replace drift unless a documented target exception applies. | |
| 72 | +| Parameterized standard | Compare after applying only the substitutions declared by the template or framework. | |
| 73 | +| Configurable standard | Keep supported repository-specific values; compare the remaining structure and defaults. | |
| 74 | +| Creation scaffold | Use for new repositories. Do not overwrite established module source, tests, examples, or content. | |
| 75 | +| Repository-owned addition | Preserve it unless it violates a governing standard or breaks the framework contract. | |
| 76 | + |
| 77 | +Treat governance files, caller workflows, linter settings, dependency |
| 78 | +configuration, agent entry points, and documentation-site defaults as |
| 79 | +template-owned or parameterized unless the template or PSModule standard says |
| 80 | +otherwise. Treat `src/`, established `tests/`, `examples/`, documentation |
| 81 | +content, and module-specific assets as repository-owned after creation. |
| 82 | + |
| 83 | +Configuration is not automatically consumer-owned. For example, |
| 84 | +`.github/PSModule.yml` may contain valid module-specific overrides while its |
| 85 | +schema and unaffected defaults still come from the template. Compare fields, |
| 86 | +not only whole-file hashes, when the standard permits overrides. |
| 87 | + |
| 88 | +## Zensical contract |
| 89 | + |
| 90 | +For module repositories, `.github/zensical.toml` comes from the matching path |
| 91 | +in `Template-PSModule`. |
| 92 | + |
| 93 | +- Preserve the template's repository placeholders when the framework resolves |
| 94 | + them during site staging. |
| 95 | +- Do not add a `nav` setting. Zensical generates navigation from the staged |
| 96 | + folder structure, places index pages first, and sorts the remaining pages |
| 97 | + alphabetically. |
| 98 | +- Keep the template's theme, palette, typography, icons, plugins, Markdown |
| 99 | + extensions, and supported assets together as one baseline. |
| 100 | +- Do not copy path-specific settings from `MSXOrg/docs` or |
| 101 | + `Process-PSModule/docs` directly into a generated module site. Their shared |
| 102 | + behavior must first be represented in `Template-PSModule` in a form the |
| 103 | + Process-PSModule site staging pipeline supports. |
| 104 | +- Preserve repository-specific documentation content. A deliberate visual or |
| 105 | + functional exception must be documented in the target and reported as an |
| 106 | + accepted difference. |
| 107 | + |
| 108 | +Use |
| 109 | +[`psmodule-zensical-migration`](../psmodule-zensical-migration/SKILL.md) when |
| 110 | +the target still uses MkDocs or requires a documentation layout migration. |
| 111 | + |
| 112 | +## Pester and workflow contracts |
| 113 | + |
| 114 | +Template comparison does not prove that an established test suite is compatible |
| 115 | +with the template's Pester version. If the target does not already meet the |
| 116 | +template's Pester baseline, invoke |
| 117 | +[`psmodule-pester-migration`](../psmodule-pester-migration/SKILL.md) and migrate |
| 118 | +every test set before declaring reconciliation complete. |
| 119 | + |
| 120 | +When the Process-PSModule caller requires a major-version migration, invoke |
| 121 | +[`psmodule-v8-upgrade`](../psmodule-v8-upgrade/SKILL.md). Preserve supported |
| 122 | +`TestData` and repository-owned automation instead of replacing them with |
| 123 | +template examples. |
| 124 | + |
| 125 | +## Reconciliation output |
| 126 | + |
| 127 | +Report each compared path with: |
| 128 | + |
| 129 | +| Field | Meaning | |
| 130 | +| --- | --- | |
| 131 | +| Path | Repository-relative path. | |
| 132 | +| Class | One of the comparison classes above. | |
| 133 | +| Status | Aligned, missing, drifted, extra, accepted difference, or blocked. | |
| 134 | +| Action | None, add, update, preserve, remove, or fix template first. | |
| 135 | +| Evidence | Template commit and governing standard or documented exception. | |
| 136 | + |
| 137 | +Do not count an extra repository-owned file as drift. Do not call a repository |
| 138 | +aligned when a required template-owned file is absent, a Pester migration is |
| 139 | +incomplete, or validation did not execute. |
| 140 | + |
| 141 | +## Fleet operation |
| 142 | + |
| 143 | +Follow the MSX Fleet Orchestration standard: |
| 144 | + |
| 145 | +1. Discover repositories from authoritative organization metadata, such as the |
| 146 | + `Type: Module` custom property. |
| 147 | +2. Use one Task or Bug, branch, draft pull request, and review loop per |
| 148 | + repository. |
| 149 | +3. Put the campaign slug in every delivery issue and pull request title. |
| 150 | +4. Adopt an existing matching pull request instead of opening a duplicate. |
| 151 | +5. Store campaign state on GitHub. Local JSON or dashboards are disposable |
| 152 | + projections, not sources of truth. |
| 153 | +6. Record the template commit in every report and pull request so a later run |
| 154 | + can distinguish new template changes from unfinished work. |
| 155 | + |
| 156 | +## Validation |
| 157 | + |
| 158 | +1. Repeat the comparison against the same recorded template commit. |
| 159 | +2. Confirm no repository-owned content or secrets changed unintentionally. |
| 160 | +3. Run the target's smallest repository-native checks for every changed |
| 161 | + surface. |
| 162 | +4. Run Pester with the declared version when tests changed. |
| 163 | +5. Build the Zensical site when documentation settings or assets changed. |
| 164 | +6. Review the diff for unresolved placeholders, generated output, and unrelated |
| 165 | + changes. |
| 166 | + |
| 167 | +Report blocked checks and their causes. A clean file comparison is not a |
| 168 | +substitute for repository tests, and a green build is not a substitute for |
| 169 | +checking template drift. |
0 commit comments