Repository navigation
feat(generic): PowerShell breadth tier (.ps1/.psm1) - #550
visualzbyvj wants to merge 1 commit into
Conversation
Register tree-sitter-powershell (already in the tree-sitter-wasm bundle) in
GENERIC_LANGS and ship a tags.scm: function/filter statements carry the name
in the function_name leaf token (@definition.function); bare command
invocations (cmdlets, script functions) are @reference.call, resolved by the
existing name resolver same-file first.
Verified on a real-world corpus: a 5k-line server .ps1 + 27 .ps1/.psm1 files
yielded 275 function nodes with signatures and 76 same-file resolved call
edges; code_search/callers/callees/skeleton all work. Known grammar limit
(noted in the test): single-line `function f { param($x) ... }` bodies hit an
ERROR region and drop that definition.
🌱 graft blast radius1 area changed → 6 areas can be affected. 15 dependent symbols, depth 2. flowchart TB
A0(("Dependency Graph<br/>8 symbols"))
A1(("Build Analysis<br/>2 symbols"))
A2(("CLI Engine<br/>2 symbols"))
A3(("Build Context<br/>1 symbol"))
A4(("LSP Graph Enrichment<br/>1 symbol"))
AX(("1 smaller area<br/>1 symbol"))
classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
class A0,A1,A2,A3,A4 reached;
classDef tail fill:#EEF2F3,stroke:#9AA4A9,stroke-width:1px,color:#3A4247;
class AX tail;
Who knows this code — 3 people across 7 areas
Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no All 15 dependent symbols, grouped by areaDependency Graph — 8 symbols in 8 files
Build Analysis — 2 symbols in 2 files
CLI Engine — 2 symbols in 2 files
Build Context — 1 symbol in 1 file
LSP Graph Enrichment — 1 symbol in 1 file
MCP Tools — 1 symbol in 1 file
Test signal per changed area — 1 –Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.
38 test suites also reference this code38 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.
Open the interactive graph → — click an area to see its dependent symbols at file:line. |
|
Thanks for this! I built the graph on PSSlack (55 .ps1/.psm1 files). On main it gives 0 nodes. On your branch it finds all 54 functions and 76 call edges, and Gleam support (#408) just merged and adds a row to GENERIC_LANGS too, so there's now a one-line conflict in src/graph/generic.ts and test/generic-extract.test.ts. Could you rebase onto main and keep both rows? I'll merge right after. Two small follow-ups, not blockers: calls only match with exact casing ( |
Re-landed from #550 with the conflicts against main resolved; the contributor's fork couldn't take the merge commit. Co-Authored-By: Shrish Dwivedi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged as #774 with the conflicts against main resolved (your fork couldn't take the merge from main). The commit on main keeps you as its author. Thank you! |
* Add learning: README language count conflicts across language PRs Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(readme): count 28 languages and list PowerShell Julia, GLSL, Bash and PowerShell landed this week. Each PR's README edit conflicted with the others, so the count was settled once here. TypeScript and JavaScript count separately, as they did for the earlier 24. PowerShell (#550) has call edges but was missing from the list. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Shrish Dwivedi <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
What
Registers PowerShell in the breadth tier and ships its tags.scm:
GENERIC_LANGSrow:{ name: "powershell", exts: [".ps1", ".psm1"], wasm: "powershell" }— thetree-sitter-powershellgrammar is already in thetree-sitter-wasmbundle, so no new dependency.src/graph/queries/powershell.scm:function_statementnames via thefunction_nameleaf token (@definition.function, coversfunction/filter); barecommandinvocations (cmdlets, script functions) as@reference.callfor the existing name resolver.SNIPPETSentry intest/generic-extract.test.tsproving defs + a same-file resolved call edge.Verification
breadth tier: powershell — defs + a call that the resolver resolves)..ps1/.psm1files): 275 function nodes with signatures, 76 same-file resolved call edges;graft ask,callers,callees, andskeletonall return hits.Known grammar limit (documented in the test)
Single-line
function f { param($x) ... }bodies parse as an ERROR region in tree-sitter-powershell and drop that definition; multi-line bodies parse cleanly. Same failure mode as other breadth languages hitting host-grammar quirks.Notes
No depth-tier extension collisions (
.ps1/.psm1are unclaimed). Member-call receiver typing stays out of scope, as with the other breadth languages.