pub enum IssueCode {
Show 17 variants
UndefinedCommand,
MissingRequiredArg,
UnknownFlag,
InvalidArgType,
SeqZeroIncrement,
InvalidRegex,
BreakOutsideLoop,
ReturnOutsideFunction,
PossiblyUndefinedVariable,
ForLoopScalarVar,
ScatterWithoutGather,
LastResultFieldAccess,
DiffNeedsTwoFiles,
InvalidSedExpr,
InvalidJqFilter,
LvalueUndefinedRoot,
DottedAssignmentTarget,
}Expand description
Categorizes validation issues for filtering and tooling.
Variants§
UndefinedCommand
Command not found in registry or user tools.
MissingRequiredArg
Required parameter not provided.
UnknownFlag
Flag not defined in tool schema.
InvalidArgType
Argument type doesn’t match schema.
SeqZeroIncrement
seq increment is zero (infinite loop).
InvalidRegex
Regex pattern is invalid.
BreakOutsideLoop
break/continue outside of a loop.
ReturnOutsideFunction
return outside of a function.
PossiblyUndefinedVariable
Variable may be undefined.
ForLoopScalarVar
Bare scalar variable in for loop (no word splitting in kaish).
ScatterWithoutGather
scatter without gather — parallel results would be lost.
LastResultFieldAccess
Field access on $? (e.g. ${?.data}, ${?.ok}) was removed.
$? is the POSIX exit code; use kaish-last for structured data.
DiffNeedsTwoFiles
diff was given other than two file operands.
InvalidSedExpr
sed expression is syntactically invalid.
InvalidJqFilter
jq filter expression is syntactically invalid.
LvalueUndefinedRoot
A subscripted assignment lvalue (x[k]=v) targets an undefined root
variable. Unlike a plain read, a path-set never autovivifies the
root — it must already exist as a collection.
DottedAssignmentTarget
An assignment target contains a dot (user.email=x). kaish is
brackets-only for collection access — the Ident token admits .
for other uses (filenames, source foo.kai), so this is caught here
rather than by tightening the lexer regex.
Implementations§
Source§impl IssueCode
impl IssueCode
Sourcepub fn code(&self) -> &'static str
pub fn code(&self) -> &'static str
Returns a short code string for the issue.
Code numbers are stable identifiers, not contiguous. E010 and
W003/W004/W005 remain retired, as does W006 (PosixTestCommand, retired
when test became a first-class builtin). E006 (InvalidSedExpr), E007
(InvalidJqFilter), and E011 (DiffNeedsTwoFiles) were wired up with
real emitters in 2026-06-14.
Sourcepub fn surfaces_to_agent(&self) -> bool
pub fn surfaces_to_agent(&self) -> bool
Whether a warning carrying this code should be surfaced to the agent (appended to the result’s stderr) rather than only trace-logged.
Most warnings stay trace-only — UndefinedCommand fires on every
external command (grep, cargo), so surfacing them all would be
noise. Opt a code in here only when its guidance is worth interrupting
for. This is the surfacing seam for the “did-you-mean” guidance pass.
Currently dormant: the one opted-in code (PosixTestCommand) was retired
when test became a builtin. The seam stays wired for the next code that
earns surfacing — add a matches!(self, IssueCode::Foo | …) arm here.
Sourcepub fn default_severity(&self) -> Severity
pub fn default_severity(&self) -> Severity
Default severity for this issue code.
Trait Implementations§
impl Copy for IssueCode
impl Eq for IssueCode
impl StructuralPartialEq for IssueCode
Auto Trait Implementations§
impl Freeze for IssueCode
impl RefUnwindSafe for IssueCode
impl Send for IssueCode
impl Sync for IssueCode
impl Unpin for IssueCode
impl UnsafeUnpin for IssueCode
impl UnwindSafe for IssueCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.