Skip to content
Merged
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
34 changes: 34 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copilot instructions (grimoire-css)

## Project shape (architecture guide)

Note: This document captures the current architecture conventions for this repo.
- Rust workspace is a single crate with **bin + lib**: `src/main.rs` calls `grimoire_css_lib::start_as_cli` (keep `main.rs` thin).
- Command routing lives in `src/commands/handler.rs` (`init` / `build` / `shorten`). Add new CLI modes by wiring them here.
- Core pipeline logic lives in `src/core/` (config → parse → build → optimize → output). Keep it side-effect-light where practical.
- External integrations live in `src/infrastructure/` (e.g. LightningCSS optimizer + miette diagnostics). Don’t mix vendor glue into `src/core/`.

## Runtime modes & config conventions
- FS mode uses a single repo config file at `grimoire/config/grimoire.config.json` (created by `init`; used by `build`). See `src/core/filesystem.rs` and `src/commands/init.rs`.
- Optimizer uses `.browserslistrc` from repo root; if missing, it is created with `defaults` (see `src/infrastructure/lightning_css_optimizer.rs`).
- Parallel project builds are opt-in via `GRIMOIRE_CSS_JOBS` (project-level isolation) — see `src/core/css_builder/css_builder_fs.rs`.
- Locking: setting `lock: true` in config enables tracking + cleanup of stale generated files via `grimoire/grimoire.lock.json` (see `src/core/file_tracker.rs`).
- Config supports external scroll/variable files: `grimoire.*.scrolls.json` and `grimoire.*.variables.json` are loaded and merged during `ConfigFs::load` (see `src/core/config/config_fs.rs`).

## Error/reporting pattern
- Prefer returning `GrimoireCssError` from core logic; attach source context when you have file content/spans using `GrimoireCssError::with_source(...)` and `SourceFile` (pattern in `src/core/parser/parser_fs.rs`).
- CLI pretty-printing goes through `GrimoireCssDiagnostic` + `miette` (see `src/infrastructure/diagnostics.rs` and `src/lib.rs`).

## Developer workflows (match CI)
- Format: `cargo fmt -- --check`
- Lint: `cargo clippy -- -D warnings`
- Tests: `cargo test`
- Coverage (CI uses this): `./scripts/coverage.sh` (requires `grcov` + `llvm-tools-preview`).

## Local running tips
- CLI (debug): `cargo run -- build` / `cargo run -- init` / `cargo run -- shorten`
- Release binary: `cargo build --release` → `target/release/grimoire_css`
- Benchmark harness expects the release binary at `../target/release/grimoire_css` (see `benchmark/README.md`).

## Versioning convention
- PR branches `rc/x.y.z` must match `version = "x.y.z"` in `Cargo.toml` (enforced by `.github/workflows/version_check.yml`).
21 changes: 21 additions & 0 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ jobs:
with:
profile: minimal
toolchain: stable
components: clippy,rustfmt

- name: Print Rust toolchain versions
run: |
rustup show active-toolchain
rustc --version
cargo --version

- name: Install llvm-tools-preview
run: rustup component add llvm-tools-preview
Expand Down Expand Up @@ -134,6 +141,13 @@ jobs:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
components: clippy,rustfmt

- name: Print Rust toolchain versions
run: |
rustup show active-toolchain
rustc --version
cargo --version

- name: Cache Cargo registry
uses: actions/cache@v4
Expand Down Expand Up @@ -187,6 +201,13 @@ jobs:
with:
profile: minimal
toolchain: stable
components: clippy,rustfmt

- name: Print Rust toolchain versions
run: |
rustup show active-toolchain
rustc --version
cargo --version

- name: Cache Cargo registry
uses: actions/cache@v4
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ jobs:
with:
profile: minimal
toolchain: stable
components: clippy,rustfmt

- name: Print Rust toolchain versions
run: |
rustup show active-toolchain
rustc --version
cargo --version

- name: Cache cargo registry
uses: actions/cache@v4
Expand Down
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# Changelog

## [v1.7.0] - 2025-12-27

> Full release notes: [releases/v1.7.0.md](./releases/v1.7.0.md)

### Added

- **Scroll templates in `g!…;`**: Use config-defined `scrolls` inside templated syntax with variable arguments.
- **Rustc-like diagnostics**: File/snippet output with labeled spans and optional help text.
- **Opt-in parallel builds**: Enable multi-core filesystem builds via `GRIMOIRE_CSS_JOBS`.
- **Repro sandbox**: Added `repro/` scenarios for quickly validating features and diagnostics.
- **Contributor instructions**: Added `.github/copilot-instructions.md` describing the repo’s architecture conventions.

### Improved

- Deterministic scroll expansion under templated selectors, including correct propagation of prefixes (`md__`, `{...}`, `hover:`).
- Reduced redundant work and lowered clone/allocation pressure in hot paths (output unchanged).

### Fixed

- Malformed function-like spell values now produce clearer, earlier errors.
- Color function argument validation now returns a proper error instead of being silently ignored.

---

## [v1.6.0] - 2025-07-21

> Full release notes: [releases/v1.6.0.md](./releases/v1.6.0.md)

### Added

- Extracted the color module into `grimoire_css_color_toolkit` for independent usage.
- Comprehensive support for curly-bracket class syntax (`class={}`, `className={}`) with nested bracket handling.

### Improved

- Migrated unit handling from `u32` to `f64` for better precision in responsive calculations.
- Upgraded to Rust Edition 2024 and set MSRV to Rust 1.88.

---

## [v1.5.0] - 2025-05-19

> Full release notes: [releases/v1.5.0.md](./releases/v1.5.0.md)
Expand Down
Loading
Loading