Documentation
¶
Overview ¶
Package instructions discovers and composes workspace project instructions.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalid means resolver configuration or a requested scope is invalid. ErrInvalid = errors.New("coding instructions: invalid configuration") // ErrFile means a project instruction file is unsafe or unreadable. ErrFile = errors.New("coding instructions: file error") // ErrTooLarge means an instruction file or combined source set exceeds its // configured byte budget. ErrTooLarge = errors.New("coding instructions: content too large") // ErrBinary means an instruction source is not UTF-8 text. ErrBinary = errors.New("coding instructions: binary content") )
Functions ¶
This section is empty.
Types ¶
type Limits ¶
Limits bounds project instruction discovery.
func DefaultLimits ¶
func DefaultLimits() Limits
DefaultLimits returns the production project-instruction budgets.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver discovers AGENTS.md files within one workspace tree.
func (*Resolver) Resolve ¶
Resolve discovers AGENTS.md from the workspace root through scope. Later sources have higher precedence when their instructions conflict.
Example ¶
package main
import (
"context"
"fmt"
"os"
"path/filepath"
"github.com/rsbin1178/pips/agent/harness"
"github.com/rsbin1178/pips/internal/coding/instructions"
"github.com/rsbin1178/pips/internal/coding/workspace"
)
func main() {
root, err := os.MkdirTemp("", "pips-instructions-")
if err != nil {
panic(err)
}
defer func() { _ = os.RemoveAll(root) }()
if err := os.WriteFile(filepath.Join(root, "AGENTS.md"), []byte("Run tests before finishing."), 0o600); err != nil {
panic(err)
}
opened, err := workspace.Open(root)
if err != nil {
panic(err)
}
tree, err := workspace.OpenTree(opened)
if err != nil {
panic(err)
}
defer func() { _ = tree.Close() }()
resolver, err := instructions.New(tree, instructions.DefaultLimits())
if err != nil {
panic(err)
}
set, err := resolver.Resolve(context.Background(), ".")
if err != nil {
panic(err)
}
option := harness.WithSystemFunc(func(harness.SystemContext) string {
return set.SystemPrompt()
})
fmt.Println(set.Sources()[0].Path, option != nil)
}
Output: AGENTS.md true
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is an immutable-by-API project instruction snapshot.
func (Set) SystemPrompt ¶
SystemPrompt returns the deterministic text for Harness system injection.
Click to show internal directories.
Click to hide internal directories.