-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshape.ps1
More file actions
77 lines (64 loc) · 1.97 KB
/
Copy pathshape.ps1
File metadata and controls
77 lines (64 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# ============================================================
# shape.ps1 (ALL-REPOS)
# ============================================================
# Updated: 2026-08-16
#
# REQ: List project working files and directories that currently exist on disk.
# WHY: Provide a concise, copyable view of the current project structure.
# OBS: Does NOT depend on Git tracking or staging status.
# OBS: Newly created files and directories appear immediately without git add.
# OBS: Empty authored directories are included in the project shape.
# OBS: Excludes common generated, cached, virtual environment, and build folders.
# CUSTOM: Add path filters only if you want a narrower project shape.
#
# Run in a PowerShell terminal (available cross platform) with:
# .\shape.ps1
# === CONFIGURE EXCLUDED DIRECTORIES ===
# WHY: These directories contain generated, cached, downloaded, or temporary
# content rather than authored project structure.
$excludedDirectories = @(
".git",
".venv",
"__pycache__",
".cache",
".ruff_cache",
".pytest_cache",
".mypy_cache",
".tox",
".nox",
"node_modules",
"build",
"dist",
"site"
)
# === GET PROJECT SHAPE ===
$projectRoot = (Get-Location).Path
Get-ChildItem -Path $projectRoot -Recurse -Force |
Where-Object {
$relativePath = [System.IO.Path]::GetRelativePath(
$projectRoot,
$_.FullName
)
$pathParts = $relativePath -split '[\\/]'
$exclude = $false
foreach ($directory in $excludedDirectories) {
if ($pathParts -contains $directory) {
$exclude = $true
break
}
}
-not $exclude
} |
ForEach-Object {
$relativePath = [System.IO.Path]::GetRelativePath(
$projectRoot,
$_.FullName
)
if ($_.PSIsContainer) {
".\$relativePath\"
}
else {
".\$relativePath"
}
} |
Sort-Object -Unique