|
1 | | -# [PROJECT_NAME] Constitution |
2 | | -<!-- Example: Spec Constitution, TaskFlow Constitution, etc. --> |
| 1 | +<!-- |
| 2 | +Sync Impact Report - Constitution v1.1.0 |
| 3 | +======================================== |
| 4 | +Version Change: 1.0.0 → 1.1.0 (MINOR - expanded guidance) |
| 5 | +Date: 2025-10-01 |
| 6 | +
|
| 7 | +Modified Principles: |
| 8 | +- Expanded Principle I (Workflow-First Design) with action script requirements |
| 9 | +- Enhanced Principle III (Platform Independence) with PowerShell 7.4+ requirement |
| 10 | +- Added CI validation workflow requirement to Principle II |
| 11 | +
|
| 12 | +Added Sections: |
| 13 | +- Technical Constraints (PowerShell version, action-based implementation) |
| 14 | +- Workflow Testing Standards (CI vs production workflow distinction) |
| 15 | +
|
| 16 | +Removed Sections: None |
| 17 | +
|
| 18 | +Templates Status: |
| 19 | +✅ plan-template.md - Already aligned with constitution checks |
| 20 | +✅ spec-template.md - No changes needed (no constitution-specific requirements) |
| 21 | +✅ tasks-template.md - No changes needed (general task structure applies) |
| 22 | +
|
| 23 | +Follow-up TODOs: |
| 24 | +- TODO(RATIFICATION_DATE): Determine original constitution adoption date |
| 25 | +
|
| 26 | +Rationale for MINOR bump: |
| 27 | +- Added specific technical requirements (PowerShell 7.4+, action scripts over inline) |
| 28 | +- Expanded workflow-first principle with implementation details |
| 29 | +- Added CI validation workflow as required testing standard |
| 30 | +- Material expansion of existing principles without breaking compatibility |
| 31 | +--> |
| 32 | + |
| 33 | +# Process-PSModule Constitution |
3 | 34 |
|
4 | 35 | ## Core Principles |
5 | 36 |
|
6 | | -### [PRINCIPLE_1_NAME] |
7 | | -<!-- Example: I. Library-First --> |
8 | | -[PRINCIPLE_1_DESCRIPTION] |
9 | | -<!-- Example: Every feature starts as a standalone library; Libraries must be self-contained, independently testable, documented; Clear purpose required - no organizational-only libraries --> |
| 37 | +### I. Workflow-First Design (NON-NEGOTIABLE) |
| 38 | +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: |
| 39 | +- Be composable and callable from other workflows using `uses:` syntax |
| 40 | +- Use clearly defined inputs and outputs with proper documentation |
| 41 | +- Follow the single responsibility principle (one workflow = one concern) |
| 42 | +- Support matrix strategies for parallel execution where appropriate |
| 43 | +- Be independently testable via the CI validation workflow (`.github/workflows/ci.yml`) |
| 44 | +- Delegate logic to reusable GitHub Actions (from github.com/PSModule organization) |
| 45 | +- **Avoid inline PowerShell code** in workflow YAML; use action-based script files instead |
| 46 | +- Reference actions by specific versions or tags for stability |
| 47 | + |
| 48 | +**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. |
| 49 | + |
| 50 | +### II. Test-Driven Development (NON-NEGOTIABLE) |
| 51 | +All code changes MUST follow strict TDD practices using Pester and PSScriptAnalyzer: |
| 52 | +- Tests MUST be written before implementation |
| 53 | +- Tests MUST fail initially (Red phase) |
| 54 | +- Implementation proceeds only after failing tests exist (Green phase) |
| 55 | +- Code MUST be refactored while maintaining passing tests (Refactor phase) |
| 56 | +- PSScriptAnalyzer rules MUST pass for all PowerShell code |
| 57 | +- Manual testing procedures MUST be documented when automated testing is insufficient |
| 58 | +- **Workflow functionality MUST be validated** through CI workflow tests (`.github/workflows/ci.yml`) |
| 59 | +- Consuming module repositories SHOULD use CI workflow for nightly validation |
| 60 | + |
| 61 | +**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. |
| 62 | + |
| 63 | +### III. Platform Independence with Modern PowerShell |
| 64 | +All workflows and features MUST support cross-platform execution (Linux, macOS, Windows) using **PowerShell 7.4 or newer**: |
| 65 | +- Use platform-agnostic PowerShell Core 7.4+ constructs exclusively |
| 66 | +- Implement matrix testing across all supported operating systems |
| 67 | +- Document any platform-specific behaviors or limitations |
| 68 | +- Test failures on any platform MUST block merging |
| 69 | +- Provide skip mechanisms for platform-specific tests when justified |
| 70 | +- **No backward compatibility** required for Windows PowerShell 5.1 or earlier PowerShell Core versions |
10 | 71 |
|
11 | | -### [PRINCIPLE_2_NAME] |
12 | | -<!-- Example: II. CLI Interface --> |
13 | | -[PRINCIPLE_2_DESCRIPTION] |
14 | | -<!-- Example: Every library exposes functionality via CLI; Text in/out protocol: stdin/args → stdout, errors → stderr; Support JSON + human-readable formats --> |
| 72 | +**Rationale**: PowerShell 7.4+ provides consistent cross-platform behavior and modern language features. Focusing on a single modern version reduces complexity and maintenance burden while ensuring maximum compatibility for consuming projects on contemporary platforms. |
15 | 73 |
|
16 | | -### [PRINCIPLE_3_NAME] |
17 | | -<!-- Example: III. Test-First (NON-NEGOTIABLE) --> |
18 | | -[PRINCIPLE_3_DESCRIPTION] |
19 | | -<!-- Example: TDD mandatory: Tests written → User approved → Tests fail → Then implement; Red-Green-Refactor cycle strictly enforced --> |
| 74 | +### IV. Quality Gates and Observability |
| 75 | +Every workflow execution MUST produce verifiable quality metrics: |
| 76 | +- Test results MUST be captured in structured formats (JSON reports) |
| 77 | +- Code coverage MUST be measured and reported |
| 78 | +- Linting results MUST be captured and enforced |
| 79 | +- All quality gates MUST fail the workflow if thresholds are not met |
| 80 | +- Workflow steps MUST produce clear, actionable error messages |
| 81 | +- Debug mode MUST be available for troubleshooting |
20 | 82 |
|
21 | | -### [PRINCIPLE_4_NAME] |
22 | | -<!-- Example: IV. Integration Testing --> |
23 | | -[PRINCIPLE_4_DESCRIPTION] |
24 | | -<!-- Example: Focus areas requiring integration tests: New library contract tests, Contract changes, Inter-service communication, Shared schemas --> |
| 83 | +**Rationale**: Measurable quality gates prevent degradation over time and provide clear feedback. Observability enables rapid debugging and continuous improvement. |
25 | 84 |
|
26 | | -### [PRINCIPLE_5_NAME] |
27 | | -<!-- Example: V. Observability, VI. Versioning & Breaking Changes, VII. Simplicity --> |
28 | | -[PRINCIPLE_5_DESCRIPTION] |
29 | | -<!-- Example: Text I/O ensures debuggability; Structured logging required; Or: MAJOR.MINOR.BUILD format; Or: Start simple, YAGNI principles --> |
| 85 | +### V. Continuous Delivery with Semantic Versioning |
| 86 | +Release management MUST be automated and follow SemVer 2.0.0: |
| 87 | +- Version bumps MUST be determined by PR labels (major, minor, patch) |
| 88 | +- Releases MUST be automated on merge to main branch |
| 89 | +- PowerShell Gallery publishing MUST be automatic for labeled releases |
| 90 | +- GitHub releases MUST be created with complete changelogs |
| 91 | +- Prerelease versioning MUST support incremental or date-based formats |
| 92 | +- Documentation MUST be published to GitHub Pages automatically |
30 | 93 |
|
31 | | -## [SECTION_2_NAME] |
32 | | -<!-- Example: Additional Constraints, Security Requirements, Performance Standards, etc. --> |
| 94 | +**Rationale**: Automated releases reduce human error, ensure consistency, and enable rapid iteration while maintaining clear version semantics. |
33 | 95 |
|
34 | | -[SECTION_2_CONTENT] |
35 | | -<!-- Example: Technology stack requirements, compliance standards, deployment policies, etc. --> |
| 96 | +## Quality Standards |
36 | 97 |
|
37 | | -## [SECTION_3_NAME] |
38 | | -<!-- Example: Development Workflow, Review Process, Quality Gates, etc. --> |
| 98 | +### Technical Constraints |
| 99 | +- **PowerShell Version**: 7.4 or newer (no backward compatibility with 5.1 or older Core versions) |
| 100 | +- **Execution Environment**: GitHub Actions runners (not designed for local development) |
| 101 | +- **Code Organization**: Action-based scripts preferred over inline workflow code |
| 102 | +- **Action References**: Use PSModule organization actions (github.com/PSModule) with version tags |
| 103 | +- **Workflow Structure**: Reusable workflows in `.github/workflows/` using `workflow_call` trigger |
39 | 104 |
|
40 | | -[SECTION_3_CONTENT] |
41 | | -<!-- Example: Code review requirements, testing gates, deployment approval process, etc. --> |
| 105 | +### Code Quality |
| 106 | +- All PowerShell code MUST pass PSScriptAnalyzer with project-defined rules |
| 107 | +- Source code structure MUST follow PSModule framework conventions |
| 108 | +- Code coverage target MUST be configurable per repository (default 0% for flexibility) |
| 109 | +- All workflow YAML MUST be valid and pass linting |
| 110 | +- Action scripts MUST be testable and maintainable |
| 111 | +- Inline code in workflows SHOULD be avoided; extract to action scripts |
| 112 | + |
| 113 | +### Documentation |
| 114 | +- README MUST provide clear setup instructions and workflow usage examples |
| 115 | +- All workflows MUST include descriptive comments explaining inputs, outputs, and purpose |
| 116 | +- Changes MUST update relevant documentation in the same PR |
| 117 | +- GitHub Pages documentation MUST be generated automatically using Material for MkDocs |
| 118 | + |
| 119 | +### Testing |
| 120 | +- Source code tests MUST validate framework compliance |
| 121 | +- Module tests MUST validate built module integrity |
| 122 | +- Local module tests (Pester) MUST validate functional behavior |
| 123 | +- BeforeAll/AfterAll setup and teardown scripts MUST be supported for test environments |
| 124 | +- Test matrices MUST be configurable via repository settings |
| 125 | +- **CI validation workflow** (`.github/workflows/ci.yml`) MUST be maintained for integration testing |
| 126 | +- **Production workflow** (`.github/workflows/workflow.yml`) is the primary consumer-facing workflow |
| 127 | +- Consuming repositories SHOULD use CI workflow for nightly regression testing |
| 128 | + |
| 129 | +## Development Workflow |
| 130 | + |
| 131 | +### Branching and Pull Requests |
| 132 | +- Follow GitHub Flow: feature branches → PR → main |
| 133 | +- PR MUST be opened for all changes |
| 134 | +- CI workflows MUST execute on PR synchronize, open, reopen, label events |
| 135 | +- PR labels determine release behavior (major, minor, patch, NoRelease) |
| 136 | + |
| 137 | +### Workflow Execution Order |
| 138 | +The standard execution order for Process-PSModule workflows MUST be: |
| 139 | +1. **Get-Settings** - Reads configuration and prepares test matrices |
| 140 | +2. **Build-Module** - Compiles source into module |
| 141 | +3. **Test-SourceCode** - Parallel matrix testing of source code standards |
| 142 | +4. **Lint-SourceCode** - Parallel matrix linting of source code |
| 143 | +5. **Test-Module** - Framework validation and linting of built module |
| 144 | +6. **Test-ModuleLocal** - Runs Pester tests with BeforeAll/AfterAll support |
| 145 | +7. **Get-TestResults** - Aggregates and validates test results |
| 146 | +8. **Get-CodeCoverage** - Validates coverage thresholds |
| 147 | +9. **Build-Docs** and **Build-Site** - Generates documentation |
| 148 | +10. **Publish-Module** and **Publish-Site** - Automated publishing on release |
| 149 | + |
| 150 | +**Workflow Types**: |
| 151 | +- **Production Workflow** (`.github/workflows/workflow.yml`) - Main workflow for consuming repositories |
| 152 | +- **CI Validation Workflow** (`.github/workflows/ci.yml`) - Integration tests for framework development |
| 153 | +- Consuming repositories use production workflow for releases, CI workflow for nightly validation |
| 154 | + |
| 155 | +### Configuration |
| 156 | +- Settings MUST be stored in `.github/PSModule.yml` (or JSON/PSD1 format) |
| 157 | +- Skip flags MUST be available for all major workflow steps |
| 158 | +- OS-specific skip flags MUST be supported (Linux, macOS, Windows) |
| 159 | +- Settings MUST support test configuration, build options, and publish behavior |
42 | 160 |
|
43 | 161 | ## Governance |
44 | | -<!-- Example: Constitution supersedes all other practices; Amendments require documentation, approval, migration plan --> |
45 | 162 |
|
46 | | -[GOVERNANCE_RULES] |
47 | | -<!-- Example: All PRs/reviews must verify compliance; Complexity must be justified; Use [GUIDANCE_FILE] for runtime development guidance --> |
| 163 | +### Constitution Authority |
| 164 | +This constitution supersedes all other development practices. When conflicts arise between this document and other guidance, the constitution takes precedence. |
| 165 | + |
| 166 | +### Amendments |
| 167 | +Changes to this constitution require: |
| 168 | +1. Documentation of the proposed change with clear rationale |
| 169 | +2. Review and approval by project maintainers |
| 170 | +3. Migration plan for existing code/workflows if applicable |
| 171 | +4. Version bump according to impact: |
| 172 | + - MAJOR: Backward incompatible principle removals or redefinitions |
| 173 | + - MINOR: New principles or materially expanded guidance |
| 174 | + - PATCH: Clarifications, wording fixes, non-semantic refinements |
| 175 | + |
| 176 | +### Compliance |
| 177 | +- All PRs MUST be validated against constitutional principles |
| 178 | +- Workflow design MUST align with Workflow-First Design principle |
| 179 | +- Test-First principle compliance is NON-NEGOTIABLE and enforced by review |
| 180 | +- Platform Independence MUST be verified through matrix testing results |
| 181 | +- Quality Gates MUST be enforced by workflow automation |
| 182 | +- PowerShell 7.4+ compatibility MUST be verified |
| 183 | +- Action-based implementation preferred over inline workflow code |
| 184 | +- CI validation workflow MUST pass before merging changes to core workflows |
| 185 | + |
| 186 | +### Runtime Development Guidance |
| 187 | +For agent-specific runtime development guidance, agents should reference: |
| 188 | +- GitHub Copilot: `.github/copilot-instructions.md` (if exists) |
| 189 | +- Other agents: Check for `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, or `QWEN.md` |
48 | 190 |
|
49 | | -**Version**: [CONSTITUTION_VERSION] | **Ratified**: [RATIFICATION_DATE] | **Last Amended**: [LAST_AMENDED_DATE] |
50 | | -<!-- Example: Version: 2.1.1 | Ratified: 2025-06-13 | Last Amended: 2025-07-16 --> |
| 191 | +**Version**: 1.1.0 | **Ratified**: TODO(RATIFICATION_DATE) | **Last Amended**: 2025-10-01 |
0 commit comments