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
- Variables
- func Quote(s string) string
- type Area
- type Config
- func (c *Config) AreaFor(file string) (Area, bool)
- func (c *Config) Command(kind string) (string, bool)
- func (c *Config) IsGenerated(rel string) bool
- func (c *Config) PythonBinDir(root string) string
- func (c *Config) Summary() string
- func (c *Config) TestFileCommand(file string) (string, bool)
- func (c *Config) TestNameCommand(file string, name string) (string, bool)
- type Env
Constants ¶
const ( Dir = ".jade" File = "project.json" )
Dir and File locate the config inside the workspace, beside commands.json.
const Source = ".jade/project.json"
Source names the config in responses that say where a command came from.
Variables ¶
var RelPath = filepath.Join(Dir, File)
RelPath is the config's path relative to the workspace root.
Functions ¶
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 ¶
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 ¶
AreaFor is the area a workspace-relative file belongs to: the deepest area whose path contains it.
func (*Config) Command ¶
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 ¶
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 ¶
PythonBinDir is the directory of the configured interpreter, for PATH.
func (*Config) TestFileCommand ¶
TestFileCommand runs one test file with its area's testFile command.