root

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package root implements the ctx add command.

It appends new decisions, tasks, learnings, or conventions to the appropriate context file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmd

func Cmd() *cobra.Command

Cmd returns the "ctx add" command for appending entries to context files.

Supported types are defined in [config.FileType] (both singular and plural forms accepted, e.g., "decision" or "decisions"). Content can be provided via command argument, --file flag, or stdin pipe.

Flags:

  • --priority, -p: Priority level for tasks (high, medium, low)
  • --section, -s: Target section within the file
  • --file, -f: Read content from a file instead of argument
  • --context, -c: Context for decisions/learnings (required)
  • --rationale, -r: Rationale for decisions (required for decisions)
  • --consequence: Consequence for decisions (required for decisions)
  • --lesson, -l: Lesson for learnings (required for learnings)
  • --application, -a: Application for learnings (required for learnings)

Returns:

  • *cobra.Command: Configured add command with flags registered

func Run

func Run(cmd *cobra.Command, args []string, flags entity.AddConfig) error

Run executes the add command logic.

Reads content from the specified source (argument, file, or stdin), validates the entry, and writes it to the appropriate context file.

Parameters:

  • cmd: Cobra command for output
  • args: Command arguments; args[0] is the entry type, args[1:] is content
  • flags: All flag values from the command

Returns:

  • error: Non-nil if content is missing, type is invalid, required flags are missing, or file operations fail

Types

This section is empty.

Jump to

Keyboard shortcuts

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