Skip to content

feat: add ci workflow, update queries, and add print statements#28

Merged
davem-intersys merged 4 commits intointersystems:mainfrom
hkimura-intersys:workflows
Mar 13, 2026
Merged

feat: add ci workflow, update queries, and add print statements#28
davem-intersys merged 4 commits intointersystems:mainfrom
hkimura-intersys:workflows

Conversation

@hkimura-intersys
Copy link
Collaborator

Overview

This PR adds the required workflows and query updates needed to be added as a tree-sitter grammar in the nvimtreesitter repo.

Key Changes

  • Added/updated CI and release automation workflows.
  • Added npm and PyPI publishing jobs.
  • Split Rust publishing into two crates:
    • tree-sitter-objectscript (UDL grammar)
    • tree-sitter-objectscript-playground (playground grammar)
  • Added ObjectScript PRINT/ZPRINT parsing support and corpus tests.
  • Refined bindings coverage and packaging layout (Node, Python, Go, Rust).
  • Added query sync automation (scripts/sync_queries.py) and git pre-commit hook.

Workflow Changes (Detailed)

.github/workflows/ci.yml

  • Triggered on push, pull_request (branch main), and workflow_dispatch.
  • Adds concurrency cancellation for in-progress duplicate runs.
  • test job:
    • Matrix OS: Ubuntu/Windows/macOS.
    • Uses tree-sitter/parser-test-action@v3.
    • Tests parser + Rust + Node + Python + Go + Swift.
    • Runs parser tests for all 4 grammar directories (objectscript, udl, core, expr).
  • query job:
    • Installs ts_query_ls.
    • Runs make checkquery.
  • examples job:
    • Parses all examples/*.cls files with UDL parser.

.github/workflows/lint.yml

  • Triggered on push, pull_request (branch main), and workflow_dispatch.
  • lint_js job:
    • Uses Node 22.
    • Uses npm ci --legacy-peer-deps --ignore-scripts.
    • Runs ESLint (npm run lint).
  • lint_queries job:
    • Uses ts_query_ls.
    • Runs make formatquery and fails if formatting changed query files.
    • Runs make lintquery.

.github/workflows/fuzz.yml

  • Triggered on push, pull_request (branch main), and workflow_dispatch.
  • Runs scanner fuzzing via tree-sitter/fuzz-action@v4.
  • Matrix over objectscript, udl, core.
  • Includes guard to skip template/initial-commit scenarios.
  • Fuzz run is conditional on scanner changes (common/scanner.h) or missing parent commit.

.github/workflows/sync-queries.yml

  • Triggered on push, pull_request (branch main), and workflow_dispatch.
  • Verifies Python query directories stay synced with source query directories.
  • Executes:
    • python3 scripts/sync_queries.py --check-python

.github/workflows/publish.yml

  • Triggered on tag push (on.push.tags: ["*"]).
  • Permissions include contents, id-token, and attestations.
  • Every publish job is guarded with if: github.repository == 'intersystems/tree-sitter-objectscript'.
  • Jobs:
    • github: reusable tree-sitter/workflows release workflow (generate: true).
    • npm: reusable npm package workflow with NPM_TOKEN.
    • pypi: reusable PyPI package workflow with PYPI_API_TOKEN.
    • crates: reusable crates.io workflow with CARGO_REGISTRY_TOKEN.
    • crates_playground: custom publish job for tree-sitter-objectscript-playground, using scripts/rust_playground_crate.sh publish.

Publishing and Package Distribution

Package Links

npm

  • Package metadata/versioning updated for release (1.5.1).
  • package.json files expanded to include core and expr grammar/query/source assets, in addition to objectscript and udl.
  • Node engine constraints documented via .nvmrc (Node 22) and engines.

PyPI

  • pyproject.toml updated:
    • Version 1.5.1
    • requires-python bumped to >=3.9
    • cibuildwheel selector changed from cp38-* to cp39-*
  • Python packaging narrowed to primary grammar packages:
    • tree_sitter_objectscript
    • tree_sitter_objectscript_udl
  • Query distribution now managed through sync script + checks.

crates.io (Rust)

  • Root crate tree-sitter-objectscript now targets UDL grammar only.
  • New crate template added: bindings/rust-playground/ for tree-sitter-objectscript-playground.
  • Added scripts/rust_playground_crate.sh to stage/package/publish playground crate from canonical sources without committing duplicate payload.
  • Updated crate readmes:
    • cargo_readme.md (UDL crate)
    • cargo_readme_playground.md (playground crate)

Binding Changes

Node bindings

  • Removed objectscript_core and objectscript_expr exports from Node native binding and TypeScript declarations.
  • Node package now exposes:
    • objectscript
    • objectscript_udl
  • Updated tests accordingly.
  • binding.gyp trimmed to compile only objectscript + UDL C sources.

Python bindings

  • Tests reduced to objectscript and objectscript_udl modules.
  • Packaging (setup.py) adjusted to include only these two Python packages and their query files.
  • Added query synchronization tooling:
    • scripts/sync_queries.py
    • .githooks/pre-commit auto-runs sync and stages generated query updates.
  • Added workflow enforcement (sync-queries.yml) to prevent divergence.

Go bindings

  • Reorganized Go binding files into top-level bindings/go/*.go.
  • Added a consolidated bindings/go/binding_test.go.
  • Maintains loadable language accessors for:
    • objectscript
    • objectscript_udl
    • objectscript_core
    • objectscript_expr

Rust bindings

  • bindings/rust now compiles only UDL parser/scanner and exposes UDL query/node-type constants.
  • Added separate bindings/rust-playground crate target for playground grammar.
  • Publish automation supports both Rust crates.

Grammar Feature: PRINT and ZPRINT

Added language support

  • Added new statement rule in core/grammar.js:
    • print_statement
    • print_argument
  • Added keywords:
    • keyword_print (P/PRINT)
    • keyword_zprint (ZP/ZPRINT)
  • Supports:
    • argumentless forms (PRINT, ZPRINT, abbreviations)
    • postconditionals (PRINT:pc)
    • line references and ranges (label^routine:label^routine)
    • indirection in line references

Added tests

Added tests for the print/zprint statements

Query lint/ changes

  • Add .tsqueryrc.json, which is used in the lint workflow to verify the queries are valid according to nvimtreesitter standards
  • Added scripts/sync_queries.py for layered query composition and Python query copying. Now, for example, udl highlights.scm file contains all the highlights it needs (expr + core + udl).
  • Make targets added/updated for query format/lint/check (formatquery, lintquery, checkquery, query).
  • Added hook installer target and repository hook path configuration (make installhooks).

Documentation

  • Added CONTRIBUTING.md.
  • Refactored README.md into concise overview + links to contributing instructions.
  • Added issue templates under .github/ISSUE_TEMPLATE/.

the workflow added includes:
- ci.yml: runs parser tests for all four grammar directories,
          and runs the bindings tests (rust + node + python + go + swift)
- lint.yml: runs eslint on .js files, and runs lint job on queries, making
            sure they follow the same standards as nvimtreesitter
- fuzz.yml: runs scanner fuzzing
- sync-queries.yml: Verifies Python query directories stay synced with source query directories.
- publish.yml: publishes a new npm package, pypi package, and two rust crates for tree-sitter-objectscript

the query changes were done to follow nvimtreesitter query rules.

finally zprint and print statements were added to the core grammar.
Squashed commit of the following:

commit 714be7c
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Thu Mar 12 21:13:30 2026 -0400

    testing

commit 2ae1abf
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Thu Mar 12 17:12:20 2026 -0400

    fix: split up rust crates into playground and udl crates.

commit 36aaced
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Thu Mar 12 15:19:36 2026 -0400

    use commit that uses supported runner labels

commit 17ffccb
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Thu Mar 12 15:16:01 2026 -0400

    fix: remove attestations

commit e146e7d
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Thu Mar 12 15:11:54 2026 -0400

    fix: pin specific commit for pypi and npm job

commit fbb7a76
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Thu Mar 12 14:48:18 2026 -0400

    remove attestations

commit 728cc32
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Thu Mar 12 14:34:55 2026 -0400

    chore: bump version to 1.5.0

commit d507f86
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Thu Mar 12 09:38:56 2026 -0400

    chore: bump npx tree-sitter-cli version to 0.26.6

commit d3cb5d5
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Thu Mar 12 00:10:20 2026 -0400

    fix: enable npm ci in lint job and fix grammars lint issues

commit afcb75a
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Wed Mar 11 23:51:45 2026 -0400

    fix(package-json.lock): remove package-json.lock from gitignore so the install modules step works as intended

commit 0795fc5
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Wed Mar 11 23:33:49 2026 -0400

    fix: set node-version in actions/setup-node

commit c76600a
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Wed Mar 11 23:29:40 2026 -0400

    update paths for testing

commit 8363c52
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Wed Mar 11 23:27:45 2026 -0400

    fix: pin node version in test job

commit f2a5c03
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Wed Mar 11 23:13:48 2026 -0400

    add git hook to automate updating queries

commit d089e3b
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Wed Mar 11 22:46:53 2026 -0400

    feature: add workflow that automatically syncs query files

    workflow added so that when a commit is added and a query file
    was changed, the  workflow automatically syncs query files such
    that the udl highlights file contains the highlights from expr, core,
    and udl,
    and the core highlights file contains the highlights from core and expr,
    and the expr highlights is just the expr highlights. This also updates
    the queries in the python binding.

commit 4a2a181
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Wed Mar 11 21:04:40 2026 -0400

    fix: read grammar path and name from tree-sitter.json

commit c79712f
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Wed Mar 11 20:27:32 2026 -0400

    fix(package.json): update tree-sitter-cli version

commit ba0c19f
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Wed Mar 11 17:07:01 2026 -0400

    fix: update common/grammar.js to common/define_grammar.js for test job in workflow to work.

commit ee2c6a7
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Wed Mar 11 16:34:35 2026 -0400

    fix: update package.json with name field

commit e61082d
Author: Hannah <hannah.kimura@intersystems.com>
Date:   Wed Mar 11 16:19:58 2026 -0400

    feat(workflow): add ci workflow
@davem-intersys davem-intersys merged commit 7aa0196 into intersystems:main Mar 13, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants