KeiSeiKit-1.0/_primitives/_rust/kei-fork/src/error.rs
Parfii-bot 0be354a920 KeiSeiKit-public — clean state
Single-commit clean baseline after security scrub of niche-tells,
project codenames, internal jargon, and contributor-email leaks.

Contents:
- 100 Rust crates (_primitives/_rust/)
- 37 agent manifests (_manifests/) + generated specs (_generated/)
- 67 user-invocable skills (skills/)
- 33 hooks (hooks/)
- Composition blocks (_blocks/)
- Documentation (docs/, README.md)
- TS adapter packages (_ts_packages/)
- Assembler (_assembler/)
- Roles (_roles/)
- Templates (_templates/)
- Forgejo CI (.forgejo/)

Author: Denis Parfionovich <info@greendragon.info>

License: see LICENSE.
2026-05-01 12:09:03 +08:00

41 lines
1.3 KiB
Rust

//! Typed error — every kei-fork public op returns `Result<_, Error>`.
//!
//! Categories:
//! - `Validate` — agent-id failed `kei_agent_runtime::validate`
//! - `Duplicate` — worktree/branch for this agent-id already exists
//! - `NotDone` — collect() called before the agent wrote `.DONE`
//! - `Gone` — rescue() could not find the worktree (live or archived)
//! - `InvalidRef` — branch / base-branch string rejected by refname guard
//! - `Io` / `Git` / `Ledger` / `Meta` — subsystem failures
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("invalid agent-id: {0}")]
Validate(String),
#[error("fork already exists for agent-id '{0}'")]
Duplicate(String),
#[error(".DONE marker missing for agent-id '{0}' (agent not finished)")]
NotDone(String),
#[error("no live or archived worktree found for agent-id '{0}'")]
Gone(String),
#[error("invalid ref name '{0}' (arg-injection guard)")]
InvalidRef(String),
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("git command failed ({cmd}): {stderr}")]
Git { cmd: String, stderr: String },
#[error("ledger command failed: {0}")]
Ledger(String),
#[error("meta file malformed: {0}")]
Meta(String),
}