Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9a1c30a
chore: protect local development workspace files
Mika3578 Jun 14, 2026
2e60904
build: add Clang, CppCheck, and auxiliary CMake scaffold
Mika3578 Jun 14, 2026
8fe6889
ci: add initial Dependabot and build workflow
Mika3578 Jun 14, 2026
0a74029
ci: expand Windows build matrix and code quality workflows
Mika3578 Jun 14, 2026
e3397f3
security: add CodeQL, dependency review, and gitleaks scanning
Mika3578 Jun 14, 2026
b9f1ee5
chore: configure repository templates, ownership, and citations
Mika3578 Jun 14, 2026
c3b9808
docs: add initial agent rule pointers and editor config
Mika3578 Jun 14, 2026
2ef0a7a
build: migrate Visual Studio projects to toolset v145
Mika3578 Jun 14, 2026
b85be77
deps: adopt vcpkg manifest and align CI release workflows
Mika3578 Jun 14, 2026
1aaef1b
deps(vcpkg): update baseline for Visual Studio 2026 migration (#36)
dependabot[bot] Jun 14, 2026
ccfb356
deps(vcpkg): bump baseline to 2026.05.25 (#51)
dependabot[bot] Jun 14, 2026
959457b
deps(vcpkg): bump baseline to 2026.06.01 (#57)
dependabot[bot] Jun 14, 2026
35790bb
deps: upgrade vendored zlib, SQLite, and UnRAR
Mika3578 Jun 14, 2026
c0edb5d
feat(kad): add Kademlia2 packet handling and protocol layer
Mika3578 Jun 14, 2026
105c5ac
feat(kad): add node storage, routing, and host cache integration
Mika3578 Jun 14, 2026
cf8881a
security(kad): harden publish packet keyword handling
Mika3578 Jun 14, 2026
9c8157d
feat(ed2k): add Source Exchange v2 and crypto foundations
Mika3578 Jun 14, 2026
505ea3c
protocol(ed2k): harden source exchange packet validation
Mika3578 Jun 14, 2026
6f361a6
feat(bittorrent): add SHA-256 Merkle tree and MSE/PE support
Mika3578 Jun 14, 2026
b959cc6
security(remote): harden the web interface and request handling
Mika3578 Jun 14, 2026
9b38c6e
fix(security): remove unsafe casts and memory access patterns
Mika3578 Jun 14, 2026
a96c164
fix(g2): correct HubHorizon use-after-free
Mika3578 Jun 14, 2026
75afb56
fix(skin): lazy-load default skin and integrate shell startup
Mika3578 Jun 14, 2026
9905125
feat(network): add IPv6 dual-stack scaffolding
Mika3578 Jun 14, 2026
d01efbd
test: add protocol, crypto, and integration test infrastructure
Mika3578 Jun 14, 2026
8124dec
test(ed2k): add Source Exchange parser smoke coverage
Mika3578 Jun 14, 2026
a59ecf2
docs: add durable build, test, release, and protocol documentation
Mika3578 Jun 14, 2026
9bf8458
docs: align branch and merge governance rules
Mika3578 Jun 14, 2026
30c4616
build(deps-dev): bump dompurify (#61)
dependabot[bot] Jun 21, 2026
3e93341
build(deps-dev): bump dompurify (#62)
dependabot[bot] Jun 21, 2026
1e758cf
build(envy): use explicit path for PreBuild.cmd invocation (#63)
Mika3578 Jun 22, 2026
6f72bc4
ci: speed up PR checks by trimming redundant work (#68)
Mika3578 Jun 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 25 additions & 0 deletions .aider.conf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Aider configuration for Envy.
# Canonical rules live in AGENTS.md - this file just tells aider to read it.

read:
- AGENTS.md
- docs/DEV_TRACKER.md
- MODERNIZATION.md

auto-commits: false
dirty-commits: false
attribute-author: false
attribute-committer: false
attribute-commit-message-author: false
attribute-commit-message-committer: false

# Match the codebase tone: terse English commits, no AI marketing tags.
commit-prompt: |
Write a single-paragraph conventional-commit-style message in English.
Subject in imperative mood, max 72 chars. No emoji, no AI attribution.

# Default model preferences (override locally if needed).
# model: claude-opus-4-7

# Honor .gitignore and avoid pulling vcpkg/vendor trees into context.
gitignore: true
52 changes: 52 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Conservative clang-format that preserves the legacy MFC style of the codebase.
# Goal: catch trailing whitespace and trivial inconsistencies without re-flowing
# every file. Run with --dry-run in CI before enabling auto-formatting.
---
Language: Cpp
BasedOnStyle: Microsoft
UseTab: ForIndentation
TabWidth: 4
IndentWidth: 4
ColumnLimit: 0
AccessModifierOffset: -4
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
BinPackArguments: true
BinPackParameters: true
BreakBeforeBraces: Allman
BreakConstructorInitializers: BeforeComma
ConstructorInitializerAllOnOneLineOrOnePerLine: false
Cpp11BracedListStyle: false
DerivePointerAlignment: false
FixNamespaceComments: false
IndentCaseLabels: false
IndentPPDirectives: None
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
PointerAlignment: Left
ReflowComments: false
SortIncludes: Never
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++20

# Exclude vendored / third-party trees from format checks.
# Use clang-format --files=... to enumerate the files you want to lint.
12 changes: 12 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Third-party / vendored sources - never reformat
Services/zlib/**
Services/SQLite/**
Services/Bzlib/**
Services/UnRAR/**
Services/MiniUPnP/**
Services/GeoIP/**
Services/LibUTP/**
Services/BugTrap/**
HashLib/HashLib/**
Plugins/RatDVDPlugin/**
Plugins/SWFPlugin/**
69 changes: 69 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Clang-Tidy configuration for Envy project
# Static analysis for C++ code quality and security

Checks: >
# Disable all checks for legacy MFC code - too many false positives
-*

WarningsAsErrors: ''

HeaderFilterRegex: '.*'

# Disable specific checks that may conflict with legacy code
# (can be enabled gradually during modernization)
DisableChecks: >
bugprone-easily-swappable-parameters,
readability-magic-numbers,
cppcoreguidelines-avoid-magic-numbers,
cppcoreguidelines-pro-bounds-pointer-arithmetic,
cppcoreguidelines-pro-bounds-array-to-pointer-decay,
modernize-use-trailing-return-type,
# MFC-related checks that cause false positives
cppcoreguidelines-pro-type-static-cast-downcast,
cppcoreguidelines-pro-type-cstyle-cast,
modernize-avoid-c-arrays,
# Windows API and legacy function checks
cert-dcl37-c,
cert-dcl51-cpp,
# Unicode and string handling (MSVC-specific functions)
misc-include-cleaner,
# MFC message map related
readability-static-accessed-through-instance,
# Performance checks that may not apply to legacy code
performance-noexcept-move-constructor,
# Disable problematic checks for legacy Windows/MFC code
clang-diagnostic-unknown-type,
clang-diagnostic-error,
misc-unused-parameters,
readability-convert-member-functions-to-static

# Format style
FormatStyle: file

# Check options
CheckOptions:
- key: readability-identifier-length.MinimumLength
value: '2'
- key: readability-identifier-length.IgnoredVariableNames
value: 'i;j;k;m;n;x;y;z;c;pDC;pOldDC'
- key: readability-function-cognitive-complexity.Threshold
value: '25'
- key: performance-unnecessary-value-param.AllowedTypes
value: 'gsl::span'
- key: cert-err33-c.Notes
value: 'Slightly relaxed for legacy code'
- key: modernize-use-trailing-return-type.IgnoreMacros
value: 'true'
- key: readability-function-size.LineThreshold
value: '500'
- key: readability-function-size.ParameterThreshold
value: '10'
- key: readability-function-size.StatementThreshold
value: '150'
- key: readability-function-size.NestingThreshold
value: '5'
# Relax some checks for MFC compatibility
- key: cppcoreguidelines-pro-type-member-init.IgnoreArrays
value: 'true'
- key: modernize-loop-convert.MinConfidence
value: 'risky'
12 changes: 12 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CompileFlags:
Add:
# Completely suppress clang diagnostics for legacy MFC code
- "-Wno-everything"
- "-w" # Suppress all warnings
# Basic Windows defines (may help with some type recognition)
- "-D _WINDOWS"
- "-D WIN32"
- "-D _WIN32"
- "-D UNICODE"
- "-D _UNICODE"
- "-D _ENVY"
29 changes: 29 additions & 0 deletions .clinerules
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Cline rules for Envy
#
# Canonical rules live in AGENTS.md.

Before making changes, read AGENTS.md and docs/DEVELOPMENT_PLAN.md.

Required:
- Branch off develop; push only your feature branch (never main, develop,
or legacy). Use type/short-kebab-summary names; no tool/agent prefixes.
- Record strategic progress in docs/DEVELOPMENT_PLAN.md; session notes
go in .local/DEV_TRACKER.md (gitignored).
- All artifacts (code, comments, commits, PRs, docs) in English; chat
replies follow the user's language.
- Match the surrounding MFC style (tabs/4, Allman braces, Hungarian
prefixes).
- Don't bulk-reformat files.
- Don't edit Plugins/PluginWizard/** (templates).
- Don't reintroduce XP/Vista/7/8 support (v141_xp, _ATL_XP_TARGETING,
_WIN32_WINNT < 0x0A00).
- Use noexcept (not throw()); drop the register keyword.
- Manage dependencies through vcpkg.json, not bundled sources.

Build:
msbuild "Visual Studio\Envy.sln" /m /p:Configuration=Release
/p:Platform=x64 /p:PlatformToolset=v145
/p:WindowsTargetPlatformVersion=10.0
/p:VcpkgEnableManifest=true /p:VcpkgTriplet=x64-windows-static

See MODERNIZATION.md for the multi-phase plan.
33 changes: 33 additions & 0 deletions .continue/rules/envy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Envy repository rules
description: Canonical rules for AI assistants operating on the Envy codebase.
alwaysApply: true
---

# Envy - AI rules

Full ruleset: `AGENTS.md`. This file is a pointer.

- **Toolchain**: VS 2026, toolset v145, MSVC 14.50.
- **C++**: C++20 first-party, C++17 legacy plugins.
- **OS target**: Windows 10 1809+ (no XP support).
- **Dependencies**: vcpkg manifest (`vcpkg.json`).
- **Style**: tabs/4, Allman braces, Hungarian-ish naming, CString/CAtlList
over std::.
- **Language**: English for code, comments, commits, PRs, docs; chat
follows the user.
- **Tracking**: record strategic progress in `docs/DEVELOPMENT_PLAN.md`;
session notes go in `.local/DEV_TRACKER.md` (gitignored).
- **Branch discipline**: branch off develop; push only your feature branch.
Use type/short-kebab-summary names; no tool/agent prefixes.

Build command:

```
msbuild "Visual Studio\Envy.sln" /m /p:Configuration=Release ^
/p:Platform=x64 /p:PlatformToolset=v145 ^
/p:WindowsTargetPlatformVersion=10.0 ^
/p:VcpkgEnableManifest=true /p:VcpkgTriplet=x64-windows-static
```

Read `MODERNIZATION.md` for the multi-phase plan.
27 changes: 27 additions & 0 deletions .cppcheck-suppressions
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# CppCheck suppressions for Envy project
# Temporary suppressions for legacy code patterns that will be addressed during modernization

# Windows API specific
windowsInclude:*
windowsFile:*
windowsGlobal:*

# MFC specific patterns
missingIncludeSystem:*.h
unusedFunction:*

# Legacy code patterns to be modernized
unusedPrivateFunction:*
unusedStructMember:*
variableScope:*

# Intentional null pointer usage (legacy code)
nullPointer:*

# Intentional memory handling (will migrate to smart pointers)
memleak:*
resourceLeak:*

# Win32 API conventions
windowsStyle:*
style:unusedFunction
86 changes: 86 additions & 0 deletions .cursor/rules/00-project-context.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
description: Project overview, technology stack, and development philosophy for the Envy P2P client
globs: ["**/*"]
alwaysApply: true
---

# Envy Project Context

## Project Overview

Envy is a comprehensive peer-to-peer file sharing application supporting multiple protocols including BitTorrent, Gnutella2 (G2), and eDonkey2000. Built with C++ using MFC (Microsoft Foundation Classes), it provides a feature-rich P2P client with extensive plugin support.

**Version:** 4.0+
**License:** AGPL v3.0
**Status:** Modernization in Progress

## Technology Stack

- **Language**: C++20 (target), C++17 minimum
- **Platform**: Windows (Win32/x64)
- **Framework**: Microsoft Foundation Classes (MFC)
- **Character Set**: Unicode (UTF-16)
- **Build System**: Visual Studio 2026 (or VS 2022 with v143 toolset)
- **MSBuild Path**: `C:\Program Files\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin\amd64\MSBuild.exe`

## Project Structure

```
Envy/
├── Envy/ # Main application code
├── Services/ # Core services and protocols
├── Plugins/ # Plugin system
├── HashLib/ # Hashing library
├── Repository/ # Resources and schemas
├── Skins/ # UI skins
├── Languages/ # Localization files
└── docs/ # Documentation
```

## Key Features

- Multi-protocol support: BitTorrent/DHT, G2/Gnutella², Gnutella, ED2K/eMule, DC++, HTTP/FTP
- Highly skinnable interface
- Built-in blacklist support
- Cross-platform compatibility (Windows or Wine)

## Development Philosophy

- **Modernization**: Gradual adoption of modern C++ features while maintaining compatibility
- **Backward Compatibility**: Maintain compatibility with existing P2P networks
- **Performance**: Critical for large downloads and many peers
- **Network Resilience**: Essential for P2P operations
- **User Data Protection**: Security is paramount

## Important Notes

- This is a mature codebase with legacy components
- Comments must be in English
- Follow MFC conventions where applicable
- Balance modern C++ with MFC compatibility
- Research Examples folder for P2P client implementations
- Create plan before coding changes

## Codebase-Specific Conventions

### Naming Patterns (Actual Usage)
- **Strings**: Use `m_s` prefix (NOT `m_str`) - e.g., `m_sAddress`, `m_sFileName`
- **Handles**: Use `m_h` prefix - e.g., `m_hSocket`, `m_hFile`
- **Time/Ticks**: Use `m_t` prefix - e.g., `m_tConnected`, `m_tLastAccess`
- **Collections**: Use `m_o` prefix - e.g., `m_oTrackers`, `m_oNodes`
- **Pointers**: Use `m_p` prefix - e.g., `m_pInput`, `m_pOutput`
- **Booleans**: Use `m_b` prefix with `BOOL` type - e.g., `m_bConnected`, `m_bInitiated`
- **Numbers**: Use `m_n` prefix - e.g., `m_nCount`, `m_nFileSize`

### Threading Patterns
- Use `CCriticalSectionPtr` for synchronization
- Use `CQuickLock` for scoped locking
- Use `CLocked<T>` template for thread-safe access
- Use `volatile` for flags accessed from multiple threads
- Use `CMutexEx` for extended mutex functionality

### Error Reporting
- Use `theApp.Message(MSG_ERROR, ...)` for error reporting
- Use `ASSERT` and `VERIFY` macros for debugging
- Check return values from Win32 APIs
- Use `BOOL` return types for MFC compatibility
26 changes: 26 additions & 0 deletions .cursor/rules/00-rules-index.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
description: Index of project rules (what exists, what to attach, and when)
globs: ["**/*"]
alwaysApply: true
---

# Cursor Rules Index (Envy)

## Always (core rules)
- `00-rules-index.mdc`: what rules exist + maintenance hook
- `00-project-context.mdc`: repo context + key conventions
- `08-dev-workflow.mdc`: workflow gates (branching, testing, small PRs) + docs requirement
- `09-docs-auto-update.mdc`: **definition of done** (must end with Docs updated / Docs: no changes)

## Auto-attached (via `globs`, only when relevant)
- `01-cpp-standards.mdc`: C++20/17 guidance + RAII + safe modernization
- `02-mfc-patterns.mdc`: MFC patterns + **GUI resource de-dup** rule
- `03-naming-conventions.mdc`: naming prefixes + file/class naming
- `04-error-handling.mdc`: Win32/MFC error handling + logging patterns
- `05-performance.mdc`: profiling-first + hot-path rules
- `06-p2p-protocols.mdc`: protocol/network input validation + compatibility rules
- `07-documentation.mdc`: docs map + writing conventions (applies to `docs/**`, `README.md`, `CHANGELOG.md`)

## Rules maintenance hook
- After any major feature/fix: run **Rules Curator** to merge duplicates and prevent drift.
- If a rule exceeds ~150 lines: prune examples, convert to checklist, or split by scope.
Loading