factory

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2026 License: Apache-2.0 Imports: 14 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 factory builds and edits the files a repository keeps in .factory/: the builder `kojo config export --factory` and the Move to the repository use, and the editor that changes one setting of factory.yaml or schedules.yaml keeping everything else as people wrote it.

Index

Constants

View Source
const (
	FactoryPath   = skills.FactoryDir + "/factory.yaml"
	SchedulesPath = skills.FactoryDir + "/schedules.yaml"
)

The two files of .factory/ that hold repository settings, by their path in the repository.

Variables

This section is empty.

Functions

func AddMergePolicy

func AddMergePolicy(src []byte, mp config.MergePolicy) ([]byte, error)

AddMergePolicy gives a factory.yaml that has no merge policy one: src is empty, comments only, `{}`, or a merge_policy key with no value.

func DecodeContent

func DecodeContent(o config.ExportObject, v any) error

DecodeContent reads an export object's content into v, through JSON: the form the config types are stored and validated in.

func DescribeMergePolicy

func DescribeMergePolicy(before, after config.MergePolicy) string

DescribeMergePolicy is the change from before to after as the lines of a diff block: one -/+ pair per field that differs, risk fields as risk.<name>, in the order of config.MergePolicy. trigger_permission and inherit are left out, as factory.yaml cannot hold them.

func DescribeSchedules

func DescribeSchedules(before, after config.Schedules) string

DescribeSchedules is the change from before to after as the lines of a diff block, schedule by schedule in the order of their names: a removed one with -, an added one with +, a changed one as the old with - and then the new with +.

func EditMergePolicy

func EditMergePolicy(src []byte, base, want config.MergePolicy) ([]byte, error)

EditMergePolicy writes the fields of want that differ from base into the merge_policy mapping of a factory.yaml, src. base is the policy src makes (skills.SyncedMergePolicy of it), want the normalised proposal. Only the keys that change are touched: every other key, comment and blank line stays as it was, so the defaults kōjō applies are not frozen into the file. trigger_permission and inherit are never written.

func EditSchedules

func EditSchedules(src []byte, want config.Schedules) ([]byte, error)

EditSchedules makes a schedules.yaml, src, hold want. src is a bare list or a document with a schedules key, and keeps its form. A schedule that did not change keeps its lines, comments included; a changed one keeps the comment lines directly above it and is written again; new ones are written plainly; all in want's order.

func MarshalYAML

func MarshalYAML(v any) ([]byte, error)

MarshalYAML writes v as YAML indented by two spaces, as the .factory/ examples in the docs are.

func OrgTriggerPermission

func OrgTriggerPermission(doc *config.Export) string

OrgTriggerPermission is the org's trigger_permission in the export, or the default.

func RemoveMergePolicy

func RemoveMergePolicy(src []byte) ([]byte, error)

RemoveMergePolicy takes the merge_policy entry out of a factory.yaml. Comment lines above it stay.

Types

type File

type File struct {
	Path string
	Data []byte
	// Object is the config object the file comes from, for errors.
	Object string
}

File is one file of .factory/, by its path relative to the .factory directory.

func Plan

func Plan(doc *config.Export, scope string) (files []File, kept, notes []string, err error)

Plan turns the objects of scope into files, and lists the objects of the scope that stay in the dashboard and anything worth saying about what was left out.

Jump to

Keyboard shortcuts

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