codemode

package
v0.16.397 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package codemode reads the JavaScript Codex sends to its "exec" tool in code mode and says in plain words what the script does. There is no JavaScript engine here: a small scanner finds the tools.<name>(...) calls and reads the literal arguments it can; anything it cannot read is left out of the summary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

type Call struct {
	Name string
	Arg  any
}

Call is one tools.<Name>(Arg) call found in a script. Arg is a string, an []any, an *Object, or nil when the argument is not a literal.

func Calls

func Calls(js string) []Call

Calls lists the tools.<name>(...) calls of a script in source order, skipping text inside strings and comments.

type Description

type Description struct {
	Tool    string
	Summary string
	// Images is set when the script draws pictures.
	Images *ImageCall
	// Commands are the shell commands the script runs, whole, in order: what a delivery or a page it opened is read
	// from, past the summary's first line.
	Commands []string
}

Description is what one script does: the tool to show it under and a one-line summary.

func Describe

func Describe(js string) Description

Describe summarizes a code-mode script.

type ImageCall added in v0.16.86

type ImageCall struct {
	Count  int
	Prompt string
	Shape  string
}

ImageCall is the picture drawing a script asks for: Count pictures, the first brief as Prompt.

type Object

type Object struct {
	// contains filtered or unexported fields
}

Object is an object literal: its keys in source order and the values the scanner could read (nil for an expression).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL