Documentation
¶
Overview ¶
Package lib is the stable bytes-in / bytes-out façade over kcp's state-processing and plan-generation pipelines. External Go modules (cc-growth-service, etc.) import this package; it wraps the internal/* implementations so they stay private.
Formats:
- state bytes must be JSON (kcp-state.json — what `kcp scan` writes).
- plan_inputs bytes must be YAML (plan-inputs.yaml shape).
- Plan output is JSON + Markdown. Resolved plan_inputs are echoed back as YAML so callers preserve the plan-inputs.yaml shape their users edit.
API surface:
func ScanSummary(stateJSON []byte) ([]byte, error)
func GeneratePlan(stateJSON, planInputsYAML []byte) (*PlanResult, error)
type PlanResult struct { JSON, Markdown, PlanInputs []byte }
EXPERIMENTAL: signatures and payload shapes may change while `plan_schema_version` is `"1-experimental"`. Pin to a specific kcp version in your go.mod and bump deliberately. Function names and argument shapes are expected to remain stable; the JSON / YAML payload schema is the surface intended to evolve.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ScanSummary ¶
ScanSummary parses a kcp-state.json byte slice and returns the ProcessedState as JSON bytes — the flattened, aggregated view the kcp UI serves at GET /state. Stateless; safe for concurrent use.
Types ¶
type PlanResult ¶
type PlanResult struct {
JSON []byte // same schema as `kcp report plan --output json`
Markdown []byte // same rendering as `kcp report plan --output md`
PlanInputs []byte // resolved plan-inputs (request merged with kcp defaults), as YAML
}
PlanResult is the output of GeneratePlan. JSON and Markdown are two renderings of the same Plan from a single Build pass. PlanInputs is the resolved input set (caller-supplied fields merged with kcp defaults) serialised as YAML — same shape as a plan-inputs.yaml file, so a UI can show it as an editable text block (with room for future commented-out optional knobs that a JSON echo would strip).
func GeneratePlan ¶
func GeneratePlan(stateJSON, planInputsYAML []byte) (*PlanResult, error)
GeneratePlan builds a migration plan from a state file and optional plan-inputs YAML. Pass nil planInputsYAML for defaults. planInputsYAML must follow the plan-inputs.yaml shape; see docs/assets/plan-inputs.example.yaml.