You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .specify/memory/constitution.md
+40-11Lines changed: 40 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,15 @@
5
5
**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.
6
6
7
7
### Product Characteristics
8
+
8
9
-**Opinionated Architecture**: Defines a specific workflow execution order and module structure
9
10
-**Reusable Workflows**: Consuming repositories call Process-PSModule workflows via `uses:` syntax
10
11
-**Configurable via Settings**: Behavior customized through `.github/PSModule.yml` (or JSON/PSD1) in consuming repos
11
12
-**Structure Requirements**: Consuming repos MUST follow documented structure in GitHub Actions README files
12
13
-**Not for Local Development**: Designed exclusively for GitHub Actions execution environment
13
14
14
15
### Consuming Repository Requirements
16
+
15
17
Repositories that consume Process-PSModule workflows MUST:
16
18
- Follow the module source structure documented in framework actions (see Required Module Structure below)
17
19
- Provide configuration file (`.github/PSModule.yml`) with appropriate settings
@@ -26,7 +28,7 @@ Repositories that consume Process-PSModule workflows MUST:
26
28
27
29
#### Complete Repository Structure
28
30
29
-
```
31
+
```plaintext
30
32
<ModuleName>/ # Repository root
31
33
├── .github/ # GitHub Actions configuration
32
34
│ ├── linters/ # Linter configuration files
@@ -99,16 +101,19 @@ Repositories that consume Process-PSModule workflows MUST:
99
101
The `src/` folder contains the module source code that Build-PSModule compiles into a production-ready module:
100
102
101
103
**Required Files/Folders**:
104
+
102
105
- At least one `.ps1` file in `functions/public/` to export functionality
103
106
-`tests/` folder at repository root with at least one Pester test file
104
107
105
108
**Optional Configuration Files**:
109
+
106
110
-`manifest.psd1` - PowerShell module manifest (auto-generated if missing with GitHub metadata)
107
111
-`header.ps1` - Code executed at module load start (before any other code)
108
112
-`finally.ps1` - Code executed at module load end (after all other code)
109
113
-`README.md` - Documentation pointer (typically references Build-PSModule for structure)
110
114
111
115
**Source Folders** (all optional, include only what your module needs):
116
+
112
117
-`assemblies/` - .NET assemblies (`.dll`) loaded into module session
- `ReleaseNotes`(not automated - can be set via PR/release description)
247
257
- `Prerelease`(managed by Publish-PSModule during release)
248
-
249
258
4. **Build Root Module** (`<ModuleName>.psm1`)
250
259
- Creates new root module file (ignoring any existing `.psm1` in source)
251
260
- **Compilation Order**:
@@ -289,11 +298,9 @@ jobs:
289
298
- Entire root module content is formatted using `Invoke-Formatter`
290
299
- Uses PSScriptAnalyzer settings from `Build/PSScriptAnalyzer.Tests.psd1`
291
300
- Ensures consistent code style and UTF-8 BOM encoding
292
-
293
301
5. **Update Manifest Aliases**
294
302
- Re-analyzes root module to extract actual aliases defined
295
303
- Updates `AliasesToExport` in manifest with discovered aliases
296
-
297
304
6. **Upload Module Artifact**
298
305
- Built module is packaged and uploaded as workflow artifact
299
306
- Artifact name defaults to `module` (configurable via action input)
@@ -318,6 +325,7 @@ jobs:
318
325
## Core Principles
319
326
320
327
### I. Workflow-First Design (NON-NEGOTIABLE)
328
+
321
329
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:
322
330
- Be composable and callable from other workflows using `uses:` syntax
323
331
- 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
331
339
**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.
332
340
333
341
### II. Test-Driven Development (NON-NEGOTIABLE)
342
+
334
343
All code changes MUST follow strict TDD practices using Pester and PSScriptAnalyzer:
344
+
335
345
- Tests MUST be written before implementation
336
346
- Tests MUST fail initially (Red phase)
337
347
- 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
344
354
**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.
345
355
346
356
### III. Platform Independence with Modern PowerShell
357
+
347
358
**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**:
348
359
- Use platform-agnostic PowerShell Core 7.4+ constructs exclusively
349
360
- **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
358
369
**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.
359
370
360
371
### IV. Quality Gates and Observability
372
+
361
373
Every workflow execution MUST produce verifiable quality metrics:
374
+
362
375
- Test results MUST be captured in structured formats (JSON reports)
363
376
- Code coverage MUST be measured and reported
364
377
- Linting results MUST be captured and enforced
@@ -369,7 +382,9 @@ Every workflow execution MUST produce verifiable quality metrics:
369
382
**Rationale**: Measurable quality gates prevent degradation over time and provide clear feedback. Observability enables rapid debugging and continuous improvement.
370
383
371
384
### V. Continuous Delivery with Semantic Versioning
385
+
372
386
Release management MUST be automated and follow SemVer 2.0.0:
387
+
373
388
- Version bumps MUST be determined by PR labels (major, minor, patch)
374
389
- Releases MUST be automated on merge to main branch
375
390
- PowerShell Gallery publishing MUST be automatic for labeled releases
@@ -388,6 +403,7 @@ Process-PSModule implements an **automated publishing workflow** triggered by pu
388
403
Pull requests MUST use labels to determine release behavior:
389
404
390
405
#### Version Increment Labels (SemVer)
406
+
391
407
- **`major`** - Breaking changes, incompatible API changes
392
408
- Increments major version: `1.2.3`→ `2.0.0`
393
409
- Resets minor and patch to zero
@@ -401,6 +417,7 @@ Pull requests MUST use labels to determine release behavior:
401
417
- Applied by default when no version label specified (if AutoPatching enabled)
402
418
403
419
#### Special Release Labels
420
+
404
421
- **`prerelease`** - Creates prerelease version (unmerged PR publishing)
405
422
- Publishes module to PowerShell Gallery with prerelease tag
406
423
- Creates GitHub Release marked as prerelease
@@ -419,6 +436,7 @@ Pull requests MUST use labels to determine release behavior:
419
436
The Process-PSModule workflow uses **dynamic conditions** to determine job execution:
420
437
421
438
#### Always Execute (All PR States)
439
+
422
440
- **Get-Settings** - Configuration loading
423
441
- **Build-Module** - Module compilation
424
442
- **Build-Docs** - Documentation generation
@@ -433,11 +451,13 @@ The Process-PSModule workflow uses **dynamic conditions** to determine job execu
433
451
#### Conditional Execution (Based on PR State and Labels)
434
452
435
453
**Publish-Site** (GitHub Pages deployment):
454
+
436
455
- **Executes when**: PR is **merged** to default branch AND tests pass
437
456
- **Skipped when**: PR is open/synchronized OR not merged OR scheduled run OR manual trigger
438
457
- Condition: `github.event_name == 'pull_request' AND github.event.pull_request.merged == true`
- **`synchronize` event** with `prerelease` label publishes new prerelease on each push
@@ -566,13 +582,15 @@ jobs:
566
582
## Quality Standards
567
583
568
584
### Technical Constraints
585
+
569
586
- **PowerShell Version**: 7.4 or newer (no backward compatibility with 5.1 or older Core versions)
570
587
- **Execution Environment**: GitHub Actions runners (not designed for local development)
571
588
- **Code Organization**: Action-based scripts preferred over inline workflow code
572
589
- **Action References**: Use PSModule organization actions (github.com/PSModule) with version tags
573
590
- **Workflow Structure**: Reusable workflows in `.github/workflows/` using `workflow_call` trigger
574
591
575
592
### Code Quality
593
+
576
594
- All PowerShell code MUST pass PSScriptAnalyzer with project-defined rules
577
595
- Source code structure MUST follow PSModule framework conventions
578
596
- Code coverage target MUST be configurable per repository (default 0% for flexibility)
@@ -581,12 +599,14 @@ jobs:
581
599
- Inline code in workflows SHOULD be avoided; extract to action scripts
582
600
583
601
### Documentation
602
+
584
603
- README MUST provide clear setup instructions and workflow usage examples
585
604
- All workflows MUST include descriptive comments explaining inputs, outputs, and purpose
586
605
- Changes MUST update relevant documentation in the same PR
587
606
- GitHub Pages documentation MUST be generated automatically using Material for MkDocs
588
607
589
608
### Testing
609
+
590
610
- Source code tests MUST validate framework compliance
591
611
- Module tests MUST validate built module integrity
592
612
- Local module tests (Pester) MUST validate functional behavior across all platforms
@@ -603,6 +623,7 @@ jobs:
603
623
## Development Workflow
604
624
605
625
### Branching and Pull Requests
626
+
606
627
- Follow GitHub Flow: feature branches → PR → main
607
628
- PR MUST be opened for all changes
608
629
- CI workflows MUST execute on PR synchronize, open, reopen, label events
@@ -617,6 +638,7 @@ jobs:
617
638
- See "Pull Request Workflow and Publishing Process" section for detailed behavior
618
639
619
640
### Workflow Execution Order
641
+
620
642
The standard execution order for Process-PSModule workflows MUST be:
621
643
1. **Get-Settings** - Reads configuration and prepares test matrices
622
644
2. **Build-Module** - Compiles source into module
@@ -632,11 +654,13 @@ The standard execution order for Process-PSModule workflows MUST be:
632
654
10. **Publish-Module** and **Publish-Site** - Automated publishing on release
633
655
634
656
**Workflow Types**:
657
+
635
658
- **Production Workflow** (`.github/workflows/workflow.yml`) - Main workflow for consuming repositories
636
659
- **CI Validation Workflow** (`.github/workflows/ci.yml`) - Integration tests for framework development
637
660
- Consuming repositories use production workflow for releases, CI workflow for nightly validation
638
661
639
662
### Configuration
663
+
640
664
- Settings MUST be stored in `.github/PSModule.yml` (or JSON/PSD1 format) in consuming repositories
641
665
- Skip flags MUST be available for all major workflow steps
642
666
- OS-specific skip flags MUST be supported (Linux, macOS, Windows)
@@ -648,12 +672,15 @@ The standard execution order for Process-PSModule workflows MUST be:
648
672
## Governance
649
673
650
674
### Constitution Authority
675
+
651
676
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.
652
677
653
678
**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.
654
679
655
680
### Amendments
681
+
656
682
Changes to this constitution require:
683
+
657
684
1. Documentation of the proposed change with clear rationale
658
685
2. Review and approval by project maintainers
659
686
3. Migration plan for existing code/workflows if applicable
@@ -663,6 +690,7 @@ Changes to this constitution require:
0 commit comments