Skip to content

Commit 99ce532

Browse files
Merge remote changes and integrate AdBlock Compiler
Co-Authored-By: Warp <agent@warp.dev>
2 parents e9057ed + a98230e commit 99ce532

42 files changed

Lines changed: 612 additions & 327 deletions

Some content is hidden

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

.github/copilot-instructions.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Multi-language toolkit for ad-blocking and AdGuard DNS management with **identic
3939
- `adguard-validate` (CLI tool)
4040

4141
### Compiler Equivalence
42-
All four compilers (TypeScript, .NET, Python, Rust) wrap `@adguard/hostlist-compiler` and **must**:
42+
All four compilers (TypeScript, .NET, Python, Rust) use `@jk-com/adblock-compiler` and **must**:
4343
- Support JSON, YAML, TOML config formats (except PowerShell: JSON only)
4444
- Count rules identically (exclude empty lines and `!`/`#` comments)
4545
- Compute SHA-384 hash of output (96 hex chars)
@@ -402,7 +402,7 @@ All compilers return/output:
402402
```
403403

404404
### Configuration Schema
405-
Supports 3 formats (JSON/YAML/TOML), mirrors `@adguard/hostlist-compiler`:
405+
Supports 3 formats (JSON/YAML/TOML), based on `@jk-com/adblock-compiler` schema:
406406
```json
407407
{
408408
"output": "data/output/adguard_user_filter.txt",
@@ -493,11 +493,13 @@ cd src/rules-compiler-rust && cargo test
493493
- **Auth**: Bearer token in `Authorization` header
494494
- **Retry logic**: 3 attempts with exponential backoff (408, 429, 5xx)
495495

496-
### @adguard/hostlist-compiler
497-
- **All compilers depend on this**: npm package must be globally installed
498-
- **Installation**: `npm install -g @adguard/hostlist-compiler`
496+
### @jk-com/adblock-compiler
497+
- **All compilers depend on this**: JSR package
498+
- **Installation**: `deno add @jk-com/adblock-compiler` or via JSR
499+
- **Source**: https://github.com/jaypatrick/hostlistcompiler
500+
- **Documentation**: https://jsr.io/@jk-com/adblock-compiler
499501
- Provides 11 transformations (RemoveComments, Compress, Validate, etc.)
500-
- Compilers wrap this, handling config parsing and result formatting
502+
- Compilers use this, handling config parsing and result formatting
501503

502504
### Docker Development
503505
- **Dockerfile**: `Dockerfile.warp` (multi-stage with .NET 8 SDK + Node 20 + PowerShell 7)

CLAUDE.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This repository is a comprehensive multi-language toolkit for ad-blocking, netwo
2828
- **Linear Import Tool** (`src/linear/`) - TypeScript tool with Deno support
2929

3030
### Configuration Support
31-
All compilers support JSON, YAML, and TOML configuration formats with full @adguard/hostlist-compiler compatibility.
31+
All compilers support JSON, YAML, and TOML configuration formats with full @jk-com/adblock-compiler compatibility.
3232

3333
## Docker Development Environment
3434

@@ -294,7 +294,7 @@ cargo test config:: # Tests in module
294294
- `data/output/adguard_user_filter.txt` - Main tracked filter list consumed by AdGuard DNS
295295

296296
### Rules Compiler - TypeScript (`src/rules-compiler-typescript/`)
297-
- TypeScript wrapper around @adguard/hostlist-compiler
297+
- TypeScript compiler using @jk-com/adblock-compiler
298298
- Deno 2.0+ runtime with npm compatibility
299299
- Supports JSON, YAML, and TOML configuration formats
300300
- **Library API** (`src/lib/`):
@@ -324,7 +324,7 @@ cargo test config:: # Tests in module
324324
- Supports JSON, YAML, TOML via external tools (yq, Python)
325325

326326
### Rules Compiler - .NET (`src/rules-compiler-dotnet/`)
327-
- .NET 10 library wrapping @adguard/hostlist-compiler
327+
- .NET 10 library for filter compilation
328328
- Supports JSON, YAML, and TOML configuration formats
329329
- `RulesCompiler` - Core library with abstractions, models, and services
330330
- `RulesCompiler.Console` - Spectre.Console interactive and CLI frontend
@@ -333,7 +333,7 @@ cargo test config:: # Tests in module
333333
- Features: Configuration validation, verbose mode, dependency injection
334334

335335
### Rules Compiler - Python (`src/rules-compiler-python/`)
336-
- Python 3.9+ package wrapping @adguard/hostlist-compiler
336+
- Python 3.9+ package for filter compilation
337337
- Supports JSON, YAML, and TOML configuration formats
338338
- `rules_compiler/config.py` - Multi-format configuration reader
339339
- `rules_compiler/compiler.py` - Core `RulesCompiler` class and `compile_rules()` function
@@ -343,7 +343,7 @@ cargo test config:: # Tests in module
343343
- Tools: pytest, mypy, ruff
344344

345345
### Rules Compiler - Rust (`src/rules-compiler-rust/`)
346-
- High-performance Rust library and CLI wrapping @adguard/hostlist-compiler
346+
- High-performance Rust library and CLI for filter compilation
347347
- Supports JSON, YAML, and TOML configuration formats
348348
- `src/config.rs` - Configuration structs and parsing
349349
- `src/compiler.rs` - `RulesCompiler` struct and `compile_rules()` function
@@ -400,7 +400,7 @@ cargo test config:: # Tests in module
400400

401401
## Configuration Schema
402402

403-
All compilers support the same @adguard/hostlist-compiler configuration schema:
403+
All compilers support the same @jk-com/adblock-compiler configuration schema:
404404

405405
### Root-Level Properties
406406
| Property | Type | Required | Description |
@@ -463,7 +463,7 @@ GitHub Actions workflows validate:
463463
| PowerShell | 7+ | PowerShell scripts |
464464
| Python | 3.9+ | Python compiler |
465465
| Rust | 1.85+ | Rust compiler (install via rustup) |
466-
| hostlist-compiler | Latest | All compilers (via Deno: `deno run npm:@adguard/hostlist-compiler`) |
466+
| adblock-compiler | 0.6.0 | TypeScript compiler (via JSR: `deno add @jk-com/adblock-compiler`) |
467467
| Docker | 24.0+ | Container development (optional but recommended) |
468468

469469
## Key File Locations

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ A comprehensive multi-language toolkit for ad-blocking, network protection, and
4444
| **Rust** | Native binary | Cargo/Binary | Zero-runtime deps, LTO optimization |
4545
| **PowerShell** | PowerShell 7+ | Module | Pipeline-friendly, Pester tests |
4646

47-
All compilers wrap [@adguard/hostlist-compiler](https://github.com/AdguardTeam/HostlistCompiler) with **built-in security validation** and support:
47+
All compilers use [@jk-com/adblock-compiler](https://github.com/jaypatrick/hostlistcompiler) with **built-in security validation** and support:
4848
- **All 11 transformations**: Deduplicate, Validate, RemoveComments, Compress, RemoveModifiers, etc.
4949
- **Multi-format config**: JSON, YAML, and TOML configuration files
5050
- **Source-specific settings**: Per-source transformations, inclusions, exclusions
@@ -216,7 +216,7 @@ curl -fsSL https://deno.land/install.sh | sh
216216
irm https://deno.land/install.ps1 | iex
217217
```
218218

219-
The `@adguard/hostlist-compiler` package is accessed via Deno's npm compatibility.
219+
The `@jk-com/adblock-compiler` package is accessed via Deno's JSR integration.
220220

221221
### Clone and Setup
222222

@@ -536,7 +536,7 @@ See [`data/archive/README.md`](data/archive/README.md) for detailed usage and re
536536
537537
538538
┌─────────────────────────────────────────────────────┐
539-
│ 4. Compile with @adguard/hostlist-compiler │
539+
│ 4. Compile with @jk-com/adblock-compiler │
540540
│ - Merge all sources │
541541
│ - Apply transformations (dedupe, validate, etc) │
542542
│ - Convert hosts format to adblock if needed │
@@ -562,7 +562,7 @@ See [`data/archive/README.md`](data/archive/README.md) for detailed usage and re
562562

563563
## Rules Compilers
564564

565-
All compilers wrap [@adguard/hostlist-compiler](https://github.com/AdguardTeam/HostlistCompiler) and support:
565+
All compilers use [@jk-com/adblock-compiler](https://github.com/jaypatrick/hostlistcompiler) and support:
566566

567567
- **Multi-format config**: JSON, YAML, TOML
568568
- **All 11 transformations**: Deduplicate, Validate, RemoveComments, Compress, etc.
@@ -744,7 +744,7 @@ println!("Compiled {} rules", result.rule_count);
744744

745745
**Location**: `src/shell/`
746746

747-
Cross-platform shell scripts that wrap `@adguard/hostlist-compiler` for simple automation and CI/CD pipelines.
747+
Cross-platform shell scripts that use `@jk-com/adblock-compiler` for simple automation and CI/CD pipelines.
748748

749749
| Script | Platform | Shell | Features |
750750
|--------|----------|-------|----------|

data/input/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ data/input/
173173
2. **Validation**: Lint and verify syntax of each file
174174
3. **Hashing**: Compute SHA-384 hash for integrity verification
175175
4. **Remote fetch** (if applicable): Download internet lists with hash verification
176-
5. **Compilation**: Merge all sources using `@adguard/hostlist-compiler`
176+
5. **Compilation**: Merge all sources using `@jk-com/adblock-compiler`
177177
6. **Output**: Write final adblock-format list to `data/output/adguard_user_filter.txt`
178178

179179
## Security

docs/AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
- `data/` contains the tracked filter list (`data/output/adguard_user_filter.txt`) and compiler configuration files.
66
- `src/` contains the multi-language toolchain:
7-
- `src/rules-compiler-*` (TypeScript/Deno, .NET, Python, Rust, shell) compilers that wrap `@adguard/hostlist-compiler`.
7+
- `src/rules-compiler-*` (TypeScript/Deno, .NET, Python, Rust, shell) compilers that use `@jk-com/adblock-compiler`.
88
- `src/adguard-api-dotnet/`, `src/adguard-api-typescript/`, and `src/adguard-api-rust/` SDKs + interactive clients for the AdGuard DNS API.
99
- `src/adguard-api-powershell/` PowerShell modules and Pester tests.
1010
- `docs/` holds guides and reference documentation.

docs/LINEAR_DOCUMENTATION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export ADGUARD_ARCHIVE_RETENTION_DAYS=90
110110

111111
**Technology Stack:**
112112
- TypeScript 5.4.5
113-
- @adguard/hostlist-compiler v1.0.39
113+
- @jk-com/adblock-compiler v0.6.0
114114
- Deno test (testing)
115115
- Deno 2.0+
116116

@@ -284,7 +284,7 @@ ad-blocking/
284284
| Technology | Version | Purpose |
285285
|------------|---------|---------|
286286
| TypeScript | 5.4.5 | Strongly-typed JavaScript |
287-
| @adguard/hostlist-compiler | 1.0.39 | Core compilation engine |
287+
| @jk-com/adblock-compiler | 0.6.0 | Core compilation engine |
288288
| Deno | 2.0+ | TypeScript/JavaScript runtime |
289289
| Deno test | built-in | Testing framework |
290290

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,6 @@ All URIs are relative to `https://api.adguard-dns.io`
138138

139139
- [AdGuard DNS](https://adguard-dns.io/)
140140
- [AdGuard DNS API Documentation](https://api.adguard-dns.io/static/swagger/swagger.json)
141-
- [@adguard/hostlist-compiler](https://github.com/AdguardTeam/HostlistCompiler)
141+
- [@jk-com/adblock-compiler](https://github.com/jaypatrick/hostlistcompiler)
142142
- [AdBlock Tester](https://adblock-tester.com/)
143143
- [AdGuard Tester](https://d3ward.github.io/toolz/adblock.html)

docs/RUNTIME_ENFORCEMENT.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@
3232
3333
3434
┌─────────────────────────────────────────┐
35-
│ @adguard/hostlist-compiler │
35+
│ @jk-com/adblock-compiler │
36+
│ (JSR package) │
3637
└─────────────────────────────────────────┘
3738
```
3839

3940
## How It Works
4041

4142
### 1. Mandatory Wrapper Function
4243

43-
All compilers **MUST** use `compile_with_validation()` instead of calling `@adguard/hostlist-compiler` directly:
44+
All compilers **MUST** use `compile_with_validation()` instead of calling `@jk-com/adblock-compiler` directly:
4445

4546
**❌ FORBIDDEN - Direct compilation bypass:**
4647
```typescript
@@ -280,7 +281,7 @@ module.exports = {
280281
rules: {
281282
'no-restricted-imports': ['error', {
282283
patterns: [{
283-
group: ['@adguard/hostlist-compiler'],
284+
group: ['@jk-com/adblock-compiler'],
284285
message: 'Do not import hostlist-compiler directly. Use compile_with_validation() from @adguard/validation instead.'
285286
}]
286287
}]

docs/RUST_WORKSPACE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Rust implementation of the AdGuard DNS API client.
1919
- **adguard-api-cli**: Interactive CLI for AdGuard DNS API
2020

2121
### 3. **rules-compiler-rust** (`src/rules-compiler-rust/`)
22-
Rust compiler for AdGuard filter rules using `@adguard/hostlist-compiler`.
22+
Rust compiler for AdGuard filter rules using `@jk-com/adblock-compiler`.
2323

2424
- Library and CLI for compiling filter rules
2525
- Supports JSON, YAML, and TOML configurations

docs/VALIDATION_ENFORCEMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ async function compile(config: CompilerConfig): Promise<CompilerResult> {
8585
}
8686
}
8787

88-
// 3. Proceed with compilation using @adguard/hostlist-compiler
88+
// 3. Proceed with compilation using @jk-com/adblock-compiler
8989
const output = await hostlistCompiler.compile(config);
9090

9191
// 4. MANDATORY: Handle file conflicts

0 commit comments

Comments
 (0)