epic

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 6 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 epic holds the deterministic core of an Epic Run: the plan schema, requirement coverage checks, DAG validation, readiness computation and priority ordering. Nothing here talks to GitHub, runs a model, or knows how a plan was produced — a plan is data, and every rule this package enforces must hold no matter who wrote it.

Index

Constants

View Source
const MaxNodes = 200

MaxNodes bounds a single plan revision. A larger spec is planned in rolling waves, not as one unreviewable graph.

Variables

This section is empty.

Functions

func ApplyBranchTarget

func ApplyBranchTarget(p *Plan, target string) []error

ApplyBranchTarget fills each node's empty BranchTarget with target and reports every node naming any other ref. It is the shared rule for every path a plan enters the system by — pasted JSON, a generated draft, the validate command — so a plan means the same thing no matter who wrote it. Call it before Validate: a node with no branch target is otherwise rejected there.

func CanonicalPlan

func CanonicalPlan(data []byte, target string) (string, []error)

CanonicalPlan parses raw plan JSON, fills empty branch targets with target (rejecting any node naming another ref), runs the full structural validation, and returns the canonical re-marshalled JSON. It is the one gate every plan passes through no matter how it enters the system — the epic-plan validate command, a shem checking its generated draft, or the orchestrator storing it.

func Hash

func Hash(p Plan) (string, error)

Hash is the plan's content identity: a SHA-256 over the canonical JSON. Approvals bind to this, so any edit — however small — produces a different hash and therefore requires a new approval.

func Ready

func Ready(p Plan, integrated map[string]bool) map[string]bool

Ready returns the nodes that are not integrated and whose hard predecessors all are. "Integrated" means merged into the branch target; a closed or ready-for-review ticket does not count.

func Validate

func Validate(p Plan) []error

Validate checks a plan structurally: well-formed IDs, unique keys, no self-edges or unknown endpoints, an acyclic graph, complete requirement coverage in both directions, non-empty acceptance criteria and branch targets, and bounded size. It returns every problem found, not the first — a human reviewing a rejected plan should fix one pass, not five.

Types

type Edge

type Edge struct {
	Predecessor string `json:"predecessor"`
	Successor   string `json:"successor"`
	Reason      string `json:"reason"`
}

type Node

type Node struct {
	Key                string   `json:"key"` // stable logical key, unique within the plan
	Title              string   `json:"title"`
	Scope              string   `json:"scope"`
	NonGoals           string   `json:"non_goals,omitempty"`
	AcceptanceCommands []string `json:"acceptance_commands"`
	RequirementIDs     []string `json:"requirement_ids"`
	ExpectedModules    []string `json:"expected_modules,omitempty"`
	Risk               string   `json:"risk,omitempty"`
	BranchTarget       string   `json:"branch_target"` // the run's target ref; filled in when empty
}

type Plan

type Plan struct {
	// Requirements are the numbered outcomes the spec demands, extracted
	// before any decomposition. Every requirement must be covered by at
	// least one node, and every node must exist for at least one
	// requirement — no uncovered outcome, no orphan work.
	Requirements []Requirement `json:"requirements"`
	// Nodes are the proposed tickets, in plan order. Plan order is the
	// stable tie-break for scheduling priority.
	Nodes []Node `json:"nodes"`
	// Edges are hard dependencies: the predecessor must be integrated
	// before the successor may start. Soft file-overlap hints are resource
	// constraints, never edges.
	Edges []Edge `json:"edges"`
}

Plan is one immutable plan revision. Once approved it never changes; an edit is a new Plan with a new hash.

type Requirement

type Requirement struct {
	ID   string `json:"id"`   // stable within the plan, e.g. "R1"
	Text string `json:"text"` // the outcome, in the spec's own terms
}

Jump to

Keyboard shortcuts

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