notes

package
v1.84.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serialize

func Serialize(
	issueURL string,
	branchType BranchType,
	description string,
) (string, error)

Serialize is a function for serializing given notes field into a JSON string representation. Returns a JSON string representation of the notes and an error if serialization fails.

Types

type BranchType

type BranchType int
const (
	BranchTypeUnknown BranchType = iota
	BranchTypeDev
	BranchTypePr
)

func (BranchType) String added in v1.74.0

func (bt BranchType) String() string

type Notes

type Notes struct {
	// Version indicates the version of the Notes structure.
	Version string `json:"version"`
	// Deprecated: use IssueURL. Kept for backward compatibility with old notes.
	GithubIssueURL string `json:"github_issue_url,omitempty"`
	// Deprecated: use IssueURL. Kept for backward compatibility with old notes.
	JiraTicketURL string     `json:"jira_ticket_url,omitempty"`
	BranchType    BranchType `json:"branch_type"` // Optional field to specify the type of branch (`dev` or `pr`)
	// Description is the original text from the dev branch creation (e.g., from `qs dev {some text}`)
	Description string `json:"description,omitempty"`
	// IssueURL is the URL of the issue associated with the branch (GitHub, Jira, or any other tracker).
	IssueURL string `json:"issue_url,omitempty"`
}

Notes represents the structure for storing metadata related to branch.

func Deserialize

func Deserialize(notes []string) (*Notes, error)

Deserialize fetches JSON string object and tries to unmarshal it into Notes structure. Parameters: - notes: a slice of strings Returns: - a pointer to Notes structure if successful - error if JSON parsing fails or the stored version is not in supportedVersions

func ReadNotes added in v1.84.0

func ReadNotes(rawNotes []string) (*Notes, error)

ReadNotes reads notes from rawNotes, supporting all formats:

  • JSON format (version 1.0) — pure JSON blob
  • Old plain-text format — "Resolves issue" / "Resolves #" markers or plain title + URL

Returns a *Notes struct populated from whichever format is detected. For old plain-text format, BranchType is set to BranchTypeDev.

func (*Notes) String

func (nt *Notes) String() string

Serialize is a function for serializing given notes field into a JSON string representation. Returns a JSON string representation of the notes

Jump to

Keyboard shortcuts

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