|
| 1 | +# CLAUDE.md — LsiGitCheckout |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +PowerShell-based dependency management tool that checks out multiple Git repositories to specified versions. Module architecture: `LsiGitCheckout.psm1` (functions) + `LsiGitCheckout.ps1` (entry point). Version 8.0.0, by LS Instruments AG. |
| 6 | + |
| 7 | +## Running the Tool |
| 8 | + |
| 9 | +```powershell |
| 10 | +.\LsiGitCheckout.ps1 # defaults to dependencies.json |
| 11 | +.\LsiGitCheckout.ps1 -InputFile "path/to/deps.json" # custom config |
| 12 | +.\LsiGitCheckout.ps1 -DryRun # preview without executing |
| 13 | +.\LsiGitCheckout.ps1 -EnableDebug -EnableErrorContext # full debug output |
| 14 | +``` |
| 15 | + |
| 16 | +Key parameters: `-InputFile`, `-CredentialsFile`, `-DryRun`, `-EnableDebug`, `-DisableRecursion`, `-MaxDepth` (default 5), `-ApiCompatibility` (Strict|Permissive), `-DisablePostCheckoutScripts`, `-EnableErrorContext` |
| 17 | + |
| 18 | +## Testing |
| 19 | + |
| 20 | +### Automated Tests (Pester 5.x) |
| 21 | + |
| 22 | +```powershell |
| 23 | +# Install Pester if needed |
| 24 | +Install-Module Pester -Force -MinimumVersion 5.0 |
| 25 | +
|
| 26 | +# Unit tests — fast, no network required |
| 27 | +Invoke-Pester ./tests/LsiGitCheckout.Unit.Tests.ps1 -Output Detailed |
| 28 | +
|
| 29 | +# Integration tests — requires network access to GitHub test repos |
| 30 | +Invoke-Pester ./tests/LsiGitCheckout.Integration.Tests.ps1 -Output Detailed |
| 31 | +``` |
| 32 | + |
| 33 | +### Manual Testing |
| 34 | + |
| 35 | +Test configs in `tests/` can also be run manually: |
| 36 | + |
| 37 | +```powershell |
| 38 | +.\LsiGitCheckout.ps1 -InputFile tests/dependencies_semver.json -DryRun |
| 39 | +``` |
| 40 | + |
| 41 | +There are 16 test JSON configs covering SemVer, Agnostic, API incompatibility, custom paths, post-checkout scripts, and recursive dependencies. |
| 42 | + |
| 43 | +## Architecture |
| 44 | + |
| 45 | +- **Module**: `LsiGitCheckout.psm1` — all function definitions (~35 functions) |
| 46 | +- **Entry point**: `LsiGitCheckout.ps1` — param block, module import, initialization, main execution |
| 47 | +- **Manifest**: `LsiGitCheckout.psd1` — module metadata, exported functions |
| 48 | +- **Two dependency resolution modes**: SemVer (recommended, automatic version resolution) and Agnostic (explicit tag-based) |
| 49 | +- **Configuration**: JSON files — `dependencies.json` for repos, `git_credentials.json` for SSH keys |
| 50 | +- **Recursive processing**: walks dependency trees with conflict detection, max depth configurable |
| 51 | +- **SSH**: PuTTY/Pageant integration for authentication (`.ppk` key format) |
| 52 | +- **Post-checkout scripts**: optional PowerShell scripts run after successful checkouts |
| 53 | + |
| 54 | +## Coding Conventions |
| 55 | + |
| 56 | +- **PowerShell 7.6 LTS** required (`#Requires -Version 7.6`) |
| 57 | +- **Function names**: PascalCase Verb-Noun (e.g., `Test-GitInstalled`, `Parse-VersionPattern`, `Get-SemVersionIntersection`) |
| 58 | +- **Documentation**: comment-based help blocks (`.SYNOPSIS`, `.DESCRIPTION`, `.PARAMETER`) on all functions |
| 59 | +- **Logging**: use `Write-Log` with levels: Info, Warning, Error, Debug, Verbose |
| 60 | +- **Error handling**: wrap operations in `Invoke-WithErrorContext -Context "description" -ScriptBlock { ... }` |
| 61 | +- **Module state**: `$script:` prefix for module-scoped variables (e.g., `$script:RepositoryDictionary`, `$script:DryRun`) |
| 62 | +- **Initialization**: call `Initialize-LsiGitCheckout` to set module state from entry point parameters |
| 63 | +- **CHANGELOG**: follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format with SemVer versioning |
| 64 | + |
| 65 | +## Project Structure |
| 66 | + |
| 67 | +``` |
| 68 | +LsiGitCheckout.ps1 # Entry point script (~230 lines) |
| 69 | +LsiGitCheckout.psm1 # Module with all functions (~2520 lines) |
| 70 | +LsiGitCheckout.psd1 # Module manifest |
| 71 | +CHANGELOG.md # Version history |
| 72 | +README.md # Comprehensive user documentation |
| 73 | +docs/ |
| 74 | + comparison_guide.md # vs Google Repo Tool |
| 75 | + migration_guide.md # Migration strategies |
| 76 | +examples/ # 7 example dependency JSON configs |
| 77 | +tests/ # 16 test JSON configs + Pester test files |
| 78 | + LsiGitCheckout.Unit.Tests.ps1 # Unit tests (no network) |
| 79 | + LsiGitCheckout.Integration.Tests.ps1 # Integration tests (needs network) |
| 80 | +``` |
| 81 | + |
| 82 | +## Key Domain Concepts |
| 83 | + |
| 84 | +- **SemVer mode**: uses `"Dependency Resolution": "SemVer"` and `"Version": "x.y.z"` fields. Supports floating versions (`"2.1.*"`, `"2.*"`) |
| 85 | +- **Agnostic mode**: uses `"Tag"` and `"API Compatible Tags"` fields for explicit version control |
| 86 | +- **Repository Dictionary** (`$script:RepositoryDictionary`): central tracking structure for all repositories being processed across the dependency tree |
| 87 | +- **Immutable config**: once a repo's resolution mode is set, it cannot change during processing |
0 commit comments