lib

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 6 Imported by: ? 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 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 }

Stability: the Go API (function names and argument shapes) is stable. The JSON / YAML payload schema is versioned by `plan_schema_version` (currently `"3"`) and may still evolve, but only through a deliberate version bump. Pin a specific kcp version in your go.mod and adopt a new schema version when you're ready.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScanSummary

func ScanSummary(stateJSON []byte) ([]byte, error)

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.

Jump to

Keyboard shortcuts

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