Skip to content

Commit ae69ff0

Browse files
committed
Merge remote-tracking branch 'origin/refactor/dependencies'
2 parents a15f91c + a22604d commit ae69ff0

23 files changed

+939
-750
lines changed

.cursor/rules/01_python.mdc

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
---
7+
description: Python development standards
8+
globs: ["**/*"]
9+
alwaysApply: true
10+
---
11+
12+
# Python Standards
13+
14+
## Language & Framework
15+
- **Language**: Python 3.8+
16+
- **Package Manager**: pip or uv
17+
- **Virtual Environment**: Always use virtual environments
18+
19+
## Code Style
20+
- Follow PEP 8 style guidelines
21+
- Use type hints for all functions and methods
22+
- Maximum line length: 88 characters (Black formatter compatible)
23+
- Use snake_case for variables and functions, PascalCase for classes
24+
- Use UPPER_CASE for constants
25+
- Write docstrings for all public functions and classes
26+
27+
## Development Tools
28+
- **Formatter**: black (recommended) or autopep8
29+
- **Linter**: flake8, pylint, or ruff
30+
- **Type Checker**: mypy or pyright
31+
- **Testing**: pytest or unittest
32+
- **Import Sorting**: isort
33+
34+
## Code Quality
35+
- Maintain type safety with type checker
36+
- Keep functions focused and single-purpose
37+
- Use descriptive error messages
38+
- Handle exceptions appropriately
39+
- Use context managers for resource management
40+
41+
## File Organization
42+
```
43+
project/
44+
├── src/ # Source code
45+
├── tests/ # Test files
46+
├── pyproject.toml # Project configuration
47+
└── README.md # Project documentation
48+
```
49+
50+
## Dependencies
51+
- Always specify minimum versions
52+
- Keep dependencies minimal and well-justified
53+
- Pin exact versions in lock files
54+
- Document new dependencies and their purpose
55+
56+
## Error Handling
57+
- Use appropriate exception types
58+
- Provide meaningful error messages
59+
- Log errors appropriately
60+
- Fail gracefully with helpful suggestions
61+
62+
## Performance
63+
- Use appropriate data structures
64+
- Consider memory usage for large data processing
65+
- Use generators for large datasets
66+
- Profile code when performance is critical
67+
68+
## Security
69+
- Never hardcode credentials
70+
- Validate input parameters
71+
- Handle sensitive data appropriately
72+
- Follow security best practices
73+

.cursor/rules/02_tasks.mdc

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
---
7+
description: Task execution framework
8+
globs: ["**/*"]
9+
alwaysApply: true
10+
---
11+
12+
# Task Execution Framework
13+
14+
You are an AI assistant with advanced problem-solving capabilities. Follow these instructions to perform tasks efficiently and accurately.
15+
16+
## 1. Analysis and Planning
17+
- Briefly summarize the main tasks
18+
- Review the specified technology stack and constraints
19+
- Identify important requirements and limitations
20+
- List potential challenges
21+
- Enumerate specific steps for task execution
22+
- Determine the optimal execution order
23+
24+
### Preventing Duplicate Implementation
25+
Before implementation, verify:
26+
- Existence of similar existing functionality
27+
- Functions or components with the same or similar names
28+
- Duplicate API endpoints
29+
- Common processes that can be shared
30+
31+
## 2. Task Execution
32+
- Execute each identified step systematically
33+
- Report progress briefly after completing each step
34+
- Maintain consistency in naming conventions and structure
35+
- Follow proper directory organization
36+
37+
## 3. Quality Control
38+
- Verify execution results of each task
39+
- For errors or issues:
40+
1. Isolate and identify root cause
41+
2. Create and implement countermeasures
42+
3. Verify fixes work correctly
43+
4. Document the resolution
44+
45+
## 4. Final Verification
46+
- Evaluate overall deliverables
47+
- Verify consistency with original instructions
48+
- Confirm no duplicate functionality was created
49+
50+
## 5. Results Reporting
51+
Report results in this format:
52+
```
53+
## Summary
54+
[Brief overview]
55+
56+
## Steps Completed
57+
1. [Step description and result]
58+
2. [Step description and result]
59+
60+
## Issues Resolved
61+
- [Problem and solution if any]
62+
63+
## Recommendations
64+
- [Suggestions for improvement if any]
65+
```
66+
67+
## Important Guidelines
68+
- Confirm unclear points before starting work
69+
- Report important decisions and get approval
70+
- Do not make changes not explicitly requested
71+
- Get approval before UI/UX changes
72+
- Do not change technology stack versions without permission

.cursor/rules/03_project.mdc

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
---
7+
description: Project-specific rules for evtx2es
8+
globs: ["**/*"]
9+
alwaysApply: true
10+
---
11+
12+
# evtx2es - Project Specific Rules
13+
14+
## Project Overview
15+
evtx2es is a Python tool for fast import of Windows EventLogs (.evtx) into Elasticsearch using Rust library pyevtx-rs for high performance.
16+
17+
## Technology Stack
18+
- **Language**: Python 3.8+
19+
- **Core Dependencies**:
20+
- pyevtx-rs (Rust-based EVTX parser)
21+
- elasticsearch (Elasticsearch client)
22+
- Click (CLI framework)
23+
- **Package Manager**: pip/poetry
24+
- **Development Tools**: pytest, black, mypy
25+
26+
## Project Structure
27+
```
28+
evtx2es/
29+
├── src/evtx2es/ # Main package
30+
├── tests/ # Test files
31+
├── docs/ # Documentation
32+
├── examples/ # Usage examples
33+
├── requirements.txt # Production dependencies
34+
├── requirements-dev.txt # Development dependencies
35+
└── README.md # Project documentation
36+
```
37+
38+
## Domain-Specific Requirements
39+
40+
### Performance Considerations
41+
- Optimize for large EVTX file processing
42+
- Use streaming/chunked processing for memory efficiency
43+
- Leverage Rust-based pyevtx-rs for maximum performance
44+
- Implement progress reporting for long-running operations
45+
46+
### Elasticsearch Integration
47+
- Support multiple Elasticsearch versions
48+
- Implement proper index mapping for Windows Event Log fields
49+
- Handle connection errors and retries gracefully
50+
- Support bulk indexing for performance
51+
52+
### CLI Design
53+
- Use Click for consistent command-line interface
54+
- Provide clear progress indicators
55+
- Support configuration files
56+
- Implement proper error messages and help text
57+
58+
### Windows Event Log Specifics
59+
- Handle various EVTX file formats correctly
60+
- Preserve all relevant event metadata
61+
- Support filtering and transformation of events
62+
- Handle malformed or corrupted EVTX files gracefully
63+
64+
### Data Processing
65+
- Implement proper JSON serialization for Elasticsearch
66+
- Handle timestamp conversion and formatting
67+
- Support custom field mapping and transformation
68+
- Ensure data integrity during processing
69+
70+
## Development Workflow
71+
- Focus on CLI usability and performance
72+
- Test with real EVTX files of various sizes
73+
- Benchmark performance improvements
74+
- Document configuration options thoroughly
75+
76+
---
77+
78+
## AI Assistant Instructions
79+
80+
### Project Context Awareness
81+
- Always consider the Windows Event Log processing context
82+
- Understand the performance-critical nature of the tool
83+
- Be aware of Elasticsearch indexing requirements
84+
- Consider CLI user experience in suggestions
85+
86+
### Enhancement Suggestions
87+
- When suggesting improvements, consider:
88+
- Performance impact on large file processing
89+
- Elasticsearch compatibility
90+
- CLI usability
91+
- Memory efficiency
92+
- Always test suggestions with the project's core functionality in mind

.cursor/rules/04_forjapanese.mdc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
---
7+
description: Japanese language settings for development
8+
globs: ["**/*"]
9+
alwaysApply: true
10+
---
11+
12+
# 日本語設定ルール
13+
14+
## 基本設定
15+
- **主要言語**: 日本語で応答してください
16+
- **コードとコメント**: 英語を使用してください
17+
- **技術的な説明**: 日本語で行ってください
18+
- **エラーメッセージ**: 日本語で説明してください
19+
20+
## コミュニケーション方針
21+
- 丁寧語を使用してください
22+
- 技術的な内容も分かりやすく説明してください
23+
- 専門用語は適切に日本語化するか、英語の場合は説明を併記してください

.cursor/rules/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Cursor Rules
2+
This directory contains rule files for consistent development assistance.
3+
4+
## Files
5+
- **`01_python.mdc`** - Python development standards
6+
- **`02_tasks.mdc`** - Task execution framework
7+
- **`03_project.mdc`** - Project-specific rules for evtx2es
8+
- **`04_forjapanese.mdc`** - Japanese language settings for development (If you are not a Japanese speaker, please ignore this)

.devcontainer/Dockerfile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
FROM python:3.11.6-bullseye
1+
FROM python:3.13.5-slim-bookworm
22

33
RUN apt -y update && apt upgrade -qqy && apt -y install \
44
curl \
55
gcc \
66
git \
77
fish \
8+
patchelf \
89
&& apt clean
910

10-
RUN chsh -s /usr/bin/fish
11-
RUN pip install -U pip && pip install poetry
11+
ARG USERNAME=dev
12+
ARG USER_UID=1000
13+
ARG USER_GID=$USER_UID
14+
15+
RUN groupadd --gid $USER_GID $USERNAME \
16+
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
17+
&& apt-get update \
18+
&& apt-get install -y sudo \
19+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
20+
&& chmod 0440 /etc/sudoers.d/$USERNAME
21+
22+
RUN chsh -s /usr/bin/fish $USERNAME
23+
24+
USER $USERNAME
25+
RUN pip install -U pip && pip install uv

.devcontainer/devcontainer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "dev",
33
"dockerComposeFile": "docker-compose.yaml",
4+
"remoteUser": "dev",
45
"service": "dev",
56
"workspaceFolder": "/workspace/",
67
"postCreateCommand": "/usr/bin/fish ./.devcontainer/postCreateCommands.fish",

.devcontainer/docker-compose.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ services:
66
context: .
77
dockerfile: Dockerfile
88
volumes:
9-
- ..:/workspace:cached
9+
- ../:/workspace:cached
1010
network_mode: service:elasticsearch
1111
tty: true
1212

1313
elasticsearch:
14-
image: elasticsearch:8.11.1
14+
image: elasticsearch:9.0.2
1515
container_name: evtx2es-elasticsearch
1616
ports:
1717
- "9200:9200"
@@ -23,10 +23,10 @@ services:
2323
soft: -1
2424
hard: -1
2525

26-
# kibana:
27-
# image: kibana:8.11.1
28-
# container_name: evtx2es-kibana
29-
# ports:
30-
# - 5601:5601
31-
# environment:
32-
# - elasticsearch.host="http://localhost:9200"
26+
kibana:
27+
image: kibana:9.0.2
28+
container_name: evtx2es-kibana
29+
ports:
30+
- 5601:5601
31+
environment:
32+
- elasticsearch.host="http://localhost:9200"
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
#!/usr/bin/fish
2-
poetry config virtualenvs.in-project true
3-
poetry install
2+
echo 'set -x PATH $PATH $HOME/.local/bin' >> $HOME/.config/fish/config.fish

.github/workflows/publish-binary-pypi.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v2
13+
1314
- name: Set up Python
1415
uses: actions/setup-python@v1
1516
with:
1617
python-version: '3.11'
18+
1719
- name: Install dependencies
1820
run: |
1921
python -m pip install --upgrade pip
20-
pip install poetry
22+
pip install uv
23+
2124
- name: Build and publish
2225
run: |
23-
poetry config pypi-token.pypi ${{secrets.PYPI_TOKEN}}
24-
poetry publish --build
26+
uv build
27+
uv publish --token ${{secrets.PYPI_TOKEN}}
2528

0 commit comments

Comments
 (0)