project

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package project reads .jade/project.json: a repository's own statement of how Jade should build, check and test it, committed next to the code the way an editor keeps its settings in .vscode/.

Discovery guesses from manifests, and the pilot benchmark showed where guessing goes wrong: a Makefile's `python -m pytest` ran the system interpreter, `npm run test` ran lint, build and browser suites for a one-file check, and a Go module with Node packages beside it could not say what "build" meant. A declared config answers those once. Empty fields fall back to discovery, so a config can state only what discovery gets wrong.

Index

Constants

View Source
const (
	Dir  = ".jade"
	File = "project.json"
)

Dir and File locate the config inside the workspace, beside commands.json.

View Source
const Source = ".jade/project.json"

Source names the config in responses that say where a command came from.

Variables

View Source
var RelPath = filepath.Join(Dir, File)

RelPath is the config's path relative to the workspace root.

Functions

func Quote

func Quote(s string) string

Quote quotes s for a POSIX shell.

Types

type Area

type Area struct {
	Path      string `json:"path"`
	Language  string `json:"language,omitempty"`
	Build     string `json:"build,omitempty"`
	Typecheck string `json:"typecheck,omitempty"`
	Test      string `json:"test,omitempty"`
	// TestFile runs one test file; {file} is the file relative to the area.
	TestFile string `json:"testFile,omitempty"`
	// TestName runs tests by name; {name} is the name, {file} optionally the
	// file it is in.
	TestName string `json:"testName,omitempty"`
}

Area is one part of the repository with its own language and commands. Its commands run inside its path.

type Config

type Config struct {
	Areas []Area `json:"areas"`
	Env   Env    `json:"env,omitzero"`
	// Generated lists paths searches skip: build output, generated code.
	Generated []string `json:"generated,omitempty"`
	// Notes is short guidance for the agent, sent when a session starts.
	Notes string `json:"notes,omitempty"`
}

Config is a parsed .jade/project.json.

func Load

func Load(root string) (*Config, error)

Load reads the config for the workspace at root. A missing file is not an error and returns nil; a file that does not parse, names an unknown field or a path outside the workspace is, because acting on half a config would run commands nobody declared.

func (*Config) AreaFor

func (c *Config) AreaFor(file string) (Area, bool)

AreaFor is the area a workspace-relative file belongs to: the deepest area whose path contains it.

func (*Config) Command

func (c *Config) Command(kind string) (string, bool)

Command is the shell command for a check kind (build, typecheck, tests) across every area that declares one, each run inside its area.

func (*Config) IsGenerated

func (c *Config) IsGenerated(rel string) bool

IsGenerated reports a workspace-relative path the config marks generated: the path itself, anything under it, or a match of a glob entry.

func (*Config) PythonBinDir

func (c *Config) PythonBinDir(root string) string

PythonBinDir is the directory of the configured interpreter, for PATH.

func (*Config) Summary

func (c *Config) Summary() string

Summary lists the areas for a session's opening instructions.

func (*Config) TestFileCommand

func (c *Config) TestFileCommand(file string) (string, bool)

TestFileCommand runs one test file with its area's testFile command.

func (*Config) TestNameCommand

func (c *Config) TestNameCommand(file string, name string) (string, bool)

TestNameCommand runs tests by name with the testName command of the file's area, or of the root area when no file is given.

type Env

type Env struct {
	// Python is the interpreter commands should find first on PATH, e.g.
	// .venv/bin/python.
	Python string            `json:"python,omitempty"`
	Vars   map[string]string `json:"vars,omitempty"`
}

Env is the environment commands run in.

Jump to

Keyboard shortcuts

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