-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGet-WaveContext.ps1
More file actions
71 lines (61 loc) · 2.26 KB
/
Copy pathGet-WaveContext.ps1
File metadata and controls
71 lines (61 loc) · 2.26 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
# Get-WaveContext.ps1
# Captures current environment for Claude context
# All values detected at runtime - nothing hardcoded
param(
[string]$Output = ".claude\wave_context.json"
)
# Ensure output directory exists
$outDir = Split-Path $Output -Parent
if ($outDir -and !(Test-Path $outDir)) {
New-Item -ItemType Directory -Path $outDir -Force | Out-Null
}
# Detect everything dynamically
$ctx = [ordered]@{
# When this snapshot was taken
timestamp = (Get-Date).ToString("o")
# Machine identity
machine = [ordered]@{
name = $env:COMPUTERNAME
arch = $env:PROCESSOR_ARCHITECTURE
os = [System.Environment]::OSVersion.VersionString
cores = [Environment]::ProcessorCount
}
# User context
user = [ordered]@{
domain = $env:USERDOMAIN
name = $env:USERNAME
home = $env:USERPROFILE
}
# Shell environment
shell = [ordered]@{
name = "PowerShell"
version = $PSVersionTable.PSVersion.ToString()
edition = $PSVersionTable.PSEdition
}
# Current working context
session = [ordered]@{
cwd = (Get-Location).Path
drive = (Get-Location).Drive.Name
isGitRepo = (Test-Path ".git")
gitBranch = if (Test-Path ".git") {
(git branch --show-current 2>$null)
} else { $null }
}
# What's installed (useful for Claude to know capabilities)
tools = [ordered]@{
git = [bool](Get-Command git -ErrorAction SilentlyContinue)
node = [bool](Get-Command node -ErrorAction SilentlyContinue)
python = [bool](Get-Command python -ErrorAction SilentlyContinue)
docker = [bool](Get-Command docker -ErrorAction SilentlyContinue)
claude = [bool](Get-Command claude -ErrorAction SilentlyContinue)
}
}
# Write JSON
$ctx | ConvertTo-Json -Depth 6 | Out-File $Output -Encoding UTF8
Write-Host "Context captured -> $Output" -ForegroundColor Green
Write-Host " Machine: $($ctx.machine.name) ($($ctx.machine.arch))"
Write-Host " Shell: PowerShell $($ctx.shell.version)"
Write-Host " CWD: $($ctx.session.cwd)"
if ($ctx.session.isGitRepo) {
Write-Host " Git: $($ctx.session.gitBranch)" -ForegroundColor Cyan
}