Skip to content
A small, flat, square illustration shows a plain file folder with three simple geometric icons rising from it: a rectangle marked ".js," another marked ".ts," and a third icon featuring a basic gear shape. The design uses five bold, contrasting corporate colors and is composed of only clean, flat shapes without any background or decorative effects. There are no people, textures, or dimensional shading. The image is limited to a 128x128 pixel size and is designed to be immediately recognizable and iconic.

Overview

GenAIScript are JavaScript files named as *.genai.mjs, or TypeScript files named as *.genai.mts, with a prompt creation engine designed by LLM prompting.

shorten.genai.mjs
script({
title: "Shorten", // displayed in UI and Copilot Chat
// also displayed but grayed out:
description:
"A prompt that shrinks the size of text without losing meaning",
})
// but the variable is appropriately delimited
const file = def("FILE", env.files)
// this appends text to the prompt
$`Shorten ${file}. Limit changes to minimum.`

Script files

  • GenAIScript will detect any file matching *.genai.mjs, *.genai.js, *.genai.mts in your workspace.
  • GenAIScript files can be placed anywhere in your workspace; but the extension will place them in a genaisrc folder by default.
  • .genai.mjs use module JavaScript syntax and support imports.
  • .genai.js are eval-ed and do not support imports.
  • .genai.mts are TypeScript module files and support imports, including dynamic imports of other TypeScript files.
  • Directory/genaisrc
    • jsconfig.json // TypeScript compiler configuration
    • genaiscript.d.ts // TypeScript definitions
    • myscript.genai.mjs // your script!

Topics