diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 64a7d6d3..4993c210 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -1,15 +1,21 @@ -{ - "permissions": { - "allow": [ - "Bash(git merge:*)", - "Bash(dotnet build:*)", - "Bash(cat:*)", - "Bash(dotnet test:*)", - "Bash(VSTEST_CONNECTION_TIMEOUT=180 dotnet test:*)", - "Bash(export VSTEST_CONNECTION_TIMEOUT=180)", - "Bash(find:*)" - ], - "deny": [], - "ask": [] - } -} +{ + "permissions": { + "allow": [ + "Bash(git merge:*)", + "Bash(dotnet build:*)", + "Bash(cat:*)", + "Bash(dotnet test:*)", + "Bash(VSTEST_CONNECTION_TIMEOUT=180 dotnet test:*)", + "Bash(export VSTEST_CONNECTION_TIMEOUT=180)", + "Bash(find:*)", + "Bash(xargs ls:*)", + "Bash(gh run view:*)", + "Bash(cargo fmt:*)", + "Bash(cargo check:*)", + "Bash(git checkout:*)", + "Bash(git add:*)" + ], + "deny": [], + "ask": [] + } +} diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index b31f0083..fbae575e 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,50 +1,73 @@ -# This workflow will build and test .NET projects +# .NET Build and Test workflow +# Optimized with matrix strategy and path-based triggers name: .NET on: push: branches: ["main"] + paths: + - 'src/adguard-api-dotnet/**' + - 'src/rules-compiler-dotnet/**' + - '.github/workflows/dotnet.yml' pull_request: branches: ["main"] + paths: + - 'src/adguard-api-dotnet/**' + - 'src/rules-compiler-dotnet/**' + - '.github/workflows/dotnet.yml' + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true jobs: - build-api-client: - name: Build API Client + build: + name: ${{ matrix.name }} runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - name: Build API Client + path: src/adguard-api-dotnet + solution: AdGuard.ApiClient.slnx + filter: "FullyQualifiedName!~Integration" + - name: Build Rules Compiler + path: src/rules-compiler-dotnet + solution: RulesCompiler.slnx + filter: "" + defaults: run: - working-directory: ./src/adguard-api-dotnet + working-directory: ${{ matrix.path }} steps: - uses: actions/checkout@v4 + - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: 10.0.x - - name: Restore dependencies - run: dotnet restore AdGuard.ApiClient.slnx - - name: Build - run: dotnet build AdGuard.ApiClient.slnx --no-restore - - name: Test - run: dotnet test AdGuard.ApiClient.slnx --no-build --verbosity normal --filter "FullyQualifiedName!~Integration" - - build-rules-compiler: - name: Build Rules Compiler - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./src/rules-compiler-dotnet - steps: - - uses: actions/checkout@v4 - - name: Setup .NET - uses: actions/setup-dotnet@v4 + - name: Cache NuGet packages + uses: actions/cache@v4 with: - dotnet-version: 10.0.x + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.slnx') }} + restore-keys: ${{ runner.os }}-nuget- + - name: Restore dependencies - run: dotnet restore RulesCompiler.slnx + run: dotnet restore ${{ matrix.solution }} + - name: Build - run: dotnet build RulesCompiler.slnx --no-restore + run: dotnet build ${{ matrix.solution }} --no-restore -c Release + - name: Test - run: dotnet test RulesCompiler.slnx --no-build --verbosity normal + run: | + if [ -n "${{ matrix.filter }}" ]; then + dotnet test ${{ matrix.solution }} --no-build -c Release --verbosity normal --filter "${{ matrix.filter }}" + else + dotnet test ${{ matrix.solution }} --no-build -c Release --verbosity normal + fi diff --git a/.github/workflows/powershell.yml b/.github/workflows/powershell.yml deleted file mode 100644 index 5f393e93..00000000 --- a/.github/workflows/powershell.yml +++ /dev/null @@ -1,49 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# -# https://github.com/microsoft/action-psscriptanalyzer -# For more information on PSScriptAnalyzer in general, see -# https://github.com/PowerShell/PSScriptAnalyzer - -name: PSScriptAnalyzer - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - schedule: - - cron: '29 16 * * 0' - -permissions: - contents: read - -jobs: - build: - permissions: - contents: read # for actions/checkout to fetch code - security-events: write # for github/codeql-action/upload-sarif to upload SARIF results - actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status - name: PSScriptAnalyzer - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Run PSScriptAnalyzer - uses: microsoft/psscriptanalyzer-action@6b2948b1944407914a58661c49941824d149734f - with: - # Check https://github.com/microsoft/action-psscriptanalyzer for more info about the options. - # The below set up runs PSScriptAnalyzer to your entire repository and runs some basic security rules. - path: .\ - recurse: true - # Include your own basic security rules. Removing this option will run all the rules - includeRule: '"PSAvoidGlobalAliases", "PSAvoidUsingConvertToSecureStringWithPlainText"' - output: results.sarif - - # Upload the SARIF file generated in the previous step - - name: Upload SARIF results file - uses: github/codeql-action/upload-sarif@v3 - with: - sarif_file: results.sarif diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 0ab9e9e2..1affe1e5 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -1,46 +1,55 @@ +# Rust Build, Test and Security Analysis workflow +# Optimized with better caching, path-based triggers, and consolidated jobs + name: Rust CI on: push: - branches: [ "main" ] + branches: ["main"] + paths: + - 'src/rules-compiler-rust/**' + - 'src/adguard-validation/**' + - 'Cargo.toml' + - 'Cargo.lock' + - '.github/workflows/rust-clippy.yml' pull_request: - branches: [ "main" ] + branches: ["main"] + paths: + - 'src/rules-compiler-rust/**' + - 'src/adguard-validation/**' + - 'Cargo.toml' + - 'Cargo.lock' + - '.github/workflows/rust-clippy.yml' schedule: - - cron: '24 0 * * 6' + - cron: '24 0 * * 6' # Weekly security scan on Saturday + +env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + RUST_BACKTRACE: short jobs: - rust-workspace-build-and-test: - name: Build and Test Rust Workspace + build-and-test: + name: Build and Test runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Full history needed for analysis + - uses: actions/checkout@v4 - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: "1.83" + toolchain: stable components: rustfmt, clippy - - name: Cache cargo registry - uses: actions/cache@v4 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - - - name: Cache cargo index + - name: Cache Cargo uses: actions/cache@v4 with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - - - name: Cache cargo build - uses: actions/cache@v4 - with: - path: target - key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- - name: Check formatting run: cargo fmt --all -- --check @@ -54,39 +63,47 @@ jobs: - name: Run clippy run: | # Run clippy on non-generated packages only - # Exclude adguard-api-lib and adguard-api-cli as they are OpenAPI-generated code - # Note: Using -W clippy::all instead of -D warnings to allow pedantic/nursery warnings - cargo clippy -p rules-compiler -p adguard-validation-core -p adguard-validation-cli --all-features -- -W clippy::all -W clippy::correctness -W clippy::suspicious + cargo clippy -p rules-compiler -p adguard-validation-core -p adguard-validation-cli \ + --all-features -- -W clippy::all -W clippy::correctness -W clippy::suspicious - rust-clippy-analyze: - name: Run rust-clippy security analysis + security-analysis: + name: Security Analysis runs-on: ubuntu-latest + if: github.event_name == 'schedule' || github.event_name == 'push' permissions: contents: read security-events: write actions: read + steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - uses: actions/checkout@v4 - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: "1.83" + toolchain: stable components: clippy - - name: Install required cargo tools + - name: Cache Cargo + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-security-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-security- + + - name: Install SARIF tools run: cargo install clippy-sarif sarif-fmt - - name: Run rust-clippy on workspace + - name: Run clippy for security analysis run: | - # Run clippy on non-generated packages only - cargo clippy -p rules-compiler -p adguard-validation-core -p adguard-validation-cli --all-features --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt + cargo clippy -p rules-compiler -p adguard-validation-core -p adguard-validation-cli \ + --all-features --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt continue-on-error: true - - name: Upload analysis results to GitHub + - name: Upload SARIF results uses: github/codeql-action/upload-sarif@v3 with: sarif_file: rust-clippy-results.sarif diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 496c93d8..d66181ac 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -9,14 +9,14 @@ on: pull_request: branches: ["main"] schedule: - - cron: "28 16 * * 6" # Weekly on Saturday + - cron: "28 16 * * 6" # Weekly on Saturday permissions: contents: read jobs: codeql: - name: CodeQL Analysis + name: CodeQL (${{ matrix.language }}) runs-on: ubuntu-latest permissions: actions: read @@ -29,10 +29,7 @@ jobs: language: ["csharp", "javascript"] steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Full history needed for CodeQL analysis + - uses: actions/checkout@v4 - name: Initialize CodeQL uses: github/codeql-action/init@v3 @@ -45,7 +42,7 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 with: - category: "/language:${{matrix.language}}" + category: "/language:${{ matrix.language }}" devskim: name: DevSkim Analysis @@ -56,15 +53,12 @@ jobs: security-events: write steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Full history needed for security scanning + - uses: actions/checkout@v4 - name: Run DevSkim scanner uses: microsoft/DevSkim-Action@v1 - - name: Upload DevSkim scan results + - name: Upload DevSkim results uses: github/codeql-action/upload-sarif@v3 with: sarif_file: devskim-results.sarif @@ -79,13 +73,11 @@ jobs: steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Full history needed for security scanning - name: Run PSScriptAnalyzer uses: microsoft/psscriptanalyzer-action@6b2948b1944407914a58661c49941824d149734f with: - path: .\ + path: ./ recurse: true includeRule: '"PSAvoidGlobalAliases", "PSAvoidUsingConvertToSecureStringWithPlainText"' output: results.sarif diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml index c09faddd..91f358b3 100644 --- a/.github/workflows/typescript.yml +++ b/.github/workflows/typescript.yml @@ -1,144 +1,72 @@ -# This workflow will build and test TypeScript projects using Deno +# Deno TypeScript Build and Test workflow +# Optimized with Deno caching, matrix strategy, and path-based triggers + name: Deno TypeScript Build on: push: - branches: [ "main" ] + branches: ["main"] + paths: + - 'src/rules-compiler-typescript/**' + - 'src/adguard-api-typescript/**' + - 'src/linear/**' + - '.github/workflows/typescript.yml' pull_request: - branches: [ "main" ] + branches: ["main"] + paths: + - 'src/rules-compiler-typescript/**' + - 'src/adguard-api-typescript/**' + - 'src/linear/**' + - '.github/workflows/typescript.yml' jobs: - build-rules-compiler: - name: Build and Test Rules Compiler (Deno) + build: + name: ${{ matrix.name }} runs-on: ubuntu-latest - defaults: - run: - working-directory: ./src/rules-compiler-typescript - - steps: - - uses: actions/checkout@v4 - - - name: Setup Deno - uses: denoland/setup-deno@v2 - with: - deno-version: v2.x - - - name: Verify Deno installation - run: deno --version - - - name: Generate type definitions - run: deno task generate:types - - - name: Verify type definitions generated - run: | - if [ ! -d "dist" ]; then - echo "Error: dist directory not created" - exit 1 - fi - file_count=$(find dist -name "*.d.ts" | wc -l) - echo "Generated $file_count .d.ts files" - if [ "$file_count" -eq 0 ]; then - echo "Error: No .d.ts files generated" - exit 1 - fi + strategy: + fail-fast: false + matrix: + include: + - name: Rules Compiler (Deno) + path: src/rules-compiler-typescript + has_tests: true + - name: AdGuard API Client (Deno) + path: src/adguard-api-typescript + has_tests: true + - name: Linear Import Tool (Deno) + path: src/linear + has_tests: false - - name: Type check - run: deno task check - - - name: Lint - run: deno task lint - - - name: Format check - run: deno fmt --check src/ - - - name: Test - run: deno task test - - build-adguard-api: - name: Build and Test AdGuard API Client (Deno) - runs-on: ubuntu-latest defaults: run: - working-directory: ./src/adguard-api-typescript + working-directory: ${{ matrix.path }} steps: - - uses: actions/checkout@v4 - - - name: Setup Deno - uses: denoland/setup-deno@v2 - with: - deno-version: v2.x - - - name: Verify Deno installation - run: deno --version - - - name: Generate type definitions - run: deno task generate:types - - - name: Verify type definitions generated - run: | - if [ ! -d "dist" ]; then - echo "Error: dist directory not created" - exit 1 - fi - file_count=$(find dist -name "*.d.ts" | wc -l) - echo "Generated $file_count .d.ts files" - if [ "$file_count" -eq 0 ]; then - echo "Error: No .d.ts files generated" - exit 1 - fi - - - name: Type check - run: deno task check - - - name: Lint - run: deno task lint - - - name: Format check - run: deno fmt --check src/ - - - name: Test - run: deno task test - - build-linear: - name: Build Linear Import Tool (Deno) - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./src/linear - - steps: - - uses: actions/checkout@v4 - - - name: Setup Deno - uses: denoland/setup-deno@v2 - with: - deno-version: v2.x - - - name: Verify Deno installation - run: deno --version - - - name: Generate type definitions - run: deno task generate:types - - - name: Verify type definitions generated - run: | - if [ ! -d "dist" ]; then - echo "Error: dist directory not created" - exit 1 - fi - file_count=$(find dist -name "*.d.ts" | wc -l) - echo "Generated $file_count .d.ts files" - if [ "$file_count" -eq 0 ]; then - echo "Error: No .d.ts files generated" - exit 1 - fi - - - name: Type check - run: deno task check - - - name: Lint - run: deno task lint - - - name: Format check - run: deno fmt --check src/ + - uses: actions/checkout@v4 + + - name: Setup Deno + uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + + - name: Cache Deno dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cache/deno + ~/.deno + key: ${{ runner.os }}-deno-${{ hashFiles('**/deno.lock', '**/deno.json') }} + restore-keys: ${{ runner.os }}-deno- + + - name: Type check + run: deno task check + + - name: Lint + run: deno task lint + + - name: Format check + run: deno fmt --check src/ + + - name: Test + if: matrix.has_tests + run: deno task test diff --git a/.github/workflows/validation-compliance.yml b/.github/workflows/validation-compliance.yml index 5cb4604f..a77f12ce 100644 --- a/.github/workflows/validation-compliance.yml +++ b/.github/workflows/validation-compliance.yml @@ -1,29 +1,43 @@ +# Validation Library Compliance workflow +# Optimized with path-based triggers and simplified job structure + name: Validation Library Compliance on: push: - branches: [ main, develop ] + branches: [main, develop] + paths: + - 'src/adguard-validation/**' + - 'src/rules-compiler-*/**' + - 'tools/check-validation-compliance.sh' + - '.github/workflows/validation-compliance.yml' pull_request: - branches: [ main, develop ] + branches: [main, develop] + paths: + - 'src/adguard-validation/**' + - 'src/rules-compiler-*/**' + - 'tools/check-validation-compliance.sh' + - '.github/workflows/validation-compliance.yml' workflow_dispatch: env: CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 jobs: validation-library-build: name: Build Validation Library runs-on: ubuntu-latest - + steps: - uses: actions/checkout@v4 - + - name: Setup Rust uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: stable - - - name: Cache Cargo dependencies + + - name: Cache Cargo uses: actions/cache@v4 with: path: | @@ -31,23 +45,22 @@ jobs: ~/.cargo/git target key: ${{ runner.os }}-cargo-validation-${{ hashFiles('**/Cargo.lock') }} - + restore-keys: ${{ runner.os }}-cargo-validation- + - name: Build validation library - run: | - cargo build --release -p adguard-validation-core --verbose - + run: cargo build --release -p adguard-validation-core + - name: Run validation library tests - run: | - cargo test -p adguard-validation-core -p adguard-validation-cli --verbose - + run: cargo test -p adguard-validation-core -p adguard-validation-cli + - name: Check clippy run: | - cargo clippy -p adguard-validation-core -p adguard-validation-cli --all-targets --all-features -- -W clippy::all -W clippy::correctness -W clippy::suspicious - + cargo clippy -p adguard-validation-core -p adguard-validation-cli \ + --all-targets --all-features -- -W clippy::all -W clippy::correctness -W clippy::suspicious + - name: Build CLI tool - run: | - cargo build --release -p adguard-validation-cli - + run: cargo build --release -p adguard-validation-cli + - name: Upload validation library artifacts uses: actions/upload-artifact@v4 with: @@ -57,118 +70,47 @@ jobs: target/release/adguard-validate retention-days: 7 - compliance-check: - name: Compliance Check - runs-on: ubuntu-latest - needs: validation-library-build - - steps: - - uses: actions/checkout@v4 - - - name: Setup Rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: stable - - - name: Run compliance check - run: | - chmod +x tools/check-validation-compliance.sh - ./tools/check-validation-compliance.sh - - - name: Generate compliance report - if: always() - run: | - echo "# Validation Library Compliance Report" > compliance-report.md - echo "" >> compliance-report.md - echo "**Date**: $(date)" >> compliance-report.md - echo "**Commit**: ${{ github.sha }}" >> compliance-report.md - echo "" >> compliance-report.md - echo "## Status" >> compliance-report.md - echo "" >> compliance-report.md - ./tools/check-validation-compliance.sh >> compliance-report.md 2>&1 || true - - - name: Upload compliance report - if: always() - uses: actions/upload-artifact@v4 - with: - name: compliance-report - path: compliance-report.md - retention-days: 30 - integration-status: name: Integration Status runs-on: ubuntu-latest - + steps: - uses: actions/checkout@v4 - - - name: Check TypeScript integration status - id: typescript + + - name: Check integration status run: | + echo "# Integration Status Summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "| Compiler | Status |" >> $GITHUB_STEP_SUMMARY + echo "|----------|--------|" >> $GITHUB_STEP_SUMMARY + + # TypeScript if grep -rq "adguard.*validation" src/rules-compiler-typescript/package.json 2>/dev/null; then - echo "status=integrated" >> $GITHUB_OUTPUT + echo "| TypeScript | integrated |" >> $GITHUB_STEP_SUMMARY else - echo "status=pending" >> $GITHUB_OUTPUT + echo "| TypeScript | pending |" >> $GITHUB_STEP_SUMMARY fi - - - name: Check .NET integration status - id: dotnet - run: | + + # .NET if grep -rq "adguard_validation" src/rules-compiler-dotnet 2>/dev/null; then - echo "status=integrated" >> $GITHUB_OUTPUT + echo "| .NET | integrated |" >> $GITHUB_STEP_SUMMARY else - echo "status=pending" >> $GITHUB_OUTPUT + echo "| .NET | pending |" >> $GITHUB_STEP_SUMMARY fi - - - name: Check Python integration status - id: python - run: | + + # Python if [ -f src/rules-compiler-python/requirements.txt ] && grep -q "adguard-validation" src/rules-compiler-python/requirements.txt 2>/dev/null; then - echo "status=integrated" >> $GITHUB_OUTPUT + echo "| Python | integrated |" >> $GITHUB_STEP_SUMMARY else - echo "status=pending" >> $GITHUB_OUTPUT + echo "| Python | pending |" >> $GITHUB_STEP_SUMMARY fi - - - name: Check Rust integration status - id: rust - run: | + + # Rust if grep -q "adguard-validation" src/rules-compiler-rust/Cargo.toml 2>/dev/null; then - echo "status=integrated" >> $GITHUB_OUTPUT + echo "| Rust | integrated |" >> $GITHUB_STEP_SUMMARY else - echo "status=pending" >> $GITHUB_OUTPUT + echo "| Rust | pending |" >> $GITHUB_STEP_SUMMARY fi - - - name: Create integration status summary - run: | - echo "# Integration Status Summary" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "| Compiler | Status |" >> $GITHUB_STEP_SUMMARY - echo "|----------|--------|" >> $GITHUB_STEP_SUMMARY - echo "| TypeScript | ${{ steps.typescript.outputs.status }} |" >> $GITHUB_STEP_SUMMARY - echo "| .NET | ${{ steps.dotnet.outputs.status }} |" >> $GITHUB_STEP_SUMMARY - echo "| Python | ${{ steps.python.outputs.status }} |" >> $GITHUB_STEP_SUMMARY - echo "| Rust | ${{ steps.rust.outputs.status }} |" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "**Note**: 'pending' status is expected during migration. See VALIDATION_ENFORCEMENT.md for timeline." >> $GITHUB_STEP_SUMMARY - enforce-integration: - name: Enforce Integration (Future) - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - - steps: - - uses: actions/checkout@v4 - - - name: Check if PR modifies compilers without validation - run: | - # This will be enabled in Phase 5 - currently informational only - echo "::notice::Integration enforcement is currently in informational mode" - echo "::notice::Future: PRs modifying compilers will require validation library integration" - - # Check if compiler files were modified - CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) - - if echo "$CHANGED_FILES" | grep -q "src/rules-compiler"; then - echo "::warning::Compiler files modified. Ensure validation library integration." - echo "::warning::See docs/VALIDATION_ENFORCEMENT.md for requirements." - fi + echo "" >> $GITHUB_STEP_SUMMARY + echo "**Note**: 'pending' status is expected during migration." >> $GITHUB_STEP_SUMMARY diff --git a/Cargo.lock b/Cargo.lock index a62351ed..284b6bc7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "adguard-api-cli" @@ -1322,6 +1322,7 @@ dependencies = [ "sha2", "tempfile", "thiserror 2.0.17", + "tokio", "toml", "uuid", "which", diff --git a/src/adguard-api-typescript/src/api/account.ts b/src/adguard-api-typescript/src/api/account.ts index 2c6e40f9..8850e37a 100644 --- a/src/adguard-api-typescript/src/api/account.ts +++ b/src/adguard-api-typescript/src/api/account.ts @@ -3,8 +3,8 @@ */ import { BaseApi } from './base.ts'; -import { ApiConfiguration } from '../helpers/configuration.ts'; -import { AccountLimits } from '../models/index.ts'; +import type { ApiConfiguration } from '../helpers/configuration.ts'; +import type { AccountLimits } from '../models/index.ts'; /** Account API endpoints */ export class AccountApi extends BaseApi { diff --git a/src/adguard-api-typescript/src/api/auth.ts b/src/adguard-api-typescript/src/api/auth.ts index 4d7086e2..4879c594 100644 --- a/src/adguard-api-typescript/src/api/auth.ts +++ b/src/adguard-api-typescript/src/api/auth.ts @@ -3,8 +3,8 @@ */ import { BaseApi } from './base.ts'; -import { ApiConfiguration } from '../helpers/configuration.ts'; -import { AccessTokenCredentials, AccessTokenResponse } from '../models/index.ts'; +import type { ApiConfiguration } from '../helpers/configuration.ts'; +import type { AccessTokenCredentials, AccessTokenResponse } from '../models/index.ts'; /** Authentication API endpoints */ export class AuthApi extends BaseApi { diff --git a/src/adguard-api-typescript/src/api/base.ts b/src/adguard-api-typescript/src/api/base.ts index 6f823b27..8b21efdc 100644 --- a/src/adguard-api-typescript/src/api/base.ts +++ b/src/adguard-api-typescript/src/api/base.ts @@ -2,13 +2,13 @@ * Base API client class */ -import { AxiosError, AxiosInstance } from 'axios'; +import { AxiosError, type AxiosInstance } from 'axios'; import { - ApiConfiguration, createAxiosInstance, createRetryableClient, - Logger, silentLogger, + type ApiConfiguration, + type Logger, } from '../helpers/configuration.ts'; import { ApiError, @@ -17,7 +17,7 @@ import { RateLimitError, ValidationError, } from '../errors/index.ts'; -import { ErrorResponse } from '../models/index.ts'; +import type { ErrorResponse } from '../models/index.ts'; /** Base API client */ export abstract class BaseApi { diff --git a/src/adguard-api-typescript/src/api/dedicated-ips.ts b/src/adguard-api-typescript/src/api/dedicated-ips.ts index 01d36204..f80d999c 100644 --- a/src/adguard-api-typescript/src/api/dedicated-ips.ts +++ b/src/adguard-api-typescript/src/api/dedicated-ips.ts @@ -3,8 +3,8 @@ */ import { BaseApi } from './base.ts'; -import { ApiConfiguration } from '../helpers/configuration.ts'; -import { DedicatedIPv4Address } from '../models/index.ts'; +import type { ApiConfiguration } from '../helpers/configuration.ts'; +import type { DedicatedIPv4Address } from '../models/index.ts'; /** Dedicated IP Addresses API endpoints */ export class DedicatedIpApi extends BaseApi { diff --git a/src/adguard-api-typescript/src/api/devices.ts b/src/adguard-api-typescript/src/api/devices.ts index 1f42946c..22153f07 100644 --- a/src/adguard-api-typescript/src/api/devices.ts +++ b/src/adguard-api-typescript/src/api/devices.ts @@ -3,8 +3,8 @@ */ import { BaseApi } from './base.ts'; -import { ApiConfiguration } from '../helpers/configuration.ts'; -import { +import type { ApiConfiguration } from '../helpers/configuration.ts'; +import type { DedicatedIps, Device, DeviceCreate, diff --git a/src/adguard-api-typescript/src/api/dns-servers.ts b/src/adguard-api-typescript/src/api/dns-servers.ts index 7cb9f7d5..27ad6c9b 100644 --- a/src/adguard-api-typescript/src/api/dns-servers.ts +++ b/src/adguard-api-typescript/src/api/dns-servers.ts @@ -3,8 +3,8 @@ */ import { BaseApi } from './base.ts'; -import { ApiConfiguration } from '../helpers/configuration.ts'; -import { +import type { ApiConfiguration } from '../helpers/configuration.ts'; +import type { DNSServer, DNSServerCreate, DNSServerSettingsUpdate, diff --git a/src/adguard-api-typescript/src/api/filter-lists.ts b/src/adguard-api-typescript/src/api/filter-lists.ts index fcaf266a..e4befd89 100644 --- a/src/adguard-api-typescript/src/api/filter-lists.ts +++ b/src/adguard-api-typescript/src/api/filter-lists.ts @@ -3,8 +3,8 @@ */ import { BaseApi } from './base.ts'; -import { ApiConfiguration } from '../helpers/configuration.ts'; -import { FilterList } from '../models/index.ts'; +import type { ApiConfiguration } from '../helpers/configuration.ts'; +import type { FilterList } from '../models/index.ts'; /** Filter Lists API endpoints */ export class FilterListsApi extends BaseApi { diff --git a/src/adguard-api-typescript/src/api/query-log.ts b/src/adguard-api-typescript/src/api/query-log.ts index d5d7276f..fd867ef4 100644 --- a/src/adguard-api-typescript/src/api/query-log.ts +++ b/src/adguard-api-typescript/src/api/query-log.ts @@ -3,8 +3,8 @@ */ import { BaseApi } from './base.ts'; -import { ApiConfiguration } from '../helpers/configuration.ts'; -import { QueryLogParams, QueryLogResponse } from '../models/index.ts'; +import type { ApiConfiguration } from '../helpers/configuration.ts'; +import type { QueryLogParams, QueryLogResponse } from '../models/index.ts'; /** Query Log API endpoints */ export class QueryLogApi extends BaseApi { diff --git a/src/adguard-api-typescript/src/api/statistics.ts b/src/adguard-api-typescript/src/api/statistics.ts index e6ad3ac2..a0d838db 100644 --- a/src/adguard-api-typescript/src/api/statistics.ts +++ b/src/adguard-api-typescript/src/api/statistics.ts @@ -3,8 +3,8 @@ */ import { BaseApi } from './base.ts'; -import { ApiConfiguration } from '../helpers/configuration.ts'; -import { +import type { ApiConfiguration } from '../helpers/configuration.ts'; +import type { CategoryQueriesStatsList, CompanyDetailedQueriesStatsList, CompanyQueriesStatsList, diff --git a/src/adguard-api-typescript/src/api/web-services.ts b/src/adguard-api-typescript/src/api/web-services.ts index a8b38628..7fcf9cba 100644 --- a/src/adguard-api-typescript/src/api/web-services.ts +++ b/src/adguard-api-typescript/src/api/web-services.ts @@ -3,8 +3,8 @@ */ import { BaseApi } from './base.ts'; -import { ApiConfiguration } from '../helpers/configuration.ts'; -import { WebService } from '../models/index.ts'; +import type { ApiConfiguration } from '../helpers/configuration.ts'; +import type { WebService } from '../models/index.ts'; /** Web Services API endpoints */ export class WebServicesApi extends BaseApi { diff --git a/src/adguard-validation/adguard-validation-core/src/archive.rs b/src/adguard-validation/adguard-validation-core/src/archive.rs index 2262642d..fdd5ab36 100644 --- a/src/adguard-validation/adguard-validation-core/src/archive.rs +++ b/src/adguard-validation/adguard-validation-core/src/archive.rs @@ -5,8 +5,8 @@ use serde::{Deserialize, Serialize}; use std::fs; use std::path::{Path, PathBuf}; -use crate::error::{Result, ValidationError}; -use crate::hash::{compute_file_hash, HashEntry}; +use crate::error::Result; +use crate::hash::compute_file_hash; /// Archive manifest containing metadata about archived files. #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/src/adguard-validation/adguard-validation-core/src/file_conflict.rs b/src/adguard-validation/adguard-validation-core/src/file_conflict.rs index f84a398f..74a2e3a6 100644 --- a/src/adguard-validation/adguard-validation-core/src/file_conflict.rs +++ b/src/adguard-validation/adguard-validation-core/src/file_conflict.rs @@ -1,6 +1,5 @@ //! File conflict resolution strategies. -use std::fs; use std::path::{Path, PathBuf}; use crate::config::ConflictStrategy; diff --git a/src/adguard-validation/adguard-validation-core/src/runtime_enforcement.rs b/src/adguard-validation/adguard-validation-core/src/runtime_enforcement.rs index d40c3087..0421127d 100644 --- a/src/adguard-validation/adguard-validation-core/src/runtime_enforcement.rs +++ b/src/adguard-validation/adguard-validation-core/src/runtime_enforcement.rs @@ -8,7 +8,6 @@ use std::path::{Path, PathBuf}; use crate::config::ValidationConfig; use crate::error::{Result, ValidationError}; -use crate::hash::HashDatabase; use crate::validator::Validator; /// Compilation result with validation metadata. diff --git a/src/adguard-validation/adguard-validation-core/src/syntax.rs b/src/adguard-validation/adguard-validation-core/src/syntax.rs index f1e8d87d..85828daf 100644 --- a/src/adguard-validation/adguard-validation-core/src/syntax.rs +++ b/src/adguard-validation/adguard-validation-core/src/syntax.rs @@ -4,7 +4,7 @@ use regex::Regex; use std::fs; use std::path::Path; -use crate::error::{Result, ValidationError}; +use crate::error::Result; /// Filter format type. #[derive(Debug, Clone, Copy, PartialEq, Eq)] diff --git a/src/linear/src/linear-client.ts b/src/linear/src/linear-client.ts index baea93d7..d615a9e5 100644 --- a/src/linear/src/linear-client.ts +++ b/src/linear/src/linear-client.ts @@ -3,7 +3,7 @@ */ import { LinearClient } from '@linear/sdk'; -import { +import type { ComponentInfo, ImportConfig, LinearImportResult, diff --git a/src/linear/src/linear-import.ts b/src/linear/src/linear-import.ts index 5aabf9ea..45cead20 100644 --- a/src/linear/src/linear-import.ts +++ b/src/linear/src/linear-import.ts @@ -31,7 +31,7 @@ import { flattenSections, parseMarkdownFile, } from './parser.ts'; -import { ImportConfig } from './types.ts'; +import type { ImportConfig } from './types.ts'; // Load environment variables const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/src/linear/src/parser.ts b/src/linear/src/parser.ts index 383bb5f0..27861a18 100644 --- a/src/linear/src/parser.ts +++ b/src/linear/src/parser.ts @@ -3,7 +3,7 @@ */ import { readFileSync } from 'fs'; -import { ComponentInfo, DocumentSection, ParsedDocument, RoadmapItem } from './types.ts'; +import type { ComponentInfo, DocumentSection, ParsedDocument, RoadmapItem } from './types.ts'; /** * Parse a markdown file into structured sections diff --git a/src/rules-compiler-rust/src/compiler.rs b/src/rules-compiler-rust/src/compiler.rs index 099b6ac1..5d040a1c 100644 --- a/src/rules-compiler-rust/src/compiler.rs +++ b/src/rules-compiler-rust/src/compiler.rs @@ -700,14 +700,9 @@ pub async fn compile_rules_async>( let temp_path = std::env::temp_dir().join(format!("compiler-config-{}.json", uuid::Uuid::new_v4())); let json = to_json(&config)?; - tokio::fs::write(&temp_path, &json) - .await - .map_err(|e| { - CompilerError::file_system( - format!("writing temp config to {}", temp_path.display()), - e, - ) - })?; + tokio::fs::write(&temp_path, &json).await.map_err(|e| { + CompilerError::file_system(format!("writing temp config to {}", temp_path.display()), e) + })?; if options.debug { eprintln!("[DEBUG] Created temp JSON config: {}", temp_path.display()); @@ -721,14 +716,12 @@ pub async fn compile_rules_async>( // Ensure output directory exists if let Some(output_dir) = output_path.parent() { - tokio::fs::create_dir_all(output_dir) - .await - .map_err(|e| { - CompilerError::file_system( - format!("creating output directory {}", output_dir.display()), - e, - ) - })?; + tokio::fs::create_dir_all(output_dir).await.map_err(|e| { + CompilerError::file_system( + format!("creating output directory {}", output_dir.display()), + e, + ) + })?; } // Get compiler command @@ -785,14 +778,12 @@ pub async fn compile_rules_async>( // Copy to rules directory if requested if options.copy_to_rules { let rules_dir = get_rules_directory(&config_path, options.rules_directory.as_deref()); - tokio::fs::create_dir_all(&rules_dir) - .await - .map_err(|e| { - CompilerError::file_system( - format!("creating rules directory {}", rules_dir.display()), - e, - ) - })?; + tokio::fs::create_dir_all(&rules_dir).await.map_err(|e| { + CompilerError::file_system( + format!("creating rules directory {}", rules_dir.display()), + e, + ) + })?; let dest_path = rules_dir.join("adguard_user_filter.txt"); tokio::fs::copy(&output_path, &dest_path) diff --git a/src/rules-compiler-typescript/src/parallel-compiler.ts b/src/rules-compiler-typescript/src/parallel-compiler.ts index 245a6ba5..363d72d2 100644 --- a/src/rules-compiler-typescript/src/parallel-compiler.ts +++ b/src/rules-compiler-typescript/src/parallel-compiler.ts @@ -4,7 +4,8 @@ */ import compile, { type IConfiguration } from '@adguard/hostlist-compiler'; -import type { ChunkedConfiguration, Logger } from './types.ts'; +import type { Logger } from './types.ts'; +import type { ChunkedConfiguration } from './chunking.ts'; import { logger as defaultLogger } from './logger.ts'; import { CompilationError, ErrorCode } from './errors.ts';