Skip to content

Latest commit

 

History

History
61 lines (44 loc) · 1.76 KB

File metadata and controls

61 lines (44 loc) · 1.76 KB

tool_template_typescript

Template repository for building a TypeScript tool that follows the Tool Specification container contract.

Use this template when you want TypeScript with generated typings. For plain JavaScript, use tool_template_node instead.

How gotap works here

This template installs gotap inside the image and uses it as the default runtime shim:

CMD ["gotap", "run", "foobar", "--input-file", "/in/input.json"]

At build time, gotap generate creates parameters.ts from src/tool.yml. At runtime, run.ts uses the generated bindings to validate /in/input.json, load typed parameters and data paths, and write structured run logs.

Required file structure

/
|- in/
|  |- input.json
|- out/
|  |- ...
|- src/
|  |- tool.yml
|  |- run.ts
|  |- parameters.ts   (generated at build time)
|  |- CITATION.cff

Build and run

docker build -t tbr_typescript_template .
docker run --rm -it \
  -v "$(pwd)/in:/in" \
  -v "$(pwd)/out:/out" \
  -e TOOL_RUN=foobar \
  tbr_typescript_template

TOOL_RUN is only needed when the image contains more than one tool entry.

Customize

  1. Update src/tool.yml to describe your tool.
  2. Add dependencies in Dockerfile.
  3. Implement the tool logic in src/run.ts.
  4. Rebuild the image so gotap generate refreshes parameters.ts.

Generated bindings and logging

The generated parameters.ts file is not edited by hand. It exposes:

  • getParameters()
  • getData()
  • getRunContext()
  • getLogger()

The starter runtime uses getLogger() for structured JSON Lines logging and still prints the sample parsed input to standard output.