Skip to content

Latest commit

 

History

History
67 lines (52 loc) · 2.55 KB

README.md

File metadata and controls

67 lines (52 loc) · 2.55 KB

vis-lang-interface

The shared contract for Vis language extensions. It gives tools such as clj.lint_code and py.lint_code the same result types and Activity presentation.

Install

Add the contract to your extension's pyproject.toml:

[project]
dependencies = [
  "vis-agent>=0.8.0",
  "vis-lang-interface @ git+https://github.com/Blockether/vis-lang-interface@v5.0.0",
]

Runtimes

Vis loads the package for the runtime that you select. The package adds no tools. When you build a Babashka extension, add a dependency on this repository in babashka/bb.edn:

{:deps {com.blockether/vis-lang-interface
        {:git/url "https://github.com/Blockether/vis-lang-interface.git"
         :git/sha "<full commit SHA>"
         :deps/root "babashka"}}}

Import vis-lang-interface.results to build shared result maps. Import vis-lang-interface.project and vis-lang-interface.changes to select files and count changes. The process and runtime namespaces require jailed process services in the Vis SDK. They report an error if Vis does not supply these services. They do not use Vis Python.

Use

Run the project's language tools and return the shared result types. This package supplies no parser and registers no tools of its own.

Module Purpose
results Return diagnostics and results for formatting, lint, syntax, tests, coverage, builds and REPLs.
changes Count added and removed lines after formatting.
process Start a language tool and collect its output.
runtime Start a runtime that stays active between calls.
project Find project roots and source files, and normalize list arguments.
presentation Show language results in Vis Activity.
syntax Check changed files with the language parser and repair them when safe.
prompt Tell the model which tools to use and when to use them.

For examples and API details, see the language extension reference. For extensions that use this contract, see vis-lang-clojure and vis-lang-python.

Development

vis-agent python --shared -m pytest tests -q
(cd babashka && bb test)

Install Babashka to compare JSON results from both runtimes. Set VIS_CONTRACT_SCHEMA_DIR to packages/vis-contract/resources/vis-contract/schema in your Vis checkout to check the package and result schemas. These checks also need jsonschema in your test environment.