Repository navigation
Conversation
Newer grammar releases in the tree-sitter ecosystem require the 0.25 runtime, so bump tree-sitter ^0.21.1→^0.25.0 and the Python/Go grammars to ^0.25.0 to unlock languages whose grammars need it. tree-sitter-typescript stays pinned at ^0.23.2 (still the latest release) — it declares peerOptional tree-sitter@^0.21.0, so an npm `overrides` entry pins its nested tree-sitter to the root one so the repo-root install resolves cleanly; verified the grammar's native binding still loads and parses correctly under tree-sitter 0.25.1. Also updates the stale-parse-limit comment in extract.ts: the chunked callback parse predates 0.25 (which lifted the 32KB string-parse limit) and is kept because it's behavior-identical and exercised by existing tests. No behavior change; full suite green (493/493).
Use stable syntax-node IDs to avoid duplicate reference edges and align the supported Node version with native Windows prebuilds.
Adds the PowerShell language to extract.ts: describePowerShell recognizes function/class/enum/method statements, psCalleeName/psImportKind/ psImportSpecifier classify commands (dot-source, Import-Module, using module) versus real calls, and psExported covers PowerShell's lack of a file-local export marker. bindings.ts's FileBindings gains a case-insensitive mode and PowerShell-specific defName/resolveRecvType handling ($this, scope-qualified definition names).
…, builtin cmdlets resolve.ts bundles the name-lookup and owner-index maps (NameIndex/ OwnerIndex) and adds a PowerShell case-folded tier alongside the existing exact-match one: same-file exact wins first, then same-file case-folded, then whole-repo exact, then whole-repo case-folded. A PowerShell caller that isn't itself a test file demotes test-path candidates at the two global tiers before the uniqueness check, so Pester's habit of redeclaring a prod name across several *.Tests.ps1 files doesn't drop every cross-file call as ambiguous. PS_BUILTIN_CMDLETS denylists the core cmdlet/Pester-DSL surface so a call to a builtin never wires to an unrelated in-repo definition of the same name. $PSScriptRoot resolves as a literal for import paths, and PS_IMPORT_EXTS keeps PowerShell's module extensions from cross-matching TS/Python specifiers. isTestPath moves to its own src/util/testpath.ts (a hard graph-topology input for resolve.ts now, not just ask.ts's soft rank-penalty); ask.ts re-exports it for backward compatibility.
CODE_EXTENSIONS picks up .ps1/.psm1/.psd1; isTestPath recognizes .tests.ps1 (Pester's naming convention). New test/graph-powershell.test.ts, test/testpath.test.ts, and test/utf16-routing.test.ts cover PowerShell graph extraction/resolution end-to-end and the UTF-16LE decode path. Every existing test file touched by the case-folding, test-aware tie-break, builtin-cmdlet denylist, and ingest changes is extended with PowerShell-specific coverage alongside its existing cases.
|
Added a domain-isolation fix found while extending the language work: PowerShell method nodes were entering the shared member-owner index, so a typed member call from another language could in principle wire cross-language to a PS class method. PS methods (and PS heritage edges) now live only in their own indexes, mirroring how PS bare names were already isolated. Suite is 621/621 on the branch. |
…nd Rust behaviour Records the verified starting point before any Rust work: PR trailhq#40/trailhq#58/trailhq#59 heads double-checked via the GitHub API and git ls-remote, strict-containment proof of the stack, and the finding that the stack carries no upstream CI signal at all. Suite on the pinned head is 638/645 with 3 failures. All three are an upstream locale defect (bare toLocaleString() resolving to ar-SA digits), reproduced verbatim on main and untouched by any Rust commit, so they are attributed upstream rather than counted as a Rust regression. Fix is deliberately deferred to its own commit. Also records measured behaviour on a Cargo workspace fixture: what already resolves, and the six gaps that Batches B-J exist to close — chiefly that cross-crate symbol imports never resolve because module-path resolution maps paths to files only. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Which tier do you want PowerShell in — if you want it at all? I'd rather rebase once, toward whatever you'd actually merge. Default plan is the breadth row unless you say otherwise. The constraint that decides it: every published The breadth row has no such problem. Worth stating plainly rather than letting it turn up mid-review. A breadth row carries the definitions (functions incl. Independent of the answer: main's This branch predates |
🌱 graft blast radius4 areas changed → 6 areas can be affected. 24 dependent symbols, depth 2. flowchart TB
A0(("Workspace Graph Freshness<br/>10 symbols"))
A1(("CLI Engine Integration<br/>5 symbols"))
A2(("MCP Tool Dispatch<br/>5 symbols"))
A3(("Grep Search<br/>2 symbols"))
A4(("Context Validation<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;
All 24 dependent symbols, grouped by areaWorkspace Graph Freshness — 10 symbols in 5 files
CLI Engine Integration — 5 symbols in 2 files
MCP Tool Dispatch — 5 symbols in 2 files
Grep Search — 2 symbols in 2 files
Context Validation — 1 symbol in 1 file
Claude Hooks — 1 symbol in 1 file
Test signal per changed area — 2 ✓ · 2 –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.
15 test suites also reference this code16 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 all the work on this, and for the careful write-up on the tier question! This branch is stacked on #40 and now conflicts with main in 9 files, including extract.ts, resolve.ts, bindings.ts and check.ts. As you noted, the native version cannot be rebased onto main until the runtime moves. |
Tier-1 graph extraction for PowerShell via tree-sitter-powershell (airbus-cert; prebuilds for all six platform/arch combos — the reason #40's 0.25 runtime bump is the prerequisite).
What
filter/workflow), classes, methods & constructors, enums.exported=truefor top-level defs and class members; functions nested inside functions/methods are scope-local → false. (PowerShell has no file-local export syntax;Export-ModuleMember/manifest interpretation is cross-file and deferred — see limitations.)script:Foo,Mod\Get-Foo), member calls$obj.M(), static calls[Type]::M(), call-operator statics& Get-Foo. Dynamic invocation (& $var) produces no edge.. ./x.ps1, quoted paths, backslash-normalized),Import-Modulewith relative paths (module names stay external specifiers, like Go stdlib imports),using module(extracted from its command shape — the grammar has no dedicated node).FOOcan never link to a Pythonfoo), original casing preserved everywhere, lookup order exact-local → folded-local → exact-global → folded-global (local scope wins, matching PS semantics). Folded matches surface asconfidence: "inferred".[Parameter(...)][Widget]$w), typed properties, cast declarations,[Widget]::new(),New-Object(positional and-TypeName),$this→ enclosing class.Get-ChildItem,Describe, …) never bind to a same-named in-repo definition (usually a Pester mock) — dropped-edge-is-safe, the same posture the resolver already takes for unresolvable member calls..ps1(Windows PowerShell 5.1Out-Filedefault) decoded at the sharedreadSourceFilesite (hash-what-you-parse holds); Pester*.Tests.ps1classified as test files and de-ranked accordingly;.psd1deliberately not graph-parsed (manifests yield no definitions).tree-sitter-powershell/bindings/node/index.js) avoids a DEP0151 warning on every CLI run (package has extensionlessmain+ noexportsmap).Fit with recent main
This was originally built against pre-0.9.0 main and re-anchored after the recent landings; the seams were adapted rather than ported blind:
initwrites for Claude Code #36): PowerShell slots into theEXTENSIONStable as two rows (.ps1/.psm1→ grammarpowershell, labelpowershell), so the banner/map coverage report is correct by construction.callersmisses consumers that reference a function without calling it directly #34): the "don't descend into import statements" rule gets one PS carve-out — a dot-source can wrap a whole script block (. { ... }), whose body must still be walked for its own calls. Pinned by test.mapclusters one entry per file instead of per directory #35): PS member calls inherit the drop-don't-guess rule unchanged; the PS case-folding applies insideresolveTypedMember's owner-qualified lookup, never as a bare-name fallback.readSourceFilecontracts as every other language — no PS-specific read or walk path exists.Evidence
Stop-Function, 2,857 call sites, shadowed by 10 Pester mocks) resolves 726 incoming call edges to its production definition.$PSScriptRootresolution (was 0/30); the 6 unresolved are genuinely dynamic (runtime variables) and stay raw by design. Re-verified on this exact branch post-rebase, including byte-identical cold-rebuild determinism.Known limitations (deliberate)
Export-ModuleMember/ manifestFunctionsToExportnot interpreted (uniformexported=trueinstead) — the common unquoted multi-name idiom doesn't parse in the current grammar anyway.$PSScriptRoot-interpolated,Join-Path-computed, and wildcard import arguments degrade to raw specifiers..psd1manifest relationships (RootModule/NestedModules) not graphed.extends(PS cannot define interfaces; targets stay external names).