diff --git a/.claude/agents/build-validator.md b/.claude/agents/build-validator.md index e559e506..a35b2824 100644 --- a/.claude/agents/build-validator.md +++ b/.claude/agents/build-validator.md @@ -17,13 +17,13 @@ Validate that the project builds correctly across all targets. 2. **WASM build** (production target) ```bash - cargo build --bin trusted-server-fastly --release --target wasm32-wasip1 + cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1 ``` 3. **Clippy** ```bash - cargo clippy --all-targets --all-features -- -D warnings + cargo clippy --workspace --all-targets --all-features -- -D warnings ``` 4. **Format check** diff --git a/.claude/agents/pr-creator.md b/.claude/agents/pr-creator.md index 1ac4c337..9825ec08 100644 --- a/.claude/agents/pr-creator.md +++ b/.claude/agents/pr-creator.md @@ -21,7 +21,7 @@ Before creating the PR, verify the branch is healthy: ``` cargo fmt --all -- --check -cargo clippy --all-targets --all-features -- -D warnings +cargo clippy --workspace --all-targets --all-features -- -D warnings cargo test --workspace cd crates/js/lib && npx vitest run cd crates/js/lib && npm run format diff --git a/.claude/agents/pr-reviewer.md b/.claude/agents/pr-reviewer.md index 0a596f41..c771aa03 100644 --- a/.claude/agents/pr-reviewer.md +++ b/.claude/agents/pr-reviewer.md @@ -70,8 +70,8 @@ For each changed file, evaluate: #### WASM compatibility - Target is `wasm32-wasip1` β€” no std::net, std::thread, or OS-specific APIs -- No Tokio or runtime-specific deps in `crates/common` -- Fastly-specific APIs only in `crates/fastly` +- No Tokio or runtime-specific deps in `crates/trusted-server-core` +- Fastly-specific APIs only in `crates/trusted-server-adapter-fastly` #### Convention compliance (from CLAUDE.md) @@ -177,7 +177,7 @@ comment. Use the file's **current line number** (not diff position) with the ````json { - "path": "crates/common/src/publisher.rs", + "path": "crates/trusted-server-core/src/publisher.rs", "line": 166, "side": "RIGHT", "body": "πŸ”§ **wrench** β€” Race condition: Description of the issue...\n\n**Fix**:\n```rust\n// suggested code\n```" @@ -288,6 +288,6 @@ Output: - Do not include any byline, "Generated with" footer, `Co-Authored-By` trailer, or self-referential titles (e.g., "Staff Engineer Review") in review comments or the review body. -- If the diff is very large (>50 files), prioritize `crates/common/` changes +- If the diff is very large (>50 files), prioritize `crates/trusted-server-core/` changes and new files over mechanical changes (Cargo.lock, generated code). - Never submit a review without explicit user approval of the findings. diff --git a/.claude/agents/repo-explorer.md b/.claude/agents/repo-explorer.md index e7fa3114..570686f8 100644 --- a/.claude/agents/repo-explorer.md +++ b/.claude/agents/repo-explorer.md @@ -11,8 +11,8 @@ implementation details. This is a Rust workspace with three crates: -- `crates/common/` β€” core library (integrations, HTML processing, synthetic IDs, GDPR) -- `crates/fastly/` β€” Fastly Compute entry point +- `crates/trusted-server-core/` β€” core library (integrations, HTML processing, synthetic IDs, GDPR) +- `crates/trusted-server-adapter-fastly/` β€” Fastly Compute entry point - `crates/js/` β€” TypeScript/JS build pipeline (per-integration IIFE bundles) Target: `wasm32-wasip1` (Fastly Compute) diff --git a/.claude/agents/verify-app.md b/.claude/agents/verify-app.md index c6ac995b..5d26c679 100644 --- a/.claude/agents/verify-app.md +++ b/.claude/agents/verify-app.md @@ -19,7 +19,7 @@ cargo fmt --all -- --check ### 2. Clippy ```bash -cargo clippy --all-targets --all-features -- -D warnings +cargo clippy --workspace --all-targets --all-features -- -D warnings ``` ### 3. Rust Tests @@ -49,7 +49,7 @@ cd docs && npm run format ### 7. WASM Build ```bash -cargo build --bin trusted-server-fastly --release --target wasm32-wasip1 +cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1 ``` ## Output diff --git a/.claude/commands/check-ci.md b/.claude/commands/check-ci.md index c6b2d942..dc4a63c0 100644 --- a/.claude/commands/check-ci.md +++ b/.claude/commands/check-ci.md @@ -1,7 +1,7 @@ Run all CI checks locally, in order. Stop and report if any step fails. 1. `cargo fmt --all -- --check` -2. `cargo clippy --all-targets --all-features -- -D warnings` +2. `cargo clippy --workspace --all-targets --all-features -- -D warnings` 3. `cargo test --workspace` 4. `cd crates/js/lib && npx vitest run` 5. `cd crates/js/lib && npm run format` diff --git a/.claude/commands/verify.md b/.claude/commands/verify.md index f6764efc..04fc8931 100644 --- a/.claude/commands/verify.md +++ b/.claude/commands/verify.md @@ -1,9 +1,9 @@ Full verification: build, test, and lint the entire project. 1. `cargo build --workspace` -2. `cargo build --bin trusted-server-fastly --release --target wasm32-wasip1` +2. `cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1` 3. `cargo fmt --all -- --check` -4. `cargo clippy --all-targets --all-features -- -D warnings` +4. `cargo clippy --workspace --all-targets --all-features -- -D warnings` 5. `cargo test --workspace` 6. `cd crates/js/lib && npx vitest run` 7. `cd crates/js/lib && npm run format` diff --git a/.github/actions/setup-integration-test-env/action.yml b/.github/actions/setup-integration-test-env/action.yml index b7656a8f..d44858f3 100644 --- a/.github/actions/setup-integration-test-env/action.yml +++ b/.github/actions/setup-integration-test-env/action.yml @@ -73,7 +73,7 @@ runs: TRUSTED_SERVER__PUBLISHER__PROXY_SECRET: integration-test-proxy-secret TRUSTED_SERVER__SYNTHETIC__SECRET_KEY: integration-test-secret-key TRUSTED_SERVER__PROXY__CERTIFICATE_CHECK: "false" - run: cargo build --bin trusted-server-fastly --release --target wasm32-wasip1 + run: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1 - name: Build WordPress test container if: ${{ inputs.build-test-images == 'true' }} diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 8fba567c..fbe95847 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -24,12 +24,12 @@ Closes # - [ ] `cargo test --workspace` -- [ ] `cargo clippy --all-targets --all-features -- -D warnings` +- [ ] `cargo clippy --workspace --all-targets --all-features -- -D warnings` - [ ] `cargo fmt --all -- --check` - [ ] JS tests: `cd crates/js/lib && npx vitest run` - [ ] JS format: `cd crates/js/lib && npm run format` - [ ] Docs format: `cd docs && npm run format` -- [ ] WASM build: `cargo build --bin trusted-server-fastly --release --target wasm32-wasip1` +- [ ] WASM build: `cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1` - [ ] Manual testing via `fastly compute serve` - [ ] Other: diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 223601b1..b6aba137 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -33,7 +33,7 @@ jobs: uses: actions-rust-lang/rustfmt@v1 - name: Run cargo clippy - run: cargo clippy --all-targets --all-features -- -D warnings + run: cargo clippy --workspace --all-targets --all-features -- -D warnings format-typescript: runs-on: ubuntu-latest diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 92bdfd74..da467583 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -13,7 +13,7 @@ on: env: ORIGIN_PORT: 8888 ARTIFACTS_DIR: /tmp/integration-test-artifacts - WASM_ARTIFACT_PATH: /tmp/integration-test-artifacts/wasm/trusted-server-fastly.wasm + WASM_ARTIFACT_PATH: /tmp/integration-test-artifacts/wasm/trusted-server-adapter-fastly.wasm DOCKER_ARTIFACT_PATH: /tmp/integration-test-artifacts/docker/test-images.tar jobs: @@ -33,7 +33,7 @@ jobs: - name: Package integration test artifacts run: | mkdir -p "$(dirname "$WASM_ARTIFACT_PATH")" "$(dirname "$DOCKER_ARTIFACT_PATH")" - cp target/wasm32-wasip1/release/trusted-server-fastly.wasm "$WASM_ARTIFACT_PATH" + cp target/wasm32-wasip1/release/trusted-server-adapter-fastly.wasm "$WASM_ARTIFACT_PATH" docker save \ --output "$DOCKER_ARTIFACT_PATH" \ test-wordpress:latest test-nextjs:latest diff --git a/AGENTS.md b/AGENTS.md index 52d00780..bcbcd179 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -18,7 +18,7 @@ If you cannot read `CLAUDE.md`, follow these rules: 1. Present a plan and get approval before coding. 2. Keep changes minimal β€” do not refactor unrelated code. 3. Run `cargo test --workspace` after every code change. -4. Run `cargo fmt --all -- --check` and `cargo clippy --all-targets --all-features -- -D warnings`. +4. Run `cargo fmt --all -- --check` and `cargo clippy --workspace --all-targets --all-features -- -D warnings`. 5. Run JS tests with `cd crates/js/lib && npx vitest run` when touching JS/TS code. 6. Use `error-stack` (`Report`) for error handling β€” not anyhow, eyre, or thiserror. 7. Use `log` macros (not `println!`) and `expect("should ...")` (not `unwrap()`). diff --git a/CLAUDE.md b/CLAUDE.md index 9ad1845c..49835fe8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -13,8 +13,8 @@ real-time bidding integration, and publisher-side JavaScript injection. ``` crates/ - common/ # Core library β€” shared logic, integrations, HTML processing - fastly/ # Fastly Compute entry point (wasm32-wasip1 binary) + trusted-server-core/ # Core library β€” shared logic, integrations, HTML processing + trusted-server-adapter-fastly/ # Fastly Compute entry point (wasm32-wasip1 binary) js/ # TypeScript/JS build β€” per-integration IIFE bundles lib/ # TS source, Vitest tests, esbuild pipeline ``` @@ -42,7 +42,7 @@ Supporting files: `fastly.toml`, `trusted-server.toml`, `.env.dev`, cargo build # Production build for Fastly -cargo build --bin trusted-server-fastly --release --target wasm32-wasip1 +cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1 # Run locally with Fastly simulator fastly compute serve @@ -61,7 +61,7 @@ cargo test --workspace cargo fmt --all -- --check # Lint -cargo clippy --all-targets --all-features -- -D warnings +cargo clippy --workspace --all-targets --all-features -- -D warnings # Check compilation cargo check @@ -268,7 +268,7 @@ IntegrationRegistration::builder(ID) Every PR must pass: 1. `cargo fmt --all -- --check` -2. `cargo clippy --all-targets --all-features -- -D warnings` +2. `cargo clippy --workspace --all-targets --all-features -- -D warnings` 3. `cargo test --workspace` 4. JS build and test (`cd crates/js/lib && npx vitest run`) 5. JS format (`cd crates/js/lib && npm run format`) @@ -362,14 +362,14 @@ both runtime behavior and build/tooling changes. | File | Purpose | | -------------------------------------------- | ------------------------------------------------- | -| `crates/common/src/integrations/registry.rs` | IntegrationRegistry, `js_module_ids()` | -| `crates/common/src/tsjs.rs` | Script tag generation with module IDs | -| `crates/common/src/html_processor.rs` | Injects `