Skip to main content

Module cli

Module cli 

Source
Expand description

The command line: which command to run, with its options.

  • [entries]: commands that read or change entries by id, for agents and scripts.
  • [mod@init]: a project’s .brain/, and the section telling its agents about it; deinit undoes it.
  • [claude]: the Claude Code hooks init adds: the context at each session start, and [hook]’s checks.
  • [hook]: kb hook prompt|stop|edit|tool, which hold an agent to describing an undescribed project first, to commenting on the tasks it started, and to kb for the brain’s files, and tell it of the user’s comments.
  • [completions]: kb completions SHELL, tab completion, and the ids, projects and tags it offers.
  • update: kb update and the app’s, the latest release over this one, through the installer, once no agent is working.

What the command line parses to (Command, EntryCommand, their variants and parts) is #[non_exhaustive], so a new command, or a new option of one, isn’t a breaking change of this crate’s API.

Modules§

update
kb update, and the app’s update: installs the latest release over this one, by running the installer the README gives, which downloads it, checks its checksum and replaces the binaries, then runs the new version’s init --all, so none of that is repeated here. Never while an agent works on a task: init --all would rewrite its instructions and a migration its data mid-session.

Structs§

AddArgs
Options of add.
EntryArgs
One of the entry commands, and whether to print JSON.
ListArgs
Options of kb list.
Program
The binary running the command line, named in the usage text and --version.
ReportArgs
Options of kb report.
Step
One thing a change to projects did, as kb says it on a line of its own, with what it was when a caller acts on it: the kanban app says a move, or the deletion of the tasks, rather than the first line.

Enums§

Command
What to do, as chosen on the command line.
EntryCommand
What to do to which entry.
ProjectChange
What project changes.
ProjectPart
What project changes in one of its texts.
StepKind
What a Step was, for the steps a caller acts on; any other is StepKind::Other.
TagChange
A change tag makes to an entry’s tags.
Text
Text given on the command line, or - to read it from stdin (for multi-line markdown).

Functions§

initDeprecated
init_steps, each step as its line.
init_steps
Makes root a repository of project name (else the one its card names, else one named after the folder), named repo in it (else as projects::repo_name picks): creates its .brain/ and card, registers it in central (joining the project’s other repositories if it has some), creates the project’s shared card if it’s new, and writes or refreshes the section in each agent file of root (creating CLAUDE.md if there’s none). Returns what it did, a Step a line.
move_repoDeprecated
move_repo_steps, each step as its line.
move_repo_steps
Moves the repository whose .brain/ is dir to project to, created if new, as kb init to there would. Links between it and its old project’s repositories are dropped on both sides: they’d name repositories of another project. Returns what it did, a Step a line.
remove_projectDeprecated
remove_project_steps, each step as its line.
remove_project_steps
Takes every repository of project out, as remove_repo does each, which removes the project’s card with the last. Returns what it did, a Step a line.
remove_repoDeprecated
remove_repo_steps, each step as its line.
remove_repo_steps
Takes the repository whose .brain/ is dir out of its project, as kb deinit does, and drops its old siblings’ links to it. With purge, its .brain/ goes too: its tasks, notes and decisions. Returns what it did, a Step a line.
rename_projectDeprecated
rename_project_steps, each step as its line.
rename_project_steps
Renames project old to new: the registry, its shared card, and each of its repositories’ cards. Returns what it did, a Step a line.
rename_repoDeprecated
rename_repo_steps, each step as its line.
rename_repo_steps
Renames the repository whose .brain/ is dir to new in its project, and rewrites its siblings’ links to it (old#3 becomes new#3). Returns what it did, a Step a line.
usage
Printed by --help and after a command-line error. The status, period and group names come from Status, Unit and Group, so they’re only written there.