Goal
Ship Initialize-GitDefaults.ps1 (repo root) that interactively (or via -Language) composes .gitattributes and .gitignore for a consumer project by combining per-language templates from upstream community repos plus a curated PowerShell block.
Replaces shipping a static .gitattributes.template from upstream IntelliSDLC.ai. Language stacks vary per consumer; the per-language templates already exist upstream -- we just need to compose them.
Source Repos (Pinned)
.gitignore: github/gitignore @ dcc0fc7bc2b5ba480cf117ad1be31bafceeaff46 (GitHub-org authoritative; powers GitHub's UI picker).
.gitattributes: alexkaratarakis/gitattributes @ fddc586cf0f10ec4485028d0d2dd6f73197a4258 (community de facto; github/gitattributes does not exist).
Ecosystem Background
| Tool |
.gitignore |
.gitattributes |
gibo (simonwhitaker/gibo) |
yes -- fetches from github/gitignore |
no |
gh repo create --gitignore X |
yes -- creation-time only |
no |
| Any other CLI |
no |
no |
Initialize-GitDefaults.ps1 integrates with gibo when present (for .gitignore) and fills the ecosystem gap for .gitattributes ourselves.
Required Language Coverage
| Language |
gitattributes |
gitignore |
| CSharp |
CSharp.gitattributes |
VisualStudio.gitignore |
| PowerShell |
curated in-script block |
curated in-script block |
| TypeScript |
Web.gitattributes |
Node.gitignore |
| ASP.NET |
+VisualStudio.gitattributes (layered on CSharp) |
VisualStudio.gitignore (shared) |
Dependency graph: ASP.NET -> CSharp. TypeScript uses Web + Node directly.
Bundled Offline Snapshots
Under .github/templates/git-defaults/ at pinned SHAs:
- From
alexkaratarakis/gitattributes: Common.gitattributes, CSharp.gitattributes, VisualStudio.gitattributes, Web.gitattributes
- From
github/gitignore: VisualStudio.gitignore, Node.gitignore, Global/Backup.gitignore
SOURCES.md documenting pinned SHAs + authority distinction + refresh procedure.
- PowerShell blocks NOT bundled -- embedded in script.
Script Spec -- Initialize-GitDefaults.ps1
[CmdletBinding(SupportsShouldProcess)]
param(
[string[]] $Language,
[switch] $IncludeGitignore = $true,
[switch] $IncludeGitattributes = $true,
[string] $GitattributesRef = 'fddc586cf0f10ec4485028d0d2dd6f73197a4258',
[string] $GitignoreRef = 'dcc0fc7bc2b5ba480cf117ad1be31bafceeaff46',
[switch] $Refresh,
[switch] $Force
)
Behaviour (summary):
- Pre-flight: validate cwd is a git repo.
- Language selection:
-Language validated against known set; else interactive multi-select picker with heuristic pre-selection; else abort.
- Dependency expansion:
ASP.NET -> CSharp etc.
- Compose
.gitattributes: header -> Common -> per-lang (stable alpha) -> curated PowerShell block.
- Compose
.gitignore: prefer gibo dump when present and not -Refresh, else assemble from bundled snapshots / network.
- Header on both files lists pinned SHAs, authority labels, languages, curated additions.
- Backup-and-replace: if target exists and not
-Force, abort; with -Force, copy to <file>.bak (timestamp suffix on collision).
- Honour
-WhatIf.
- Cache:
$env:LOCALAPPDATA\IntelliSDLC.ai\cache\git-defaults\<SHA>\ with tasks/.cache/git-defaults/<SHA>/ fallback.
Pull-SDLC.ai.ps1 Integration
git rm .gitattributes.template.
- Remove
.gitattributes.template from $script:TemplateScaffoldMap and $script:UpstreamManagedPaths.
- Confirm
.gitattributes on $script:AlwaysLocalPaths (already there).
- Add
.github/templates/git-defaults/ to $script:UpstreamManagedPaths.
- Post-sync hint when missing
.gitattributes/.gitignore: print exactly once a one-liner instructing the user to run ./Initialize-GitDefaults.ps1. Do NOT auto-invoke.
Acceptance Criteria
Invoke-Pester on Initialize-GitDefaults.Tests.ps1 and Pull-SDLC.ai.Tests.ps1 passes 100%.
- PSScriptAnalyzer reports zero new findings vs main on both scripts.
./Initialize-GitDefaults.ps1 -Language CSharp,PowerShell,TypeScript -Force in a fresh temp dir composes both files end-to-end, exit 0.
./Initialize-GitDefaults.ps1 -Language ASP.NET -Force includes CSharp content.
.gitattributes.template gone from repo.
- Fresh sync into consumer worktree without
.gitattributes prints the hint.
Goal
Ship
Initialize-GitDefaults.ps1(repo root) that interactively (or via-Language) composes.gitattributesand.gitignorefor a consumer project by combining per-language templates from upstream community repos plus a curated PowerShell block.Replaces shipping a static
.gitattributes.templatefrom upstream IntelliSDLC.ai. Language stacks vary per consumer; the per-language templates already exist upstream -- we just need to compose them.Source Repos (Pinned)
.gitignore:github/gitignore@dcc0fc7bc2b5ba480cf117ad1be31bafceeaff46(GitHub-org authoritative; powers GitHub's UI picker)..gitattributes:alexkaratarakis/gitattributes@fddc586cf0f10ec4485028d0d2dd6f73197a4258(community de facto;github/gitattributesdoes not exist).Ecosystem Background
.gitignore.gitattributesgibo(simonwhitaker/gibo)github/gitignoregh repo create --gitignore XInitialize-GitDefaults.ps1integrates withgibowhen present (for.gitignore) and fills the ecosystem gap for.gitattributesourselves.Required Language Coverage
CSharp.gitattributesVisualStudio.gitignoreWeb.gitattributesNode.gitignore+VisualStudio.gitattributes(layered on CSharp)VisualStudio.gitignore(shared)Dependency graph:
ASP.NET -> CSharp.TypeScriptuses Web + Node directly.Bundled Offline Snapshots
Under
.github/templates/git-defaults/at pinned SHAs:alexkaratarakis/gitattributes:Common.gitattributes,CSharp.gitattributes,VisualStudio.gitattributes,Web.gitattributesgithub/gitignore:VisualStudio.gitignore,Node.gitignore,Global/Backup.gitignoreSOURCES.mddocumenting pinned SHAs + authority distinction + refresh procedure.Script Spec --
Initialize-GitDefaults.ps1Behaviour (summary):
-Languagevalidated against known set; else interactive multi-select picker with heuristic pre-selection; else abort.ASP.NET -> CSharpetc..gitattributes: header ->Common-> per-lang (stable alpha) -> curated PowerShell block..gitignore: prefergibo dumpwhen present and not-Refresh, else assemble from bundled snapshots / network.-Force, abort; with-Force, copy to<file>.bak(timestamp suffix on collision).-WhatIf.$env:LOCALAPPDATA\IntelliSDLC.ai\cache\git-defaults\<SHA>\withtasks/.cache/git-defaults/<SHA>/fallback.Pull-SDLC.ai.ps1 Integration
git rm .gitattributes.template..gitattributes.templatefrom$script:TemplateScaffoldMapand$script:UpstreamManagedPaths..gitattributeson$script:AlwaysLocalPaths(already there)..github/templates/git-defaults/to$script:UpstreamManagedPaths..gitattributes/.gitignore: print exactly once a one-liner instructing the user to run./Initialize-GitDefaults.ps1. Do NOT auto-invoke.Acceptance Criteria
Invoke-PesteronInitialize-GitDefaults.Tests.ps1andPull-SDLC.ai.Tests.ps1passes 100%../Initialize-GitDefaults.ps1 -Language CSharp,PowerShell,TypeScript -Forcein a fresh temp dir composes both files end-to-end, exit 0../Initialize-GitDefaults.ps1 -Language ASP.NET -Forceincludes CSharp content..gitattributes.templategone from repo..gitattributesprints the hint.