Skip to content

Commit 71d19b6

Browse files
fix linting
1 parent a8791ef commit 71d19b6

File tree

1 file changed

+40
-11
lines changed

1 file changed

+40
-11
lines changed

.specify/memory/constitution.md

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
**Process-PSModule** is a **reusable workflow product** that provides an **opinionated flow and structure** for building PowerShell modules using GitHub Actions. It is NOT a library or toolkit; it is a complete CI/CD workflow framework designed to be consumed by PowerShell module repositories.
66

77
### Product Characteristics
8+
89
- **Opinionated Architecture**: Defines a specific workflow execution order and module structure
910
- **Reusable Workflows**: Consuming repositories call Process-PSModule workflows via `uses:` syntax
1011
- **Configurable via Settings**: Behavior customized through `.github/PSModule.yml` (or JSON/PSD1) in consuming repos
1112
- **Structure Requirements**: Consuming repos MUST follow documented structure in GitHub Actions README files
1213
- **Not for Local Development**: Designed exclusively for GitHub Actions execution environment
1314

1415
### Consuming Repository Requirements
16+
1517
Repositories that consume Process-PSModule workflows MUST:
1618
- Follow the module source structure documented in framework actions (see Required Module Structure below)
1719
- Provide configuration file (`.github/PSModule.yml`) with appropriate settings
@@ -26,7 +28,7 @@ Repositories that consume Process-PSModule workflows MUST:
2628

2729
#### Complete Repository Structure
2830

29-
```
31+
```plaintext
3032
<ModuleName>/ # Repository root
3133
├── .github/ # GitHub Actions configuration
3234
│ ├── linters/ # Linter configuration files
@@ -99,16 +101,19 @@ Repositories that consume Process-PSModule workflows MUST:
99101
The `src/` folder contains the module source code that Build-PSModule compiles into a production-ready module:
100102

101103
**Required Files/Folders**:
104+
102105
- At least one `.ps1` file in `functions/public/` to export functionality
103106
- `tests/` folder at repository root with at least one Pester test file
104107

105108
**Optional Configuration Files**:
109+
106110
- `manifest.psd1` - PowerShell module manifest (auto-generated if missing with GitHub metadata)
107111
- `header.ps1` - Code executed at module load start (before any other code)
108112
- `finally.ps1` - Code executed at module load end (after all other code)
109113
- `README.md` - Documentation pointer (typically references Build-PSModule for structure)
110114

111115
**Source Folders** (all optional, include only what your module needs):
116+
112117
- `assemblies/` - .NET assemblies (`.dll`) loaded into module session
113118
- `classes/private/` - Private PowerShell classes (not exported)
114119
- `classes/public/` - Public PowerShell classes (exported via TypeAccelerators)
@@ -126,6 +131,7 @@ The `src/` folder contains the module source code that Build-PSModule compiles i
126131
- `variables/public/` - Public variables (exported to module consumers)
127132

128133
**Build Processing**:
134+
129135
- Build-PSModule compiles `src/` into a single root module file (`<ModuleName>.psm1`)
130136
- Source folders are removed from output after processing (only compiled module remains)
131137
- Files processed in alphabetical order within each folder
@@ -134,26 +140,30 @@ The `src/` folder contains the module source code that Build-PSModule compiles i
134140
#### Repository Configuration Details
135141

136142
**GitHub Actions Configuration** (`.github/` folder):
143+
137144
- `PSModule.yml` (or `.json`/`.psd1`) - **REQUIRED** configuration file controlling Process-PSModule behavior
138145
- `workflows/Process-PSModule.yml` - **REQUIRED** workflow file calling reusable Process-PSModule workflow
139146
- `mkdocs.yml` - Material for MkDocs configuration for GitHub Pages documentation
140147
- `linters/` - Linter configuration files (optional, uses framework defaults if missing)
141148
- Other workflows (Linter, Nightly-Run) are optional supplementary workflows
142149

143150
**Documentation Assets**:
151+
144152
- `LICENSE` - Referenced in module manifest `LicenseUri` property
145153
- `icon/icon.png` - Referenced in module manifest `IconUri` property (public URL)
146154
- `README.md` - Project documentation, referenced in GitHub repository metadata
147155
- `examples/` - Usage examples for module consumers
148156

149157
**Testing Requirements**:
158+
150159
- `tests/` folder at repository root (NOT inside `src/`)
151160
- Pester test files (`.Tests.ps1`) for module validation
152161
- Optional `BeforeAll.ps1` and `AfterAll.ps1` for test environment setup/teardown
153162
- Tests executed by Test-ModuleLocal workflow across all platforms
154163
- See "Test-ModuleLocal workflow" section for matrix testing details
155164

156165
**Key Points**:
166+
157167
- **Private vs Public**: `private/` folders contain internal implementations; `public/` folders contain exported elements
158168
- **Optional Components**: Not all folders are required; include only what your module needs
159169
- **Function Organization**: Functions can be organized in subdirectories with optional category documentation
@@ -162,6 +172,7 @@ The `src/` folder contains the module source code that Build-PSModule compiles i
162172
- **Template Reference**: Use [Template-PSModule](https://github.com/PSModule/Template-PSModule) as starting point
163173

164174
**Documentation References**:
175+
165176
- [Build-PSModule README](https://github.com/PSModule/Build-PSModule) - Complete build process details
166177
- [Template-PSModule](https://github.com/PSModule/Template-PSModule) - Reference implementation
167178
- [Process-PSModule Configuration](#configuration) - Settings file documentation
@@ -186,6 +197,7 @@ jobs:
186197
```
187198
188199
**Configuration Requirements**:
200+
189201
- Configuration file at `.github/PSModule.yml` (YAML, JSON, or PSD1 format supported)
190202
- Reference: [Process-PSModule Configuration Documentation](https://github.com/PSModule/Process-PSModule#configuration)
191203
- Use Template-PSModule as starting point: https://github.com/PSModule/Template-PSModule
@@ -202,12 +214,10 @@ jobs:
202214
- Allows custom pre-build logic (e.g., code generation, asset processing, configuration setup)
203215
- Example: `1-build.ps1` runs before `2-build.ps1` regardless of directory location
204216
- Custom scripts can modify source files before the build process continues
205-
206217
2. **Copy Source Code**
207218
- All files from `src/` folder are copied to the output folder
208219
- Existing root module file (`<ModuleName>.psm1`) is **excluded** (recreated in step 4)
209220
- Creates a clean build environment for compilation
210-
211221
3. **Build Module Manifest** (`<ModuleName>.psd1`)
212222
- Searches for existing `manifest.psd1` or `<ModuleName>.psd1` in source
213223
- If found, uses it as base (preserving specified properties)
@@ -245,7 +255,6 @@ jobs:
245255
- `ExternalModuleDependencies`, `HelpInfoURI`, `DefaultCommandPrefix`
246256
- `ReleaseNotes` (not automated - can be set via PR/release description)
247257
- `Prerelease` (managed by Publish-PSModule during release)
248-
249258
4. **Build Root Module** (`<ModuleName>.psm1`)
250259
- Creates new root module file (ignoring any existing `.psm1` in source)
251260
- **Compilation Order**:
@@ -289,11 +298,9 @@ jobs:
289298
- Entire root module content is formatted using `Invoke-Formatter`
290299
- Uses PSScriptAnalyzer settings from `Build/PSScriptAnalyzer.Tests.psd1`
291300
- Ensures consistent code style and UTF-8 BOM encoding
292-
293301
5. **Update Manifest Aliases**
294302
- Re-analyzes root module to extract actual aliases defined
295303
- Updates `AliasesToExport` in manifest with discovered aliases
296-
297304
6. **Upload Module Artifact**
298305
- Built module is packaged and uploaded as workflow artifact
299306
- Artifact name defaults to `module` (configurable via action input)
@@ -318,6 +325,7 @@ jobs:
318325
## Core Principles
319326

320327
### I. Workflow-First Design (NON-NEGOTIABLE)
328+
321329
Every feature MUST be implemented as a reusable GitHub Actions workflow component. This is NOT a local development framework; it is designed for CI/CD execution. Workflows MUST:
322330
- Be composable and callable from other workflows using `uses:` syntax
323331
- Use clearly defined inputs and outputs with proper documentation
@@ -331,7 +339,9 @@ Every feature MUST be implemented as a reusable GitHub Actions workflow componen
331339
**Rationale**: Reusable workflow architecture enables maintainability, reduces duplication, and allows consuming repositories to leverage Process-PSModule capabilities consistently. Action-based scripts provide better testability, reusability, and version control than inline code.
332340

333341
### II. Test-Driven Development (NON-NEGOTIABLE)
342+
334343
All code changes MUST follow strict TDD practices using Pester and PSScriptAnalyzer:
344+
335345
- Tests MUST be written before implementation
336346
- Tests MUST fail initially (Red phase)
337347
- Implementation proceeds only after failing tests exist (Green phase)
@@ -344,6 +354,7 @@ All code changes MUST follow strict TDD practices using Pester and PSScriptAnaly
344354
**Rationale**: TDD ensures code quality, prevents regressions, and creates living documentation through tests. This is fundamental to project reliability. CI workflow validation ensures the entire framework functions correctly in real-world scenarios.
345355

346356
### III. Platform Independence with Modern PowerShell
357+
347358
**Modules MUST be built to be cross-platform.** All workflows, features, and consuming modules MUST support cross-platform execution (Linux, macOS, Windows) using **PowerShell 7.4 or newer**:
348359
- Use platform-agnostic PowerShell Core 7.4+ constructs exclusively
349360
- **Modules MUST function identically** on Linux, macOS, and Windows
@@ -358,7 +369,9 @@ All code changes MUST follow strict TDD practices using Pester and PSScriptAnaly
358369
**Rationale**: PowerShell 7.4+ provides consistent cross-platform behavior and modern language features. Focusing on a single modern version reduces complexity and maintenance burden. Modules built with Process-PSModule framework must work seamlessly across all platforms, verified through automated matrix testing in Test-ModuleLocal, ensuring maximum compatibility for consuming projects on contemporary platforms.
359370

360371
### IV. Quality Gates and Observability
372+
361373
Every workflow execution MUST produce verifiable quality metrics:
374+
362375
- Test results MUST be captured in structured formats (JSON reports)
363376
- Code coverage MUST be measured and reported
364377
- Linting results MUST be captured and enforced
@@ -369,7 +382,9 @@ Every workflow execution MUST produce verifiable quality metrics:
369382
**Rationale**: Measurable quality gates prevent degradation over time and provide clear feedback. Observability enables rapid debugging and continuous improvement.
370383

371384
### V. Continuous Delivery with Semantic Versioning
385+
372386
Release management MUST be automated and follow SemVer 2.0.0:
387+
373388
- Version bumps MUST be determined by PR labels (major, minor, patch)
374389
- Releases MUST be automated on merge to main branch
375390
- PowerShell Gallery publishing MUST be automatic for labeled releases
@@ -388,6 +403,7 @@ Process-PSModule implements an **automated publishing workflow** triggered by pu
388403
Pull requests MUST use labels to determine release behavior:
389404

390405
#### Version Increment Labels (SemVer)
406+
391407
- **`major`** - Breaking changes, incompatible API changes
392408
- Increments major version: `1.2.3` → `2.0.0`
393409
- Resets minor and patch to zero
@@ -401,6 +417,7 @@ Pull requests MUST use labels to determine release behavior:
401417
- Applied by default when no version label specified (if AutoPatching enabled)
402418

403419
#### Special Release Labels
420+
404421
- **`prerelease`** - Creates prerelease version (unmerged PR publishing)
405422
- Publishes module to PowerShell Gallery with prerelease tag
406423
- Creates GitHub Release marked as prerelease
@@ -419,6 +436,7 @@ Pull requests MUST use labels to determine release behavior:
419436
The Process-PSModule workflow uses **dynamic conditions** to determine job execution:
420437

421438
#### Always Execute (All PR States)
439+
422440
- **Get-Settings** - Configuration loading
423441
- **Build-Module** - Module compilation
424442
- **Build-Docs** - Documentation generation
@@ -433,11 +451,13 @@ The Process-PSModule workflow uses **dynamic conditions** to determine job execu
433451
#### Conditional Execution (Based on PR State and Labels)
434452

435453
**Publish-Site** (GitHub Pages deployment):
454+
436455
- **Executes when**: PR is **merged** to default branch AND tests pass
437456
- **Skipped when**: PR is open/synchronized OR not merged OR scheduled run OR manual trigger
438457
- Condition: `github.event_name == 'pull_request' AND github.event.pull_request.merged == true`
439458

440459
**Publish-Module** (PowerShell Gallery publishing):
460+
441461
- **Executes when**:
442462
- PR is **merged** to default branch AND tests pass (normal release), OR
443463
- PR has **`prerelease` label** AND PR is **not merged** AND tests pass (prerelease)
@@ -474,30 +494,25 @@ The Publish-PSModule action determines the new version using this process:
474494
- Query PowerShell Gallery for latest published version
475495
- Query GitHub Releases for latest release version
476496
- Use the higher of the two as base version
477-
478497
2. **Determine Version Increment**
479498
- Check PR labels for `major`, `minor`, or `patch`
480499
- If no version label and AutoPatching enabled, default to `patch`
481500
- If no version label and AutoPatching disabled, skip publishing
482-
483501
3. **Calculate New Version**
484502
- Apply SemVer increment based on label
485503
- Major: `1.2.3` → `2.0.0`
486504
- Minor: `1.2.3` → `1.3.0`
487505
- Patch: `1.2.3` → `1.2.4`
488-
489506
4. **Add Prerelease Tag** (if `prerelease` label present on unmerged PR)
490507
- Extract branch name, sanitize to alphanumeric only
491508
- Query existing prerelease versions with same branch name
492509
- Increment prerelease counter
493510
- Format: `<version>-<branchname><increment>`
494511
- Example: `1.3.0-featureauth001`, `1.3.0-featureauth002`
495-
496512
5. **Publish to PowerShell Gallery**
497513
- Upload module with calculated version
498514
- Set prerelease flag if prerelease tag present
499515
- Validate publication success
500-
501516
6. **Create GitHub Release**
502517
- Generate release notes from PR description and commits
503518
- Create release with version tag (e.g., `v1.3.0` or `v1.3.0-featureauth001`)
@@ -547,6 +562,7 @@ jobs:
547562
```
548563

549564
**Key Points**:
565+
550566
- **`closed` event** with `github.event.pull_request.merged == true` triggers normal releases
551567
- **`labeled` event** allows immediate prerelease publishing when `prerelease` label added
552568
- **`synchronize` event** with `prerelease` label publishes new prerelease on each push
@@ -566,13 +582,15 @@ jobs:
566582
## Quality Standards
567583

568584
### Technical Constraints
585+
569586
- **PowerShell Version**: 7.4 or newer (no backward compatibility with 5.1 or older Core versions)
570587
- **Execution Environment**: GitHub Actions runners (not designed for local development)
571588
- **Code Organization**: Action-based scripts preferred over inline workflow code
572589
- **Action References**: Use PSModule organization actions (github.com/PSModule) with version tags
573590
- **Workflow Structure**: Reusable workflows in `.github/workflows/` using `workflow_call` trigger
574591

575592
### Code Quality
593+
576594
- All PowerShell code MUST pass PSScriptAnalyzer with project-defined rules
577595
- Source code structure MUST follow PSModule framework conventions
578596
- Code coverage target MUST be configurable per repository (default 0% for flexibility)
@@ -581,12 +599,14 @@ jobs:
581599
- Inline code in workflows SHOULD be avoided; extract to action scripts
582600

583601
### Documentation
602+
584603
- README MUST provide clear setup instructions and workflow usage examples
585604
- All workflows MUST include descriptive comments explaining inputs, outputs, and purpose
586605
- Changes MUST update relevant documentation in the same PR
587606
- GitHub Pages documentation MUST be generated automatically using Material for MkDocs
588607

589608
### Testing
609+
590610
- Source code tests MUST validate framework compliance
591611
- Module tests MUST validate built module integrity
592612
- Local module tests (Pester) MUST validate functional behavior across all platforms
@@ -603,6 +623,7 @@ jobs:
603623
## Development Workflow
604624

605625
### Branching and Pull Requests
626+
606627
- Follow GitHub Flow: feature branches → PR → main
607628
- PR MUST be opened for all changes
608629
- CI workflows MUST execute on PR synchronize, open, reopen, label events
@@ -617,6 +638,7 @@ jobs:
617638
- See "Pull Request Workflow and Publishing Process" section for detailed behavior
618639

619640
### Workflow Execution Order
641+
620642
The standard execution order for Process-PSModule workflows MUST be:
621643
1. **Get-Settings** - Reads configuration and prepares test matrices
622644
2. **Build-Module** - Compiles source into module
@@ -632,11 +654,13 @@ The standard execution order for Process-PSModule workflows MUST be:
632654
10. **Publish-Module** and **Publish-Site** - Automated publishing on release
633655

634656
**Workflow Types**:
657+
635658
- **Production Workflow** (`.github/workflows/workflow.yml`) - Main workflow for consuming repositories
636659
- **CI Validation Workflow** (`.github/workflows/ci.yml`) - Integration tests for framework development
637660
- Consuming repositories use production workflow for releases, CI workflow for nightly validation
638661

639662
### Configuration
663+
640664
- Settings MUST be stored in `.github/PSModule.yml` (or JSON/PSD1 format) in consuming repositories
641665
- Skip flags MUST be available for all major workflow steps
642666
- OS-specific skip flags MUST be supported (Linux, macOS, Windows)
@@ -648,12 +672,15 @@ The standard execution order for Process-PSModule workflows MUST be:
648672
## Governance
649673

650674
### Constitution Authority
675+
651676
This constitution supersedes all other development practices **for Process-PSModule framework development**. When conflicts arise between this document and other guidance, the constitution takes precedence.
652677

653678
**For Consuming Repositories**: This constitution defines how the Process-PSModule framework is built and maintained. Consuming repositories follow the opinionated structure and configuration documented in framework action README files.
654679

655680
### Amendments
681+
656682
Changes to this constitution require:
683+
657684
1. Documentation of the proposed change with clear rationale
658685
2. Review and approval by project maintainers
659686
3. Migration plan for existing code/workflows if applicable
@@ -663,6 +690,7 @@ Changes to this constitution require:
663690
- PATCH: Clarifications, wording fixes, non-semantic refinements
664691

665692
### Compliance
693+
666694
- All PRs MUST be validated against constitutional principles **for framework development**
667695
- Workflow design MUST align with Workflow-First Design principle
668696
- Test-First principle compliance is NON-NEGOTIABLE and enforced by review
@@ -675,6 +703,7 @@ Changes to this constitution require:
675703
- **Consuming repositories** MUST follow the Required Module Structure documented in Product Overview
676704

677705
### Runtime Development Guidance
706+
678707
For agent-specific runtime development guidance **when developing the framework**, agents should reference:
679708
- GitHub Copilot: `.github/copilot-instructions.md` (if exists)
680709
- Other agents: Check for `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, or `QWEN.md`

0 commit comments

Comments
 (0)