refactor: make the module manifest the only version source
The project version was stamped into the banner of every file and kept in sync by Bump-Version.ps1, which rewrote them with regexes. It had already drifted: ElysiumSettings.txt.sample still said 2.4.4. Now that src/Elysium/Elysium.psd1 carries ModuleVersion and both the module and the Elysium.Common.ps1 loader read $ElysiumVersion from it, the banner "Version:" lines and Bump-Version.ps1 have no job left. Removed both. Releasing is: change ModuleVersion, add the CHANGELOG entry, commit, tag - documented in the README's versioning section. AGENTS.md: project structure now lists the module layout, and agents are told not to add version numbers back into banners.
This commit is contained in:
@@ -25,8 +25,13 @@ The tool performs three core workflows:
|
||||
|
||||
```
|
||||
Elysium.ps1 # Main menu / orchestrator script
|
||||
Elysium.Common.ps1 # Shared helpers: pwsh relauncher, Windows PS fallback
|
||||
Elysium.Common.ps1 # Transitional loader: dot-sources src/Elysium/Private/*.ps1 into the calling script
|
||||
ElysiumSettings.txt # Live configuration (key=value format, # comments)
|
||||
|
||||
src/Elysium/Elysium.psd1 # Module manifest; ModuleVersion is the single source of the project version
|
||||
src/Elysium/Elysium.psm1 # Root module: dot-sources Private/ and Public/
|
||||
src/Elysium/Private/ # Shared helpers: Relaunch, Settings, Storage (Azure/S3/SigV4), AdPreflight
|
||||
src/Elysium/Public/ # Exported cmdlets (root scripts are being converted into these)
|
||||
ElysiumSettings.txt.sample # Documented template for operators
|
||||
|
||||
Update-KHDB.ps1 # KHDB downloader: manifest + shard incremental update
|
||||
@@ -122,4 +127,5 @@ No CI pipeline exists. The one automated check is `python3 tests/test_decrypt.py
|
||||
- Do **not** introduce new package-manager files (e.g., `package.json`, `pyproject.toml`, `Cargo.toml`). This project is intentionally dependency-light and script-driven.
|
||||
- When adding new settings, keep the `key=value` flat format and update both `ElysiumSettings.txt.sample` and any parser that reads the file.
|
||||
- If you add a new operational script, include the standard banner, strict mode, transcript logging, and the `Elysium.Common.ps1` relauncher pattern.
|
||||
- The version lives only in `src/Elysium/Elysium.psd1` (`ModuleVersion`); code reads it as `$ElysiumVersion`. Do not add version numbers to file banners.
|
||||
- The `.gitignore` excludes `khdb.txt`, `ElysiumSettings.txt`, `Reports/`, `khdb-shards/`, and `khdb-manifest.json`. Exception: `khdb.txt` has been tracked since the first commit, so the ignore rule does not apply to it. Do not `git rm` it casually - client clones have a locally modified `khdb.txt`, and an upstream deletion makes their `git pull` fail.
|
||||
|
||||
@@ -1,162 +0,0 @@
|
||||
##################################################
|
||||
## ____ ___ ____ _____ _ _ _____ _____ ##
|
||||
## / ___/ _ \| _ \| ____| | \ | | ____|_ _| ##
|
||||
## | | | | | | |_) | _| | \| | _| | | ##
|
||||
## | |__| |_| | _ <| |___ _| |\ | |___ | | ##
|
||||
## \____\__\_\_| \_\_____(_)_| \_|_____| |_| ##
|
||||
## Move fast and fix things. ##
|
||||
##################################################
|
||||
## Project: Elysium ##
|
||||
## File: Bump-Version.ps1 ##
|
||||
## Version: 2.4.6 ##
|
||||
## Support: support@cqre.net ##
|
||||
##################################################
|
||||
|
||||
#Requires -Version 5.1
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Bumps the unified Elysium version across all project files.
|
||||
|
||||
.DESCRIPTION
|
||||
Updates the centralized $ElysiumVersion variable, ASCII headers in all
|
||||
operational scripts, the settings template, and runtime references
|
||||
(User-Agent, usage beacon, etc.). Optionally stubs a new CHANGELOG entry.
|
||||
|
||||
.PARAMETER NewVersion
|
||||
The new version string to apply (e.g. 2.2.2).
|
||||
|
||||
.PARAMETER SkipChangelog
|
||||
Do not print a CHANGELOG entry stub.
|
||||
|
||||
.EXAMPLE
|
||||
.\Bump-Version.ps1 -NewVersion 2.2.2
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$NewVersion,
|
||||
|
||||
[switch]$SkipChangelog
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
$scriptRoot = $PSScriptRoot
|
||||
if (-not $scriptRoot) { $scriptRoot = (Get-Location).Path }
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Validate input
|
||||
# ---------------------------------------------------------------------------
|
||||
if ($NewVersion -notmatch '^\d+\.\d+\.\d+$') {
|
||||
throw "Version must be in semantic format X.Y.Z (e.g. 2.2.2). Got: '$NewVersion'"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Determine current version from Elysium.Common.ps1
|
||||
# ---------------------------------------------------------------------------
|
||||
$commonPath = Join-Path -Path $scriptRoot -ChildPath 'Elysium.Common.ps1'
|
||||
if (-not (Test-Path -LiteralPath $commonPath)) {
|
||||
throw "Elysium.Common.ps1 not found at $commonPath"
|
||||
}
|
||||
|
||||
$commonContent = Get-Content -LiteralPath $commonPath -Raw
|
||||
$currentVersionMatch = [regex]::Match($commonContent, "\`$script:ElysiumVersion\s*=\s*'([^']+)'")
|
||||
if (-not $currentVersionMatch.Success) {
|
||||
throw "Could not determine current version from Elysium.Common.ps1"
|
||||
}
|
||||
$oldVersion = $currentVersionMatch.Groups[1].Value
|
||||
|
||||
if ($oldVersion -eq $NewVersion) {
|
||||
Write-Warning "Current version is already $NewVersion. Nothing to do."
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host "Bumping Elysium from $oldVersion -> $NewVersion"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Helper: replace in file
|
||||
# ---------------------------------------------------------------------------
|
||||
function Edit-FileVersion {
|
||||
param(
|
||||
[string]$Path,
|
||||
[string]$Old,
|
||||
[string]$New
|
||||
)
|
||||
$content = Get-Content -LiteralPath $Path -Raw
|
||||
$newContent = $content.Replace($Old, $New)
|
||||
if ($newContent -eq $content) {
|
||||
Write-Verbose " No changes in $(Split-Path -Leaf $Path)"
|
||||
} else {
|
||||
Set-Content -LiteralPath $Path -Value $newContent -NoNewline -Encoding UTF8
|
||||
Write-Host " Updated $(Split-Path -Leaf $Path)"
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 1. Central version variable
|
||||
# ---------------------------------------------------------------------------
|
||||
Write-Host "`n[1/4] Updating centralized version variable..."
|
||||
Edit-FileVersion -Path $commonPath -Old "`$script:ElysiumVersion = '$oldVersion'" -New "`$script:ElysiumVersion = '$NewVersion'"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 2. ASCII headers in scripts and templates
|
||||
# ---------------------------------------------------------------------------
|
||||
Write-Host "`n[2/4] Updating script headers..."
|
||||
$headerTargets = Get-ChildItem -Path $scriptRoot -File | Where-Object {
|
||||
$_.Extension -in @('.ps1', '.py') -or $_.Name -eq 'ElysiumSettings.txt.sample'
|
||||
}
|
||||
foreach ($file in $headerTargets) {
|
||||
$content = Get-Content -LiteralPath $file.FullName -Raw
|
||||
# The header pattern: ## Version: X.Y.Z ##
|
||||
$pattern = "## Version:\s+$([regex]::Escape($oldVersion))\s+##"
|
||||
$replacement = "## Version: $NewVersion ##"
|
||||
$newContent = [regex]::Replace($content, $pattern, $replacement)
|
||||
if ($newContent -ne $content) {
|
||||
Set-Content -LiteralPath $file.FullName -Value $newContent -NoNewline -Encoding UTF8
|
||||
Write-Host " Updated $($file.Name)"
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 3. Runtime references (safety net)
|
||||
# ---------------------------------------------------------------------------
|
||||
Write-Host "`n[3/4] Updating runtime version references..."
|
||||
$runtimeTargets = Get-ChildItem -Path $scriptRoot -Filter '*.ps1' -File
|
||||
foreach ($file in $runtimeTargets) {
|
||||
$content = Get-Content -LiteralPath $file.FullName -Raw
|
||||
$newContent = $content
|
||||
# User-Agent patterns: 'Elysium/2.2.1 (+...)' or "Elysium/2.2.1 (+...)"
|
||||
$newContent = [regex]::Replace($newContent,
|
||||
"Elysium/$([regex]::Escape($oldVersion))",
|
||||
"Elysium/$NewVersion")
|
||||
# Literal string assignments: version = '2.2.1'
|
||||
$newContent = [regex]::Replace($newContent,
|
||||
"version\s*=\s*'$([regex]::Escape($oldVersion))'",
|
||||
"version = '$NewVersion'")
|
||||
if ($newContent -ne $content) {
|
||||
Set-Content -LiteralPath $file.FullName -Value $newContent -NoNewline -Encoding UTF8
|
||||
Write-Host " Updated runtime refs in $($file.Name)"
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 4. CHANGELOG stub
|
||||
# ---------------------------------------------------------------------------
|
||||
if (-not $SkipChangelog) {
|
||||
Write-Host "`n[4/4] CHANGELOG entry stub (copy-paste ready):"
|
||||
$today = (Get-Date).ToString('yyyy-MM-dd')
|
||||
$stub = @"
|
||||
|
||||
---
|
||||
|
||||
## [$NewVersion] - $today
|
||||
|
||||
### Changed
|
||||
- (describe your change here)
|
||||
"@
|
||||
Write-Host $stub
|
||||
Write-Host "`nAppend the above to CHANGELOG.md, then commit and tag."
|
||||
}
|
||||
|
||||
Write-Host "`nDone. Review the changes with: git diff --stat"
|
||||
@@ -7,7 +7,6 @@
|
||||
##################################################
|
||||
## Project: Elysium ##
|
||||
## File: Elysium.ps1 ##
|
||||
## Version: 2.4.6 ##
|
||||
## Support: support@cqre.net ##
|
||||
##################################################
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
##################################################
|
||||
## Project: Elysium ##
|
||||
## File: ElysiumSettings.txt ##
|
||||
## Version: 2.4.4 ##
|
||||
## Support: support@cqre.net ##
|
||||
##################################################
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
##################################################
|
||||
## Project: Elysium ##
|
||||
## File: Extract-NTHashes.ps1 ##
|
||||
## Version: 2.4.6 ##
|
||||
## Support: support@cqre.net ##
|
||||
##################################################
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
##################################################
|
||||
## Project: Elysium ##
|
||||
## File: Prepare-KHDBStorage.ps1 ##
|
||||
## Version: 2.4.6 ##
|
||||
## Support: support@cqre.net ##
|
||||
##################################################
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ Sensitive operations are confined only to the dedicated host. In the third step,
|
||||
|
||||
## Versioning and Releases
|
||||
|
||||
Elysium uses a **unified project version** starting with v2.2.0. Every script, the settings template, and the documentation share the same version number so you can verify consistency at a glance by checking the header of any `.ps1` file. Releases are tagged in Git (`v<major>.<minor>.<patch>`) and documented in `CHANGELOG.md`.
|
||||
Elysium uses a **unified project version** starting with v2.2.0. The version is defined once, as `ModuleVersion` in `src/Elysium/Elysium.psd1`; the scripts read it from there at runtime (User-Agent, usage beacon, diagnostic dumps). To release, change `ModuleVersion`, add the `CHANGELOG.md` entry, commit, and tag `v<major>.<minor>.<patch>`.
|
||||
|
||||
Prior to v2.2.0, each script carried its own version number; those historical versions are preserved in the changelog for reference.
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
##################################################
|
||||
## Project: Elysium ##
|
||||
## File: Test-WeakADPasswords.ps1 ##
|
||||
## Version: 2.4.6 ##
|
||||
## Support: support@cqre.net ##
|
||||
##################################################
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
##################################################
|
||||
## Project: Elysium ##
|
||||
## File: Uninstall.ps1 ##
|
||||
## Version: 2.4.6 ##
|
||||
## Support: support@cqre.net ##
|
||||
##################################################
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
##################################################
|
||||
## Project: Elysium ##
|
||||
## File: Update-KHDB.ps1 ##
|
||||
## Version: 2.4.6 ##
|
||||
## Support: support@cqre.net ##
|
||||
##################################################
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
##################################################
|
||||
## Project: Elysium ##
|
||||
## File: Update-LithnetStore.ps1 ##
|
||||
## Version: 2.4.6 ##
|
||||
## Support: support@cqre.net ##
|
||||
##################################################
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
##################################################
|
||||
## Project: Elysium ##
|
||||
## File: decrypt.py ##
|
||||
## Version: 1.1.0 ##
|
||||
## Support: support@cqre.net ##
|
||||
##################################################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user