feat: Pascal/Delphi support, pnpm v10 fixes, and cross-platform test improvements#322
Open
jimmckeeth wants to merge 8 commits into
Open
feat: Pascal/Delphi support, pnpm v10 fixes, and cross-platform test improvements#322jimmckeeth wants to merge 8 commits into
jimmckeeth wants to merge 8 commits into
Conversation
- Add allowBuilds: true to pnpm-workspace.yaml for esbuild and all tree-sitter-* packages; pnpm v10+ requires explicit opt-in for packages that run build scripts (ERR_PNPM_IGNORED_BUILDS) - Update pnpm-lock.yaml after successful pnpm install - Add Ensure-Pnpm / ensure_pnpm to install.ps1 and install.sh so the installers automatically install pnpm via corepack (preferred) or npm if it is not already on PATH - Add prerequisites note to README listing Node.js >= 22 and pnpm >= 10
Adds full structural analysis and call graph extraction for Pascal,
Object Pascal (Delphi), and Free Pascal source files using
github:jimmckeeth/tree-sitter-pascal.
- Language config: .pas, .dpr, .lpr, .pp extensions; entry points, test
patterns, and Pascal-specific concept hints
- PascalExtractor: extracts procedures/functions (defProc), class and
interface type declarations (declType + declClass/declIntf), uses-clause
imports (declUses + moduleName), and exports from the interface section
- Call graph: captures exprCall (with-args) and bare statement identifier
calls; handles qualified names (genericDot, operatorDot) for method impls
- WASM build scripts: scripts/build-pascal-wasm.{sh,ps1} via Docker/Emscripten;
pre-built WASM available at jimmckeeth/tree-sitter-pascal releases
- 16 passing tests covering functions, classes, interfaces, imports,
exports, call graph, and a comprehensive realistic unit
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…stall workaround tree-sitter-pascal now ships tree-sitter-pascal.wasm directly in the GitHub repo. Update pnpm-lock.yaml to commit 8212ff0 which includes the pre-built WASM, so pnpm install delivers it automatically. Remove the stale comments in pascal.ts that directed users to download the WASM separately — it is now available via the normal dependency install path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…it checkout When install.sh / install.ps1 is run from a local git working tree (e.g. during development on a feature branch), the installer now detects the current branch and checks it out in the cloned repo at ~/.understand-anything/repo. Falls back gracefully when piped from curl (no git context available). This lets developers test branches end-to-end with a real install path by running the local install.sh / install.ps1 directly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Five fixes for cross-platform test compatibility: - vitest.config.ts: add strip-shebang load plugin so test files can import CLI .mjs scripts that start with #!/usr/bin/env node - worktree-redirect.test.mjs: skip on Windows (bash resolves paths through MSYS /tmp/... while Node.js uses C:\... Windows paths) - merge-recover-imports.test.mjs: skip when python3 is not available (Windows typically lacks python3 in PATH; CI/Linux still runs these) - test_scan_project.test.mjs: use gitInit:false for !pattern negation test so a developer's global gitignore (which may include *.log) cannot shadow the .understandignore negation before createIgnoreFilter sees it — the test is about filter logic, not git enumeration - test_extract_import_map.test.mjs: skip tree-sitter init graceful failure test on Windows (ESM loader hooks don't reliably intercept module resolution there) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 tasks
…gonex-AI#183 - Extend StructuralAnalysis types with optional parents[], interfaces[], and imports[].section ("interface"|"implementation") — backward compatible - PascalExtractor now emits parents/interfaces from declClass/declIntf typeref ancestors, and tags each import with its Pascal section - extract-structure.mjs surfaces parents, interfaces, and section in JSON output - Add emit-dfm-pairs.mjs: post-merge helper that wires .pas↔.dfm related edges - Add resolve-external-class-refs.mjs: generic post-merge pass that rewires cross-batch class:external:<Name> inheritance edges to actual node IDs - Add skills/understand/languages/pascal.md: LLM prompt snippet for Pascal/Delphi Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ebc7871 to
52f9746
Compare
Port the inheritance/interface fields from Egonex-AI PR Egonex-AI#183 to all existing language extractors, using each language's native AST nodes: - TypeScript/JS: class_heritage → extends_clause (parents) + implements_clause (interfaces) - Java: superclass field (parents) + interfaces field (interfaces); interface extends_interfaces (parents) - C#: base_list with I-prefix heuristic to split parents vs interfaces - Python: superclasses argument_list → parents (no syntactic interface distinction) - PHP: base_clause (parents) + class_interface_clause (interfaces) - Ruby: superclass field (parents) + include/prepend/extend calls (interfaces) - Go: embedded struct fields (no field_identifier child) → parents for method promotion - C++: base_class_clause → parents (no syntactic interface concept) - Rust: trait supertrait bounds → parents; impl Trait for Type → interfaces via traitsByType pass Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
|
I rebased, resolved conflicts, and integrated the changes from the similar PR #183 by @Cameron64 |
The Wasmer Registry (jimmckeeth/tree-sitter-pascal) and PyPI packages ship non-npm formats that can't be consumed by web-tree-sitter's require.resolve() mechanism. Follow the same pattern used for Dart: vendor the pre-built WASM from the v0.11.0 GitHub release into a workspace package. - Add packages/tree-sitter-pascal-wasm/ with tree-sitter-pascal.wasm (v0.11.0, 964 KB) — resolves via require.resolve() just like all other grammars - Switch core package.json from "tree-sitter-pascal": "github:jimmckeeth/..." to "@understand-anything/tree-sitter-pascal-wasm": "workspace:*" - Update pascal.ts language config: wasmPackage → "@understand-anything/tree-sitter-pascal-wasm" - Remove tree-sitter-pascal from pnpm-workspace.yaml allowBuilds (no build scripts needed for a vendored WASM); fix the Kotlin allowBuilds entry that was previously left as "set this to true or false" - Update pnpm-lock.yaml Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tree-sitter-pascal(own grammar atgithub:jimmckeeth/tree-sitter-pascal), with WASM now pre-built and bundled in the npm package — no manual download step neededallowBuildsfix —pnpm-workspace.yamlhad placeholder text instead oftruevalues, causingERR_PNPM_IGNORED_BUILDSfor all tree-sitter packages and esbuildinstall.sh/install.ps1now attempt to install pnpm if it's missing, rather than failing with an unhelpful errorinstall.sh/install.ps1from a local git checkout (e.g. on a feature branch), the installer checks out the same branch in~/.understand-anything/repopnpm testpasses on Windows without Python or bash in PATH (shebang-strip vitest plugin, conditional skips for bash/Python-dependent tests, test isolation fix for!patternnegation)Test plan
pnpm install && pnpm testpasses (14 pass, 2 skipped on Linux; all 16 pass/skip on Windows)pnpm --filter @understand-anything/core testpasses.pas/.dprfiles are recognized and parsed in the/understandskillpnpm-workspace.yamlallowBuildsentries aretrue(not placeholder text)🤖 Generated with Claude Code