Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude/agents/build-validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
2 changes: 1 addition & 1 deletion .claude/agents/pr-creator.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .claude/agents/pr-reviewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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```"
Expand Down Expand Up @@ -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.
4 changes: 2 additions & 2 deletions .claude/agents/repo-explorer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions .claude/agents/verify-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .claude/commands/check-ci.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
4 changes: 2 additions & 2 deletions .claude/commands/verify.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-integration-test-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ runs:
env:
TRUSTED_SERVER__PUBLISHER__ORIGIN_URL: http://127.0.0.1:${{ inputs.origin-port }}
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' }}
Expand Down
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ Closes #
<!-- How did you verify this works? Check all that apply -->

- [ ] `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: <!-- describe -->

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<E>`) for error handling — not anyhow, eyre, or thiserror.
7. Use `tracing` macros (not `println!`) and `expect("should ...")` (not `unwrap()`).
Expand Down
26 changes: 13 additions & 13 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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`)
Expand Down Expand Up @@ -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 `<script>` at `<head>` start |
| `crates/common/src/publisher.rs` | `/static/tsjs=` handler, concatenates modules |
| `crates/common/src/synthetic.rs` | Synthetic ID generation |
| `crates/common/src/cookies.rs` | Cookie handling |
| `crates/common/src/gdpr.rs` | GDPR consent management |
| `crates/common/src/http_wrapper.rs` | HTTP abstractions |
| `crates/trusted-server-core/src/integrations/registry.rs` | IntegrationRegistry, `js_module_ids()` |
| `crates/trusted-server-core/src/tsjs.rs` | Script tag generation with module IDs |
| `crates/trusted-server-core/src/html_processor.rs` | Injects `<script>` at `<head>` start |
| `crates/trusted-server-core/src/publisher.rs` | `/static/tsjs=` handler, concatenates modules |
| `crates/trusted-server-core/src/synthetic.rs` | Synthetic ID generation |
| `crates/trusted-server-core/src/cookies.rs` | Cookie handling |
| `crates/trusted-server-core/src/gdpr.rs` | GDPR consent management |
| `crates/trusted-server-core/src/http_wrapper.rs` | HTTP abstractions |
| `crates/js/build.rs` | Discovers dist files, generates `tsjs_modules.rs` |
| `crates/js/src/bundle.rs` | Module map, concatenation, hashing |

Expand Down
Loading
Loading