Skip to content

Commit 54a21da

Browse files
committed
feat: update permissions in settings.local.json and remove obsolete .clinerules files
1 parent 31f3886 commit 54a21da

File tree

11 files changed

+194
-79
lines changed

11 files changed

+194
-79
lines changed

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"permissions": {
33
"allow": [
44
"Bash(make lint)",
5-
"Bash(uv run pytest:*)"
5+
"Bash(uv run pytest:*)",
6+
"Bash(find:*)"
67
],
78
"deny": []
89
}

.clinerules

Lines changed: 0 additions & 70 deletions
This file was deleted.

CLAUDE.md

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
**wish** is an LLM-assisted shell for penetration testing that translates natural language "wishes" into executable shell commands. It provides a TUI (Text-based User Interface) for reviewing suggested commands, executing them, and monitoring their execution status. The system integrates with various security tools and supports both local execution and remote C2 operations.
8+
9+
## Key Development Commands
10+
11+
### Testing and Quality
12+
```bash
13+
# Root directory commands
14+
make test # Run unit tests across all projects
15+
make integrated-test # Run integration tests (requires API keys and .env)
16+
make lint # Run ruff linting
17+
make format # Auto-format with ruff
18+
19+
# Individual module testing
20+
cd <module-name>
21+
uv sync --dev # Install dependencies
22+
uv run pytest # Run module tests
23+
uv run pytest --ignore=tests/integrated/ # Run only unit tests
24+
uv run pytest tests/integrated/ # Run only integration tests
25+
```
26+
27+
### Running wish
28+
```bash
29+
# Install and run
30+
pip install wish-sh
31+
export OPENAI_API_KEY=your-api-key-here
32+
wish # or wish-sh on macOS
33+
34+
# Development mode
35+
cd wish-sh
36+
uv run wish
37+
```
38+
39+
### API Services
40+
```bash
41+
# Start unified API Gateway
42+
make run-api
43+
44+
# Run E2E tests
45+
make e2e
46+
```
47+
48+
## Architecture Overview
49+
50+
### Module Structure
51+
- **wish-sh**: Main TUI application with WishManager orchestrator
52+
- **wish-models**: Shared Pydantic models (CommandResult, Wish, etc.)
53+
- **wish-command-generation**: LLM-based command generation with RAG capabilities
54+
- **wish-command-generation-api**: Lambda-based API for command generation using LangGraph
55+
- **wish-command-execution**: Command execution with multiple backends (Bash, Sliver C2)
56+
- **wish-log-analysis**: Client library for command log analysis
57+
- **wish-log-analysis-api**: Lambda-based API for LLM-powered log analysis
58+
- **wish-knowledge-loader**: CLI tool for loading knowledge bases from GitHub repositories
59+
- **wish-tools**: Framework for integrating security tools (msfconsole, etc.)
60+
- **wish-api**: Unified API Gateway for all wish services
61+
62+
### Core Workflow
63+
1. **User Input**: Natural language wishes in TUI
64+
2. **Command Generation**: LLM converts wishes to executable commands using RAG
65+
3. **Command Review**: User approves/modifies suggested commands
66+
4. **Execution**: Commands run locally (Bash) or remotely (Sliver C2)
67+
5. **Monitoring**: Real-time status tracking and log analysis
68+
6. **Analysis**: LLM analyzes execution logs and determines success/failure
69+
70+
### Key Design Patterns
71+
- **Modular Architecture**: Each component is independently packaged with uv
72+
- **State Machine**: LangGraph manages command generation workflows
73+
- **Factory Pattern**: Test factories in `test_factories/` for creating test data
74+
- **Strategy Pattern**: Multiple execution backends (Bash, Sliver)
75+
- **Client-Server**: API-based services for scalable command generation and analysis
76+
77+
## Development Environment
78+
79+
### Required Configuration
80+
Create `.env` file in project root or set environment variables:
81+
```
82+
OPENAI_API_KEY=<your-key>
83+
LANGCHAIN_API_KEY=<optional-for-langsmith>
84+
LANGCHAIN_PROJECT=<optional-project-name>
85+
```
86+
87+
### Testing Considerations
88+
- Unit tests mock external dependencies (LLMs, APIs)
89+
- Integration tests require real API connections and keys
90+
- Use `@pytest.mark.parametrize` for testing multiple scenarios
91+
- Test factories provide consistent test data across modules
92+
93+
## Common Patterns
94+
95+
### Adding New Features
96+
1. Define models in `wish-models` if needed
97+
2. Implement core logic in appropriate module
98+
3. Add unit tests with mocked dependencies
99+
4. Add integration tests for end-to-end validation
100+
5. Update TUI flows in `wish-sh` if needed
101+
102+
### Adding New Tools
103+
1. Extend `wish-tools` framework with new tool class
104+
2. Follow the base tool interface pattern
105+
3. Add comprehensive tests including integration tests
106+
4. Document tool capabilities and usage
107+
108+
### Debugging Workflows
109+
1. Use LangSmith tracing for detailed LLM interactions
110+
2. Check logs in execution directories (timestamped)
111+
3. Use individual module testing for isolated debugging
112+
4. Review command generation API logs for generation issues
113+
114+
## Data Models
115+
116+
### Core Models (wish-models)
117+
- **Wish**: Top-level user request with commands and execution state
118+
- **CommandResult**: Execution results with logs, exit codes, and analysis
119+
- **CommandInput**: Generated commands ready for execution
120+
- **SystemInfo**: System context for command generation
121+
122+
### States and Lifecycle
123+
- **Wish States**: PENDING → IN_PROGRESS → COMPLETED/FAILED
124+
- **Command States**: TODO → RUNNING → SUCCESS/FAILED/TIMEOUT/CANCELLED
125+
- **Execution Flow**: Generation → Review → Execution → Analysis → Completion
126+
127+
## Tool Integration
128+
129+
### Supported Tools
130+
- **bash**: Local shell command execution
131+
- **msfconsole**: Metasploit framework integration with automation support
132+
- **sliver**: C2 framework for remote operations
133+
134+
### Tool Framework
135+
Located in `wish-tools/`, provides:
136+
- Base tool interface for consistent integration
137+
- Tool registry for dynamic discovery
138+
- Testing framework for tool validation
139+
- Documentation generation for tool capabilities
140+
141+
## API Architecture
142+
143+
### Command Generation API
144+
- **Endpoint**: Lambda-based API with LangGraph processing
145+
- **Features**: RAG-enhanced generation, error handling, command optimization
146+
- **Nodes**: feedback_analyzer, query_processor, command_generator, command_modifier
147+
148+
### Log Analysis API
149+
- **Endpoint**: Lambda-based API for LLM-powered log analysis
150+
- **Features**: Command state classification, log summarization
151+
- **Processing**: Multi-stage analysis with result combination
152+
153+
## Common Development Tasks
154+
155+
### Running Tests
156+
```bash
157+
# All tests
158+
make test
159+
160+
# Specific module
161+
cd wish-sh && uv run pytest
162+
163+
# With coverage
164+
cd wish-sh && uv run pytest --cov=wish_sh
165+
```
166+
167+
### Code Quality
168+
```bash
169+
# Lint and format
170+
make lint
171+
make format
172+
173+
# Type checking (if configured)
174+
cd <module> && uv run mypy src/
175+
```
176+
177+
### Knowledge Base Management
178+
```bash
179+
# Load knowledge base
180+
wish-knowledge-loader load --repo owner/repo --include "*.md"
181+
182+
# Search knowledge
183+
wish-knowledge-loader search "nmap port scan"
184+
```
185+
186+
## Security Considerations
187+
188+
- API keys should be set via environment variables, never committed
189+
- Command execution is sandboxed where possible
190+
- Remote execution through Sliver C2 requires proper authentication
191+
- Log files may contain sensitive information and should be handled carefully
192+
- Tool integrations follow security best practices for automated execution

wish-command-execution/.clinerules

Lines changed: 0 additions & 1 deletion
This file was deleted.

wish-command-generation-api/.clinerules

Lines changed: 0 additions & 1 deletion
This file was deleted.

wish-command-generation/.clinerules

Lines changed: 0 additions & 1 deletion
This file was deleted.

wish-knowledge-loader/.clinerules

Lines changed: 0 additions & 1 deletion
This file was deleted.

wish-log-analysis-api/.clinerules

Lines changed: 0 additions & 1 deletion
This file was deleted.

wish-log-analysis/.clinerules

Lines changed: 0 additions & 1 deletion
This file was deleted.

wish-models/.clinerules

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)