vm-deterministic-extractor
Skill detail with category, linked agents, and source metadata.
vm-deterministic-extractor
Deterministic script-based extraction skill for reverse engineering. Generates and executes OS-aware scripts (PowerShell on Windows, POSIX on Linux/macOS) to extract file inventories, signatures, dependency graphs, LOC counts, and complexity metrics WITHOUT using AI. Reads script-config.json from Phase -1 calibration to tune regex patterns. All structural extraction is deterministic and reproducible. USE WHEN: running Phases 0-4 of reverse engineering where structural data can be extracted by scripts rather than AI.
Source: .github/skills/code-generation/vm-deterministic-extractor/SKILL.md
Used By Agents
Preview
View source preview (first 3000 chars)
# Deterministic Extractor Skill
Generates and runs OS-aware scripts to extract structural codebase data without AI analysis.
## When to Use This Skill
- Phase 0: File inventory enumeration
- Phase 1: Role tag assignment and clustering (pattern-based)
- Phase 2: Signature extraction (class, function, import detection via regex)
- Phase 3: Dependency graph construction (from Phase 2 import data)
- Phase 4a: LOC counting and cyclomatic complexity calculation
- Any time structural data can be extracted deterministically rather than by AI
## Unitary Function
**ONE RESPONSIBILITY:** Generate and execute deterministic extraction scripts, write structural JSON artifacts.
**NOT RESPONSIBLE FOR:**
- Semantic analysis, summaries, or business logic (those are AI sub-agent tasks)
- Calibrating regex patterns (see vm-script-calibrator)
- Report generation or HTML output (see 3i-RE-Report-Generator)
## Input
```json
{
"repo_path": "/absolute/path/to/repo",
"output_dir": "docs/codebase-analysis",
"script_config_path": "docs/codebase-analysis/intermediate/script-config.json",
"phase": "phase0|phase1|phase2|phase3|phase4a",
"host_os": "windows|linux|macos"
}
```
## Script Templates
### Phase 0: File Inventory
**Purpose:** Enumerate every file in the repository, classify by extension, exclude vendor/build directories.
**PowerShell (Windows):**
```powershell
# Phase 0: File Inventory
param(
[string]$RepoPath,
[string]$OutputPath,
[string[]]$ExcludeDirs = @("node_modules", ".git", "dist", "build", "__pycache__", ".venv", "venv", "vendor", "obj", "bin", "target")
)
$excludePattern = ($ExcludeDirs | ForEach-Object { [regex]::Escape($_) }) -join '|'
$files = Get-ChildItem -Path $RepoPath -Recurse -File |
Where-Object { $_.FullName -notmatch $excludePattern } |
Select-Object @{N='path'; E={ $_.FullName.Replace($RepoPath, '').TrimStart('\','/').Replace('\','/') }},
@{N='extension'; E={ $_.Extension.ToLower() }},
@{N='size_bytes'; E={ $_.Length }}
# Language mapping
$langMap = @{
'.py'='python'; '.js'='javascript'; '.jsx'='javascript'; '.ts'='typescript'; '.tsx'='typescript';
'.java'='java'; '.cs'='csharp'; '.go'='go'; '.rs'='rust'; '.rb'='ruby'; '.php'='php';
'.css'='css'; '.scss'='scss'; '.less'='less'; '.html'='html'; '.md'='markdown';
'.json'='json'; '.yaml'='yaml'; '.yml'='yaml'; '.xml'='xml'; '.sql'='sql';
'.sh'='shell'; '.ps1'='powershell'; '.bat'='batch'
}
$enriched = $files | ForEach-Object {
$lang = $langMap[$_.extension]
if (-not $lang) { $lang = 'other' }
[PSCustomObject]@{
path = $_.path
extension = $_.extension
language = $lang
size_bytes = $_.size_bytes
}
}
$counts = $enriched | Group-Object language | ForEach-Object {
@{ $_.Name = $_.Count }
} | ForEach-Object { $_ }
$inventory = @{
generated_at = (Get-Date -Format 'o')
repo_path = $RepoPath
host_os = 'windows'
script_type = 'powershell