@@ -139,7 +139,7 @@ function Get-FileCategories {
139139 $excludePattern = ' (^|[/\\])(' + (($excludeDirs | ForEach-Object { [regex ]::Escape($_ ) }) -join ' |' ) + ' )([/\\]|$)'
140140
141141 # Get all files, excluding common directories
142- $allFiles = Get-ChildItem - Path $RepoRoot - Recurse - File - ErrorAction SilentlyContinue |
142+ $allFiles = Get-ChildItem - Path $RepoRoot - Recurse - File - Force - ErrorAction SilentlyContinue |
143143 Where-Object { $_.FullName -notmatch $excludePattern }
144144
145145 foreach ($file in $allFiles ) {
@@ -164,6 +164,16 @@ function Get-FileCategories {
164164 continue
165165 }
166166
167+ # Check build files by path/name first so that workflow .yml files are not
168+ # claimed by the config extension check below.
169+ if ($relativePath -match ' (^|[/\\])\.github[/\\]workflows[/\\]' -or
170+ $name -match ' ^dockerfile' -or
171+ $name -eq ' makefile' -or
172+ $ext -in @ (' .gradle' , ' .maven' )) {
173+ $categories.build += $relativePath
174+ continue
175+ }
176+
167177 # Check config by extension or env files
168178 if ($ext -in $configExtensions -or $name -match ' ^\.env' -or $name -match ' rc$' ) {
169179 $categories.config += $relativePath
@@ -181,14 +191,6 @@ function Get-FileCategories {
181191 $categories.scripts += $relativePath
182192 continue
183193 }
184-
185- # Check build files
186- if ($relativePath -match ' \.github/workflows/' -or
187- $name -match ' ^dockerfile' -or
188- $name -eq ' makefile' -or
189- $ext -in @ (' .gradle' , ' .maven' )) {
190- $categories.build += $relativePath
191- }
192194 }
193195
194196 return $categories
@@ -468,6 +470,37 @@ function Get-PatternDetection {
468470 return $patterns
469471}
470472
473+ function Get-SpeckitVersion {
474+ param ([string ]$RepoRoot )
475+
476+ $stampPath = Join-Path $RepoRoot ' .documentation/SPECKIT_VERSION'
477+ $info = @ {
478+ stamp_exists = $false
479+ installed_version = $null
480+ installed_date = $null
481+ agent = $null
482+ }
483+
484+ if (Test-Path $stampPath ) {
485+ $info.stamp_exists = $true
486+ try {
487+ $lines = @ (Get-Content $stampPath - ErrorAction SilentlyContinue)
488+ if ($lines.Count -gt 0 ) {
489+ $info.installed_version = $lines [0 ].Trim()
490+ }
491+ foreach ($line in $lines ) {
492+ if ($line -match ' ^installed:\s*(.+)$' ) {
493+ $info.installed_date = $matches [1 ].Trim()
494+ } elseif ($line -match ' ^agent:\s*(.+)$' ) {
495+ $info.agent = $matches [1 ].Trim()
496+ }
497+ }
498+ } catch { }
499+ }
500+
501+ return $info
502+ }
503+
471504function Get-ConstitutionInfo {
472505 param ([string ]$RepoRoot )
473506
@@ -514,13 +547,15 @@ function Get-SampledItems {
514547# Main execution
515548$repoRoot = Get-RepoRoot
516549$constitutionInfo = Get-ConstitutionInfo - RepoRoot $repoRoot
550+ $speckitVersion = Get-SpeckitVersion - RepoRoot $repoRoot
517551
518552# Build result object
519553$result = @ {
520554 timestamp = (Get-Date - Format ' yyyy-MM-ddTHH:mm:ssZ' )
521555 scope = $Scope
522556 repo_root = $repoRoot
523557 constitution = $constitutionInfo
558+ speckit = $speckitVersion
524559 audit_dir = ' .documentation/copilot/audit'
525560}
526561
@@ -607,6 +642,7 @@ if ($OutputFormat -eq 'json') {
607642 Write-Output " Repository: $repoRoot "
608643 Write-Output " Scope: $Scope "
609644 Write-Output " Constitution: $ ( if ($constitutionInfo.exists ) { ' Found' } else { ' MISSING' }) "
645+ Write-Output " Spec Kit Version: $ ( if ($speckitVersion.stamp_exists ) { $speckitVersion.installed_version } else { ' absent' }) "
610646 Write-Output " "
611647 Write-Output " File Counts:"
612648 Write-Output " Source files: $ ( $fileCategories.source.Count ) "
@@ -629,14 +665,14 @@ if ($OutputFormat -eq 'json') {
629665 Write-Output " Code Metrics:"
630666 Write-Output " Total lines: $ ( $result.metrics.total_lines ) "
631667 Write-Output " Avg lines/file: $ ( $result.metrics.avg_lines_per_file ) "
632- Write-Output " Large files (>500 lines): $ ( $result.metrics.large_files.Count ) "
668+ Write-Output " Large files (>500 lines): $ ( $result.metrics.large_files_total ) "
633669 }
634670
635671 if ($result.patterns ) {
636672 Write-Output " "
637673 Write-Output " Pattern Detection:"
638- Write-Output " Potential secrets: $ ( $result.patterns.security.hardcoded_secrets.Count ) "
639- Write-Output " Insecure patterns: $ ( $result.patterns.security.insecure_patterns.Count ) "
640- Write-Output " TODO/FIXME comments: $ ( $result.patterns.quality.todo_comments.Count ) "
674+ Write-Output " Potential secrets: $ ( $result.patterns.security.hardcoded_secrets_total ) "
675+ Write-Output " Insecure patterns: $ ( $result.patterns.security.insecure_patterns_total ) "
676+ Write-Output " TODO/FIXME comments: $ ( $result.patterns.quality.todo_comments_total ) "
641677 }
642678}
0 commit comments