codecheck

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 6 Imported by: ? 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 codecheck gives the agent immediate syntax feedback on the files it writes: after write_file or edit_file, a cheap per-extension command checks the file and its complaint is appended to the tool result, so a broken edit is fixed in the next step instead of surfacing at the end of a test run. It is deliberately not a language server: no project build, no type check.

Index

Constants

View Source
const Timeout = 20 * time.Second

Timeout bounds one check.

Variables

View Source
var Defaults = map[string]string{
	".go":   "gofmt -e {path} >/dev/null",
	".py":   "python3 -m py_compile {path}",
	".json": "python3 -m json.tool {path} >/dev/null",
	".js":   "node --check {path}",
	".mjs":  "node --check {path}",
	".sh":   "bash -n {path}",
	".rb":   "ruby -c {path} >/dev/null",
	".php":  "php -l {path} >/dev/null",
}

Defaults are syntax-only checks; {path} is the shell-quoted file. A check whose first word is not installed is skipped silently.

Functions

func Parse

func Parse(s string) (map[string]string, error)

Parse reads "ext=command;ext=command" (CODE_CHECKS).

Types

type Checker

type Checker struct {
	// Commands maps a lower-case extension (".go") to a shell command with {path}.
	Commands map[string]string
}

Checker runs the checks.

func New

func New(extra map[string]string) *Checker

New returns a Checker with the Defaults overridden by extra (an entry with an empty command disables an extension).

func (*Checker) Check

func (c *Checker) Check(ctx context.Context, sb sandbox.Sandbox, p string) string

Check runs the command of p's extension in sb and returns the notice for the model: "" when the file is fine, has no check, or the tool is not installed.

Jump to

Keyboard shortcuts

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