Skip to content
A simple 2D 8-bit style illustration at 128x128 pixels displays a geometric computer screen with two overlapping windows. One window shows code snippets, and the other features icons for version control. Additional symbols include a cloud for sharing, a stylized lock symbolizing secret content, a gear for settings, and a minimalistic folder. The color palette uses five solid corporate colors in a flat, minimalist design with no people, text, shadows, or background.

GitHub Gists

GitHub Gists are a simple way to share code snippets and notes with others. They are essentially Git repositories that can be created and shared easily. Gists can be public or secret, and they support versioning, making them a great tool for collaboration.

A screenshot of GistPad in Visual Studio Code

Running GenAIScript from Gists

GenAIScript supports the following URL formats to run scripts directly from a gist.

  • gist://<gist id>/<file name>
  • vscode://vsls-contrib.gistfs/open?gist=<gist id>&file=<file>
Terminal window
genaiscript run gist://8f7db2674f7b0eaaf563eae28253c2b0/poem.genai.mts

The gist file is cached locally in .genaiscript/resources then executed. If available, it uses the GitHub login information to access private gists.

GistPad in Visual Studio code

The GistPad extension for Visual Studio Code allows you to create, edit, and manage gists directly from your editor.

You can open a file in a Gist and run it using the genaiscript command.

Type Checking

To get type checking working, we need to upload the genaiscript.d.ts to the gist and setup a reference to it by adding this comment at the top of the file:

/// <reference path="./genaiscript.d.ts" />

This can be done automatically:

  • right click on the Gist GenAIScript file
  • select GenAIScript: Fix Type Definitions
  • You might be prompted to allow GenAIScript to use your GitHub account. GenAIScript will request a token with gist scope to upload the missing files.

In order to load the GenAIScript types, you’ll need to “nudge” the TypeScript compiler:

  • open the genaiscript.d.ts file from the GistPad tree (this loads the types in memory)
  • open your GenAIScript file in the GistPad tree and it should have type checking!

Limitations

Since the GistPad extension is not a full-fledged IDE, there are some limitations to be aware of:

  • imports will probably not resolve