Skip to content

Commit ef2c9db

Browse files
author
DavidQ
committed
Adds repo prep/update/clean scripts for website deployment and enforces updated commit format.
BUILD_PR_LEVEL_09_20_WEBSITE_REPO_PREP_SCRIPTING
1 parent 71cb9a1 commit ef2c9db

12 files changed

Lines changed: 435 additions & 35 deletions

docs/dev/CODEX_COMMANDS.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
21
MODEL: GPT-5.4
32
REASONING: high
43

54
COMMAND:
6-
- use scripts/PS/codex/ as the base path for all codex scripts
7-
- implement template game creation script
8-
- include tool project scaffolding
9-
- enforce asset/data folder structure
10-
- reverse commit comment format:
11-
description first
12-
PR name last
13-
- update roadmap status only (no text changes except previously approved additions)
5+
- use scripts/PS/codex/ path
6+
- implement repo prep/update/clean scripts for website deployment
7+
- ensure safe, non-destructive defaults
8+
- enforce commit format:
9+
description starts first line (no leading CR)
10+
PR name last line
11+
- update roadmap status only (no text changes except approved additions)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Codex Website Repo Deployment Scripting
2+
3+
Use these scripts from `scripts/PS/codex/` to stage repo content for website deployment with safe defaults.
4+
5+
## Scripts
6+
- `scripts/PS/codex/Prep-WebsiteRepoDeployment.ps1`
7+
- `scripts/PS/codex/Update-WebsiteRepoDeployment.ps1`
8+
- `scripts/PS/codex/Clean-WebsiteRepoDeployment.ps1`
9+
10+
## Safety Defaults
11+
- All scripts default to preview-only mode.
12+
- No files are written or deleted unless `-Apply` is provided.
13+
- Clean operations are restricted to staging paths under `<repo>/tmp`.
14+
15+
## Typical Flow
16+
Prepare staging plan:
17+
18+
```powershell
19+
.\scripts\PS\codex\Prep-WebsiteRepoDeployment.ps1 -Apply
20+
```
21+
22+
Update staged website content:
23+
24+
```powershell
25+
.\scripts\PS\codex\Update-WebsiteRepoDeployment.ps1 -Apply
26+
```
27+
28+
Clean staged site output only:
29+
30+
```powershell
31+
.\scripts\PS\codex\Clean-WebsiteRepoDeployment.ps1 -Apply
32+
```
33+
34+
Clean staged site output plus metadata files:
35+
36+
```powershell
37+
.\scripts\PS\codex\Clean-WebsiteRepoDeployment.ps1 -RemoveMetadata -Apply
38+
```
39+
40+
## Outputs
41+
- default staging root: `tmp/website-deploy/`
42+
- staged content root: `tmp/website-deploy/site/`
43+
- metadata root: `tmp/website-deploy/meta/`
44+
- `website-deploy-plan.json`
45+
- `website-deploy-last-update.json`

docs/dev/COMMIT_COMMENT.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1+
Adds safe website deployment staging automation with prep/update/clean scripts under `scripts/PS/codex/`, preview-only defaults, and constrained clean behavior under `<repo>/tmp`.
12

2-
Adds `scripts/PS/codex/New-CodexTemplateGame.ps1` to create new games from `games/_template`, scaffold tool project metadata, and enforce runtime/domain + tool-data folder structure under `games/<game>/assets/<domain>/data/`. Keeps codex scripts under `scripts/PS/codex/` and applies roadmap status-only updates.
3-
4-
BUILD_PR_LEVEL_09_19_TEMPLATE_GAME_CREATION_SCRIPTING
3+
BUILD_PR_LEVEL_09_20_WEBSITE_REPO_PREP_SCRIPTING

docs/dev/NEXT_COMMAND.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
BUILD_PR_LEVEL_09_20_WEBSITE_REPO_PREP_SCRIPTING
1+
BUILD_PR_LEVEL_09_21_SCRIPT_VALIDATION_AND_SAFETY
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
Summary
2-
- Added `scripts/PS/codex/New-CodexTemplateGame.ps1` as a focused template game creation script.
3-
- Script copies `games/_template` into `games/<game>` and enforces active asset domains with runtime/data split:
4-
- `assets/sprites/data`
5-
- `assets/tilemaps/data`
6-
- `assets/parallax/data`
7-
- `assets/vectors/data`
8-
- Script scaffolds:
9-
- `games/<game>/assets/<game>.assets.json`
10-
- `games/<game>/config/<game>.project.json`
11-
- Updated codex scripting doc paths to use `scripts/PS/codex/` as the base location.
12-
- Updated roadmap with status-only bracket change for template game creation scripting.
13-
- Commit comment format remains description first and PR name last.
2+
- Added website deployment scripting under `scripts/PS/codex/`:
3+
- `Prep-WebsiteRepoDeployment.ps1`
4+
- `Update-WebsiteRepoDeployment.ps1`
5+
- `Clean-WebsiteRepoDeployment.ps1`
6+
- shared helper: `WebsiteRepoDeploymentCommon.ps1`
7+
- Implemented safe non-destructive defaults: scripts run in preview mode unless `-Apply` is provided.
8+
- Added deployment scripting usage/guardrails doc:
9+
- `docs/dev/CODEX_WEBSITE_REPO_DEPLOYMENT_SCRIPTING.md`
10+
- Updated roadmap with status-only bracket change for the website prep/update/delete scripting lane.
11+
- Commit comment format is description on first line and PR name on last line.
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
Validation Checklist - BUILD_PR_LEVEL_09_19_TEMPLATE_GAME_CREATION_SCRIPTING
1+
Validation Checklist - BUILD_PR_LEVEL_09_20_WEBSITE_REPO_PREP_SCRIPTING
22

3-
[x] `scripts/PS/codex/` used as base path for codex scripts in touched docs/scripts
4-
[x] template game creation script added
5-
[x] tool project scaffolding generated by script
6-
[x] asset/data folder structure enforced by script
7-
[x] commit comment format is description first, PR name last
8-
[x] roadmap updated with status-only bracket change
9-
[x] PowerShell parse check passes on touched codex scripts
10-
[x] focused template-creation smoke check passes
3+
[x] website deployment scripts added under `scripts/PS/codex/`
4+
[x] scripts default to preview mode unless `-Apply` is provided
5+
[x] clean script safety checks restrict deletes to staging paths under `<repo>/tmp`
6+
[x] focused PowerShell parse checks pass on touched scripts
7+
[x] focused prep/update/clean smoke checks pass
8+
[x] roadmap updated with status-only bracket changes
9+
[x] commit format enforced: description first line, PR name last line

docs/dev/roadmaps/MASTER_ROADMAP_HIGH_LEVEL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@
600600
### Repo Operator + Asset Conversion Scripting Lanes
601601
- [ ] Existing games asset folders updated so existing images / vectors / related runtime assets can be transformed into tool-editable `data/` objects, with corresponding project JSON updates
602602
- [x] Add the ability for a PowerShell script to create a new game from template, including a project scaffold for the tools
603-
- [ ] Add scripts to prep / update / delete the repo so it can be placed on a website
603+
- [x] Add scripts to prep / update / delete the repo so it can be placed on a website
604604
- [x] Add scripts to switch between Pay-as-you-go and Codex plan modes, and scripts to input API key material and validate it
605605

606606
### Later Capability Lanes
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# BUILD_PR — LEVEL 09_20 — WEBSITE REPO PREP SCRIPTING
2+
3+
## Objective
4+
Add PowerShell scripts to prep, update, and clean the repo for website deployment scenarios.
5+
6+
## Key Updates
7+
- Commit comment format: no leading CR, description starts on first line
8+
- Codex scripts located at scripts/PS/codex/
9+
10+
## Scope
11+
- script to prep repo for website
12+
- script to update repo content for deployment
13+
- script to clean/remove unnecessary files
14+
15+
## Out of Scope
16+
- no runtime changes
17+
- no tool UI changes
18+
19+
## Roadmap Instruction
20+
- Update roadmap status only where applicable
21+
- Maintain previously added roadmap items
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[CmdletBinding()]
2+
param(
3+
[string]$StagingRoot,
4+
[switch]$RemoveMetadata,
5+
[switch]$Apply
6+
)
7+
8+
Set-StrictMode -Version Latest
9+
$ErrorActionPreference = "Stop"
10+
11+
. (Join-Path $PSScriptRoot "WebsiteRepoDeploymentCommon.ps1")
12+
13+
$repoRoot = Get-CodexRepoRoot
14+
$paths = Get-WebsiteDeploymentPaths -StagingRoot $StagingRoot
15+
16+
if (-not (Test-PathWithinRoot -Path $paths.stagingRoot -RootPath (Join-Path $repoRoot "tmp"))) {
17+
throw "Safety check failed. Staging root must remain under <repo>/tmp: $($paths.stagingRoot)"
18+
}
19+
20+
$targets = New-Object System.Collections.Generic.List[string]
21+
if (Test-Path -LiteralPath $paths.siteRoot) {
22+
$targets.Add($paths.siteRoot)
23+
}
24+
if ($RemoveMetadata.IsPresent) {
25+
if (Test-Path -LiteralPath $paths.planPath) {
26+
$targets.Add($paths.planPath)
27+
}
28+
if (Test-Path -LiteralPath $paths.updateReportPath) {
29+
$targets.Add($paths.updateReportPath)
30+
}
31+
}
32+
33+
if ($targets.Count -eq 0) {
34+
Write-Host "Nothing to clean."
35+
exit 0
36+
}
37+
38+
if (-not $Apply.IsPresent) {
39+
Write-Host "Preview mode only. No files were deleted."
40+
Write-Host "Run with -Apply to remove deployment artifacts."
41+
Write-Host "Targets:"
42+
foreach ($target in $targets) {
43+
Write-Host " - $target"
44+
}
45+
exit 0
46+
}
47+
48+
foreach ($target in $targets) {
49+
if (-not (Test-PathWithinRoot -Path $target -RootPath $paths.stagingRoot)) {
50+
throw "Safety check failed. Target escapes staging root: $target"
51+
}
52+
Remove-Item -LiteralPath $target -Recurse -Force
53+
}
54+
55+
Write-Host "Cleaned website deployment artifacts."
56+
Write-Host "Removed targets: $($targets.Count)"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[CmdletBinding()]
2+
param(
3+
[string]$StagingRoot,
4+
[string[]]$IncludePaths,
5+
[switch]$Apply
6+
)
7+
8+
Set-StrictMode -Version Latest
9+
$ErrorActionPreference = "Stop"
10+
11+
. (Join-Path $PSScriptRoot "WebsiteRepoDeploymentCommon.ps1")
12+
13+
$repoRoot = Get-CodexRepoRoot
14+
$paths = Get-WebsiteDeploymentPaths -StagingRoot $StagingRoot
15+
$normalizedIncludePaths = Normalize-IncludePaths -IncludePaths $IncludePaths
16+
if ($normalizedIncludePaths.Count -eq 0) {
17+
$normalizedIncludePaths = Get-DefaultWebsiteIncludePaths
18+
}
19+
20+
$missing = New-Object System.Collections.Generic.List[string]
21+
foreach ($entry in $normalizedIncludePaths) {
22+
$fullPath = [System.IO.Path]::GetFullPath((Join-Path $repoRoot $entry))
23+
if (-not (Test-PathWithinRoot -Path $fullPath -RootPath $repoRoot)) {
24+
throw "Include path escapes repo root: $entry"
25+
}
26+
if (-not (Test-Path -LiteralPath $fullPath)) {
27+
$missing.Add($entry)
28+
}
29+
}
30+
if ($missing.Count -gt 0) {
31+
throw "Prep validation failed. Missing include path(s): $($missing -join ', ')"
32+
}
33+
34+
$plan = New-WebsiteDeploymentPlan -IncludePaths $normalizedIncludePaths -RepoRoot $repoRoot
35+
36+
if (-not $Apply.IsPresent) {
37+
Write-Host "Preview mode only. No files were created."
38+
Write-Host "Run with -Apply to create staging folders and deployment plan."
39+
Write-Host "Staging root: $($paths.stagingRoot)"
40+
Write-Host "Planned include paths: $($normalizedIncludePaths -join ', ')"
41+
exit 0
42+
}
43+
44+
Ensure-Directory -Path $paths.stagingRoot
45+
Ensure-Directory -Path $paths.siteRoot
46+
Ensure-Directory -Path $paths.metaRoot
47+
Write-JsonFile -Value $plan -Path $paths.planPath
48+
49+
Write-Host "Prepared website deployment staging."
50+
Write-Host "Staging root: $($paths.stagingRoot)"
51+
Write-Host "Plan file: $($paths.planPath)"
52+
Write-Host "Include paths: $($normalizedIncludePaths -join ', ')"

0 commit comments

Comments
 (0)