Skip to main content

Crate toha

Crate toha 

Source
Expand description

Toha logo

§Toha

Generate projects and files from templates.

CI Latest release

Toha terminal demo

Toha is a project scaffolding tool and Rust library. Templates ask questions, then render file paths and contents with Jinja. Preview the plan before writing.

  • Use the same interview from a terminal, scripts, agents, or Rust.
  • Resume interviews and supply headless answers, including document answers.
  • Keep application inputs and file ownership in a committed .toha.json record.
  • Select template parts and update generated projects while preserving edits.
  • Render typed Jinja values, file paths, loops, and static files.
  • Reserve user-editable sections inside generated files.
  • Create empty directories with rendered paths and optional loops.
  • Use Git templates, short names, aliases, and hooks gated by trust.
  • Read embedded agent guidance with toha skills.

Read the Toha documentation for detailed guides.

§Install

With Homebrew on macOS or Linux:

brew install wyrd-company/tools/toha

See installation methods for other platforms.

§First run

Toha includes an offline demo template:

toha apply toha-demo ./notes

Answer Note title and Topic. To preview without writing, run toha apply toha-demo ./preview --dry-run.

§Use from Rust

Use Toha without CLI dependencies to run interviews, manage templates, and apply or update projects. See Using Toha from Rust for the dependency, session flow, and a complete consumer example.

See CONTRIBUTING.md for development and changes.

Re-exports§

pub use apply::Applied;
pub use apply::ApplyError;
pub use apply::ApplyOptions;
pub use apply::HookReport;
pub use inject::Anchor;
pub use inject::EditReport;
pub use inject::EditResolution;
pub use inject::JsonEditError;
pub use inject::JsonFormat;
pub use inject::JsonPath;
pub use inject::JsonPathSegment;
pub use inject::MarkerStyle;
pub use inject::Occurrence;
pub use inject::PlannedEdit;
pub use inject::PlannedJsonEdit;
pub use inject::PlannedRegionEdit;
pub use inject::RegionError;
pub use inject::RegionKey;
pub use inject::json_value_to_cst_input;
pub use inject::report_json_edit;
pub use inject::report_region_edit;
pub use inject::resolve_json_edit;
pub use inject::resolve_region_edit;
pub use interview::Answer;
pub use interview::AnswerError;
pub use interview::Answers;
pub use interview::Batch;
pub use interview::CheckError;
pub use interview::Completed;
pub use interview::Disposition;
pub use interview::EndKind;
pub use interview::Ended;
pub use interview::EvalError;
pub use interview::Interview;
pub use interview::Item;
pub use interview::Pending;
pub use interview::Prompt;
pub use interview::PromptKind;
pub use interview::RawAnswer;
pub use interview::RawAnswers;
pub use interview::Rejection;
pub use interview::RejectionKind;
pub use interview::Rejections;
pub use interview::Seed;
pub use interview::Step;
pub use plan::Content;
pub use plan::Deferred;
pub use plan::FileMutation;
pub use plan::Plan;
pub use plan::PlanError;
pub use plan::Planned;
pub use plan::PlannedFile;
pub use plan::PlannedHook;
pub use plan::PlannedProgram;
pub use plan::TargetPath;
pub use requirement::MissingRequirements;
pub use requirement::Requirement;
pub use review::HookSurface;
pub use review::HookSurfaceDiff;
pub use review::HookView;
pub use review::ReviewDigest;
pub use review::ReviewError;
pub use review::ScriptDigest;
pub use review::Trust;
pub use review::evaluate_trust;
pub use template::FlowAction;
pub use template::FlowNode;
pub use template::Id;
pub use template::LoadError;
pub use template::Node;
pub use template::Problem;
pub use template::Question;
pub use template::QuestionKind;
pub use template::SkipScope;
pub use template::Template;

Modules§

application_seed
Application selection and answer defaults. Seed defaults from an application of the same source, selected by target.
applied
Committed applied records and three-way template updates.
apply
assets
Embedded agent guidance inventory, bytes and export.
bundled
The embedded offline template and its content identity. The offline bundled demo template.
catalog
Installed-template transactions and structured reports. Installed-template transactions shared by embedded callers and the command line.
config
Layered configuration for template lookup.
context
Toha’s immutable, typed invocation context.
document
Document question contracts and the filesystem/network admission boundary.
git_target
Initializes an apply target as a git repository for a template’s git question, with an optional origin remote.
hook
inject
Content injection: bounded mutation of an existing target file.
interview
operations
Shared application/session operations with explicit caller inputs. Shared application preparation, owned interview replay and plan/application boundaries.
parts
Selection of the options of a template’s part question.
plan
protocol
The interview protocol boundary: the external answers envelope, the identity gate, and the result documents.
registry
Validated registry layers, discovery, and name resolution.
requirement
The programs a template declares in requires, confirmed on PATH before an interview starts so that a caller does not answer questions for an apply whose hooks cannot run.
resolve
Resolve, fetch, cache and resume template identities with caller-owned paths.
review
The reviewable executable surface of a template and the single trust rule.
source
Template addresses and immutable Git fetches.
staging
stop
A caller’s signal that stops a template fetch or an apply.
template
updates
Prepared baseline and recorded-application update operations. Prepared template upgrades with explicit host inputs and an injected hook runner.