mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-04-09 03:02:26 -04:00
## Description
This change introduces a new tool for compiling local Dataform projects.
The new tool, `dataform-compile`, allows users to programmatically run
the `dataform compile` command against a project on the local
filesystem. This tool does not require a `source` and instead relies on
the `dataform` CLI being available in the server's `PATH`.
### Changes:
* Added the new tool definition in
`internal/tools/dataformcompile/dataformcompile.go`.
* The tool requires the following parameter:
* `project_dir`: The local Dataform project directory to compile.
* The tool uses `os/exec` to run the `dataform compile --json` command
and parses the resulting JSON output.
* Added a new integration test in
`internal/tools/dataformcompile/dataformcompile_test.go` which:
* Skips the test if the `dataform` CLI is not found in the `PATH`.
* Uses `dataform init` to create a temporary, minimal project for
testing.
* Verifies success, missing parameter errors, and errors from a
non-existent directory.
---
> Should include a concise description of the changes (bug or feature),
it's
> impact, along with a summary of the solution
## PR Checklist
---
> Thank you for opening a Pull Request! Before submitting your PR, there
are a
> few things you can do to make sure it goes smoothly:
- [x] Make sure you reviewed
[CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md)
- [x] Make sure to open an issue as a
[bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose)
before writing your code! That way we can discuss the change, evaluate
designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)
- [x] Make sure to add `!` if this involve a breaking change
🛠️ Fixes #1469
---------
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
1.6 KiB
1.6 KiB
title, type, weight, description, aliases
| title | type | weight | description | aliases | |
|---|---|---|---|---|---|
| dataform-compile-local | docs | 1 | A "dataform-compile-local" tool runs the `dataform compile` CLI command on a local project directory. |
|
About
A dataform-compile-local tool runs the dataform compile command on a local Dataform project.
It is a standalone tool and is not compatible with any sources.
At invocation time, the tool executes dataform compile --json in the specified project directory and returns the resulting JSON object from the CLI.
dataform-compile-local takes the following parameter:
project_dir(string): The absolute or relative path to the local Dataform project directory. The server process must have read access to this path.
Requirements
Dataform CLI
This tool executes the dataform command-line interface (CLI) via a system call. You must have the dataform CLI installed and available in the server's system PATH.
You can typically install the CLI via npm:
npm install -g @dataform/cli
See the official Dataform documentation for more details.
Example
tools:
my_dataform_compiler:
kind: dataform-compile-local
description: Use this tool to compile a local Dataform project.
Reference
| field | type | required | description |
|---|---|---|---|
| kind | string | true | Must be "dataform-compile-local". |
| description | string | true | Description of the tool that is passed to the LLM. |