Skip to content

Commit abc2fab

Browse files
authored
Merge pull request #250 from syncable-dev/develop
Develop
2 parents c186dbe + f4e96de commit abc2fab

89 files changed

Lines changed: 20090 additions & 20 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,18 @@ authors = ["Syncable Team"]
66
description = "A Rust-based CLI that analyzes code repositories and generates Infrastructure as Code configurations"
77
license = "GPL-3.0"
88
repository = "https://github.com/syncable-dev/syncable-cli"
9-
keywords = ["iac", "infrastructure", "docker", "terraform", "cli"]
9+
keywords = [
10+
"cli",
11+
"devops",
12+
"ai",
13+
"ai-agent",
14+
"infrastructure",
15+
"iac",
16+
"terraform",
17+
"kubernetes",
18+
"docker",
19+
"security"
20+
]
1021
categories = ["command-line-utilities", "development-tools"]
1122
readme = "README.md"
1223

THIRD_PARTY_NOTICES.md

Lines changed: 93 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,88 @@ original project.
8383

8484
---
8585

86+
## KubeLint (kube-linter)
87+
88+
The Kubernetes manifest linting functionality in `src/analyzer/kubelint/` is a Rust
89+
translation of the original kube-linter project by StackRox (Red Hat).
90+
91+
**Original Project:** [kube-linter](https://github.com/stackrox/kube-linter)
92+
93+
**Original Authors:**
94+
- StackRox, Inc. (now part of Red Hat)
95+
- And all contributors to the kube-linter project
96+
97+
**Original License:** Apache License 2.0
98+
99+
**Original Copyright:**
100+
```
101+
Copyright (c) 2020-2024 StackRox, Inc.
102+
```
103+
104+
**What was translated:**
105+
- Kubernetes manifest parsing and validation logic (originally in Go)
106+
- 63 built-in security and best practice checks
107+
- Pragma/ignore directive handling via annotations
108+
- Helm chart rendering integration
109+
- Kustomize directory support
110+
- Check severity and priority system
111+
- SARIF and JSON output formats
112+
113+
**Modifications made:**
114+
- Complete rewrite from Go to Rust
115+
- Integration with Syncable-CLI's agent and tool system
116+
- Native async support for streaming output
117+
- Adaptation to Rust error handling patterns
118+
- Graceful fallback for broken Helm charts
119+
- Additional rules and improvements specific to Syncable's use cases
120+
121+
**License Notice:**
122+
This derivative work maintains compatibility with the Apache-2.0 license.
123+
The full text of the Apache-2.0 license can be found at:
124+
https://www.apache.org/licenses/LICENSE-2.0
125+
126+
---
127+
128+
## Helmlint (helmtest)
129+
130+
The Helm chart linting functionality in `src/analyzer/helmlint/` is a Rust
131+
implementation inspired by and partially derived from the helmtest project
132+
by StackRox (Red Hat).
133+
134+
**Original Project:** [helmtest](https://github.com/stackrox/helmtest)
135+
136+
**Original Authors:**
137+
- StackRox, Inc. (now part of Red Hat)
138+
- And all contributors to the helmtest project
139+
140+
**Original License:** Apache License 2.0
141+
142+
**Original Copyright:**
143+
```
144+
Copyright (c) 2020-2024 StackRox, Inc.
145+
```
146+
147+
**What was implemented:**
148+
- Helm chart structure validation (Chart.yaml, values.yaml)
149+
- Go template syntax analysis
150+
- Values validation and unused value detection
151+
- Security checks for rendered templates
152+
- Best practice validation patterns
153+
154+
**Modifications made:**
155+
- Complete implementation in Rust (original was Go)
156+
- Integration with Syncable-CLI's agent and tool system
157+
- Native async support for streaming output
158+
- Adaptation to Rust error handling patterns
159+
- Additional rules (HL1xxx-HL5xxx series) specific to Syncable's use cases
160+
161+
**License Notice:**
162+
This derivative work maintains compatibility with the Apache-2.0 license.
163+
The full text of the Apache-2.0 license can be found at:
164+
https://www.apache.org/licenses/LICENSE-2.0
165+
166+
---
167+
86168
## ShellCheck (Rule Concepts)
87169

88170
Some shell-related lint rules are inspired by ShellCheck.
@@ -101,11 +183,17 @@ concepts and documentation.
101183

102184
## Acknowledgments
103185

104-
We are grateful to the open source community and the authors of Hadolint and
105-
docker-compose-linter for creating and maintaining excellent container configuration
106-
linting tools. These Rust implementations allow native integration with Syncable-CLI
107-
while preserving the valuable rule definitions and linting logic developed by the
108-
original authors.
186+
We are grateful to the open source community and the authors of:
187+
188+
- **Hadolint** - For the comprehensive Dockerfile linting rules
189+
- **docker-compose-linter** - For Docker Compose best practices
190+
- **kube-linter (StackRox/Red Hat)** - For the extensive Kubernetes security checks
191+
- **helmtest (StackRox/Red Hat)** - For Helm chart validation patterns
192+
193+
These Rust implementations allow native integration with Syncable-CLI while
194+
preserving the valuable rule definitions and linting logic developed by the
195+
original authors. Special thanks to StackRox (now part of Red Hat) for their
196+
excellent Kubernetes and Helm security tooling.
109197

110198
If you are the author of any software mentioned here and believe the attribution
111199
is incorrect or incomplete, please open an issue at:

src/agent/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,8 @@ pub async fn run_interactive(
362362
.tool(VulnerabilitiesTool::new(project_path_buf.clone()))
363363
.tool(HadolintTool::new(project_path_buf.clone()))
364364
.tool(DclintTool::new(project_path_buf.clone()))
365+
.tool(KubelintTool::new(project_path_buf.clone()))
366+
.tool(HelmlintTool::new(project_path_buf.clone()))
365367
.tool(TerraformFmtTool::new(project_path_buf.clone()))
366368
.tool(TerraformValidateTool::new(project_path_buf.clone()))
367369
.tool(TerraformInstallTool::new())
@@ -438,6 +440,8 @@ pub async fn run_interactive(
438440
.tool(VulnerabilitiesTool::new(project_path_buf.clone()))
439441
.tool(HadolintTool::new(project_path_buf.clone()))
440442
.tool(DclintTool::new(project_path_buf.clone()))
443+
.tool(KubelintTool::new(project_path_buf.clone()))
444+
.tool(HelmlintTool::new(project_path_buf.clone()))
441445
.tool(TerraformFmtTool::new(project_path_buf.clone()))
442446
.tool(TerraformValidateTool::new(project_path_buf.clone()))
443447
.tool(TerraformInstallTool::new())
@@ -518,6 +522,8 @@ pub async fn run_interactive(
518522
.tool(VulnerabilitiesTool::new(project_path_buf.clone()))
519523
.tool(HadolintTool::new(project_path_buf.clone()))
520524
.tool(DclintTool::new(project_path_buf.clone()))
525+
.tool(KubelintTool::new(project_path_buf.clone()))
526+
.tool(HelmlintTool::new(project_path_buf.clone()))
521527
.tool(TerraformFmtTool::new(project_path_buf.clone()))
522528
.tool(TerraformValidateTool::new(project_path_buf.clone()))
523529
.tool(TerraformInstallTool::new())
@@ -1410,6 +1416,8 @@ pub async fn run_query(
14101416
.tool(VulnerabilitiesTool::new(project_path_buf.clone()))
14111417
.tool(HadolintTool::new(project_path_buf.clone()))
14121418
.tool(DclintTool::new(project_path_buf.clone()))
1419+
.tool(KubelintTool::new(project_path_buf.clone()))
1420+
.tool(HelmlintTool::new(project_path_buf.clone()))
14131421
.tool(TerraformFmtTool::new(project_path_buf.clone()))
14141422
.tool(TerraformValidateTool::new(project_path_buf.clone()))
14151423
.tool(TerraformInstallTool::new())
@@ -1453,6 +1461,8 @@ pub async fn run_query(
14531461
.tool(VulnerabilitiesTool::new(project_path_buf.clone()))
14541462
.tool(HadolintTool::new(project_path_buf.clone()))
14551463
.tool(DclintTool::new(project_path_buf.clone()))
1464+
.tool(KubelintTool::new(project_path_buf.clone()))
1465+
.tool(HelmlintTool::new(project_path_buf.clone()))
14561466
.tool(TerraformFmtTool::new(project_path_buf.clone()))
14571467
.tool(TerraformValidateTool::new(project_path_buf.clone()))
14581468
.tool(TerraformInstallTool::new())
@@ -1499,6 +1509,8 @@ pub async fn run_query(
14991509
.tool(VulnerabilitiesTool::new(project_path_buf.clone()))
15001510
.tool(HadolintTool::new(project_path_buf.clone()))
15011511
.tool(DclintTool::new(project_path_buf.clone()))
1512+
.tool(KubelintTool::new(project_path_buf.clone()))
1513+
.tool(HelmlintTool::new(project_path_buf.clone()))
15021514
.tool(TerraformFmtTool::new(project_path_buf.clone()))
15031515
.tool(TerraformValidateTool::new(project_path_buf.clone()))
15041516
.tool(TerraformInstallTool::new())

src/agent/prompts/mod.rs

Lines changed: 59 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,23 @@ You have access to tools to help analyze and understand the project:
146146
- analyze_project - Detect languages, frameworks, dependencies, and architecture
147147
- security_scan - Find potential vulnerabilities and secrets
148148
- check_vulnerabilities - Check dependencies for known CVEs
149-
- hadolint - Lint Dockerfiles for best practices
150-
- terraform_fmt - Format Terraform configuration files
151-
- terraform_validate - Validate Terraform configurations
152149
- read_file - Read file contents
153150
- list_directory - List files and directories
154151
152+
**Linting Tools (use NATIVE tools, not shell commands):**
153+
- hadolint - Lint Dockerfiles for best practices and security
154+
- dclint - Lint docker-compose files for best practices
155+
- kubelint - Lint Kubernetes manifests for SECURITY and BEST PRACTICES
156+
• Use for: raw YAML files, Helm charts (renders them), Kustomize directories
157+
• Checks: privileged containers, missing probes, RBAC issues, resource limits
158+
- helmlint - Lint Helm chart STRUCTURE and TEMPLATES (before rendering)
159+
• Use for: Chart.yaml validation, values.yaml, Go template syntax
160+
• Checks: chart metadata, template errors, undefined values, unclosed blocks
161+
162+
**Terraform Tools:**
163+
- terraform_fmt - Format Terraform configuration files
164+
- terraform_validate - Validate Terraform configurations
165+
155166
**Generation Tools:**
156167
- write_file - Write content to a file (creates parent directories automatically)
157168
- write_files - Write multiple files at once
@@ -220,6 +231,12 @@ pub fn get_code_development_prompt(project_path: &std::path::Path) -> String {
220231
- read_file - Read file contents
221232
- list_directory - List files and directories
222233
234+
**Linting Tools (for DevOps artifacts):**
235+
- hadolint - Lint Dockerfiles
236+
- dclint - Lint docker-compose files
237+
- kubelint - Lint K8s manifests (security, best practices)
238+
- helmlint - Lint Helm charts (structure, templates)
239+
223240
**Development Tools:**
224241
- write_file - Write or update a single file
225242
- write_files - Write multiple files at once
@@ -296,16 +313,29 @@ pub fn get_devops_prompt(project_path: &std::path::Path) -> String {
296313
- analyze_project - Detect languages, frameworks, dependencies, build commands
297314
- security_scan - Find potential vulnerabilities
298315
- check_vulnerabilities - Check dependencies for known CVEs
299-
- hadolint - Native Dockerfile linter (use this, NOT shell hadolint)
300316
- read_file - Read file contents
301317
- list_directory - List files and directories
302318
319+
**Linting Tools (use NATIVE tools, not shell commands):**
320+
- hadolint - Native Dockerfile linter for best practices and security
321+
- dclint - Native docker-compose linter for best practices
322+
- kubelint - Native Kubernetes manifest linter for SECURITY and BEST PRACTICES
323+
• Use for: K8s YAML files, Helm charts (renders them first), Kustomize directories
324+
• Checks: privileged containers, missing probes, RBAC wildcards, resource limits
325+
- helmlint - Native Helm chart linter for STRUCTURE and TEMPLATES
326+
• Use for: Chart.yaml, values.yaml, Go template syntax validation
327+
• Checks: missing apiVersion, unused values, undefined template variables
328+
329+
**Terraform Tools:**
330+
- terraform_fmt - Format Terraform configuration files
331+
- terraform_validate - Validate Terraform configurations
332+
303333
**Generation Tools:**
304334
- write_file - Write Dockerfile, terraform config, helm values, etc.
305335
- write_files - Write multiple files (Terraform modules, Helm charts)
306336
307-
**Validation Tools:**
308-
- shell - Execute validation commands (docker build, terraform validate, helm lint)
337+
**Shell Tool:**
338+
- shell - Execute build/test commands (docker build, terraform init)
309339
310340
**Plan Execution Tools:**
311341
- plan_list - List available plans in plans/ directory
@@ -358,16 +388,24 @@ When the user says "execute the plan" or similar:
358388
1. **Analyze**: Use analyze_project to understand the project
359389
2. **Plan**: Determine what files need to be created
360390
3. **Generate**: Use write_file or write_files to create artifacts
361-
4. **Validate**:
362-
- Docker: hadolint tool FIRST, then shell docker build
363-
- Terraform: shell terraform init && terraform validate
364-
- Helm: shell helm lint ./chart
391+
4. **Validate** (use NATIVE linting tools, not shell commands):
392+
- **Docker**: hadolint tool FIRST, then shell docker build
393+
- **docker-compose**: dclint tool
394+
- **Terraform**: terraform_validate tool (or shell terraform init && terraform validate)
395+
- **Helm charts**: helmlint tool for chart structure/templates
396+
- **K8s manifests**: kubelint tool for security/best practices
397+
- **Helm + K8s**: Use BOTH helmlint (structure) AND kubelint (security on rendered output)
365398
5. **Self-Correct**: If validation fails, analyze error, fix files, re-validate
366399
367-
**CRITICAL for hadolint**: If hadolint finds ANY errors or warnings:
400+
**CRITICAL for linting tools**: If ANY linter finds errors or warnings:
368401
1. STOP and report ALL issues to the user FIRST
369-
2. Show each violation with line number, rule code, message
370-
3. DO NOT proceed to docker build until user acknowledges
402+
2. Show each violation with line number, rule code, message, and fix recommendation
403+
3. DO NOT proceed to build/deploy until user acknowledges or issues are fixed
404+
405+
**When to use helmlint vs kubelint:**
406+
- helmlint: Chart.yaml issues, values.yaml unused values, template syntax errors
407+
- kubelint: Security (privileged, RBAC), best practices (probes, limits), after Helm renders
408+
- For Helm charts: Run BOTH - helmlint catches template issues, kubelint catches security issues
371409
</work_protocol>
372410
373411
<error_handling>
@@ -554,7 +592,14 @@ Task status markers:
554592
- list_directory - List files and directories
555593
- shell - Run read-only commands only (ls, cat, grep, find, git status/log/diff)
556594
- analyze_project - Analyze project architecture, dependencies
557-
- hadolint - Lint Dockerfiles (read-only analysis)
595+
596+
**Linting Tools (read-only analysis):**
597+
- hadolint - Lint Dockerfiles for best practices
598+
- dclint - Lint docker-compose files
599+
- kubelint - Lint K8s manifests for security/best practices (works on YAML, Helm charts, Kustomize)
600+
- helmlint - Lint Helm chart structure and templates
601+
602+
**Planning Tools:**
558603
- **plan_create** - Create structured plan files with task checkboxes
559604
- **plan_list** - List existing plans in plans/ directory
560605

0 commit comments

Comments
 (0)