deploy git attributes and ignore

This commit is contained in:
2025-11-10 19:23:40 -07:00
parent 5b409d771b
commit 23562de9cf
4 changed files with 606 additions and 3 deletions

View File

@@ -0,0 +1,571 @@
<!-- Generated by SpecStory, Markdown v2.0.0 -->
<!-- cursor Session 1aae6d70-0daa-49a8-b8f1-7e9d36a76a3b (2025-11-11 01:50Z) -->
# Update configloader to overwrite gitattributes and gitignore (2025-11-11 01:50Z)
_**User (2025-11-11 01:50Z)**_
@ConfigLoader.ps1 let's make it so configloader also overwrites gitattributes and gitignore.@2025-11-10_16-59Z-change-compression-method-to-7z.md
---
_**Agent (model default, mode Agent)**_
---
Reviewing the history file and locating `gitattributes` and `gitignore` files.
---
<tool-use data-tool-type="read" data-tool-name="read_file">
<details><summary>Tool use: **read_file** • Read file: .specstory/history/2025-11-10_16-59Z-change-compression-method-to-7z.md</summary>
</details>
</tool-use>
---
<tool-use data-tool-type="read" data-tool-name="read_file">
<details><summary>Tool use: **read_file** • Read file: components/gitattributes</summary>
</details>
</tool-use>
---
<tool-use data-tool-type="read" data-tool-name="read_file">
<details><summary>Tool use: **read_file** • Read file: components/gitignore</summary>
</details>
</tool-use>
---
---
Updating `ConfigLoader.ps1` to include `gitattributes` and `gitignore` in the deployment, using the same recursive update pattern as the batch files.
---
<tool-use data-tool-type="write" data-tool-name="search_replace">
<details><summary>Tool use: **code_edit** • Edit file: ConfigLoader.ps1</summary>
**Chunk 1**
Lines added: 3, lines removed: 1
```diff
@@ -215,5 +215,7 @@
@{ Name = &#39;ZipSeqArchv.bat&#39;; Source = Join-Path -Path $structDir -ChildPath &#39;ZipSeqArchv.bat&#39; },
@{ Name = &#39;UnzipSeqArchv.bat&#39;; Source = Join-Path -Path $structDir -ChildPath &#39;UnzipSeqArchv.bat&#39; },
- @{ Name = &#39;NewDaily.bat&#39;; Source = Join-Path -Path $structDir -ChildPath &#39;NewDaily.bat&#39; }
+ @{ Name = &#39;NewDaily.bat&#39;; Source = Join-Path -Path $structDir -ChildPath &#39;NewDaily.bat&#39; },
+ @{ Name = &#39;.gitattributes&#39;; Source = Join-Path -Path $structDir -ChildPath &#39;components\gitattributes&#39; },
+ @{ Name = &#39;.gitignore&#39;; Source = Join-Path -Path $structDir -ChildPath &#39;components\gitignore&#39; }
)
```
</details>
</tool-use>
---
---
Checking for linting errors:
---
<tool-use data-tool-type="generic" data-tool-name="read_lints">
<details>
<summary>Tool use: **read_lints** • Read lints for 1 file</summary>
Lint paths:
- `ConfigLoader.ps1`
Lint results
**No lint errors found**
</details>
</tool-use>
---
---
Updated `ConfigLoader.ps1` to include `.gitattributes` and `.gitignore` in the deployment. They are added to the `$specs` array and will be overwritten recursively throughout the project, using the source files from the `components` directory.
The changes:
- Added `.gitattributes` with source from `components\gitattributes`
- Added `.gitignore` with source from `components\gitignore`
When you run `ConfigLoader.ps1`, it will find and update these files wherever they exist in the project, just like the batch files.
---
_**User (2025-11-11 01:50Z)**_
@d:\2025-02 BondingArtifact\.gitattributes @d:\2025-02 BondingArtifact\.gitignore @gitattributes @gitignore compare and contrast these pls?
---
_**Agent (model default, mode Agent)**_
---
Comparing the project files with the source components:
---
<tool-use data-tool-type="read" data-tool-name="read_file">
<details><summary>Tool use: **read_file** • Read file: ConfigLoader.ps1</summary>
</details>
</tool-use>
---
---
## Comparison: `.gitattributes`
**Project file** (`d:\2025-02 BondingArtifact\.gitattributes`): 50 lines
**Source file** (`components/gitattributes`): 53 lines
**Differences:**
- Missing in project:
- `*.blend2` (line 26 in source)
- `*.aegraphic` (line 46 in source)
- `*.prel` (line 49 in source)
- `*.docx` (line 51 in source)
- `*.MOV` (line 52 in source)
- `*.gif` (line 53 in source)
- Project has:
- `*.sbs` (line 48)
- `*.sbsar` (line 49)
- `*.spp` (line 50)
- Order: project has `*.wav` at line 43; source has it at line 50
## Comparison: `.gitignore`
**Project file** (`d:\2025-02 BondingArtifact\.gitignore`): 135 lines
**Source file** (`components/gitignore`): 131 lines
**Differences:**
- Project has (not in source):
- `# Archive files` section (lines 86-89):
```
*.zip
*.rar
*.tar.gz
```
- Project-specific paths (lines 121-127):
```
# image sequences
seq/
Renders/
png/
Pr/3_background/RenderRegions/
Pr/3_background/background/
```
- Different Premiere path (line 134):
```
Pr/3_background/RnR/
```
- Source has (not in project):
- More generic `Renders/**` pattern with exceptions (lines 116-121):
```
Renders/**
!Renders/_zipped/
!Renders/_zipped/**
!Renders/**/
!Renders/**/*.bat
!Renders/**/*.log
```
- Generic Premiere path (line 130):
```
Pr/RnR/
```
## Summary
- `.gitattributes`: Project is missing 6 entries and includes 3 project-specific ones (Substance files).
- `.gitignore`: Project has project-specific paths and a different `Renders/` pattern; source uses a more generic pattern with exceptions.
When `ConfigLoader.ps1` runs, it will overwrite the project files with the source versions, removing the project-specific customizations. Consider updating the source files to include commonly needed entries, or adjust the deployment logic to preserve project-specific sections.
---
_**User (2025-11-11 01:50Z)**_
this is post config load. it didn't overwrite them at all. @pwsh (55-109) first, let's add the substance gitattributes to here in projectstructure. then I'll run it and I can clean up what I need manually.
---
_**Agent (model default, mode Agent)**_
---
Adding the Substance file extensions to the source `gitattributes` file.
---
<tool-use data-tool-type="read" data-tool-name="read_file">
<details><summary>Tool use: **read_file** • Read file: components/gitattributes</summary>
</details>
</tool-use>
---
---
Adding the Substance file extensions to the source `gitattributes` file:
---
<tool-use data-tool-type="write" data-tool-name="search_replace">
<details><summary>Tool use: **code_edit** • Edit file: components/gitattributes</summary>
**Chunk 1**
Lines added: 4, lines removed: 2
```diff
@@ -50,4 +51,6 @@
*.docx filter=lfs diff=lfs merge=lfs -text
*.MOV filter=lfs diff=lfs merge=lfs -text
- *.MOV filter=lfs diff=lfs merge=lfs -text
- *.gif filter=lfs diff=lfs merge=lfs -text
+ *.gif filter=lfs diff=lfs merge=lfs -text
+ *.sbs filter=lfs diff=lfs merge=lfs -text
+ *.sbsar filter=lfs diff=lfs merge=lfs -text
+ *.spp filter=lfs diff=lfs merge=lfs -text
```
</details>
</tool-use>
---
---
Added the Substance file extensions (`*.sbs`, `*.sbsar`, `*.spp`) to the source `gitattributes` file. They're now at the end of the file. When you run ConfigLoader again, these will be included in the deployment.
---
_**User (2025-11-11 01:50Z)**_
@pwsh (55-164) it didn't deploy them.
---
_**Agent (model default, mode Agent)**_
---
The script only updates existing files; it doesn't create new ones. Since `.gitattributes` wasn't found, it wasn't created. Updating the script to also deploy `.gitattributes` and `.gitignore` to the project root if they don't exist:
---
<tool-use data-tool-type="read" data-tool-name="read_file">
<details><summary>Tool use: **read_file** • Read file: ConfigLoader.ps1</summary>
</details>
</tool-use>
---
---
Updating the script to also deploy `.gitattributes` and `.gitignore` to the project root if they don't exist:
---
<tool-use data-tool-type="write" data-tool-name="search_replace">
<details><summary>Tool use: **code_edit** • Edit file: ConfigLoader.ps1</summary>
**Chunk 1**
Lines added: 19, lines removed: undefined
```diff
@@ -312,4 +312,23 @@
Write-Host &quot;All batch files refreshed successfully.&quot; -ForegroundColor Green
+
+ # Deploy .gitattributes and .gitignore to project root if they don&#39;t exist
+ Write-Host &quot;&#96;n=== Deploying .gitattributes and .gitignore to project root ===&quot; -ForegroundColor Magenta
+ $gitFiles = @(
+ @{ Name = &#39;.gitattributes&#39;; Source = Join-Path -Path $structDir -ChildPath &#39;components\gitattributes&#39; },
+ @{ Name = &#39;.gitignore&#39;; Source = Join-Path -Path $structDir -ChildPath &#39;components\gitignore&#39; }
+ )
+ foreach ($gitFile in $gitFiles) {
+ $targetPath = Join-Path -Path $resolvedProject -ChildPath $gitFile.Name
+ try {
+ Copy-Item -Path $gitFile.Source -Destination $targetPath -Force
+ Write-Host &quot;[OK] $targetPath&quot; -ForegroundColor Green
+ }
+ catch {
+ Write-Host &quot;[FAIL] $targetPath&quot; -ForegroundColor Red
+ Write-Host &quot; $($_.Exception.Message)&quot; -ForegroundColor DarkRed
+ exit 1
+ }
+ }
# Deploy config files to projectroot\.config\
```
</details>
</tool-use>
---
---
<tool-use data-tool-type="generic" data-tool-name="read_lints">
<details>
<summary>Tool use: **read_lints** • Read lints for 1 file</summary>
Lint paths:
- `ConfigLoader.ps1`
Lint results
**No lint errors found**
</details>
</tool-use>
---
---
---
Updated the script to deploy `.gitattributes` and `.gitignore` to the project root. It will:
1. **Update existing files** recursively (as before)
2. **Deploy to the project root**, creating them if missing or overwriting if present
When you run ConfigLoader, it will:
- Update any existing `.gitattributes` and `.gitignore` files found recursively
- Deploy fresh copies to the project root (including the Substance file extensions we just added)
The deployment happens after the batch file updates and before the config files deployment.
---
_**User (2025-11-11 01:50Z)**_
make sure they both deploy as hidden!
---
_**Agent (model default, mode Agent)**_
---
Updating the script to set the hidden attribute on `.gitattributes` and `.gitignore` after deployment:
---
<tool-use data-tool-type="read" data-tool-name="read_file">
<details><summary>Tool use: **read_file** • Read file: ConfigLoader.ps1</summary>
</details>
</tool-use>
---
---
<tool-use data-tool-type="write" data-tool-name="search_replace">
<details><summary>Tool use: **code_edit** • Edit file: ConfigLoader.ps1</summary>
**Chunk 1**
Lines added: 3, lines removed: undefined
```diff
@@ -323,4 +323,7 @@
try {
Copy-Item -Path $gitFile.Source -Destination $targetPath -Force
+ # Set hidden attribute on the file
+ $file = Get-Item -LiteralPath $targetPath -Force
+ $file.Attributes = $file.Attributes -bor [System.IO.FileAttributes]::Hidden
Write-Host &quot;[OK] $targetPath&quot; -ForegroundColor Green
}
```
</details>
</tool-use>
---
---
---
Checking if we should also set the hidden attribute on recursively updated files:
---
<tool-use data-tool-type="read" data-tool-name="read_file">
<details><summary>Tool use: **read_file** • Read file: ConfigLoader.ps1</summary>
</details>
</tool-use>
---
---
Updating the recursive update section to set the hidden attribute on `.gitattributes` and `.gitignore` files:
---
<tool-use data-tool-type="write" data-tool-name="search_replace">
<details><summary>Tool use: **code_edit** • Edit file: ConfigLoader.ps1</summary>
**Chunk 1**
Lines added: 5, lines removed: undefined
```diff
@@ -277,4 +277,9 @@
try {
Copy-Item -Path $spec.Source -Destination $target.FullName -Force
+ # Set hidden attribute for .gitattributes and .gitignore files
+ if ($spec.Name -eq &#39;.gitattributes&#39; -or $spec.Name -eq &#39;.gitignore&#39;) {
+ $file = Get-Item -LiteralPath $target.FullName -Force
+ $file.Attributes = $file.Attributes -bor [System.IO.FileAttributes]::Hidden
+ }
Write-Host &quot;[OK] $($target.FullName)&quot; -ForegroundColor Green
$updated++
```
</details>
</tool-use>
---
---
<tool-use data-tool-type="generic" data-tool-name="read_lints">
<details>
<summary>Tool use: **read_lints** • Read lints for 1 file</summary>
Lint paths:
- `ConfigLoader.ps1`
Lint results
**No lint errors found**
</details>
</tool-use>
---
---
---
Updated the script to set the hidden attribute on `.gitattributes` and `.gitignore` in both cases:
1. **When updating existing files recursively** — any `.gitattributes` or `.gitignore` found and updated will be marked hidden
2. **When deploying to the project root** — the files deployed to the root will be marked hidden
Both files will be hidden after deployment.
---

View File

@@ -214,7 +214,9 @@ if ($MyInvocation.InvocationName -ne '.') {
@{ Name = 'UpdateAllSequences.bat'; Source = Join-Path -Path $structDir -ChildPath 'UpdateAllSequences.bat' }, @{ Name = 'UpdateAllSequences.bat'; Source = Join-Path -Path $structDir -ChildPath 'UpdateAllSequences.bat' },
@{ Name = 'ZipSeqArchv.bat'; Source = Join-Path -Path $structDir -ChildPath 'ZipSeqArchv.bat' }, @{ Name = 'ZipSeqArchv.bat'; Source = Join-Path -Path $structDir -ChildPath 'ZipSeqArchv.bat' },
@{ Name = 'UnzipSeqArchv.bat'; Source = Join-Path -Path $structDir -ChildPath 'UnzipSeqArchv.bat' }, @{ Name = 'UnzipSeqArchv.bat'; Source = Join-Path -Path $structDir -ChildPath 'UnzipSeqArchv.bat' },
@{ Name = 'NewDaily.bat'; Source = Join-Path -Path $structDir -ChildPath 'NewDaily.bat' } @{ Name = 'NewDaily.bat'; Source = Join-Path -Path $structDir -ChildPath 'NewDaily.bat' },
@{ Name = '.gitattributes'; Source = Join-Path -Path $structDir -ChildPath 'components\gitattributes' },
@{ Name = '.gitignore'; Source = Join-Path -Path $structDir -ChildPath 'components\gitignore' }
) )
# Config files to deploy to projectroot\.config\ # Config files to deploy to projectroot\.config\
@@ -274,6 +276,11 @@ if ($MyInvocation.InvocationName -ne '.') {
foreach ($target in $targets) { foreach ($target in $targets) {
try { try {
Copy-Item -Path $spec.Source -Destination $target.FullName -Force Copy-Item -Path $spec.Source -Destination $target.FullName -Force
# Set hidden attribute for .gitattributes and .gitignore files
if ($spec.Name -eq '.gitattributes' -or $spec.Name -eq '.gitignore') {
$file = Get-Item -LiteralPath $target.FullName -Force
$file.Attributes = $file.Attributes -bor [System.IO.FileAttributes]::Hidden
}
Write-Host "[OK] $($target.FullName)" -ForegroundColor Green Write-Host "[OK] $($target.FullName)" -ForegroundColor Green
$updated++ $updated++
@@ -310,6 +317,28 @@ if ($MyInvocation.InvocationName -ne '.') {
Write-Host "All batch files refreshed successfully." -ForegroundColor Green Write-Host "All batch files refreshed successfully." -ForegroundColor Green
# Deploy .gitattributes and .gitignore to project root if they don't exist
Write-Host "`n=== Deploying .gitattributes and .gitignore to project root ===" -ForegroundColor Magenta
$gitFiles = @(
@{ Name = '.gitattributes'; Source = Join-Path -Path $structDir -ChildPath 'components\gitattributes' },
@{ Name = '.gitignore'; Source = Join-Path -Path $structDir -ChildPath 'components\gitignore' }
)
foreach ($gitFile in $gitFiles) {
$targetPath = Join-Path -Path $resolvedProject -ChildPath $gitFile.Name
try {
Copy-Item -Path $gitFile.Source -Destination $targetPath -Force
# Set hidden attribute on the file
$file = Get-Item -LiteralPath $targetPath -Force
$file.Attributes = $file.Attributes -bor [System.IO.FileAttributes]::Hidden
Write-Host "[OK] $targetPath" -ForegroundColor Green
}
catch {
Write-Host "[FAIL] $targetPath" -ForegroundColor Red
Write-Host " $($_.Exception.Message)" -ForegroundColor DarkRed
exit 1
}
}
# Deploy config files to projectroot\.config\ # Deploy config files to projectroot\.config\
Write-Host "`n=== Deploying config files to .config\ ===" -ForegroundColor Magenta Write-Host "`n=== Deploying config files to .config\ ===" -ForegroundColor Magenta
foreach ($asset in $configAssets) { foreach ($asset in $configAssets) {

View File

@@ -50,4 +50,7 @@
*.wav filter=lfs diff=lfs merge=lfs -text *.wav filter=lfs diff=lfs merge=lfs -text
*.docx filter=lfs diff=lfs merge=lfs -text *.docx filter=lfs diff=lfs merge=lfs -text
*.MOV filter=lfs diff=lfs merge=lfs -text *.MOV filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text *.gif filter=lfs diff=lfs merge=lfs -text
*.sbs filter=lfs diff=lfs merge=lfs -text
*.sbsar filter=lfs diff=lfs merge=lfs -text
*.spp filter=lfs diff=lfs merge=lfs -text

View File

@@ -1,6 +1,6 @@
{ {
"dailyFormat": "daily_YYMMDD", "dailyFormat": "daily_YYMMDD",
"structDir": "A:\\1 Amazon_Active_Projects\\3 ProjectStructure", "structDir": "D:\\0 ProjectStructure",
"zipper": "7z", "zipper": "7z",
"compression": 9 "compression": 9
} }