1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// SPDX-License-Identifier: Apache-2.0
//! `oo` (double-o) — a context-efficient command runner for AI coding agents.
//!
//! This library helps AI agents run shell commands efficiently by classifying output
//! and reducing context usage. Commands are executed, their output is analyzed, and
//! results are compressed using pattern matching and intelligent categorization.
//!
//! # Core Concepts
//!
//! - **Classification**: Commands are categorized into four tiers based on success/failure
//! and output size. Small successful outputs pass through verbatim, while large outputs
//! are pattern-matched to extract terse summaries or indexed for later recall.
//! - **Patterns**: Regular expressions define how to extract summaries from command output.
//! Built-in patterns exist for common tools (pytest, cargo test, npm test, etc.).
//! Custom patterns can be loaded from project-local `<git-root>/.oo/patterns/` or
//! user-global `~/.config/oo/patterns/` TOML files (project patterns take precedence).
//! - **Storage**: Large unpatterned outputs are stored in a searchable database (SQLite by
//! default, with optional Vipune semantic search). Stored outputs can be recalled with
//! full-text search.
//! - **Categories**: Commands are auto-detected as Status (tests, builds, linters),
//! Content (git show, diff, cat), Data (git log, ls, gh), or Unknown. This determines
//! default behavior when no pattern matches.
//!
//! # Example
//!
//! ```
//! use double_o::{classify, Classification, CommandOutput, Pattern};
//! use double_o::pattern::builtins;
//!
//! // Run a command
//! let args = vec!["echo".into(), "hello".into()];
//! let output = double_o::exec::run(&args).unwrap();
//!
//! // Classify the output
//! let command = "echo hello";
//! let patterns = builtins(); // or load_user_patterns(&path)
//! let result = classify(&output, command, &patterns);
//!
//! match result {
//! Classification::Passthrough { output } => {
//! println!("Output: {}", output);
//! }
//! Classification::Success { label, summary } => {
//! println!("✓ {}: {}", label, summary);
//! }
//! Classification::Failure { label, output } => {
//! println!("✗ {}: {}", label, output);
//! }
//! Classification::Large { label, size, .. } => {
//! println!("Indexed: {} ({} bytes)", label, size);
//! }
//! }
//! ```
/// Command output classification and intelligent truncation.
/// Error types for oo operations.
/// Command execution and output capture.
/// LLM-powered pattern learning.
/// Pattern matching and output compression.
/// Session tracking and management.
/// Storage backends for indexed output.
// CLI internals - hidden from documentation but accessible to binary crate
// Re-exports for library users
pub use ;
pub use Error;
pub use CommandOutput;
pub use ;
pub use ;
// CLI internals - re-exported for binary crate but hidden from documentation
pub use ;
// Internal type re-exported for learn module
pub use FailureSection;