Skip to content

Commit 7a816e5

Browse files
committed
init commit
0 parents  commit 7a816e5

539 files changed

Lines changed: 223174 additions & 0 deletions

File tree

Some content is hidden

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

‎.cargo/config.toml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[target.x86_64-unknown-linux-musl]
2+
rustflags = ["-C", "link-arg=-static"]
3+
4+
[target.aarch64-unknown-linux-musl]
5+
rustflags = ["-C", "link-arg=-static"]

‎.coderabbit.yaml‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# CodeRabbit configuration for ZeroBuild
2+
# Documentation: https://docs.coderabbit.ai/reference/configuration
3+
4+
language: en-US
5+
early_access: false
6+
7+
# Enable tone control for reviews
8+
reviews:
9+
# Request changes workflow
10+
request_changes_workflow: false
11+
12+
# High level summary of the PR
13+
high_level_summary: true
14+
15+
# Generate sequence diagrams
16+
sequence_diagrams: true
17+
18+
# Auto-review configuration
19+
auto_review:
20+
enabled: true
21+
# Only review PRs targeting these branches
22+
base_branches:
23+
- main
24+
- develop
25+
# Skip reviews for draft PRs or WIP
26+
drafts: false
27+
# Enable base branch analysis
28+
base_branch_analysis: true
29+
30+
# Poem configuration
31+
poem:
32+
enabled: false
33+
34+
# Reviewer suggestions
35+
reviewer:
36+
# Suggest reviewers based on blame data
37+
enabled: true
38+
# Automatically assign suggested reviewers
39+
auto_assign: false
40+
41+
# Enable finishing touches
42+
finishing_touches:
43+
# Generate docstrings
44+
docstrings:
45+
enabled: true
46+
# Generate unit tests
47+
unit_tests:
48+
enabled: true
49+
50+
# Tools configuration
51+
tools:
52+
# Rust-specific tools
53+
cargo:
54+
enabled: true
55+
56+
# Chat configuration
57+
chat:
58+
auto_reply: true
59+
60+
# Path filters - ignore generated files
61+
path_filters:
62+
- "!**/target/**"
63+
- "!**/node_modules/**"
64+
- "!**/.cargo/**"
65+
- "!**/Cargo.lock"
66+
67+
# Review instructions specific to Rust and this project
68+
review_instructions:
69+
- "Focus on Rust best practices and idiomatic code"
70+
- "Check for security vulnerabilities in encryption/crypto code"
71+
- "Ensure proper error handling with Result types"
72+
- "Verify memory safety and avoid unnecessary clones"
73+
- "Check for proper use of lifetimes and borrowing"
74+
- "Ensure tests cover critical security paths"
75+
- "Review configuration migration code carefully"

‎.dockerignore‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Git history (may contain old secrets)
2+
.git
3+
.gitignore
4+
.githooks
5+
6+
# Rust build artifacts (can be multiple GB)
7+
target
8+
9+
# Documentation and examples (not needed for runtime)
10+
docs
11+
examples
12+
tests
13+
14+
# Markdown files (README, CHANGELOG, etc.)
15+
*.md
16+
17+
# Images (unnecessary for build)
18+
*.png
19+
*.svg
20+
*.jpg
21+
*.jpeg
22+
*.gif
23+
24+
# SQLite databases (conversation history, cron jobs)
25+
*.db
26+
*.db-journal
27+
28+
# macOS artifacts
29+
.DS_Store
30+
.AppleDouble
31+
.LSOverride
32+
33+
# CI/CD configs (not needed in image)
34+
.github
35+
36+
# Cargo deny config (lint tool, not runtime)
37+
deny.toml
38+
39+
# License file (not needed for runtime)
40+
LICENSE
41+
42+
# Temporary files
43+
.tmp_*
44+
*.tmp
45+
*.bak
46+
*.swp
47+
*~
48+
49+
# IDE and editor configs
50+
.idea
51+
.vscode
52+
*.iml
53+
54+
# Windsurf workflows
55+
.windsurf
56+
57+
# Environment files (may contain secrets)
58+
.env
59+
.env.*
60+
!.env.example
61+
62+
# Coverage and profiling
63+
*.profraw
64+
*.profdata
65+
coverage
66+
lcov.info

‎.editorconfig‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# EditorConfig — https://editorconfig.org
2+
# Provides consistent formatting defaults across editors and platforms.
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
indent_style = space
12+
indent_size = 4
13+
14+
[*.md]
15+
# Trailing whitespace is significant in Markdown (line breaks).
16+
trim_trailing_whitespace = false
17+
18+
[*.{yml,yaml}]
19+
indent_size = 2
20+
21+
[*.toml]
22+
indent_size = 2
23+
24+
[Dockerfile]
25+
indent_size = 4

‎.env.example‎

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# ZeroClaw Environment Variables
2+
# Copy this file to `.env` and fill in your local values.
3+
# Never commit `.env` or any real secrets.
4+
5+
# ── Core Runtime ──────────────────────────────────────────────
6+
# Provider key resolution at runtime:
7+
# 1) explicit key passed from config/CLI
8+
# 2) provider-specific env var (OPENROUTER_API_KEY, OPENAI_API_KEY, ...)
9+
# 3) generic fallback env vars below
10+
11+
# Generic fallback API key (used when provider-specific key is absent)
12+
API_KEY=your-api-key-here
13+
# ZEROBUILD_API_KEY=your-api-key-here
14+
15+
# Default provider/model (can be overridden by CLI flags)
16+
PROVIDER=openrouter
17+
# ZEROBUILD_PROVIDER=openrouter
18+
# ZEROBUILD_MODEL=anthropic/claude-sonnet-4-6
19+
# ZEROBUILD_TEMPERATURE=0.7
20+
21+
# Workspace directory override
22+
# ZEROBUILD_WORKSPACE=/path/to/workspace
23+
24+
# Reasoning mode (enables extended thinking for supported models)
25+
# ZEROBUILD_REASONING_ENABLED=false
26+
# REASONING_ENABLED=false
27+
28+
# ── Provider-Specific API Keys ────────────────────────────────
29+
# OpenRouter
30+
# OPENROUTER_API_KEY=sk-or-v1-...
31+
32+
# Anthropic
33+
# ANTHROPIC_OAUTH_TOKEN=...
34+
# ANTHROPIC_API_KEY=sk-ant-...
35+
36+
# OpenAI / Gemini
37+
# OPENAI_API_KEY=sk-...
38+
# GEMINI_API_KEY=...
39+
# GOOGLE_API_KEY=...
40+
41+
# Other supported providers
42+
# VENICE_API_KEY=...
43+
# GROQ_API_KEY=...
44+
# MISTRAL_API_KEY=...
45+
# DEEPSEEK_API_KEY=...
46+
# XAI_API_KEY=...
47+
# TOGETHER_API_KEY=...
48+
# FIREWORKS_API_KEY=...
49+
# PERPLEXITY_API_KEY=...
50+
# COHERE_API_KEY=...
51+
# MOONSHOT_API_KEY=...
52+
# GLM_API_KEY=...
53+
# MINIMAX_OAUTH_TOKEN=...
54+
# MINIMAX_API_KEY=...
55+
# MINIMAX_OAUTH_REFRESH_TOKEN=...
56+
# MINIMAX_OAUTH_REGION=global # optional: global|cn
57+
# QIANFAN_API_KEY=...
58+
# DASHSCOPE_API_KEY=...
59+
# ZAI_API_KEY=...
60+
# SYNTHETIC_API_KEY=...
61+
# OPENCODE_API_KEY=...
62+
# VERCEL_API_KEY=...
63+
# CLOUDFLARE_API_KEY=...
64+
65+
# ── Gateway ──────────────────────────────────────────────────
66+
# ZEROBUILD_GATEWAY_PORT=3000
67+
# ZEROBUILD_GATEWAY_HOST=127.0.0.1
68+
# ZEROBUILD_ALLOW_PUBLIC_BIND=false
69+
70+
# ── Storage ─────────────────────────────────────────────────
71+
# Backend override for persistent storage (default: sqlite)
72+
# ZEROBUILD_STORAGE_PROVIDER=sqlite
73+
# ZEROBUILD_STORAGE_DB_URL=postgres://localhost/zeroclaw
74+
# ZEROBUILD_STORAGE_CONNECT_TIMEOUT_SECS=5
75+
76+
# ── Proxy ──────────────────────────────────────────────────
77+
# Forward provider/service traffic through an HTTP(S) proxy.
78+
# ZEROBUILD_PROXY_ENABLED=false
79+
# ZEROBUILD_HTTP_PROXY=http://proxy.example.com:8080
80+
# ZEROBUILD_HTTPS_PROXY=http://proxy.example.com:8080
81+
# ZEROBUILD_ALL_PROXY=socks5://proxy.example.com:1080
82+
# ZEROBUILD_NO_PROXY=localhost,127.0.0.1
83+
# ZEROBUILD_PROXY_SCOPE=zeroclaw # environment|zeroclaw|services
84+
# ZEROBUILD_PROXY_SERVICES=openai,anthropic
85+
86+
# ── Optional Integrations ────────────────────────────────────
87+
# Pushover notifications (`pushover` tool)
88+
# PUSHOVER_TOKEN=your-pushover-app-token
89+
# PUSHOVER_USER_KEY=your-pushover-user-key
90+
91+
# ── Zerobuilder Master Agent ─────────────────────────────────
92+
# URL of the Zerobuilder orchestrator backend (Node.js/Express).
93+
# Must match the PORT in backend/.env
94+
# ZEROBUILDER_ORCHESTRATOR_URL=http://127.0.0.1:3000
95+
96+
# Shared secret — must match ORCHESTRATOR_SECRET in backend/.env
97+
# ZEROBUILDER_ORCHESTRATOR_SECRET=changeme
98+
99+
# ── Builder → Master Agent progress routing ──────────────────
100+
# Set in backend/.env to route Builder Agent progress messages
101+
# through the ZeroClaw gateway instead of sending directly to Telegram.
102+
# ZEROBUILD_GATEWAY_URL=http://127.0.0.1:3001 # ZeroClaw gateway port
103+
# ZEROBUILD_NOTIFY_SECRET=changeme # must match [zerobuilder] orchestrator_secret
104+
105+
# ── Z.AI GLM Coding Plan ───────────────────────────────────────
106+
# Z.AI provides GLM models through OpenAI-compatible endpoints.
107+
# API key format: id.secret (e.g., abc123.xyz789)
108+
#
109+
# Usage:
110+
# zeroclaw onboard --provider zai --api-key YOUR_ZAI_API_KEY
111+
#
112+
# Or set the environment variable:
113+
# ZAI_API_KEY=your-id.secret
114+
#
115+
# Common models: glm-5, glm-4.7, glm-4-plus, glm-4-flash
116+
# See docs/zai-glm-setup.md for detailed configuration.
117+
118+
# ── Web Search ────────────────────────────────────────────────
119+
# Web search tool for finding information on the internet.
120+
# Enabled by default with DuckDuckGo (free, no API key required).
121+
#
122+
# WEB_SEARCH_ENABLED=true
123+
# WEB_SEARCH_PROVIDER=duckduckgo
124+
# WEB_SEARCH_MAX_RESULTS=5
125+
# WEB_SEARCH_TIMEOUT_SECS=15
126+
#
127+
# Optional: Brave Search (requires API key from https://brave.com/search/api)
128+
# WEB_SEARCH_PROVIDER=brave
129+
# BRAVE_API_KEY=your-brave-search-api-key

‎.envrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

‎.gemini/style-guide.md‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# ZeroBuild Code Style Guide
2+
3+
This style guide provides instructions for Gemini Code Assist when reviewing pull requests for the ZeroBuild project.
4+
5+
## Project Overview
6+
7+
ZeroBuild is a Rust-based security-focused project that handles encryption, secrets management, and secure configuration. Code reviews should prioritize security, memory safety, and Rust best practices.
8+
9+
## General Principles
10+
11+
### Priority Levels
12+
13+
- **CRITICAL**: Security vulnerabilities, memory safety issues, data leaks
14+
- **HIGH**: Logic errors, incorrect error handling, API misuse
15+
- **MEDIUM**: Code quality, performance concerns, non-idiomatic Rust
16+
- **LOW**: Style issues, documentation improvements, minor refactoring
17+
18+
## Rust-Specific Guidelines
19+
20+
### Memory Safety
21+
22+
1. **Borrowing and Lifetimes**: Verify proper use of borrowing and lifetime annotations
23+
2. **Unsafe Code**: Flag any `unsafe` blocks for careful review - they should be minimal and well-justified
24+
3. **Clone Usage**: Identify unnecessary `.clone()` calls that could be replaced with borrowing
25+
4. **Memory Leaks**: Watch for potential memory leaks in long-running processes
26+
27+
### Error Handling
28+
29+
1. **Result Types**: All fallible operations should return `Result` types
30+
2. **Error Propagation**: Use `?` operator for clean error propagation
31+
3. **Custom Errors**: Ensure custom error types implement appropriate traits
32+
4. **Panic**: Flag any uses of `panic!`, `unwrap()`, or `expect()` in production code
33+
34+
### Security
35+
36+
1. **Cryptography**: Review all crypto code for:
37+
- Proper key generation and storage
38+
- Secure random number generation
39+
- No hardcoded secrets or keys
40+
- Use of well-vetted crypto libraries
41+
42+
2. **Secrets Management**:
43+
- Secrets should never be logged
44+
- Use secure memory wiping when appropriate
45+
- Validate encryption/decryption implementations
46+
47+
3. **Input Validation**: All external input must be validated
48+
49+
### Code Quality
50+
51+
1. **Documentation**: Public APIs should have doc comments with examples
52+
2. **Tests**: Critical paths should have comprehensive test coverage
53+
3. **Type Safety**: Prefer type-safe abstractions over primitive types
54+
4. **Idiomatic Rust**: Follow Rust API guidelines and conventions
55+
56+
## Project-Specific Rules
57+
58+
### Configuration Management
59+
60+
- Configuration migrations must be backward compatible
61+
- Validate all configuration before applying
62+
- Test migration paths from legacy to new formats
63+
64+
### Dependencies
65+
66+
- Prefer well-maintained crates with security audit history
67+
- Avoid unnecessary dependencies
68+
- Check for known vulnerabilities in dependencies
69+
70+
## Review Focus Areas
71+
72+
When reviewing PRs, pay special attention to:
73+
74+
1. Changes in `src/security/` - highest security scrutiny
75+
2. Configuration migration code - ensure data integrity
76+
3. Error handling paths - verify all edge cases
77+
4. Public API changes - check for breaking changes
78+
5. Test coverage - ensure critical code is tested
79+
80+
## Common Issues to Flag
81+
82+
- Unhandled errors or generic error messages
83+
- Missing input validation
84+
- Hardcoded credentials or secrets
85+
- Unsafe code without justification
86+
- Missing documentation on public APIs
87+
- Inadequate test coverage on security-critical code
88+
- Performance issues (unnecessary allocations, inefficient algorithms)
89+
- Breaking API changes without deprecation warnings

0 commit comments

Comments
 (0)