orgie

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Overview

Package orgie implements the organize-text format: a hierarchical, tag-headed text view of tagged/typed objects that round-trips through an editor (or, since #7, the MCP organize_plan/organize_commit tools) to apply bulk tag/description/move changes.

orgie-extract: this package is a candidate for extraction into a standalone amarbel-llc/orgie module — a general tool for applying structured, hierarchical mutations to tagged/typed objects. Two follow-ups shape that boundary: (#3) a structured (JSON / box-format) alternative to the text round-trip below, and object-signature drift detection between plan and commit (signatures embedded in the text/JSON let a commit detect that the underlying objects changed since the plan, and fail or merge). The SKU coupling lives only at the leaf (obj wrapper) and the GetSkus/addToSet mutation; the Assignment tree itself is object-agnostic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assignment

type Assignment struct {
	sku.Transacted

	IsRoot bool
	Depth  int

	Objects
	Children []*Assignment
	Parent   *Assignment
	// contains filtered or unexported fields
}

func (*Assignment) AddObject

func (assignment *Assignment) AddObject(object *obj) (err error)

func (Assignment) AlignmentSpacing

func (assignment Assignment) AlignmentSpacing() int

func (*Assignment) AllTags

func (assignment *Assignment) AllTags(tags ids.TagSetMutable) (err error)

func (*Assignment) Contains

func (assignment *Assignment) Contains(e *ids.TagStruct) bool

func (Assignment) GetDepth

func (assignment Assignment) GetDepth() int

func (Assignment) MaxDepth

func (assignment Assignment) MaxDepth() (depth int)

func (Assignment) MaxLen

func (assignment Assignment) MaxLen() (maxLength int)

func (*Assignment) SortChildren

func (assignment *Assignment) SortChildren()

func (Assignment) String

func (assignment Assignment) String() (s string)

func (*Assignment) SubtractFromSet

func (assignment *Assignment) SubtractFromSet(
	tagsToSubtract ids.TagSetMutable,
) (err error)

type Changes

type Changes struct {
	Before, After  SkuMapWithOrder
	Added, Removed SkuMapWithOrder
	Changed        SkuMapWithOrder
}

func ChangesFrom

func ChangesFrom(
	po options_print.Options,
	a, b *Text,
	original sku.SkuTypeSet,
) (c Changes, err error)

func ChangesFromResults

func ChangesFromResults(
	po options_print.Options,
	results OrganizeResults,
) (c Changes, err error)

func (Changes) String

func (c Changes) String() string

type ErrorRead

type ErrorRead struct {
	// contains filtered or unexported fields
}

func (ErrorRead) GetErrorType

func (err ErrorRead) GetErrorType() pkgErrDisamb

func (ErrorRead) Is

func (err ErrorRead) Is(target error) bool

type Flags

type Flags struct {
	Options

	ExtraTags collections_ptr.Flag[ids.TagStruct, *ids.TagStruct]
	// contains filtered or unexported fields
}

func MakeFlags

func MakeFlags() Flags

func MakeFlagsWithMetadata

func MakeFlagsWithMetadata(metadata Metadata) Flags

func (*Flags) GetOptions

func (flagz *Flags) GetOptions(
	printOptions options_print.Options,
	tagSet ids.TagSet,
	skuBoxFormat *box_format.BoxCheckedOut,
	abbr ids.Abbr,
	objectFactory sku.ObjectFactory,
) Options

func (*Flags) GetOptionsWithMetadata

func (flagz *Flags) GetOptionsWithMetadata(
	printOptions options_print.Options,
	boxFormat *box_format.BoxCheckedOut,
	abbr ids.Abbr,
	objectFactory sku.ObjectFactory,
	metadata Metadata,
) Options

func (*Flags) SetFlagDefinitions

func (flagz *Flags) SetFlagDefinitions(flagDefs interfaces.CLIFlagDefinitions)

type Metadata

type Metadata struct {
	ids.TagSet
	Matchers interfaces.Set[sku.Query] // TODO remove
	OptionCommentSet
	Type   ids.TypeStruct
	RepoId ids.RepoId
}

TODO replace with embedded *sku.Transacted

func NewMetadata

func NewMetadata(repoId ids.RepoId) Metadata

func NewMetadataWithOptionCommentLookup

func NewMetadataWithOptionCommentLookup(
	repoId ids.RepoId,
	elements map[string]OptionComment,
) Metadata

func (Metadata) AsMetadata

func (metadata Metadata) AsMetadata() (m1 objects.MetadataMutable)

func (Metadata) GetMetadataWriterTo

func (metadata Metadata) GetMetadataWriterTo() hyphence.MetadataWriterTo

func (*Metadata) GetTags

func (metadata *Metadata) GetTags() ids.TagSet

func (Metadata) HasMetadataContent

func (metadata Metadata) HasMetadataContent() bool

func (*Metadata) ReadFrom

func (metadata *Metadata) ReadFrom(reader io.Reader) (n int64, err error)

func (Metadata) RemoveFromTransacted

func (metadata Metadata) RemoveFromTransacted(object sku.SkuType) (err error)

func (*Metadata) SetFromObjectMetadata

func (metadata *Metadata) SetFromObjectMetadata(
	otherMetadata objects.MetadataMutable,
	repoId ids.RepoId,
) (err error)

func (Metadata) WriteTo

func (metadata Metadata) WriteTo(w1 io.Writer) (n int64, err error)

type Objects

type Objects []*obj

func (*Objects) Add

func (os *Objects) Add(v *obj) error

func (*Objects) All

func (os *Objects) All() interfaces.Seq2[int, *obj]

func (Objects) Any

func (os Objects) Any() *obj

func (*Objects) Del

func (os *Objects) Del(v *obj) error

func (Objects) Len

func (os Objects) Len() int

func (Objects) Sort

func (objects Objects) Sort()

type OptionComment

type OptionComment interface {
	CloneOptionComment() OptionComment
	interfaces.StringerSetter
}

type OptionCommentBooleanFlag

type OptionCommentBooleanFlag struct {
	Value   *bool
	Comment string
}

func (OptionCommentBooleanFlag) CloneOptionComment

func (ocf OptionCommentBooleanFlag) CloneOptionComment() OptionComment

func (OptionCommentBooleanFlag) Set

func (ocf OptionCommentBooleanFlag) Set(v string) (err error)

func (OptionCommentBooleanFlag) String

func (ocf OptionCommentBooleanFlag) String() string

type OptionCommentDryRun

type OptionCommentDryRun struct {
	mad_domain_interfaces.MutableConfigDryRun
}

func (*OptionCommentDryRun) CloneOptionComment

func (ocf *OptionCommentDryRun) CloneOptionComment() OptionComment

func (*OptionCommentDryRun) Set

func (ocf *OptionCommentDryRun) Set(v string) (err error)

func (*OptionCommentDryRun) String

func (ocf *OptionCommentDryRun) String() string

type OptionCommentSet

type OptionCommentSet struct {
	OptionComments []OptionComment
	// contains filtered or unexported fields
}

func MakeOptionCommentSet

func MakeOptionCommentSet(
	elements map[string]OptionComment,
	options ...OptionComment,
) OptionCommentSet

TODO add config to automatically add dry run if necessary

func (*OptionCommentSet) AddPrototype

func (ocs *OptionCommentSet) AddPrototype(
	key string,
	o OptionComment,
) OptionComment

func (*OptionCommentSet) AddPrototypeAndOption

func (ocs *OptionCommentSet) AddPrototypeAndOption(
	key string,
	o OptionComment,
) OptionComment

func (*OptionCommentSet) GetPrototypeOptionComments

func (ocs *OptionCommentSet) GetPrototypeOptionComments() PrototypeOptionComments

func (*OptionCommentSet) Set

func (ocs *OptionCommentSet) Set(v string) (err error)

type OptionCommentUnknown

type OptionCommentUnknown struct {
	Value string
}

func (OptionCommentUnknown) CloneOptionComment

func (ocf OptionCommentUnknown) CloneOptionComment() OptionComment

func (*OptionCommentUnknown) Set

func (ocf *OptionCommentUnknown) Set(v string) (err error)

func (OptionCommentUnknown) String

func (ocf OptionCommentUnknown) String() string

type OptionCommentWithApply

type OptionCommentWithApply interface {
	OptionComment
	ApplyToText(Options, *Assignment) error
	ApplyToReader(Options, *reader) error
	ApplyToWriter(Options, *writer) error
}

type OptionCommentWithKey

type OptionCommentWithKey struct {
	Key string
	OptionComment
}

TODO add support for ApplyTo*

func (OptionCommentWithKey) CloneOptionComment

func (ocf OptionCommentWithKey) CloneOptionComment() OptionComment

func (OptionCommentWithKey) Set

func (ocf OptionCommentWithKey) Set(v string) (err error)

func (OptionCommentWithKey) String

func (ocf OptionCommentWithKey) String() string

type Options

type Options struct {
	Config mad_domain_interfaces.MutableConfigDryRun

	Metadata

	GroupingTags ids.TagSlice
	ExtraTags    ids.TagSet
	Skus         sku.SkuTypeSet

	sku.ObjectFactory

	Abbr ids.Abbr

	UsePrefixJoints   bool
	UseRefiner        bool
	UseMetadataHeader bool
	Limit             int

	PrintOptions options_print.Options
	// contains filtered or unexported fields
}

func (Options) Make

func (o Options) Make() (ot *Text, err error)

type OrganizeResults

type OrganizeResults struct {
	Before, After *Text
	Original      sku.SkuTypeSet
	QueryGroup    *queries.Query
}

orgie-extract: OrganizeResults (Before/After/Original) and ChangesFromResults are the diff seam. Today drift between a plan and its commit is invisible — Before is re-derived from the query at commit time. A follow-up keys drift detection here on object signatures carried in the organize text/JSON, so a commit can fail (or merge) when Original changed since the plan. TODO combine with above

type PrefixSet

type PrefixSet struct {
	// contains filtered or unexported fields
}

func MakePrefixSet

func MakePrefixSet(c int) (s PrefixSet)

func MakePrefixSetFrom

func MakePrefixSetFrom(
	objectSet objSet,
) (prefixSet PrefixSet)

func (*PrefixSet) Add

func (prefixSet *PrefixSet) Add(object *obj) (err error)

this splits on right-expanded

func (*PrefixSet) AddSku

func (prefixSet *PrefixSet) AddSku(object sku.SkuType) (err error)

func (PrefixSet) AllObjectSets

func (prefixSet PrefixSet) AllObjectSets() interfaces.Seq2[string, objSet]

func (PrefixSet) AllObjects

func (prefixSet PrefixSet) AllObjects() interfaces.Seq2[string, *obj]

func (PrefixSet) Len

func (prefixSet PrefixSet) Len() int

func (PrefixSet) Match

func (prefixSet PrefixSet) Match(
	tag ids.TagStruct,
) (out Segments)

func (PrefixSet) Subset

func (prefixSet PrefixSet) Subset(
	tag ids.TagStruct,
) (out Segments)

func (PrefixSet) Subtract

func (prefixSet PrefixSet) Subtract(
	objects objSet,
) (output PrefixSet)

type PrototypeOptionComments

type PrototypeOptionComments map[string]OptionComment

type Refiner

type Refiner struct {
	Enabled         bool
	UsePrefixJoints bool
}

func (*Refiner) Refine

func (atc *Refiner) Refine(a *Assignment) (err error)

passed-in assignment may be nil?

type Segments

type Segments struct {
	Ungrouped objSet
	Grouped   PrefixSet
}

type SkuMapWithOrder

type SkuMapWithOrder struct {
	// contains filtered or unexported fields
}

func MakeSkuMapWithOrder

func MakeSkuMapWithOrder(c int) (out SkuMapWithOrder)

func (*SkuMapWithOrder) Add

func (sm *SkuMapWithOrder) Add(sk sku.SkuType) error

func (*SkuMapWithOrder) AllSkuAndIndex

func (smwo *SkuMapWithOrder) AllSkuAndIndex() interfaces.Seq2[int, sku.SkuType]

func (*SkuMapWithOrder) AsExternalLikeSet

func (smwo *SkuMapWithOrder) AsExternalLikeSet() sku.SkuTypeSetMutable

func (*SkuMapWithOrder) AsTransactedSet

func (smwo *SkuMapWithOrder) AsTransactedSet() sku.TransactedMutableSet

func (*SkuMapWithOrder) Clone

func (sm *SkuMapWithOrder) Clone() (out SkuMapWithOrder)

func (*SkuMapWithOrder) Del

func (sm *SkuMapWithOrder) Del(sk sku.SkuType) error

func (*SkuMapWithOrder) Len

func (sm *SkuMapWithOrder) Len() int

func (SkuMapWithOrder) Sorted

func (sm SkuMapWithOrder) Sorted() (out []sku.SkuType)

type TagSetGetter

type TagSetGetter interface {
	GetTags() ids.TagSet
}

type Text

type Text struct {
	Options
	*Assignment // TODO make not embedded
}

func New

func New(options Options) (ot *Text, err error)

func (*Text) GetSkus

func (ot *Text) GetSkus(
	original sku.SkuTypeSet,
) (out SkuMapWithOrder, err error)

func (*Text) ReadFrom

func (t *Text) ReadFrom(r io.Reader) (n int64, err error)

orgie-extract: ReadFrom/WriteTo are the text-format seam. #3 adds a structured (JSON / box-format) alternative alongside this hyphence text round-trip; object signatures (for plan↔commit drift detection) ride in the same metadata header these read/write.

func (*Text) Refine

func (t *Text) Refine() (err error)

func (Text) WriteTo

func (ot Text) WriteTo(out io.Writer) (n int64, err error)

Source Files

  • assignment.go
  • changeable.go
  • changes.go
  • constructor.go
  • constructor2.go
  • errors.go
  • main.go
  • metadata.go
  • option.go
  • options.go
  • reader.go
  • refiner.go
  • set_prefix_transacted.go
  • structs.go
  • writer.go

Jump to

Keyboard shortcuts

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