Skip to content

teaceo-debug/DEEP6 / .claude/skills/nt8-build-verify

nt8-build-verify

Verified

FileKindSize
README.mdmarkdown13.6 KB
SKILL.mdskill md1.5 KB
fixes/BRACE_MISMATCH.mdmarkdown5.1 KB
fixes/CS0019.mdmarkdown4.7 KB
fixes/CS0101.mdmarkdown4.9 KB
fixes/CS0103.mdmarkdown4.0 KB
fixes/CS0246.mdmarkdown5.4 KB
fixes/CS0535.mdmarkdown3.6 KB
fixes/CS1061.mdmarkdown5.0 KB
fixes/MISSING_ATTRIBUTE.mdmarkdown5.9 KB
knowledge.mdmarkdown3.5 KB
lib/__init__.pyscript0 B
lib/diagnostics.pyscript2.3 KB
lib/nt8_paths.pyscript3.8 KB
scripts/compile_editor.ps1script5.1 KB
scripts/compile_headless.ps1script9.2 KB
scripts/deploy.ps1script2.6 KB
scripts/fix_loop.ps1script19.7 KB
scripts/fix_router.pyscript15.8 KB
scripts/install_indicator.ps1script16.0 KB
scripts/modal_detect.ps1script10.9 KB
scripts/orchestrator.ps1script19.8 KB
scripts/parse_errors.pyscript4.6 KB
scripts/runtime_check.ps1script2.9 KB
scripts/screenshot_chart.ps1script7.5 KB
scripts/verify_visual.pyscript8.0 KB
scripts/workspace_mutator.pyscript17.6 KB

scripts/screenshot_chart.ps1

View on GitHub
# screenshot_chart.ps1 - Targeted NT8 chart window capture via PrintWindow Win32 API
# Usage: screenshot_chart.ps1 -ChartTitle "NQ 09-25" [-OutputPath path.png] [-SettleMs 1500]
#        screenshot_chart.ps1 -MainWindow [-OutputPath path.png] [-SettleMs 1500]
#
# Exit codes: 0=success, 1=chart not found, 2=NT8 not running

[CmdletBinding()]
param(
    [string]$ChartTitle,
    [switch]$MainWindow,
    [string]$OutputPath,
    [int]$SettleMs = 1500
)

$ErrorActionPreference = "Stop"

# --- Assemblies ---
Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName System.Windows.Forms

# --- P/Invoke ---
Add-Type @"
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;

public class Win32Screenshot {
    [DllImport("user32.dll")]
    public static extern bool SetForegroundWindow(IntPtr hWnd);

    [DllImport("user32.dll")]
    public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

    [DllImport("user32.dll")]
    public static extern bool PrintWindow(IntPtr hWnd, IntPtr hdcBlt, uint nFlags);

    [DllImport("user32.dll")]
    public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);

    [DllImport("user32.dll")]
    public static extern bool IsWindowVisible(IntPtr hWnd);

    [DllImport("user32.dll")]
    public static extern int GetWindowTextLength(IntPtr hWnd);

    [DllImport("user32.dll", CharSet = CharSet.Unicode)]
    public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);

    [DllImport("user32.dll")]
    public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);

    public delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);

    [DllImport("user32.dll")]
    public static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam);

    [StructLayout(LayoutKind.Sequential)]
    public struct RECT {
        public int Left, Top, Right, Bottom;
    }

    // Find all visible windows belonging to a process
    public static List<IntPtr> GetProcessWindows(uint processId) {
        var windows = new List<IntPtr>();
        EnumWindows(delegate(IntPtr hWnd, IntPtr lParam) {
            uint pid;
            GetWindowThreadProcessId(hWnd, out pid);
            if (pid == processId && IsWindowVisible(hWnd)) {
                int len = GetWindowTextLength(hWnd);
                if (len > 0) {
                    windows.Add(hWnd);
                }
            }
            return true;
        }, IntPtr.Zero);
        return windows;
    }

    // Get window title
    public static string GetTitle(IntPtr hWnd) {
        int len = GetWindowTextLength(hWnd);
        if (len == 0) return "";
        var sb = new StringBuilder(len + 1);
        GetWindowText(hWnd, sb, sb.Capacity);
        return sb.ToString();
    }
}
"@

# --- Find NinjaTrader process ---
$nt8 = Get-Process -Name "NinjaTrader" -ErrorAction SilentlyContinue
if (-not $nt8) {
    Write-Output '{"error":"NinjaTrader process not found"}'
    exit 2
}

# Handle multiple NT8 processes (take first)
if ($nt8 -is [System.Array]) { $nt8 = $nt8[0] }
$nt8Pid = [uint32]$nt8.Id

# --- Validate params ---
if (-not $MainWindow -and -not $ChartTitle) {
    Write-Output '{"error":"must specify -ChartTitle or -MainWindow"}'
    exit 1
}

# --- Find target window ---
$targetHandle = [IntPtr]::Zero

if ($MainWindow) {
    $targetHandle = $nt8.MainWindowHandle
} else {
    # Enumerate all NT8 windows, find by title substring
    $allWindows = [Win32Screenshot]::GetProcessWindows($nt8Pid)
    foreach ($hwnd in $allWindows) {
        $title = [Win32Screenshot]::GetTitle($hwnd)
        if ($title -like "*$ChartTitle*") {
            $targetHandle = $hwnd
            break
        }
    }
}

if ($targetHandle -eq [IntPtr]::Zero) {
    $searchInfo = if ($ChartTitle) { $ChartTitle } else { "MainWindow" }
    Write-Output "{`"error`":`"chart not found`",`"search`":`"$searchInfo`"}"
    exit 1
}

# --- Wait for rendering to settle ---
Start-Sleep -Milliseconds $SettleMs

# --- Bring window to foreground ---
[Win32Screenshot]::ShowWindow($targetHandle, 9) | Out-Null  # SW_RESTORE
Start-Sleep -Milliseconds 200
[Win32Screenshot]::SetForegroundWindow($targetHandle) | Out-Null
Start-Sleep -Milliseconds 200

# --- Get window dimensions ---
$rect = New-Object Win32Screenshot+RECT
[Win32Screenshot]::GetWindowRect($targetHandle, [ref]$rect) | Out-Null
$width = $rect.Right - $rect.Left
$height = $rect.Bottom - $rect.Top

if ($width -le 0 -or $height -le 0) {
    Write-Output '{"error":"invalid window dimensions","width":' + $width + ',"height":' + $height + '}'
    exit 1
}

# --- Capture via PrintWindow ---
$bitmap = $null
$captureMethod = "printwindow"
$captureOk = $false

try {
    $bitmap = New-Object System.Drawing.Bitmap($width, $height)
    $graphics = [System.Drawing.Graphics]::FromImage($bitmap)
    $hdc = $graphics.GetHdc()

    try {
        # PW_RENDERFULLCONTENT = 2 (captures even occluded windows on Win 8.1+)
        $result = [Win32Screenshot]::PrintWindow($targetHandle, $hdc, 2)
        if ($result) {
            $captureOk = $true
        }
    } finally {
        $graphics.ReleaseHdc($hdc)
        $graphics.Dispose()
    }
} catch {
    $captureOk = $false
}

# --- Fallback to CopyFromScreen ---
if (-not $captureOk) {
    $captureMethod = "copyfromscreen"
    if ($bitmap) { $bitmap.Dispose(); $bitmap = $null }

    try {
        $bitmap = New-Object System.Drawing.Bitmap($width, $height)
        $graphics = [System.Drawing.Graphics]::FromImage($bitmap)
        $graphics.CopyFromScreen($rect.Left, $rect.Top, 0, 0, (New-Object System.Drawing.Size($width, $height)))
        $graphics.Dispose()
        $captureOk = $true
    } catch {
        if ($bitmap) { $bitmap.Dispose() }
        Write-Output "{`"error`":`"capture failed: $($_.Exception.Message)`"}"
        exit 1
    }
}

# --- Default output path ---
if (-not $OutputPath) {
    $timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
    $OutputPath = Join-Path $PSScriptRoot "..\..\..\..\captures\nt8-chart-$timestamp.png"
}

# Ensure output directory exists
$outDir = Split-Path $OutputPath
if ($outDir -and -not (Test-Path $outDir)) {
    New-Item -ItemType Directory -Path $outDir -Force | Out-Null
}

# --- Save PNG ---
$bitmap.Save($OutputPath, [System.Drawing.Imaging.ImageFormat]::Png)

# --- Blank detection: pixel variance sampling ---
$blankCheck = "pass"
try {
    $colors = [System.Collections.Generic.List[double]]::new()
    $stepX = [Math]::Max(1, [int]($width / 20))
    $stepY = [Math]::Max(1, [int]($height / 20))

    for ($x = 0; $x -lt $width; $x += $stepX) {
        for ($y = 0; $y -lt $height; $y += $stepY) {
            $pixel = $bitmap.GetPixel($x, $y)
            $colors.Add([double]($pixel.R + $pixel.G + $pixel.B))
        }
    }

    if ($colors.Count -gt 1) {
        $sum = 0.0; $sumSq = 0.0; $n = $colors.Count
        foreach ($c in $colors) { $sum += $c; $sumSq += $c * $c }
        $mean = $sum / $n
        $variance = ($sumSq / $n) - ($mean * $mean)
        $stddev = [Math]::Sqrt([Math]::Max(0, $variance))

        if ($stddev -lt 5.0) {
            $blankCheck = "warn"
        }
    }
} catch {
    $blankCheck = "error"
}

# --- Dispose bitmap ---
$bitmap.Dispose()

# --- Resolve full path ---
$resolvedPath = (Resolve-Path $OutputPath).Path

# --- JSON output ---
$windowTitle = [Win32Screenshot]::GetTitle($targetHandle)
$result = @{
    path           = $resolvedPath
    width          = $width
    height         = $height
    blank_check    = $blankCheck
    capture_method = $captureMethod
    window_title   = $windowTitle
} | ConvertTo-Json -Compress

Write-Output $result
exit 0
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 197kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall