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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
//! Agent tools using Rig's Tool trait
//!
//! These tools wrap existing CLI functionality for the agent to use.
//!
//! ## Available Tools
//!
//! ### File Operations
//! - `ReadFileTool` - Read file contents
//! - `WriteFileTool` - Write single files (Dockerfiles, Terraform, etc.)
//! - `WriteFilesTool` - Write multiple files (Terraform modules, Helm charts)
//! - `ListDirectoryTool` - List directory contents
//!
//! ### Analysis
//! - `AnalyzeTool` - Analyze project architecture, dependencies, build commands
//!
//! ### Security
//! - `SecurityScanTool` - Security vulnerability scanning
//! - `VulnerabilitiesTool` - Dependency vulnerability checking
//!
//! ### Linting
//! - `HadolintTool` - Native Dockerfile linting (best practices, security)
//! - `DclintTool` - Native Docker Compose linting (best practices, style, security)
//! - `HelmlintTool` - Native Helm chart structure/template linting
//! - `KubelintTool` - Native Kubernetes manifest security/best practice linting
//!
//! ### Resource Optimization
//! - `K8sOptimizeTool` - Kubernetes resource right-sizing and cost optimization
//! - `K8sCostsTool` - Kubernetes workload cost attribution and analysis
//! - `K8sDriftTool` - Detect configuration drift between manifests and cluster
//!
//! ### Prometheus Integration (for live K8s analysis)
//! - `PrometheusDiscoverTool` - Discover Prometheus services in Kubernetes cluster
//! - `PrometheusConnectTool` - Establish connection to Prometheus (port-forward or URL)
//! - `BackgroundProcessManager` - Manage long-running background processes
//!
//! ### Helm vs Kubernetes Linting
//! - **HelmlintTool**: Use for Helm chart development - validates Chart.yaml, values.yaml,
//! Go template syntax, and Helm-specific best practices. Works on chart directories.
//! - **KubelintTool**: Use for K8s security - checks rendered manifests for privileged containers,
//! missing probes, RBAC issues, resource limits. Works on YAML files, Helm charts (renders them),
//! and Kustomize directories.
//!
//! ### Diagnostics
//! - `DiagnosticsTool` - Check for code errors via IDE/LSP or language-specific commands
//!
//! ### Terraform
//! - `TerraformFmtTool` - Format Terraform configuration files
//! - `TerraformValidateTool` - Validate Terraform configurations
//! - `TerraformInstallTool` - Install Terraform CLI (auto-detects OS)
//!
//! ### Shell
//! - `ShellTool` - Execute validation commands (docker build, terraform validate, helm lint)
//!
//! ### Planning (Forge-style workflow)
//! - `PlanCreateTool` - Create structured plan files with task checkboxes
//! - `PlanNextTool` - Get next pending task and mark it in-progress
//! - `PlanUpdateTool` - Update task status (done, failed)
//! - `PlanListTool` - List all available plan files
//!
//! ### Web
//! - `WebFetchTool` - Fetch content from URLs (converts HTML to markdown)
//!
//! ### Platform (Syncable Platform API)
//! - `ListOrganizationsTool` - List organizations the user belongs to
//! - `ListProjectsTool` - List projects within an organization
//! - `SelectProjectTool` - Select a project as current context
//! - `CurrentContextTool` - Get the currently selected project context
//! - `OpenProviderSettingsTool` - Open cloud provider settings in browser
//! - `CheckProviderConnectionTool` - Check if a cloud provider is connected
//! - `ListDeploymentConfigsTool` - List deployment configurations for a project
//! - `TriggerDeploymentTool` - Trigger a deployment using a config
//! - `GetDeploymentStatusTool` - Get deployment task status and progress
//! - `ListDeploymentsTool` - List recent deployments with URLs
//! - `GetServiceLogsTool` - Get container logs for a deployed service
//!
//! ## Error Handling Pattern
//!
//! Tools use the shared error utilities in `error.rs`:
//!
//! 1. Each tool keeps its own error type (e.g., `ReadFileError`, `ShellError`)
//! 2. Use `ToolErrorContext` trait to add context when propagating errors
//! 3. Use `format_error_for_llm` for structured JSON error responses to the agent
//! 4. Error categories help the agent understand and recover from errors
//!
//! See `error.rs` for the complete error handling infrastructure.
//!
//! ## Response Format Pattern
//!
//! Tools use the shared response utilities in `response.rs` for consistent output:
//!
//! 1. Use `format_file_content` for file read operations (with truncation metadata)
//! 2. Use `format_list` for directory listings and search results
//! 3. Use `format_write_success` for successful write operations
//! 4. Use `format_cancelled` for user-cancelled operations
//! 5. Use `ResponseMetadata` to track truncation, compression, and item counts
//!
//! For large outputs (analysis, lint results), use `compress_tool_output` or
//! `compress_analysis_output` from `compression.rs` which store full data
//! and return a compressed summary with retrieval reference.
//!
//! ### Example
//!
//! ```ignore
//! use crate::agent::tools::response::{format_file_content, format_list};
//!
//! // File read response
//! Ok(format_file_content(&path, &content, total_lines, returned_lines, truncated))
//!
//! // Directory listing response
//! Ok(format_list(&path, &entries, total_count, was_truncated))
//! ```
//!
//! See `response.rs` for the complete response formatting infrastructure.
/// Execution context for tools that behave differently in CLI vs server mode.
pub use ;
// Smart compression exports
pub use ;
pub use ;
// Error handling utilities for tools
pub use ;
// Response formatting utilities for tools
pub use ;
pub use AnalyzeTool;
pub use BackgroundProcessManager;
pub use DclintTool;
pub use DiagnosticsTool;
pub use WebFetchTool;
pub use ;
pub use HadolintTool;
pub use HelmlintTool;
pub use K8sCostsTool;
pub use K8sDriftTool;
pub use K8sOptimizeTool;
pub use KubelintTool;
pub use ;
pub use ;
pub use PrometheusConnectTool;
pub use PrometheusDiscoverTool;
pub use ;
pub use ShellTool;
pub use ;