Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
f26cfae
feat(PowerForge): ✨ add `PowerForge` core library, CLI and services
PrzemyslawKlys Nov 5, 2025
d2bf20b
feat(PowerForge): ✨ add formatting pipeline, preprocessor and format …
PrzemyslawKlys Nov 5, 2025
4c03913
feat(New-ConfigurationBuild): ✨ add `VersionedInstallStrategy` and `V…
PrzemyslawKlys Nov 6, 2025
f3ace02
feat(PowerForge): ✨ add C# cmdlets for project encoding & line ending…
PrzemyslawKlys Nov 6, 2025
229320a
feat(PowerForge): ✨ add encoding & line-ending converters, manifest e…
PrzemyslawKlys Nov 6, 2025
0401fd8
feat(PowerForge): ✨ add C# BuildServices and integrate formatting + v…
PrzemyslawKlys Nov 6, 2025
9b8103e
feat(BuildServices): ✨ refactor and enhance functionality
PrzemyslawKlys Nov 7, 2025
aff3451
feat(Merge-Module): ✨ update BuildServices references and add export …
PrzemyslawKlys Nov 7, 2025
7a7d308
feat(ExportSet, BuildServices, ExportDetector, ManifestEditor): ✨ add…
PrzemyslawKlys Nov 7, 2025
b791830
feat(BuildServices, ManifestWriter): ✨ add SetRequiredModulesFromDict…
PrzemyslawKlys Nov 7, 2025
a54ec99
feat(Docs): ✨ update `New-ConfigurationBuild` documentation and remov…
PrzemyslawKlys Nov 7, 2025
49a3352
feat(BuildServices, ManifestEditor): ✨ add methods for setting delive…
PrzemyslawKlys Nov 7, 2025
1b0c149
ple
PrzemyslawKlys Nov 14, 2025
1d5cdf2
continue
PrzemyslawKlys Nov 14, 2025
1cb1416
feat(BuildServices, ExportDetector, ModuleBuilder): ✨ enhance assembl…
PrzemyslawKlys Dec 25, 2025
cabd983
feat(build): ✨ add `build` command with staging and module options
PrzemyslawKlys Dec 25, 2025
1ad57d5
feat(InvokeModuleBuildCommand): ✨ enhance parameter documentation and…
PrzemyslawKlys Dec 25, 2025
6e235af
feat(PowerShellRunner): ✨ improve argument handling in `AddArg` method
PrzemyslawKlys Dec 25, 2025
1376bcb
feat(ModuleBuilder): ✨ enhance manifest handling for existing modules
PrzemyslawKlys Dec 25, 2025
a0b6fec
feat(cmdlets): ✨ Add new configuration cmdlets for module publishing
PrzemyslawKlys Dec 25, 2025
1537787
feat(services): ✨ add AutoLatestCompleter and EmptyValuePruner for ar…
PrzemyslawKlys Dec 25, 2025
380e781
refactor(module): 🔥 remove deprecated version retrieval functions
PrzemyslawKlys Dec 25, 2025
2a21f30
feat(enums): ✨ add new configuration enums for publishing and documen…
PrzemyslawKlys Dec 25, 2025
816d7aa
feat(cmdlets): ✨ Add GetProjectEncoding and GetProjectLineEnding comm…
PrzemyslawKlys Dec 25, 2025
d059d37
feat(services): ✨ Add ProjectFileAnalysis for encoding and line endin…
PrzemyslawKlys Dec 25, 2025
64b35fa
feat(module): ✨ Refactor test failure analysis and comment removal fu…
PrzemyslawKlys Dec 25, 2025
25538db
refactor(tests): 🔧 Improve module import path in test setup
PrzemyslawKlys Dec 25, 2025
2604e2f
chore: 🗑️ remove deprecated private functions
PrzemyslawKlys Dec 26, 2025
0c9a626
chore: 🗑️ remove deprecated scripts
PrzemyslawKlys Dec 26, 2025
c2cd683
feat(cmds): ✨ Add RemoveProjectFiles and SendGitHubRelease cmdlets
PrzemyslawKlys Dec 26, 2025
217d4ab
chore: 🗑️ remove Get-PowerShellFileCompatibility function
PrzemyslawKlys Dec 26, 2025
a1dee4c
chore(docs): 🗑️ remove deprecated documentation files
PrzemyslawKlys Dec 26, 2025
7c36c11
feat(cmds): ✨ Add `find` and `publish` commands with argument parsing
PrzemyslawKlys Dec 26, 2025
03881ad
feat(enums): ✨ Add new enums for certificate handling and project cle…
PrzemyslawKlys Dec 26, 2025
8076190
chore: 🗑️ Update TODO.md for clarity and completeness
PrzemyslawKlys Dec 26, 2025
3c4bcb9
feat(models): ✨ Add module build and install specifications
PrzemyslawKlys Dec 26, 2025
d0bf618
chore: 🗑️ Remove unused `Initialize` class from the module
PrzemyslawKlys Dec 26, 2025
714d3ec
feat(cmds): ✨ Enhance `build` and `install` commands with config file…
PrzemyslawKlys Dec 26, 2025
897bf45
refactor(module): 🔥 remove obsolete functions and scripts
PrzemyslawKlys Dec 26, 2025
c65d551
feat(manifest): ✨ Add `RequiredVersion` property to `RequiredModule` …
PrzemyslawKlys Dec 26, 2025
783c1ca
feat(models): ✨ Add `ModuleVersionStepResult` class for version manag…
PrzemyslawKlys Dec 26, 2025
4e5eea7
feat(manifest): ✨ Enhance `RequiredModule` initialization with `Requi…
PrzemyslawKlys Dec 26, 2025
91c33a1
feat(cmds): ✨ Add `StepVersionCommand` for version stepping
PrzemyslawKlys Dec 26, 2025
d38c370
feat(build): ✨ Add JSON output support for `build`, `normalize`, `for…
PrzemyslawKlys Dec 26, 2025
d2f2e96
feat(todos): ✨ Update TODO.md with current status and roadmap
PrzemyslawKlys Dec 26, 2025
a544d54
feat(configuration): ✨ Add configuration segments for build, document…
PrzemyslawKlys Dec 26, 2025
77fa66c
feat(cmdlets): ✨ Refactor configuration commands to use structured cl…
PrzemyslawKlys Dec 26, 2025
4123b00
🗑️ chore: remove deprecated private functions
PrzemyslawKlys Dec 26, 2025
c4143bf
feat(logging): ✨ Add `NullLogger` implementation to discard log messages
PrzemyslawKlys Dec 26, 2025
ee3f169
feat(psresource): ✨ Add `PSResourceInstallOptions` and `Install` meth…
PrzemyslawKlys Dec 26, 2025
9d6f7f6
🗑️ chore: remove unused enums from `ConfigurationEnums.cs`
PrzemyslawKlys Dec 26, 2025
e84f0ff
feat(pipeline): ✨ Add `ModulePipelineSpec`, `ModulePipelinePlan`, `Mo…
PrzemyslawKlys Dec 26, 2025
0888488
feat(pipeline): ✨ Add `ConfigurationSegmentJsonConverter` for JSON se…
PrzemyslawKlys Dec 26, 2025
d6a4777
feat(legacy): ✨ Implement `LegacySegmentAdapter` for configuration se…
PrzemyslawKlys Dec 26, 2025
abe633d
feat(pipeline): ✨ Add `ModulePipelineRunner` for configuration-driven…
PrzemyslawKlys Dec 26, 2025
a074180
feat(todos): ✨ Update `TODO.md` with current status and configuration…
PrzemyslawKlys Dec 26, 2025
fc72da1
feat(artefacts): ✨ Add `ArtefactBuildResult`, `ArtefactModuleEntry`, …
PrzemyslawKlys Dec 26, 2025
6d0cb27
update files
PrzemyslawKlys Dec 26, 2025
5f6b234
fix(project): 🐛 Add missing references for `System.IO.Compression` an…
PrzemyslawKlys Dec 26, 2025
a0253f9
feat(todos): ✨ Enhance `ModulePipelineRunner` to execute `Configurati…
PrzemyslawKlys Dec 26, 2025
80ae70c
feat(text-encoding): ✨ Add `UTF7` encoding option to `TextEncodingKind`
PrzemyslawKlys Dec 26, 2025
1328b01
feat(analysis): ✨ Add new analysis models for project consistency and…
PrzemyslawKlys Dec 26, 2025
3065bc1
feat(services): ✨ Add project text analysis tools for encoding and li…
PrzemyslawKlys Dec 26, 2025
e60a8af
feat(cmdlets): ✨ Refactor GetProjectEncoding and GetProjectLineEnding…
PrzemyslawKlys Dec 26, 2025
6d0334d
feat(gitignore): ✨ Add `testResults.xml` to ignore list
PrzemyslawKlys Dec 26, 2025
fe7d705
chore(psd1): 🔧 Remove `PSPublishModule.dll` from NestedModules
PrzemyslawKlys Dec 26, 2025
1c874c7
feat(analysis): ✨ Add classes for missing-function analysis
PrzemyslawKlys Dec 26, 2025
4034db6
feat(models): ✨ Add new models for project cleanup and module testing
PrzemyslawKlys Dec 26, 2025
2998b09
feat(tests): ✨ add ModuleTestSuiteService for running module test suites
PrzemyslawKlys Dec 26, 2025
0cd0064
refactor(RemoveProjectFilesCommand): ✨ Improve project cleanup logic …
PrzemyslawKlys Dec 26, 2025
10efc9c
refactor(BuildServices): 🔧 Update `RequiredModule` to include `Maximu…
PrzemyslawKlys Dec 26, 2025
7fbd003
feat(ModuleBuild): ✨ Add support for excluding specific files during …
PrzemyslawKlys Dec 27, 2025
ed86535
feat(tests): ✨ Add `powerforge test` command to run Pester test suite
PrzemyslawKlys Dec 27, 2025
1cfd892
docs: ✏️ Update documentation for `Get-MissingFunctions`, `Get-Module…
PrzemyslawKlys Dec 27, 2025
0109bdb
feat(ModuleBuild): ✨ Add support for `ExportAssemblies` and `DisableB…
PrzemyslawKlys Dec 27, 2025
71b75a2
feat(CLI): ✨ Add `schemaVersion` to JSON output for commands
PrzemyslawKlys Dec 27, 2025
4f72114
feat(Documentation): ✨ Add `DocumentationExtractionPayload` and `Mark…
PrzemyslawKlys Dec 27, 2025
6547d67
feat(Configuration): ✨ Update `DocumentationTool` enum for clarity
PrzemyslawKlys Dec 27, 2025
3be1626
fix(NewConfigurationDocumentationCommand): 🐛 Correct documentation en…
PrzemyslawKlys Dec 27, 2025
242d3c2
fix(ExampleModuleBuilder): 🐛 Remove ignored module name from configur…
PrzemyslawKlys Dec 27, 2025
eda8e9d
feat(Configuration): ✨ Enhance publishing configuration with new enum…
PrzemyslawKlys Dec 27, 2025
2655120
feat(Models): ✨ Add new models for repository operations
PrzemyslawKlys Dec 27, 2025
d4eed53
feat(PSResourceGet, PowerShellGet): ✨ Add support for repository cred…
PrzemyslawKlys Dec 27, 2025
e8e641d
feat(Cmdlets): ✨ Enhance configuration commands to accept new data st…
PrzemyslawKlys Dec 27, 2025
d13dd6a
feat(PowerForge): ✨ Add PowerShellToolNotAvailableException for bette…
PrzemyslawKlys Dec 27, 2025
3516c85
feat(Cli): ✨ Add support for multiple target frameworks and Spectre.C…
PrzemyslawKlys Dec 27, 2025
4b1a4e9
feat(Project): ✨ Add support for .NET 10.0 target framework
PrzemyslawKlys Dec 27, 2025
a86c97a
feat(TODO): ✨ Refactor cmdlet and service structure for maintainability
PrzemyslawKlys Dec 27, 2025
34773c8
feat(Configuration): ✨ Add external help generation options
PrzemyslawKlys Dec 27, 2025
f15018d
feat(Documentation): ✨ Enhance help generation with inputs, outputs, …
PrzemyslawKlys Dec 27, 2025
a1fd2bb
feat(Documentation): ✨ Add external help generation support
PrzemyslawKlys Dec 27, 2025
5c78da8
feat(Console): ✨ Add console environment detection and rendering mode…
PrzemyslawKlys Dec 27, 2025
824d26c
feat(InvokeModuleBuildCommand): ✨ Refactor legacy segment handling an…
PrzemyslawKlys Dec 27, 2025
9f63044
feat(DocumentationEngine): ✨ Enhance help file generation with extern…
PrzemyslawKlys Dec 27, 2025
33d95d0
feat(DotNetRelease): ✨ Implement .NET release build service with sign…
PrzemyslawKlys Dec 27, 2025
3b1c3fb
feat(InvokeDotNetReleaseBuild): ✨ Refactor build process and improve …
PrzemyslawKlys Dec 27, 2025
7f52fa7
feat(PowerShellCompatibilityAnalyzer): ✨ Add compatibility analysis f…
PrzemyslawKlys Dec 27, 2025
15eda08
feat(GetPowerShellCompatibilityCommand): ✨ Refactor compatibility ana…
PrzemyslawKlys Dec 27, 2025
157ecd1
feat(TODO.md): ✨ Collapse `New-ConfigurationBuild` segments for impro…
PrzemyslawKlys Dec 27, 2025
d62a65e
feat(Build): ✨ Add `Build-ModuleSelf.ps1` for improved module buildin…
PrzemyslawKlys Dec 27, 2025
6c7b511
feat(Docs): ✨ Update documentation for `New-ConfigurationDocumentatio…
PrzemyslawKlys Dec 27, 2025
9b0dfec
feat(Documentation): ✨ Update `INTEGRATION_SUMMARY.md` and `REFACTORI…
PrzemyslawKlys Dec 27, 2025
5d4d4cb
feat(BuildModule): ✨ Remove `-IgnoreModuleName` from `New-Configurati…
PrzemyslawKlys Dec 27, 2025
495e98b
feat(TestingExamples): ✨ Update test result properties and remove unu…
PrzemyslawKlys Dec 27, 2025
87cbd3f
feat(tests): ✨ Enhance test coverage for encoding detection and modul…
PrzemyslawKlys Dec 27, 2025
3835fca
feat(ModuleInstaller): ✨ Enhance module installation process with dir…
PrzemyslawKlys Dec 27, 2025
a0081d0
feat(tests): ✨ Add unit tests for `ModuleBuilder` and `ModuleInstaller`
PrzemyslawKlys Dec 27, 2025
1e05992
feat(PublishNugetPackageCommand): ✨ Improve argument handling for `do…
PrzemyslawKlys Dec 27, 2025
2dbf4e2
fix(CmdletLogger): 🐛 Correct error handling in `Error` method
PrzemyslawKlys Dec 27, 2025
4add3ca
feat(InstallationStrategy): ✨ Update documentation for `Exact` instal…
PrzemyslawKlys Dec 27, 2025
9a0971f
feat(schemas): ✨ Add new JSON schemas for PowerForge modules
PrzemyslawKlys Dec 27, 2025
0056982
fix(docs): 🐛 Update description for `Exact` install strategy
PrzemyslawKlys Dec 27, 2025
c81ec7e
feat(sln): ✨ Add configurations for `PowerForge.Tests` project
PrzemyslawKlys Dec 27, 2025
503abd3
feat(ModuleBuildPipeline): ✨ Enhance version resolution from manifest
PrzemyslawKlys Dec 27, 2025
e0abd63
feat(build): ✨ Enhance configuration handling and error reporting
PrzemyslawKlys Dec 27, 2025
83fd35a
feat(Build): ✨ Refactor self-build script for improved CLI integration
PrzemyslawKlys Dec 27, 2025
727fc5d
feat(tests): ✨ Add automated version resolution tests
PrzemyslawKlys Dec 27, 2025
b68ee4c
feat(docs): ✨ Add comprehensive documentation for contributing, migra…
PrzemyslawKlys Dec 27, 2025
41954fa
feat(ModulePipeline): ✨ Add ModulePipelineStep and ModulePipelineStep…
PrzemyslawKlys Dec 29, 2025
383e1f1
feat(PipelineConsoleUi): ✨ Implement interactive view handling for pi…
PrzemyslawKlys Dec 29, 2025
af57585
feat(ModulePipeline): ✨ Enhance pipeline execution with progress repo…
PrzemyslawKlys Dec 29, 2025
804558f
fix(NewConfigurationManifestCommand): 🐛 Remove alias for `Guid` param…
PrzemyslawKlys Dec 29, 2025
fe18048
feat(docs): ✨ Add interactive Spectre.Console progress for `docs`/`pa…
PrzemyslawKlys Dec 29, 2025
0bf074d
feat(cli): ✨ Add JSON serialization context and refactor output handling
PrzemyslawKlys Dec 29, 2025
9188dbc
feat(PowerShellGet): ✨ Implement `Save-Module` options and functionality
PrzemyslawKlys Dec 29, 2025
8fae953
feat(PowerShellRunner): ✨ Enhance argument handling for PowerShell ex…
PrzemyslawKlys Dec 29, 2025
b42c89c
chore(tests): 🧪 Update test setup for `Remove-Comments`
PrzemyslawKlys Dec 29, 2025
896d3ff
feat(Build): ✨ Enhance build output handling for PowerForge CLI
PrzemyslawKlys Dec 29, 2025
2295c8c
feat(TODO): ✨ Update current status and enhance JSON output handling
PrzemyslawKlys Dec 29, 2025
e017658
fix(MamlHelpWriter): 🐛 Improve null handling and trimming in helper m…
PrzemyslawKlys Dec 29, 2025
2f45cb6
feat(Directory.Build.props): ✨ Add initial project configuration
PrzemyslawKlys Dec 29, 2025
f291103
fix(RepositoryPublisher): 🐛 Improve repository name handling in `Publ…
PrzemyslawKlys Dec 29, 2025
1b410a2
fix(SendGitHubReleaseCommand): 🐛 Improve null handling in `TrimForMes…
PrzemyslawKlys Dec 29, 2025
7bbd997
feat(ModulePipelineStep): ✨ Enhance progress visibility by splitting …
PrzemyslawKlys Dec 29, 2025
e25597f
feat(DocumentationEngine, ModuleBuildPipeline, ModulePipelineRunner):…
PrzemyslawKlys Dec 29, 2025
b2cd972
feat(PipelineConsoleUi): ✨ Enhance console output with detailed proje…
PrzemyslawKlys Dec 29, 2025
0ed580c
refactor(Cmdlets): 🔄 Remove unused `CmdletLogger` class from `InvokeD…
PrzemyslawKlys Dec 29, 2025
0493d5b
test(ModulePipelineStep): ✨ Add unit tests for module pipeline steps
PrzemyslawKlys Dec 29, 2025
75942db
feat(TODO.md): ✨ Update AOT publish tasks and add validation notes
PrzemyslawKlys Dec 29, 2025
94c46fe
feat(ConsoleEncoding): ✨ Add UTF-8 console encoding setup
PrzemyslawKlys Dec 29, 2025
7320dca
feat(ArtefactBuilder): ✨ Enhance PSResource handling with improved er…
PrzemyslawKlys Dec 29, 2025
2ae2fe2
feat(PipelineConsoleUi): ✨ Enhance console output with Unicode suppor…
PrzemyslawKlys Dec 29, 2025
a515e5e
feat(InvokeModuleBuildCommand): ✨ Add directory and file exclusion pa…
PrzemyslawKlys Dec 29, 2025
15687b7
feat(Logging): ✨ Add Spectre.Console logging implementation
PrzemyslawKlys Dec 29, 2025
dcaf56b
feat(ModuleBuilder): ✨ Add support for `System.Text.Json` in module b…
PrzemyslawKlys Dec 29, 2025
4847589
fix(powerforge): 🐛 Remove deprecated framework version from configura…
PrzemyslawKlys Dec 29, 2025
89d5edb
feat(PSPublishModule): ✨ Enhance binary module loading and dot-sourcing
PrzemyslawKlys Dec 29, 2025
89f2b0f
feat(Console): ✨ Ensure UTF-8 encoding for console output
PrzemyslawKlys Dec 30, 2025
a80108b
feat(ModulePipeline): ✨ Add compatibility and file consistency valida…
PrzemyslawKlys Dec 30, 2025
9c4b159
feat(PipelineConsoleUi): ✨ Add validation summary for file consistenc…
PrzemyslawKlys Dec 30, 2025
c7caf0f
feat(ModulePipeline): ✨ Add validation steps for file consistency and…
PrzemyslawKlys Dec 30, 2025
3e51d61
feat(InvokeModuleBuildCommand): ✨ Add JSON export functionality for p…
PrzemyslawKlys Dec 30, 2025
fb62e73
feat(Build): ✨ Add parameters for flexible module building
PrzemyslawKlys Dec 30, 2025
497a34a
feat(Build): ✨ Enhance staging publish behavior and template path res…
PrzemyslawKlys Dec 30, 2025
e6dc9da
feat(Build): ✨ Add support for additional runtime identifiers
PrzemyslawKlys Dec 30, 2025
f24d8f8
feat(DotNetPublish): ✨ Introduce new models for dotnet publish workflow
PrzemyslawKlys Dec 30, 2025
31f78ed
feat(pipeline): ✨ Implement DotNet publish pipeline runner
PrzemyslawKlys Dec 30, 2025
23ce512
feat(dotnet): ✨ Add dotnet publish command with configuration support
PrzemyslawKlys Dec 30, 2025
ffda982
feat(Cmdlets): ✨ Update project path parameters to support multiple v…
PrzemyslawKlys Dec 30, 2025
7dd4387
feat(schema): ✨ Add DotNet publish schema and configuration file
PrzemyslawKlys Dec 30, 2025
2e08b59
feat(Build): ✨ Enhance runtime parameter handling for multi-runtime s…
PrzemyslawKlys Dec 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
testResults.xml

# NUnit
*.VisualState.xml
Expand Down Expand Up @@ -386,4 +387,4 @@ FodyWeavers.xsd

/.idea/
CLAUDE.md
.claude/*
.claude/*
174 changes: 174 additions & 0 deletions Build/Build-PowerForge.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
[CmdletBinding()] param(
[ValidateSet('win-x64', 'win-arm64', 'linux-x64', 'linux-arm64', 'linux-musl-x64', 'linux-musl-arm64', 'osx-x64', 'osx-arm64')]
[string[]] $Runtime = @('win-x64'),
[ValidateSet('Debug', 'Release')]
[string] $Configuration = 'Release',
[ValidateSet('net10.0', 'net8.0')]
[string] $Framework = 'net10.0',
[ValidateSet('SingleContained', 'SingleFx', 'Portable', 'Fx')]
[string] $Flavor = 'SingleContained',
[string] $OutDir,
[switch] $ClearOut,
[switch] $Zip,
[switch] $UseStaging = $true,
[switch] $KeepSymbols,
[switch] $KeepDocs
)

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'

function Write-Header($t) { Write-Host "`n=== $t ===" -ForegroundColor Cyan }
function Write-Ok($t) { Write-Host "[OK] $t" -ForegroundColor Green }
function Write-Step($t) { Write-Host "[+] $t" -ForegroundColor Yellow }

$repoRoot = (Resolve-Path -LiteralPath ([IO.Path]::GetFullPath([IO.Path]::Combine($PSScriptRoot, '..')))).Path
$proj = Join-Path $repoRoot 'PowerForge.Cli/PowerForge.Cli.csproj'

if (-not (Test-Path -LiteralPath $proj)) { throw "Project not found: $proj" }

# When using a staging publish dir, treat the output as an exact snapshot and clear it by default.
if ($UseStaging -and -not $PSBoundParameters.ContainsKey('ClearOut')) {
$ClearOut = $true
}

$outDirProvided = $PSBoundParameters.ContainsKey('OutDir')
$rids = @(
@($Runtime) |
Where-Object { $_ -and $_.Trim() } |
ForEach-Object { $_.Trim() } |
Select-Object -Unique
)
if ($rids.Count -eq 0) { throw "Runtime must not be empty." }
$multiRuntime = $rids.Count -gt 1

function Resolve-OutDir {
param([Parameter(Mandatory)][string] $Rid)
if ($outDirProvided) {
if ($multiRuntime) {
return Join-Path $OutDir ("{0}/{1}/{2}" -f $Rid, $Framework, $Flavor)
}
return $OutDir
}
return Join-Path $repoRoot ("Artifacts/PowerForge/{0}/{1}/{2}" -f $Rid, $Framework, $Flavor)
}

$singleFile = $Flavor -in @('SingleContained', 'SingleFx')
$selfContained = $Flavor -in @('SingleContained', 'Portable')
$compress = $singleFile
$selfExtract = $Flavor -eq 'SingleContained'

Write-Header "Build PowerForge ($Flavor)"
Write-Step "Framework -> $Framework"
Write-Step "Configuration -> $Configuration"
Write-Step ("Runtimes -> {0}" -f ($rids -join ', '))

foreach ($rid in $rids) {
$outDirThis = Resolve-OutDir -Rid $rid
New-Item -ItemType Directory -Force -Path $outDirThis | Out-Null

$publishDir = $outDirThis
$stagingDir = $null
if ($UseStaging) {
$stagingDir = Join-Path $env:TEMP ("PowerForge.Cli.publish." + [guid]::NewGuid().ToString("N"))
$publishDir = $stagingDir
Write-Step "Using staging publish dir -> $publishDir"
if (Test-Path $publishDir) {
Remove-Item -Path $publishDir -Recurse -Force -ErrorAction SilentlyContinue
}
New-Item -ItemType Directory -Force -Path $publishDir | Out-Null
}

Write-Step "Runtime -> $rid"
Write-Step "Publishing -> $publishDir"

$publishArgs = @(
'publish', $proj,
'-c', $Configuration,
'-f', $Framework,
'-r', $rid,
"--self-contained:$selfContained",
"/p:PublishSingleFile=$singleFile",
"/p:PublishReadyToRun=false",
"/p:PublishTrimmed=false",
"/p:IncludeAllContentForSelfExtract=$singleFile",
"/p:IncludeNativeLibrariesForSelfExtract=$selfExtract",
"/p:EnableCompressionInSingleFile=$compress",
"/p:DebugType=None",
"/p:DebugSymbols=false",
"/p:GenerateDocumentationFile=false",
"/p:CopyDocumentationFiles=false",
"/p:ExcludeSymbolsFromSingleFile=true",
"/p:ErrorOnDuplicatePublishOutputFiles=false",
"/p:UseAppHost=true",
"/p:PublishDir=$publishDir"
)

if ($ClearOut -and (Test-Path $outDirThis) -and ($publishDir -eq $outDirThis)) {
Write-Step "Clearing $outDirThis"
Get-ChildItem -Path $outDirThis -Recurse -Force -ErrorAction SilentlyContinue |
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
}

dotnet.exe @publishArgs
if ($LASTEXITCODE -ne 0) { throw "Publish failed ($LASTEXITCODE)" }

if (-not $KeepSymbols) {
Write-Step "Removing symbols (*.pdb)"
Get-ChildItem -Path $publishDir -Filter *.pdb -File -Recurse -ErrorAction SilentlyContinue |
Remove-Item -Force -ErrorAction SilentlyContinue
}

if (-not $KeepDocs) {
Write-Step "Removing docs (*.xml, *.pdf)"
Get-ChildItem -Path $publishDir -File -Recurse -ErrorAction SilentlyContinue |
Where-Object { $_.Extension -in @('.xml', '.pdf') } |
Remove-Item -Force -ErrorAction SilentlyContinue
}

$ridIsWindows = $rid -like 'win-*'
$cliExe = Join-Path $publishDir 'PowerForge.Cli.exe'
$cliExeAlt = Join-Path $publishDir 'PowerForge.Cli'
$friendlyExe = Join-Path $publishDir ($ridIsWindows ? 'powerforge.exe' : 'powerforge')
foreach ($candidate in @($cliExe, $cliExeAlt)) {
if (-not (Test-Path -LiteralPath $candidate)) { continue }

# Keep a stable, user-friendly binary name without duplicating 50+ MB on disk.
if (Test-Path -LiteralPath $friendlyExe) {
Remove-Item -LiteralPath $friendlyExe -Force -ErrorAction SilentlyContinue
}
Move-Item -LiteralPath $candidate -Destination $friendlyExe -Force
break
}

if ($ClearOut -and (Test-Path $outDirThis) -and ($publishDir -ne $outDirThis)) {
Write-Step "Clearing $outDirThis"
Get-ChildItem -Path $outDirThis -Recurse -Force -ErrorAction SilentlyContinue |
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
}

if ($publishDir -ne $outDirThis) {
Write-Step "Copying publish output -> $outDirThis"
Copy-Item -Path (Join-Path $publishDir '*') -Destination $outDirThis -Recurse -Force
}

if ($Zip) {
$zipName = "PowerForge-" + $Framework + "-" + $rid + "-" + $Flavor + "-" + (Get-Date -Format 'yyyyMMdd-HHmm') + ".zip"
$zipPath = Join-Path (Split-Path -Parent $outDirThis) $zipName
if (Test-Path $zipPath) { Remove-Item -Force $zipPath }
Write-Step ("Create zip -> {0}" -f $zipPath)
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory($outDirThis, $zipPath)
}

if ($stagingDir -and (Test-Path $stagingDir)) {
Remove-Item -Path $stagingDir -Recurse -Force -ErrorAction SilentlyContinue
}
}

if ($multiRuntime) {
$root = if ($outDirProvided) { $OutDir } else { Join-Path $repoRoot 'Artifacts/PowerForge' }
Write-Ok ("Built PowerForge -> {0}" -f $root)
} else {
Write-Ok ("Built PowerForge -> {0}" -f (Resolve-OutDir -Rid $rids[0]))
}
27 changes: 27 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Contributing

## Repo goals

- Keep **core logic** in `PowerForge` (C#) so it can be reused by:
- PowerShell cmdlets (`PSPublishModule`)
- CLI (`PowerForge.Cli`)
- GitHub Actions / future VSCode extension
- Keep **cmdlets thin**: parameter binding + `ShouldProcess` + call core service + typed output.
- Prefer **typed models/enums**; keep `Hashtable/OrderedDictionary` only for legacy adapters.

## Build

- `dotnet build .\\PSPublishModule.sln -c Release`

## Tests

- C# unit tests: `dotnet test .\\PSPublishModule.sln -c Release`
- Pester tests: `Invoke-Pester -Path .\\Module\\Tests -CI`

## Adding/Refactoring a cmdlet

1. Create/extend a typed service in `PowerForge` (spec/result models in `PowerForge/Models`).
2. Create/update a thin cmdlet in `PSPublishModule/Cmdlets` that calls the service.
3. Remove legacy PowerShell functions once replaced (avoid duplicate implementations).
4. Add unit tests (xUnit) and/or Pester coverage for the public behavior.

5 changes: 5 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
</Project>
65 changes: 65 additions & 0 deletions JSON_SCHEMA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# PowerForge CLI JSON Schema

PowerForge CLI commands accept JSON configuration files (`--config <file.json>`). This repository ships a **baseline JSON Schema** set intended for editor validation (VSCode) and for building future tooling (e.g., a VSCode extension).

## Input config schemas (v1)

- Build: `schemas/powerforge.buildspec.schema.json` (maps to `PowerForge.ModuleBuildSpec`)
- Install: `schemas/powerforge.installspec.schema.json` (maps to `PowerForge.ModuleInstallSpec`)
- Test: `schemas/powerforge.testsuitespec.schema.json` (maps to `PowerForge.ModuleTestSuiteSpec`)
- DotNet publish: `schemas/powerforge.dotnetpublish.schema.json` (maps to `PowerForge.DotNetPublishSpec`)
- Pipeline / Plan: `schemas/powerforge.pipelinespec.schema.json` (maps to `PowerForge.ModulePipelineSpec`)
- Segments: `schemas/powerforge.segments.schema.json` (maps to `PowerForge.IConfigurationSegment` + concrete segment types)
- Shared enums: `schemas/powerforge.common.schema.json`

## Using with VSCode

Add a `$schema` property to your JSON file (PowerForge ignores unknown properties during deserialization):

```json
{
"$schema": "./schemas/powerforge.pipelinespec.schema.json",
"SchemaVersion": 1,
"Build": {
"Name": "MyModule",
"SourcePath": ".",
"Version": "1.0.0",
"Frameworks": ["net472", "net8.0", "net10.0"]
},
"Install": {
"Enabled": true,
"Strategy": "AutoRevision",
"KeepVersions": 3
},
"Segments": [
{ "Type": "Manifest", "Configuration": { "Author": "Me" } },
{ "Type": "Packed", "Configuration": { "Enabled": true, "Path": "Artefacts" } }
]
}
```

## Segment type discriminators

Segments use a required `Type` discriminator (case-insensitive). Supported `Type` values include:

- Fixed: `Manifest`, `Build`, `BuildLibraries`, `Information`, `Options`, `Formatting`, `Documentation`, `BuildDocumentation`, `ImportModules`, `ModuleSkip`, `Command`, `PlaceHolder`, `PlaceHolderOption`, `Compatibility`, `FileConsistency`, `TestsAfterMerge`
- Publish: `GalleryNuget`, `GitHubNuget`
- Artefacts: `Unpacked`, `Packed`, `Script`, `ScriptPacked`
- Module dependencies: `RequiredModule`, `ExternalModule`, `ApprovedModule`

## Notes

- Property names are treated case-insensitively by PowerForge (`System.Text.Json` options); the schemas use canonical PascalCase names.
- The CLI config parser allows JSON comments and trailing commas; many JSON Schema validators do not.
- `Version` supports the special value `"auto"` for build/pipeline/install configs (reads `ModuleVersion` from `<Name>.psd1`).

## CLI JSON output

When you run with `--output json`, stdout contains a single JSON object with a stable envelope:

- `schemaVersion` (int)
- `command` (string)
- `success` (bool)
- `exitCode` (int)
- `error` (string, when `success=false`)
- plus command-specific payload (`spec`, `result`, `logs`, etc.)
37 changes: 37 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# PSPublishModule Migration Guide (PowerShell → C# Core + PowerShell + CLI)

This repo is migrating from a PowerShell-only implementation to:

- **`PowerForge` (C# library)**: the reusable core (build/docs/publish logic).
- **`PSPublishModule` (PowerShell module)**: *thin* cmdlets (parameter binding + `ShouldProcess` + call `PowerForge`).
- **`PowerForge.Cli` (CLI)**: non-PowerShell entrypoint for CI, GitHub Actions, and future VSCode extension scenarios.

## What stays compatible

- Existing module repos that call `Build\\Build-Module.ps1` should continue to work.
- The “PowerShell configuration DSL” remains supported (typed segments now; legacy adapters only where unavoidable).

## What changes (notable)

- “Private” internal PowerShell helper functions are being removed as functionality moves to `PowerForge`.
- Don’t depend on internal functions like `Test-*` helpers from the module.
- Use the **public** cmdlets and/or the CLI.
- Output is increasingly **typed** (classes/enums) rather than `Hashtable`/`OrderedDictionary`.

## Recommended workflows

### PowerShell (interactive)

- Keep using existing build scripts, but prefer cmdlets that route through `PowerForge` services.
- When developing PSPublishModule itself, prefer **staging-first** builds to avoid file-locking (“in use”) issues.

### CLI (CI / GitHub Actions / future VSCode)

- Prefer JSON-driven execution so CI and tooling can call a stable contract.
- Typical flow: `plan` → `pipeline`/`build` with `--output json` and CI-safe UI settings.

## Publishing (PowerShellGet + PSResourceGet)

- Publishing is being unified behind `PowerForge` publishers.
- **No standalone “PSResourceGet cmdlets”** are exposed; `PSResourceGet` is used internally where configured/appropriate.

Loading
Loading