diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 00000000..5dd4e2d3 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,21 @@ +# pre-commit hooks for repositories that keep an Aether workload spec. +# Requires the `aether` binary on PATH. Use: +# repos: +# - repo: https://github.com/zyvorai/Aether +# rev: main +# hooks: +# - id: aether-lint +- id: aether-lint + name: aether lint + description: Lint workload.yaml (unknown keys, bad values, ignored fields) + entry: aether lint --deny-warnings + language: system + pass_filenames: false + files: '^workload\.ya?ml$' +- id: aether-spec-lock + name: aether spec-lock check + description: Fail when workload.yaml drifts from workload.yaml.lock.json + entry: aether spec-lock check + language: system + pass_filenames: false + files: '^workload\.ya?ml(\.lock\.json)?$' diff --git a/CHANGELOG.md b/CHANGELOG.md index eb39bf35..9eaa177d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added (round 4) +- **`aether lint --fix` / `--diff`** (`src/specfix.rs`): safe, comment-preserving fixes for `W020` (typo'd key renamed to the suggested key) and `I021` (snake_case alias to camelCase); refuses edits that raise the error count. `POST /api/spec/fix`. +- **`aether spec-policy RULES.yaml`** (`src/specpolicy.rs`): policy as code. Declarative rule file (path with `[*]`, 14 operators including quantity comparison and globs, `when`, severity), findings with source lines, text/json/junit/github output. `examples/policy/org-baseline.yaml`. `POST /api/spec/policy`. +- **`aether spec-lock write|check`** (`src/speclock.rs`): hash-only baseline file, per-section drift report, `--ignore`, exit 2 on drift. `POST /api/spec/lock`, `/api/spec/lock/check`. +- **`aether manifest-check FILES`** (`src/manifestcheck.rs`): kubeconform-style offline validation of Kubernetes manifests against the bundled k8s-openapi types (types, missing required fields, bad base64, unserved apiVersions, `--strict` unknown fields, `--ignore-missing-schemas`, `--skip`, text/json/junit). `POST /api/spec/manifest-check`. +- **`aether spec-ci github|gitlab|pre-commit`** (`src/specci.rs`): ready-to-paste CI/pre-commit configuration. `GET /api/spec/ci/{provider}`. Root `.pre-commit-hooks.yaml` for consumers of the repository. +- B101-B109 are now cross-checked against the kube-linter check list and Polaris security checks (docs/RESEARCH.md round 4). + +### Changed (round 4 upgrades) +- **reqwest 0.12 -> 0.13**, no longer blocked: `openidconnect` 4.1 is built with `default-features = false` (no bundled reqwest) and `src/oidc.rs` implements its `AsyncHttpClient` trait for a thin wrapper around the application's reqwest 0.13 client. One reqwest version in the tree; native-tls/OpenSSL no longer linked (rustls with aws-lc-rs is the 0.13 default). The `form` and `query` features are enabled explicitly (0.13 made them opt-in). +- **`serde_yaml` 0.9 (unmaintained) -> `serde_yaml_ng` 0.10** via a Cargo `package` rename; no source changes, golden and spec-tool tests unchanged and green. +- **Dashboard: Tailwind CSS 3 -> 4** (`tailwindcss` + `@tailwindcss/postcss`, autoprefixer removed, `@import 'tailwindcss'` + `@config` for the existing theme). Renamed utilities migrated (`rounded` -> `rounded-sm`, `shadow-sm` -> `shadow-xs`, `backdrop-blur-sm` -> `backdrop-blur-xs`, `outline-none` -> `outline-hidden`, `flex-shrink-0` -> `shrink-0`, `placeholder-*` -> `placeholder:text-*`); a base rule restores the v3 default border colour (gray-200). Not visually checked in a browser. +- Other npm updates (lucide-react 1.79, @playwright/test 1.65); GitHub Actions pins and Docker base images re-verified as the latest releases. + ### Added (round 3) - **Lint output formats** (`src/lintfmt.rs`): `aether lint --format text|json|sarif|junit|github`. SARIF 2.1.0 carries the properties GitHub code scanning requires, with a stable per-finding fingerprint; JUnit XML and GitHub workflow commands escape everything that comes from the spec. - **Lint suppression and rule catalog:** `--ignore CODE[,CODE]`, inline `# aether-lint: ignore=CODE` (next line or same line) and `ignore-file=CODE`; suppressed counts are reported; `E00x`/`E01x` cannot be suppressed. `aether lint --list-rules` / `--explain CODE`, `GET /api/spec/lint/rules[/{code}]`. A test keeps the catalog in step with the codes the linter emits. diff --git a/Cargo.lock b/Cargo.lock index 48409a6b..2adc44ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -84,12 +84,12 @@ dependencies = [ "rand 0.10.4", "ratatui", "redis", - "reqwest 0.12.28", + "reqwest", "rsa 0.10.0", "rustls", "serde", "serde_json", - "serde_yaml", + "serde_yaml_ng", "sha2 0.11.1", "tempfile", "thiserror 2.0.21", @@ -1516,21 +1516,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.3" @@ -1937,22 +1922,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", -] - [[package]] name = "hyper-util" version = "0.1.21" @@ -2736,6 +2705,12 @@ dependencies = [ "hashbrown 0.17.2", ] +[[package]] +name = "lru-slab" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f" + [[package]] name = "mac_address" version = "1.2.1" @@ -2842,23 +2817,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" -[[package]] -name = "native-tls" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nix" version = "0.29.0" @@ -3010,7 +2968,6 @@ dependencies = [ "getrandom 0.2.17", "http", "rand 0.8.8", - "reqwest 0.12.28", "serde", "serde_json", "serde_path_to_error", @@ -3099,49 +3056,12 @@ dependencies = [ "url", ] -[[package]] -name = "openssl" -version = "0.10.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4de8111e94a56adca7ebfe6c365b6d42f99deb69b74b6becacd4204e2f193aa2" -dependencies = [ - "bitflags 2.13.2", - "cfg-if", - "foreign-types", - "libc", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - [[package]] name = "openssl-probe" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e036b411754132fd6b74e94b74e9a13c5cf606fa93d1885c35860d3060820b1" -[[package]] -name = "openssl-sys" -version = "0.9.118" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c413d6ec9ebaf5e1c829d355cb3e9f783778d700f135be0921d52fce3c60ae" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "opentelemetry" version = "0.33.1" @@ -3166,7 +3086,7 @@ dependencies = [ "bytes", "http", "opentelemetry", - "reqwest 0.13.5", + "reqwest", ] [[package]] @@ -3182,7 +3102,7 @@ dependencies = [ "opentelemetry-proto", "opentelemetry_sdk", "prost", - "reqwest 0.13.5", + "reqwest", "thiserror 2.0.21", ] @@ -3766,6 +3686,63 @@ dependencies = [ "cc", ] +[[package]] +name = "quinn" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.21", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe" +dependencies = [ + "aws-lc-rs", + "bytes", + "getrandom 0.4.3", + "lru-slab", + "rand 0.10.4", + "rand_pcg", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.21", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.61.2", +] + [[package]] name = "quote" version = "1.0.47" @@ -3869,6 +3846,15 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" +[[package]] +name = "rand_pcg" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb95882a1e14462c69aea9984bb261293ccfe6022ef8de0eda18bd5afb0052df" +dependencies = [ + "rand_core 0.10.1", +] + [[package]] name = "ratatui" version = "0.30.2" @@ -4075,11 +4061,11 @@ checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6" [[package]] name = "reqwest" -version = "0.12.28" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +checksum = "16a1cfa75cc186dd73d5818e510e042e40927bccc9c236b061cea97e1eb08029" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "bytes", "encoding_rs", "futures-channel", @@ -4091,52 +4077,22 @@ dependencies = [ "http-body-util", "hyper", "hyper-rustls", - "hyper-tls", "hyper-util", "js-sys", "log", "mime", - "native-tls", "percent-encoding", "pin-project-lite", + "quinn", + "rustls", "rustls-pki-types", + "rustls-platform-verifier", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", "tokio", - "tokio-native-tls", - "tower", - "tower-http 0.6.11", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "reqwest" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16a1cfa75cc186dd73d5818e510e042e40927bccc9c236b061cea97e1eb08029" -dependencies = [ - "base64 0.23.1", - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-util", - "js-sys", - "log", - "percent-encoding", - "pin-project-lite", - "sync_wrapper", - "tokio", + "tokio-rustls", "tower", "tower-http 0.6.11", "tower-service", @@ -4211,6 +4167,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + [[package]] name = "rustc_version" version = "0.4.1" @@ -4276,6 +4238,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "102f35f7de7b06d8c61f1cff6592f5253e0dea431c74867aad5dfd70f44663fb" dependencies = [ + "web-time", "zeroize", ] @@ -4591,10 +4554,10 @@ dependencies = [ ] [[package]] -name = "serde_yaml" -version = "0.9.34+deprecated" +name = "serde_yaml_ng" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +checksum = "7b4db627b98b36d4203a7b458cf3573730f2bb591b28871d916dfa9efabfd41f" dependencies = [ "indexmap 2.14.2", "itoa", @@ -5179,16 +5142,6 @@ dependencies = [ "syn 3.0.10", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-postgres" version = "0.7.18" @@ -5638,12 +5591,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.5" diff --git a/Cargo.toml b/Cargo.toml index 6d15f13e..c440ac90 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ clap_complete = "4.6" # Serialization serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -serde_yaml = "0.9" +serde_yaml = { package = "serde_yaml_ng", version = "0.10" } # TUI framework ratatui = "0.30" @@ -31,7 +31,7 @@ kube = { version = "5", features = ["client", "runtime", "derive", "ws"] } k8s-openapi = { version = "0.29", features = ["latest"] } # HTTP client for external APIs -reqwest = { version = "0.12", features = ["json", "blocking"] } +reqwest = { version = "0.13", features = ["json", "blocking", "form", "query"] } # API Server axum = { version = "0.8", features = ["ws"] } @@ -81,7 +81,7 @@ aes-gcm = "0.11" aes = "0.9" cbc = "0.2" sha2 = "0.11" -openidconnect = { version = "4", default-features = false, features = ["reqwest"] } +openidconnect = { version = "4", default-features = false } jsonwebtoken = { version = "12", default-features = false, features = ["use_pem", "rust_crypto"] } rand = "0.10" redis = { version = "1", default-features = false, features = ["tokio-comp", "connection-manager"] } diff --git a/docs/RESEARCH.md b/docs/RESEARCH.md index 130accbf..a21a7b39 100644 --- a/docs/RESEARCH.md +++ b/docs/RESEARCH.md @@ -94,3 +94,28 @@ hashes. Not built: strategic-merge or JSON 6902 patches (merge patch covers env overlays; list-merge keys need schema knowledge per field), saved plans (secrets, see round 2), a `--lock-image-digests` equivalent (needs registry access, outside the offline boundary). + +## Round 4: verified rule sources, policy, baselines, manifest validation + +Pages read in this round (fetched and read, not recalled): + +* https://raw.githubusercontent.com/stackrox/kube-linter/main/docs/generated/checks.md - the full kube-linter check list. Confirms `no-liveness-probe`, `no-readiness-probe`, `run-as-non-root`, `no-read-only-root-fs`, `privilege-escalation-container`, `privileged-container`, `drop-net-raw-capability`, `default-service-account`, `latest-tag`, `minimum-three-replicas`, `no-anti-affinity`, `pdb-max-unavailable`/`pdb-min-available`, `non-isolated-pod`, `host-network`/`host-pid`/`host-ipc`, `docker-sock`, `sensitive-host-mounts`, `env-var-secret`, `exposed-services`, `unset-cpu-requirements`/`unset-memory-requirements`, `schema-validation` (kubeconform). **The B1xx rules are now verified against this list** (mapping in `docs/guides/spec-tools.md`). Checks from the list that Aether does not have yet: privileged container, NET_RAW capability, host namespaces, docker.sock/sensitive host mounts, anti-affinity, missing CPU/memory requests (kube-linter flags them; Aether's `requirements` always has defaults). +* https://raw.githubusercontent.com/FairwindsOps/polaris/master/docs/checks/security.md - Polaris security checks with severities (`runAsRootAllowed` warning, `privilegeEscalationAllowed` danger, `runAsPrivileged` danger, `notReadOnlyRootFilesystem` warning, `hostNetworkSet` warning, `tlsSettingsMissing` warning, `sensitiveContainerEnvVar` danger, ...). Used to cross-check the B1xx set and to choose warning severity for hardening advice. +* https://raw.githubusercontent.com/Score-spec/score-k8s/main/README.md - `score-k8s init` / `generate`, `--override-property path=key` and `--overrides-file` to set or remove values in the Score file before conversion, plus patch templates (a list of `set`/`delete` operations on dot paths). This is the same model as `spec-merge --set path=value` (null deletes), which is therefore consistent with Score; patch templates (Go templates over generated manifests) are not copied. +* https://raw.githubusercontent.com/open-policy-agent/conftest/master/README.md - Conftest runs Rego `deny` rules over structured config and prints `FAIL - file - message` with a pass/warn/fail summary. The page does not document warn semantics or exit codes (**[U]**). Drove `spec-policy`: same idea (rules outside the tool, message per violation, summary line), but a closed declarative operator set so it stays offline and deterministic without a Rego runtime. +* Web search for Kubescape: confirmed control ids `C-0013` (non-root containers) and `C-0017` (immutable container filesystem) and the `kubescape scan framework nsa|mitre` model; framework membership of individual controls was not confirmed **[U]**. +* https://github.com/yannh/kubeconform README (fetched via the raw URL returned 404 this round; the round 2 reading of the repository page stands): `-strict`, `-ignore-missing-schemas`, `-skip`, json/junit/tap output. Drove `manifest-check`. + +Not fetched: Datree (project is discontinued **[U]**), Helm lint, kustomize build, Garden and Tilt (dev-loop tools; no spec-validation overlap with this change). + +Decisions this round: + +| Idea | Decision | +| --- | --- | +| Policy-as-code rule file (`spec-policy`) | Built. Rules evaluated against the spec as written, with line numbers. | +| Baseline drift (`spec-lock write/check`) | Built. Hash-only lock, per-section drift, exit 2 on drift. | +| kubeconform-style manifest validation (`manifest-check`) | Built on the typed `k8s-openapi` objects, not fetched JSON schemas, so it is offline. Required-field detection works by noticing that the typed object serialises defaulted required fields; strictness by diffing keys. Built-in kinds only. | +| `lint --fix` for safe findings | Built for `W020` and `I021` only; `B1xx` advice is opinionated and never auto-fixed. | +| CI / pre-commit snippets (`spec-ci`) | Built. | +| JSON schema generation | Skipped: `schema/workload.schema.json` already exists and is validated in CI by `validate:schema`. | +| Rendered-manifest validation chained into `spec-plan` | Not built; adapters still need a client context to render (see round 2). | diff --git a/docs/guides/spec-tools.md b/docs/guides/spec-tools.md index 17b28407..00e41d3a 100644 --- a/docs/guides/spec-tools.md +++ b/docs/guides/spec-tools.md @@ -99,6 +99,14 @@ Polaris. They are advice, not correctness, so plain `lint` never reports them. B103-B109 apply only when Kubernetes is an allowed runtime. +Cross-checked against the kube-linter check list and Polaris security checks +(see `docs/RESEARCH.md`, round 4): B101/B102 are kube-linter `no-liveness-probe` +/ `no-readiness-probe`, B103 `run-as-non-root` / Polaris `runAsRootAllowed`, +B104 `no-read-only-root-fs` / `notReadOnlyRootFilesystem`, B105 +`privilege-escalation-container` / `privilegeEscalationAllowed`, B106 +`minimum-three-replicas` + `pdb-*`, B107 `non-isolated-pod` / `missingNetworkPolicy`, +B108 `latest-tag`, B109 `default-service-account`. + ## aether portability ```bash @@ -171,6 +179,74 @@ printed as `***`, but the hash covers the real values, so rotating a secret still changes it. Treat the hash itself as non-public for specs whose secrets are low-entropy. +### Auto-fix (`--fix`, `--diff`) + +`aether lint --fix` applies only safe, textual edits and keeps comments and +layout: a misspelt key with a "did you mean" hint is renamed (`W020`; the old +key was being ignored, so this *does* change behaviour and is reported as +such) and a snake_case alias becomes its canonical camelCase key (`I021`, +behaviour-neutral). `--diff` shows the edits and changes nothing. If the edited +spec would have more errors than before, nothing is written. Best-practice +rules are never auto-fixed. + +## aether spec-policy + +Policy as code: organisation rules live in a YAML file and are evaluated +against the spec as written, so every finding has a source line. See +`examples/policy/org-baseline.yaml`. + +```yaml +rules: + - id: ORG003 + description: memory request stays below 8Gi + path: requirements.memory + op: lte + value: 8Gi + severity: error # error (default) | warning | info + when: { path: runtime.preferred, op: equals, value: kube } # optional + skip_if_missing: false # optional + message: custom text # optional +``` + +Operators: `exists`, `absent`, `equals`, `not_equals`, `in`, `not_in`, +`matches` / `not_matches` (glob `*` `?`), `lt`, `lte`, `gt`, `gte` (numbers and +quantities such as `500m`, `256Mi`), `min_len`, `max_len`. Paths use dots, +`[N]` and `[*]` (every list element; quote the path in flow style, since a bare `*` starts a YAML alias). A missing value fails every operator +except `absent`, `not_equals`, `not_in` and `not_matches`. Formats: `text`, +`json`, `junit`, `github`; exit 1 on errors (or warnings with +`--deny-warnings`). Unknown rule keys, duplicate ids and bad paths are rejected. + +## aether spec-lock + +Offline drift detection against a committed baseline. `spec-lock write` stores +the canonical hashes (overall and per section, the same as `spec-render`) in +`.lock.json`; the lock holds no spec values. `spec-lock check` exits 0 +with no drift, 2 on drift (naming the changed, added and removed sections) and +1 on errors such as a malformed lock. `--ignore requirements,scaling` leaves +sections out of the comparison. For live state use `aether diff`. + +## aether manifest-check + +kubeconform-style validation of Kubernetes manifests (rendered, Helm or +kustomize output), offline. Each document is parsed into the typed +`k8s-openapi` object for its `apiVersion`/`kind`: wrong types, missing +required fields, bad base64 in Secrets and apiVersions the API no longer +serves (`extensions/v1beta1` Ingress) are invalid. `--strict` also reports +unknown fields with their path. Multi-document streams, `kind: List` and stdin +(`-`) work. Built-in kinds only (Pod, Service, ConfigMap, Secret, Namespace, +ServiceAccount, PVC, ResourceQuota, LimitRange, Deployment, StatefulSet, +DaemonSet, ReplicaSet, Job, CronJob, Ingress, NetworkPolicy, HPA v2, PDB, RBAC +kinds); custom resources (KubeVirt, Cilium, ...) are errors unless +`--ignore-missing-schemas`, or skipped with `--skip Kind`. Formats `text`, +`json`, `junit`; exit 1 on invalid or error. The schema is the one bundled +with the `k8s-openapi` crate; CEL rules and admission are not evaluated. + +## aether spec-ci + +`aether spec-ci github|gitlab|pre-commit` prints a ready-to-paste config that +runs `lint --best-practices` and `spec-lock check`. The spec path comes from +`--spec` and is restricted to `[A-Za-z0-9._/-]`. + ## API The same checks are available over HTTP (Operator or Admin role, like other @@ -184,6 +260,12 @@ POST endpoints): | `POST /api/spec/render` | `{"spec": ""}` | `{hash, sections, spec}` | | `POST /api/spec/portability` | `{"spec": ""}` | portability report | | `POST /api/spec/plan` | `{"old": "", "new": ""}` | plan | +| `POST /api/spec/fix` | `{"spec": ""}` | `{fixed, changed, applied, skipped, remaining}` (nothing is stored) | +| `POST /api/spec/policy` | `{"spec": "", "rules": ""}` | policy report | +| `POST /api/spec/lock` | `{"spec": ""}` | lock | +| `POST /api/spec/lock/check` | `{"spec": "", "lock": "", "ignore": []}` | drift result | +| `POST /api/spec/manifest-check` | `{"manifests": "", "strict": false, "ignoreMissingSchemas": false, "skip": []}` | `{results, summary}` | +| `GET /api/spec/ci/{provider}?spec=path` | - | `{provider, snippet}` | Request bodies larger than 1 MiB per spec are refused. diff --git a/examples/policy/org-baseline.yaml b/examples/policy/org-baseline.yaml new file mode 100644 index 00000000..02a19fd5 --- /dev/null +++ b/examples/policy/org-baseline.yaml @@ -0,0 +1,31 @@ +# Example organisation policy for `aether spec-policy`. +# aether --spec workload.yaml spec-policy examples/policy/org-baseline.yaml +rules: + - id: ORG001 + description: every workload names an owner + path: metadata.owner + op: exists + - id: ORG002 + severity: warning + description: images come from the internal registry + path: build.registry + op: matches + value: "registry.internal/*" + skip_if_missing: true + - id: ORG003 + description: memory request stays below 8Gi + path: requirements.memory + op: lte + value: 8Gi + - id: ORG004 + severity: warning + description: use unprivileged ports + path: network.ports[*].containerPort + op: gte + value: 1024 + - id: ORG005 + description: production workloads must not run on the single-host runtime + path: runtime.preferred + op: not_in + value: [podman, docker] + when: { path: metadata.environment, op: equals, value: production } diff --git a/src/api/handlers.rs b/src/api/handlers.rs index 5ce5b723..f1e8a8fc 100644 --- a/src/api/handlers.rs +++ b/src/api/handlers.rs @@ -5420,6 +5420,115 @@ pub(crate) async fn restore_backup( )) } +#[derive(Deserialize)] +pub(crate) struct SpecPolicyRequest { + pub(crate) spec: String, + pub(crate) rules: String, +} + +#[derive(Deserialize)] +pub(crate) struct SpecLockCheckRequest { + pub(crate) spec: String, + pub(crate) lock: String, + #[serde(default)] + pub(crate) ignore: Vec, +} + +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +pub(crate) struct ManifestCheckRequest { + pub(crate) manifests: String, + #[serde(default)] + pub(crate) strict: bool, + #[serde(default)] + pub(crate) ignore_missing_schemas: bool, + #[serde(default)] + pub(crate) skip: Vec, +} + +#[derive(Deserialize)] +pub(crate) struct SpecCiQuery { + pub(crate) spec: Option, +} + +/// POST /api/spec/fix - safe auto-fixes for lint findings (nothing is written). +pub(crate) async fn api_spec_fix(Json(req): Json) -> impl IntoResponse { + if req.spec.len() > crate::speclint::MAX_SPEC_BYTES { + return err_bad_request("spec too large"); + } + let r = crate::specfix::fix_str(&req.spec); + let remaining = crate::speclint::lint_str(&r.fixed); + ( + StatusCode::OK, + Json(ApiResponse::success(json!({ + "fixed": r.fixed, + "changed": r.changed, + "applied": r.applied, + "skipped": r.skipped, + "remaining": remaining, + }))), + ) +} + +/// POST /api/spec/policy - evaluate a rule file against a spec. +pub(crate) async fn api_spec_policy(Json(req): Json) -> impl IntoResponse { + if req.spec.len() > crate::speclint::MAX_SPEC_BYTES { + return err_bad_request("spec too large"); + } + match crate::specpolicy::evaluate(&req.spec, &req.rules) { + Ok(r) => (StatusCode::OK, Json(ApiResponse::success(r))), + Err(e) => err_bad_request(e), + } +} + +/// POST /api/spec/lock - baseline hashes for a spec. +pub(crate) async fn api_spec_lock(Json(req): Json) -> impl IntoResponse { + match crate::speclock::make_lock(&req.spec) { + Ok(l) => (StatusCode::OK, Json(ApiResponse::success(l))), + Err(e) => err_bad_request(e), + } +} + +/// POST /api/spec/lock/check - drift of a spec against a lock. +pub(crate) async fn api_spec_lock_check( + Json(req): Json, +) -> impl IntoResponse { + match crate::speclock::check(&req.spec, &req.lock, &req.ignore) { + Ok(c) => (StatusCode::OK, Json(ApiResponse::success(c))), + Err(e) => err_bad_request(e), + } +} + +/// POST /api/spec/manifest-check - kubeconform-style validation of manifests. +pub(crate) async fn api_manifest_check(Json(req): Json) -> impl IntoResponse { + let opts = crate::manifestcheck::Options { + strict: req.strict, + ignore_missing_schemas: req.ignore_missing_schemas, + skip: req.skip, + }; + match crate::manifestcheck::check(&[("manifests".to_string(), req.manifests)], &opts) { + Ok(r) => (StatusCode::OK, Json(ApiResponse::success(r))), + Err(e) => err_bad_request(e), + } +} + +/// GET /api/spec/ci/{provider}?spec=path - CI / pre-commit snippet. +pub(crate) async fn api_spec_ci( + Path(provider): Path, + axum::extract::Query(q): axum::extract::Query, +) -> impl IntoResponse { + let spec = q.spec.unwrap_or_else(|| "workload.yaml".to_string()); + match crate::specci::snippet(&provider, &spec) { + Ok(s) => ( + StatusCode::OK, + Json(ApiResponse::success( + json!({ "provider": provider, "snippet": s }), + )), + ), + Err(e) => err_bad_request(e), + } +} + #[cfg(test)] mod tests { use super::*; @@ -5662,4 +5771,109 @@ mod spec_api_tests { .await; assert_eq!(st, StatusCode::BAD_REQUEST); } + + #[tokio::test] + async fn fix_endpoint_renames_typos_and_reports_remaining() { + let (st, v) = call(api_spec_fix(Json(SpecTextRequest { spec: SPEC.into() }))).await; + assert_eq!(st, StatusCode::OK); + assert_eq!(v["data"]["changed"], true); + assert!(v["data"]["fixed"] + .as_str() + .unwrap() + .contains("serviceType: NodePort")); + assert_eq!(v["data"]["applied"][0]["code"], "W020"); + assert_eq!(v["data"]["remaining"]["warnings"], 0); + let clean = SPEC.replace("servicetype", "serviceType"); + let (_, v) = call(api_spec_fix(Json(SpecTextRequest { spec: clean }))).await; + assert_eq!(v["data"]["changed"], false); + } + + const RULES: &str = "rules:\n - {id: P1, path: metadata.team, op: exists, message: team required}\n - {id: P2, path: requirements.memory, op: lte, value: 1Gi}\n"; + + #[tokio::test] + async fn policy_endpoint_reports_violations_and_bad_rules() { + let req = SpecPolicyRequest { + spec: SPEC.into(), + rules: RULES.into(), + }; + let (st, v) = call(api_spec_policy(Json(req))).await; + assert_eq!(st, StatusCode::OK); + assert_eq!(v["data"]["errors"], 1); + assert_eq!(v["data"]["violations"][0]["id"], "P1"); + assert_eq!(v["data"]["passed"], 1); + let bad = SpecPolicyRequest { + spec: SPEC.into(), + rules: "rules: [{id: A}]".into(), + }; + let (st, _) = call(api_spec_policy(Json(bad))).await; + assert_eq!(st, StatusCode::BAD_REQUEST); + } + + #[tokio::test] + async fn lock_and_lock_check_endpoints() { + let spec = SPEC.replace("servicetype", "serviceType"); + let (st, v) = call(api_spec_lock(Json(SpecTextRequest { spec: spec.clone() }))).await; + assert_eq!(st, StatusCode::OK); + let lock = v["data"].to_string(); + let req = SpecLockCheckRequest { + spec: spec.clone(), + lock: lock.clone(), + ignore: vec![], + }; + let (_, v) = call(api_spec_lock_check(Json(req))).await; + assert_eq!(v["data"]["drift"], false); + let req = SpecLockCheckRequest { + spec: spec.replace("256Mi", "1Gi"), + lock, + ignore: vec![], + }; + let (_, v) = call(api_spec_lock_check(Json(req))).await; + assert_eq!(v["data"]["drift"], true); + assert_eq!(v["data"]["changed"][0], "requirements"); + let req = SpecLockCheckRequest { + spec, + lock: "{}".into(), + ignore: vec![], + }; + let (st, _) = call(api_spec_lock_check(Json(req))).await; + assert_eq!(st, StatusCode::BAD_REQUEST); + } + + #[tokio::test] + async fn manifest_check_endpoint() { + let m = "apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: c\ndata:\n a: b\n---\napiVersion: kubevirt.io/v1\nkind: VirtualMachine\nmetadata:\n name: vm\n"; + let req = + serde_json::from_value(json!({"manifests": m, "ignoreMissingSchemas": true})).unwrap(); + let (st, v) = call(api_manifest_check(Json(req))).await; + assert_eq!(st, StatusCode::OK); + assert_eq!(v["data"]["summary"]["valid"], 1); + assert_eq!(v["data"]["summary"]["skipped"], 1); + let req = serde_json::from_value(json!({"manifests": m})).unwrap(); + let (_, v) = call(api_manifest_check(Json(req))).await; + assert_eq!(v["data"]["summary"]["errors"], 1); + let req = serde_json::from_value(json!({"manifests": "x".repeat(5 << 20)})).unwrap(); + let (st, _) = call(api_manifest_check(Json(req))).await; + assert_eq!(st, StatusCode::BAD_REQUEST); + } + + #[tokio::test] + async fn ci_endpoint() { + let q = axum::extract::Query(SpecCiQuery { + spec: Some("deploy/w.yaml".into()), + }); + let (st, v) = call(api_spec_ci(Path("github".into()), q)).await; + assert_eq!(st, StatusCode::OK); + assert!(v["data"]["snippet"] + .as_str() + .unwrap() + .contains("aether --spec deploy/w.yaml lint")); + let q = axum::extract::Query(SpecCiQuery { + spec: Some("a b".into()), + }); + let (st, _) = call(api_spec_ci(Path("github".into()), q)).await; + assert_eq!(st, StatusCode::BAD_REQUEST); + let q = axum::extract::Query(SpecCiQuery { spec: None }); + let (st, _) = call(api_spec_ci(Path("jenkins".into()), q)).await; + assert_eq!(st, StatusCode::BAD_REQUEST); + } } diff --git a/src/api/mod.rs b/src/api/mod.rs index 9b728ef0..8a969287 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1935,6 +1935,12 @@ pub async fn start_server(config: ApiConfig) -> anyhow::Result<()> { .route("/api/spec/render", post(api_spec_render)) .route("/api/spec/portability", post(api_spec_portability)) .route("/api/spec/plan", post(api_spec_plan)) + .route("/api/spec/fix", post(api_spec_fix)) + .route("/api/spec/policy", post(api_spec_policy)) + .route("/api/spec/lock", post(api_spec_lock)) + .route("/api/spec/lock/check", post(api_spec_lock_check)) + .route("/api/spec/manifest-check", post(api_manifest_check)) + .route("/api/spec/ci/{provider}", get(api_spec_ci)) .route("/api/sla", get(api_sla_list).post(api_sla_add)) .route("/api/sla/{workload}", get(api_sla_check)) .route("/api/events", get(api_events_list)) diff --git a/src/cli.rs b/src/cli.rs index 99bd1a16..095c9c7a 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -93,6 +93,25 @@ fn get_styles() -> clap::builder::Styles { ) } +#[derive(Subcommand, Debug)] +pub(crate) enum SpecLockAction { + /// Write the lock file for the current spec + Write { + /// Lock file (default: .lock.json) + #[arg(long)] + lock: Option, + }, + /// Compare the spec with the lock file; exit 0 no drift, 2 drift, 1 error + Check { + /// Lock file (default: .lock.json) + #[arg(long)] + lock: Option, + /// Top-level sections to leave out of the comparison (comma separated) + #[arg(long, value_delimiter = ',')] + ignore: Vec, + }, +} + #[derive(Subcommand)] pub(crate) enum Commands { /// Validate workload specification (checks syntax, intent, and runtime compatibility) @@ -549,6 +568,54 @@ pub(crate) enum Commands { /// List every diagnostic code and exit #[arg(long)] list_rules: bool, + /// Apply safe fixes in place (rename typo'd keys to the suggested key, snake_case aliases to camelCase) + #[arg(long)] + fix: bool, + /// Show the fixes as a diff and change nothing + #[arg(long)] + diff: bool, + }, + + /// Check the spec against organisation rules from a YAML rule file (policy as code) + SpecPolicy { + /// Rule file (see docs/guides/spec-tools.md) + rules: PathBuf, + /// Output format: text, json, junit or github + #[arg(long, default_value = "text")] + format: String, + /// Exit non-zero on warnings as well as errors + #[arg(long)] + deny_warnings: bool, + }, + + /// Record or check a hash baseline of the spec (offline drift detection for CI) + SpecLock { + #[command(subcommand)] + action: SpecLockAction, + }, + + /// Validate Kubernetes manifests against the bundled API schemas (kubeconform-style) + ManifestCheck { + /// Manifest files; `-` reads stdin + files: Vec, + /// Report fields the schema does not know + #[arg(long)] + strict: bool, + /// Skip kinds without a bundled schema (custom resources) instead of failing + #[arg(long)] + ignore_missing_schemas: bool, + /// Skip these kinds (comma separated) + #[arg(long, value_delimiter = ',')] + skip: Vec, + /// Output format: text, json or junit + #[arg(long, default_value = "text")] + format: String, + }, + + /// Print a CI or pre-commit configuration that runs the spec checks + SpecCi { + /// github, gitlab or pre-commit + provider: String, }, /// Merge the spec with overlay files and --set overrides (JSON merge patch), then lint the result @@ -1057,6 +1124,10 @@ impl Commands { Self::Cp { .. } => "cp", Self::Watch { .. } => "watch", Self::Lint { .. } => "lint", + Self::SpecPolicy { .. } => "spec-policy", + Self::SpecLock { .. } => "spec-lock", + Self::ManifestCheck { .. } => "manifest-check", + Self::SpecCi { .. } => "spec-ci", Self::SpecMerge { .. } => "spec-merge", Self::SpecRender { .. } => "spec-render", Self::Portability => "portability", diff --git a/src/commands.rs b/src/commands.rs index e5db74af..351fb051 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -4348,6 +4348,8 @@ pub(crate) struct LintArgs { pub ignore: Vec, pub explain: Option, pub list_rules: bool, + pub fix: bool, + pub diff: bool, } pub(crate) async fn lint_command(spec_path: &std::path::Path, args: LintArgs) -> Result<()> { @@ -4382,7 +4384,38 @@ pub(crate) async fn lint_command(spec_path: &std::path::Path, args: LintArgs) -> if output::is_json() && format == Format::Text { format = Format::Json; } - let text = read_spec_text(spec_path)?; + let mut text = read_spec_text(spec_path)?; + if args.fix || args.diff { + let fixed = aether::specfix::fix_str(&text); + let name = spec_path.display().to_string(); + for f in &fixed.applied { + eprintln!( + "{name}:{}: fix[{}]: `{}` -> `{}`{}", + f.line, + f.code, + f.from, + f.to, + if f.behaviour_change { + " (was ignored; behaviour changes)" + } else { + "" + } + ); + } + for s in &fixed.skipped { + eprintln!("{name}: not fixed: {s}"); + } + if args.diff { + print!("{}", aether::specfix::diff(&text, &fixed.fixed, &name)); + return Ok(()); + } + if fixed.changed { + std::fs::write(spec_path, &fixed.fixed) + .with_context(|| format!("cannot write '{}'", spec_path.display()))?; + eprintln!("{name}: applied {} fix(es)", fixed.applied.len()); + text = fixed.fixed; + } + } let report = aether::speclint::lint_with( &text, &aether::speclint::LintOptions { @@ -4400,6 +4433,132 @@ pub(crate) async fn lint_command(spec_path: &std::path::Path, args: LintArgs) -> Ok(()) } +/// `aether spec-policy`: evaluate a rule file against the spec. +pub(crate) async fn spec_policy_command( + spec_path: &std::path::Path, + rules_path: &std::path::Path, + format: &str, + deny_warnings: bool, +) -> Result<()> { + let spec = read_spec_text(spec_path)?; + let rules = read_spec_text(rules_path)?; + let report = aether::specpolicy::evaluate(&spec, &rules).map_err(|e| anyhow::anyhow!(e))?; + let file = spec_path.display().to_string(); + let format = if output::is_json() { "json" } else { format }; + match format { + "text" => print!("{}", report.render_text(&file)), + "json" => println!("{}", serde_json::to_string_pretty(&report)?), + "github" => print!("{}", report.render_github(&file)), + "junit" => print!("{}", report.render_junit(&file)), + other => anyhow::bail!("unknown format `{other}` (expected text, json, junit or github)"), + } + if report.failed(deny_warnings) { + std::process::exit(1); + } + Ok(()) +} + +/// `aether spec-lock`: write or check the hash baseline. +pub(crate) async fn spec_lock_command( + spec_path: &std::path::Path, + action: crate::cli::SpecLockAction, +) -> Result<()> { + use crate::cli::SpecLockAction; + let default_lock = || { + let mut s = spec_path.as_os_str().to_owned(); + s.push(".lock.json"); + PathBuf::from(s) + }; + let spec = read_spec_text(spec_path)?; + match action { + SpecLockAction::Write { lock } => { + let path = lock.unwrap_or_else(default_lock); + let l = aether::speclock::make_lock(&spec).map_err(|e| anyhow::anyhow!(e))?; + std::fs::write(&path, aether::speclock::lock_text(&l)) + .with_context(|| format!("cannot write '{}'", path.display()))?; + println!("wrote {} ({})", path.display(), l.hash); + } + SpecLockAction::Check { lock, ignore } => { + let path = lock.unwrap_or_else(default_lock); + let lock_text = read_spec_text(&path)?; + let c = aether::speclock::check(&spec, &lock_text, &ignore) + .map_err(|e| anyhow::anyhow!(e))?; + if output::is_json() { + println!("{}", serde_json::to_string_pretty(&c)?); + } else { + print!("{}", c.render_text()); + } + if c.drift { + std::process::exit(2); + } + } + } + Ok(()) +} + +/// `aether manifest-check`: kubeconform-style schema validation. +pub(crate) async fn manifest_check_command( + files: &[PathBuf], + strict: bool, + ignore_missing_schemas: bool, + skip: Vec, + format: &str, +) -> Result<()> { + use std::io::Read; + if files.is_empty() { + anyhow::bail!("give at least one manifest file (or `-` for stdin)"); + } + let mut inputs = Vec::new(); + for f in files { + if f.as_os_str() == "-" { + let mut s = String::new(); + std::io::stdin() + .take(aether::manifestcheck::MAX_BYTES as u64 + 1) + .read_to_string(&mut s)?; + inputs.push(("".to_string(), s)); + } else { + inputs.push((f.display().to_string(), read_manifest_text(f)?)); + } + } + let report = aether::manifestcheck::check( + &inputs, + &aether::manifestcheck::Options { + strict, + ignore_missing_schemas, + skip, + }, + ) + .map_err(|e| anyhow::anyhow!(e))?; + let format = if output::is_json() { "json" } else { format }; + match format { + "text" => print!("{}", report.render_text()), + "json" => println!("{}", serde_json::to_string_pretty(&report)?), + "junit" => print!("{}", report.render_junit()), + other => anyhow::bail!("unknown format `{other}` (expected text, json or junit)"), + } + if report.failed() { + std::process::exit(1); + } + Ok(()) +} + +fn read_manifest_text(path: &std::path::Path) -> Result { + let meta = + std::fs::metadata(path).with_context(|| format!("cannot read '{}'", path.display()))?; + if meta.len() as usize > aether::manifestcheck::MAX_BYTES { + anyhow::bail!("'{}' exceeds the manifest size limit", path.display()); + } + std::fs::read_to_string(path).with_context(|| format!("cannot read '{}'", path.display())) +} + +/// `aether spec-ci`: print a CI / pre-commit snippet. +pub(crate) async fn spec_ci_command(spec_path: &std::path::Path, provider: &str) -> Result<()> { + let spec = spec_path.display().to_string(); + let s = aether::specci::snippet(provider, &spec).map_err(|e| anyhow::anyhow!(e))?; + print!("{s}"); + Ok(()) +} + /// `aether spec-merge`: base spec + overlays + `--set`, linted. pub(crate) async fn spec_merge_command( spec_path: &std::path::Path, diff --git a/src/lib.rs b/src/lib.rs index dbeedae2..2dfdde79 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -48,6 +48,7 @@ pub mod licence; pub mod lintfmt; pub mod local_auth; pub mod maintenance; +pub mod manifestcheck; pub mod metrics; pub mod migration; pub mod mock_idp; @@ -71,9 +72,13 @@ pub mod scheduler; pub mod secrets; pub mod sla; pub mod spec; +pub mod specci; +pub mod specfix; pub mod speclint; +pub mod speclock; pub mod specmerge; pub mod specplan; +pub mod specpolicy; pub mod specrender; pub mod state; pub mod state_postgres; diff --git a/src/main.rs b/src/main.rs index 159c0fc4..0f21cd1a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -246,6 +246,8 @@ async fn main() -> Result<()> { ignore, explain, list_rules, + fix, + diff, } => { commands::lint_command( &cli.spec, @@ -256,10 +258,29 @@ async fn main() -> Result<()> { ignore, explain, list_rules, + fix, + diff, }, ) .await } + Commands::SpecPolicy { + rules, + format, + deny_warnings, + } => commands::spec_policy_command(&cli.spec, &rules, &format, deny_warnings).await, + Commands::SpecLock { action } => commands::spec_lock_command(&cli.spec, action).await, + Commands::ManifestCheck { + files, + strict, + ignore_missing_schemas, + skip, + format, + } => { + commands::manifest_check_command(&files, strict, ignore_missing_schemas, skip, &format) + .await + } + Commands::SpecCi { provider } => commands::spec_ci_command(&cli.spec, &provider).await, Commands::SpecMerge { overlays, set, diff --git a/src/manifestcheck.rs b/src/manifestcheck.rs new file mode 100644 index 00000000..c878db7d --- /dev/null +++ b/src/manifestcheck.rs @@ -0,0 +1,627 @@ +// Copyright 2026 ZyvorAI Labs Private Limited +// SPDX-License-Identifier: LicenseRef-Zyvor-Production-2.0 + +//! Offline schema validation of Kubernetes manifests (`aether manifest-check`), +//! in the spirit of kubeconform. +//! +//! Each document is deserialised into the typed `k8s-openapi` object for its +//! `apiVersion`/`kind`. That rejects wrong types, missing required fields, +//! required fields that were left out, malformed base64 in Secret data, and apiVersions the bundled API no longer +//! serves (for example `extensions/v1beta1` Ingress). With `strict`, the typed +//! object is serialised back and every key in the input that did not survive +//! is reported as an unknown field (a misspelt `readinessProbe`, say), the same +//! idea as kubeconform's `-strict`. +//! +//! Limits, stated plainly: only the built-in kinds listed in [`KINDS`] have a +//! schema, so CRDs (KubeVirt `VirtualMachine`, Cilium policies, ...) are +//! "missing schema" and are errors unless `ignore_missing_schemas` is set. The +//! schema is the one bundled in the `k8s-openapi` crate, not fetched. CEL rules +//! and server-side admission are not evaluated. + +use crate::lintfmt::xml_escape; +use crate::speclint::{self, sanitize}; +use serde::Serialize; +use serde_json::Value; + +/// Hard cap on the manifest text accepted in one call. +pub const MAX_BYTES: usize = 4 * 1024 * 1024; +/// Hard cap on documents per call. +pub const MAX_DOCS: usize = 2000; + +#[derive(Debug, Clone, Default)] +pub struct Options { + pub strict: bool, + pub ignore_missing_schemas: bool, + /// Kinds to skip entirely (case-insensitive). + pub skip: Vec, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] +#[serde(rename_all = "lowercase")] +pub enum Status { + Valid, + Invalid, + Skipped, + /// Not validated because there is no schema or the document did not parse. + Error, +} + +#[derive(Debug, Clone, Serialize)] +pub struct ResourceResult { + pub source: String, + pub line: usize, + pub api_version: String, + pub kind: String, + pub name: String, + pub status: Status, + pub messages: Vec, +} + +#[derive(Debug, Clone, Serialize)] +pub struct Summary { + pub valid: usize, + pub invalid: usize, + pub skipped: usize, + pub errors: usize, +} + +#[derive(Debug, Clone, Serialize)] +pub struct CheckReport { + pub results: Vec, + pub summary: Summary, +} + +impl CheckReport { + pub fn failed(&self) -> bool { + self.summary.invalid > 0 || self.summary.errors > 0 + } + + pub fn render_text(&self) -> String { + let mut out = String::new(); + for r in &self.results { + let label = match r.status { + Status::Valid => "valid", + Status::Invalid => "INVALID", + Status::Skipped => "skipped", + Status::Error => "ERROR", + }; + out.push_str(&format!( + "{}:{}: {} {}/{} {}\n", + sanitize(&r.source), + r.line, + sanitize(&r.api_version), + sanitize(&r.kind), + sanitize(&r.name), + label + )); + for m in &r.messages { + out.push_str(&format!(" {}\n", sanitize(m))); + } + } + let s = &self.summary; + out.push_str(&format!( + "Summary: {} valid, {} invalid, {} errors, {} skipped\n", + s.valid, s.invalid, s.errors, s.skipped + )); + out + } + + pub fn render_junit(&self) -> String { + let s = &self.summary; + let mut out = String::from("\n"); + out.push_str(&format!( + "\n", + self.results.len(), + s.invalid + s.errors, + s.skipped + )); + for r in &self.results { + out.push_str(&format!( + " ", + xml_escape(&sanitize(&r.source)), + xml_escape(&sanitize(&format!("{}/{}", r.kind, r.name))) + )); + match r.status { + Status::Valid => {} + Status::Skipped => out.push_str(""), + Status::Invalid | Status::Error => out.push_str(&format!( + "{}:{}", + xml_escape(&sanitize(&r.messages.join("; "))), + xml_escape(&sanitize(&r.source)), + r.line + )), + } + out.push_str("\n"); + } + out.push_str("\n"); + out + } +} + +macro_rules! kinds { + ($(($av:literal, $k:literal, $t:ty)),* $(,)?) => { + /// Every `(apiVersion, kind)` that has a bundled schema. + pub const KINDS: &[(&str, &str)] = &[$(($av, $k)),*]; + + /// Typed round trip: `None` when there is no schema for the pair. + fn roundtrip(av: &str, kind: &str, v: &Value) -> Option> { + match (av, kind) { + $(($av, $k) => Some( + serde_json::from_value::<$t>(v.clone()) + .map_err(|e| e.to_string()) + .and_then(|t| serde_json::to_value(&t).map_err(|e| e.to_string())), + ),)* + _ => None, + } + } + }; +} + +kinds! { + ("v1", "Pod", k8s_openapi::api::core::v1::Pod), + ("v1", "Service", k8s_openapi::api::core::v1::Service), + ("v1", "ConfigMap", k8s_openapi::api::core::v1::ConfigMap), + ("v1", "Secret", k8s_openapi::api::core::v1::Secret), + ("v1", "Namespace", k8s_openapi::api::core::v1::Namespace), + ("v1", "ServiceAccount", k8s_openapi::api::core::v1::ServiceAccount), + ("v1", "PersistentVolumeClaim", k8s_openapi::api::core::v1::PersistentVolumeClaim), + ("v1", "ResourceQuota", k8s_openapi::api::core::v1::ResourceQuota), + ("v1", "LimitRange", k8s_openapi::api::core::v1::LimitRange), + ("apps/v1", "Deployment", k8s_openapi::api::apps::v1::Deployment), + ("apps/v1", "StatefulSet", k8s_openapi::api::apps::v1::StatefulSet), + ("apps/v1", "DaemonSet", k8s_openapi::api::apps::v1::DaemonSet), + ("apps/v1", "ReplicaSet", k8s_openapi::api::apps::v1::ReplicaSet), + ("batch/v1", "Job", k8s_openapi::api::batch::v1::Job), + ("batch/v1", "CronJob", k8s_openapi::api::batch::v1::CronJob), + ("networking.k8s.io/v1", "Ingress", k8s_openapi::api::networking::v1::Ingress), + ("networking.k8s.io/v1", "NetworkPolicy", k8s_openapi::api::networking::v1::NetworkPolicy), + ("autoscaling/v2", "HorizontalPodAutoscaler", k8s_openapi::api::autoscaling::v2::HorizontalPodAutoscaler), + ("policy/v1", "PodDisruptionBudget", k8s_openapi::api::policy::v1::PodDisruptionBudget), + ("rbac.authorization.k8s.io/v1", "Role", k8s_openapi::api::rbac::v1::Role), + ("rbac.authorization.k8s.io/v1", "ClusterRole", k8s_openapi::api::rbac::v1::ClusterRole), + ("rbac.authorization.k8s.io/v1", "RoleBinding", k8s_openapi::api::rbac::v1::RoleBinding), + ("rbac.authorization.k8s.io/v1", "ClusterRoleBinding", k8s_openapi::api::rbac::v1::ClusterRoleBinding), +} + +/// Keys present in `orig` that are missing from the typed round trip. +fn unknown_fields(orig: &Value, rt: &Value, path: &str, out: &mut Vec) { + match (orig, rt) { + (Value::Object(o), Value::Object(r)) => { + for (k, v) in o { + let p = if path.is_empty() { + k.clone() + } else { + format!("{path}.{k}") + }; + match r.get(k) { + Some(rv) => unknown_fields(v, rv, &p, out), + None => { + // Null and empty values may legitimately be dropped. + let empty = v.is_null() + || v.as_object().is_some_and(|m| m.is_empty()) + || v.as_array().is_some_and(|a| a.is_empty()); + if !empty { + out.push(format!("unknown field `{p}`")); + } + } + } + } + } + (Value::Array(o), Value::Array(r)) => { + for (i, (ov, rv)) in o.iter().zip(r).enumerate() { + unknown_fields(ov, rv, &format!("{path}[{i}]"), out); + } + } + _ => {} + } +} + +/// Required fields that were absent from the input. The typed objects fill +/// missing required (non-optional) fields with defaults and always serialise +/// them, while optional fields are omitted when unset, so a key that exists +/// only in the round trip is a required field the author left out. +fn missing_required(orig: &Value, rt: &Value, path: &str, out: &mut Vec) { + match (orig, rt) { + (Value::Object(o), Value::Object(r)) => { + for (k, rv) in r { + let p = if path.is_empty() { + k.clone() + } else { + format!("{path}.{k}") + }; + match o.get(k) { + Some(ov) => missing_required(ov, rv, &p, out), + None if path.is_empty() && (k == "apiVersion" || k == "kind") => {} + None => out.push(format!("missing required field `{p}`")), + } + } + } + (Value::Array(o), Value::Array(r)) => { + for (i, (ov, rv)) in o.iter().zip(r).enumerate() { + missing_required(ov, rv, &format!("{path}[{i}]"), out); + } + } + _ => {} + } +} + +/// Split a multi-document stream on `---` lines, with each document's start line. +fn split_docs(src: &str) -> Vec<(usize, String)> { + let mut docs = Vec::new(); + let mut cur = String::new(); + let mut start = 1usize; + for (i, line) in src.lines().enumerate() { + let n = i + 1; + if line == "---" || line.starts_with("--- ") || line.trim_end() == "---" { + if !cur.trim().is_empty() { + docs.push((start, std::mem::take(&mut cur))); + } + cur.clear(); + start = n + 1; + continue; + } + if cur.is_empty() && line.trim().is_empty() { + start = n + 1; + continue; + } + cur.push_str(line); + cur.push('\n'); + } + if !cur.trim().is_empty() { + docs.push((start, cur)); + } + docs +} + +fn check_doc( + source: &str, + line: usize, + doc: &Value, + opts: &Options, + results: &mut Vec, +) { + let s = |k: &str| { + doc.get(k) + .and_then(|v| v.as_str()) + .unwrap_or("") + .to_string() + }; + let (av, kind) = (s("apiVersion"), s("kind")); + let name = doc + .get("metadata") + .and_then(|m| m.get("name")) + .and_then(|n| n.as_str()) + .unwrap_or("") + .to_string(); + let mk = |status, messages: Vec| ResourceResult { + source: source.to_string(), + line, + api_version: av.clone(), + kind: kind.clone(), + name: name.clone(), + status, + messages, + }; + if av.is_empty() || kind.is_empty() { + results.push(mk( + Status::Invalid, + vec!["a manifest needs `apiVersion` and `kind`".into()], + )); + return; + } + if kind == "List" && av == "v1" { + match doc.get("items").and_then(|i| i.as_array()) { + Some(items) => { + for it in items { + check_doc(source, line, it, opts, results); + } + } + None => results.push(mk(Status::Invalid, vec!["List without `items`".into()])), + } + return; + } + if opts.skip.iter().any(|k| k.eq_ignore_ascii_case(&kind)) { + results.push(mk(Status::Skipped, vec!["skipped by --skip".into()])); + return; + } + match roundtrip(&av, &kind, doc) { + Some(Ok(rt)) => { + let mut msgs = Vec::new(); + missing_required(doc, &rt, "", &mut msgs); + if opts.strict { + unknown_fields(doc, &rt, "", &mut msgs); + } + let status = if msgs.is_empty() { + Status::Valid + } else { + Status::Invalid + }; + results.push(mk(status, msgs)); + } + Some(Err(e)) => results.push(mk(Status::Invalid, vec![e])), + None => { + if let Some((expected, _)) = KINDS + .iter() + .find(|(_, k)| *k == kind) + .map(|(a, k)| (*a, *k)) + { + results.push(mk( + Status::Invalid, + vec![format!( + "apiVersion `{av}` is not served for {kind} (use `{expected}`)" + )], + )); + } else if opts.ignore_missing_schemas { + results.push(mk( + Status::Skipped, + vec!["no bundled schema (custom resource)".into()], + )); + } else { + results.push(mk( + Status::Error, + vec![format!( + "no bundled schema for {av} {kind}; pass --ignore-missing-schemas to skip custom resources" + )], + )); + } + } + } +} + +/// Validate one named manifest stream, appending to `results`. +fn check_source(source: &str, text: &str, opts: &Options, results: &mut Vec) { + for (line, chunk) in split_docs(text) { + if results.len() >= MAX_DOCS { + return; + } + let parsed = speclint::guarded_parse(&chunk) + .map_err(|d| d.message) + .and_then(|y| serde_json::to_value(&y).map_err(|e| format!("unsupported YAML: {e}"))); + match parsed { + Ok(Value::Null) => {} + Ok(v) if v.is_object() => check_doc(source, line, &v, opts, results), + Ok(_) => results.push(ResourceResult { + source: source.to_string(), + line, + api_version: String::new(), + kind: String::new(), + name: String::new(), + status: Status::Invalid, + messages: vec!["document is not a mapping".into()], + }), + Err(e) => results.push(ResourceResult { + source: source.to_string(), + line, + api_version: String::new(), + kind: String::new(), + name: String::new(), + status: Status::Error, + messages: vec![format!("parse error: {e}")], + }), + } + } +} + +/// Validate several `(source name, text)` inputs. +pub fn check(inputs: &[(String, String)], opts: &Options) -> Result { + let total: usize = inputs.iter().map(|(_, t)| t.len()).sum(); + if total > MAX_BYTES { + return Err(format!("manifests exceed {MAX_BYTES} bytes")); + } + let mut results = Vec::new(); + for (name, text) in inputs { + check_source(name, text, opts, &mut results); + } + if results.len() >= MAX_DOCS { + return Err(format!("more than {MAX_DOCS} documents")); + } + let count = |st: Status| results.iter().filter(|r| r.status == st).count(); + let summary = Summary { + valid: count(Status::Valid), + invalid: count(Status::Invalid), + skipped: count(Status::Skipped), + errors: count(Status::Error), + }; + Ok(CheckReport { results, summary }) +} + +#[cfg(test)] +mod tests { + use super::*; + + const DEPLOY: &str = "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: web\nspec:\n replicas: 2\n selector:\n matchLabels:\n app: web\n template:\n metadata:\n labels:\n app: web\n spec:\n containers:\n - name: web\n image: nginx:1.27\n ports:\n - containerPort: 80\n resources:\n limits:\n memory: 128Mi\n"; + + fn run(text: &str, opts: Options) -> CheckReport { + check(&[("m.yaml".into(), text.into())], &opts).unwrap() + } + + #[test] + fn valid_deployment_passes_even_strict() { + let r = run( + DEPLOY, + Options { + strict: true, + ..Default::default() + }, + ); + assert_eq!(r.summary.valid, 1, "{}", r.render_text()); + assert!(!r.failed()); + } + + #[test] + fn wrong_type_and_missing_required_field_are_invalid() { + let r = run( + &DEPLOY.replace("replicas: 2", "replicas: many"), + Options::default(), + ); + assert_eq!(r.summary.invalid, 1); + let r = run( + &DEPLOY.replace(" image: nginx:1.27\n", ""), + Options::default(), + ); + assert_eq!(r.summary.invalid, 0, "image is optional in the schema"); + let r = run( + &DEPLOY.replace(" selector:\n matchLabels:\n app: web\n", ""), + Options::default(), + ); + assert!( + r.results[0] + .messages + .iter() + .any(|m| m.contains("missing required field `spec.selector`")), + "{:?}", + r.results + ); + let r = run( + &DEPLOY.replace(" - name: web\n image", " - image"), + Options::default(), + ); + assert_eq!( + r.summary.invalid, + 1, + "container name is required: {}", + r.render_text() + ); + assert!( + r.results[0].messages[0].contains("containers[0].name"), + "{:?}", + r.results[0].messages + ); + } + + #[test] + fn strict_reports_unknown_fields_with_paths() { + let typo = DEPLOY.replace( + " image:", + " imagePullPolcy: Always\n image:", + ); + let lenient = run(&typo, Options::default()); + assert_eq!(lenient.summary.valid, 1); + let strict = run( + &typo, + Options { + strict: true, + ..Default::default() + }, + ); + assert_eq!(strict.summary.invalid, 1); + assert!( + strict.results[0].messages[0] + .contains("spec.template.spec.containers[0].imagePullPolcy"), + "{:?}", + strict.results[0].messages + ); + } + + #[test] + fn multi_doc_lines_and_empty_docs() { + let text = format!("# header\n---\n{DEPLOY}---\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n name: c\ndata:\n a: b\n"); + let r = run(&text, Options::default()); + assert_eq!(r.results.len(), 2); + assert_eq!(r.results[0].line, 3); + assert_eq!(r.results[1].kind, "ConfigMap"); + assert!(r.results[1].line > r.results[0].line); + } + + #[test] + fn deprecated_api_version_is_named() { + let ing = "apiVersion: extensions/v1beta1\nkind: Ingress\nmetadata:\n name: i\n"; + let r = run(ing, Options::default()); + assert_eq!(r.results[0].status, Status::Invalid); + assert!(r.results[0].messages[0].contains("networking.k8s.io/v1")); + } + + #[test] + fn custom_resources_need_the_flag() { + let vm = "apiVersion: kubevirt.io/v1\nkind: VirtualMachine\nmetadata:\n name: vm\n"; + let r = run(vm, Options::default()); + assert_eq!(r.results[0].status, Status::Error); + assert!(r.failed()); + let r = run( + vm, + Options { + ignore_missing_schemas: true, + ..Default::default() + }, + ); + assert_eq!(r.results[0].status, Status::Skipped); + assert!(!r.failed()); + let r = run( + vm, + Options { + skip: vec!["virtualmachine".into()], + ..Default::default() + }, + ); + assert_eq!(r.results[0].status, Status::Skipped); + } + + #[test] + fn secret_data_must_be_base64() { + let s = + "apiVersion: v1\nkind: Secret\nmetadata:\n name: s\ndata:\n k: \"not base64!!\"\n"; + assert_eq!( + run(s, Options::default()).results[0].status, + Status::Invalid + ); + let ok = "apiVersion: v1\nkind: Secret\nmetadata:\n name: s\ndata:\n k: aHVudGVyMg==\nstringData:\n x: y\n"; + assert_eq!( + run( + ok, + Options { + strict: true, + ..Default::default() + } + ) + .results[0] + .status, + Status::Valid + ); + } + + #[test] + fn list_kind_is_expanded() { + let l = "apiVersion: v1\nkind: List\nitems:\n - apiVersion: v1\n kind: ConfigMap\n metadata:\n name: a\n - apiVersion: v1\n kind: ConfigMap\n metadata:\n name: b\n"; + assert_eq!(run(l, Options::default()).summary.valid, 2); + } + + #[test] + fn missing_kind_duplicate_keys_and_non_mappings() { + assert_eq!( + run("metadata:\n name: x\n", Options::default()) + .summary + .invalid, + 1 + ); + let dup = "apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: a\n name: b\n"; + let r = run(dup, Options::default()); + assert_eq!(r.results[0].status, Status::Error, "{:?}", r.results); + assert_eq!(run("- a\n- b\n", Options::default()).summary.invalid, 1); + } + + #[test] + fn junit_and_text_escape_hostile_names() { + let c = "apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: \"a&\"\ndata: 5\n"; + let r = run(c, Options::default()); + let x = r.render_junit(); + assert!( + x.contains("a<b>&") && x.contains(")>, } +/// Adapter that lets openidconnect (built against reqwest 0.12) use the +/// application's own reqwest 0.13 client through its `AsyncHttpClient` trait. +#[derive(Clone)] +struct ReqwestHttp(reqwest::Client); + +type OidcHttpFuture<'c> = std::pin::Pin< + Box< + dyn std::future::Future< + Output = Result< + openidconnect::HttpResponse, + openidconnect::HttpClientError, + >, + > + Send + + 'c, + >, +>; + +impl<'c> openidconnect::AsyncHttpClient<'c> for ReqwestHttp { + type Error = openidconnect::HttpClientError; + type Future = OidcHttpFuture<'c>; + + fn call(&'c self, request: openidconnect::HttpRequest) -> Self::Future { + Box::pin(async move { + let (parts, body) = request.into_parts(); + let req = self + .0 + .request(parts.method, parts.uri.to_string()) + .headers(parts.headers) + .body(body); + let response = req.send().await.map_err(Box::new)?; + let mut builder = axum::http::Response::builder() + .status(response.status()) + .version(response.version()); + for (name, value) in response.headers() { + builder = builder.header(name, value); + } + let bytes = response.bytes().await.map_err(Box::new)?; + builder + .body(bytes.to_vec()) + .map_err(openidconnect::HttpClientError::Http) + }) + } +} + pub struct OidcRuntime { - http: reqwest::Client, + http: ReqwestHttp, issuer_url: IssuerUrl, client_id: ClientId, client_secret: Option, @@ -104,10 +148,12 @@ impl OidcRuntime { if role_mapping.is_some() { tracing::info!("OIDC group → role mapping enabled"); } - let http = reqwest::Client::builder() - .redirect(reqwest::redirect::Policy::none()) - .build() - .context("failed to build reqwest client for OIDC")?; + let http = ReqwestHttp( + reqwest::Client::builder() + .redirect(reqwest::redirect::Policy::none()) + .build() + .context("failed to build reqwest client for OIDC")?, + ); tracing::info!( issuer = %issuer_url, "OpenID Connect relying-party mode enabled" diff --git a/src/specci.rs b/src/specci.rs new file mode 100644 index 00000000..40ffd2cd --- /dev/null +++ b/src/specci.rs @@ -0,0 +1,96 @@ +// Copyright 2026 ZyvorAI Labs Private Limited +// SPDX-License-Identifier: LicenseRef-Zyvor-Production-2.0 + +//! CI and pre-commit integration snippets (`aether spec-ci`). +//! +//! Prints a ready-to-paste configuration that runs the spec tools (lint with +//! best practices, spec-lock drift check) in GitHub Actions, GitLab CI or +//! pre-commit. The spec path is restricted to a conservative character set so +//! it can never inject YAML or shell syntax into the snippet. + +pub const PROVIDERS: &[&str] = &["github", "gitlab", "pre-commit"]; + +/// Accept only `[A-Za-z0-9._/-]`, no leading `-` and no `..` segments. +pub fn safe_path(p: &str) -> Result<&str, String> { + let ok = !p.is_empty() + && p.len() <= 200 + && !p.starts_with('-') + && !p.split('/').any(|s| s == "..") + && p.chars() + .all(|c| c.is_ascii_alphanumeric() || matches!(c, '.' | '_' | '/' | '-')); + if ok { + Ok(p) + } else { + Err(format!( + "unsupported spec path `{}` (use letters, digits, `.`, `_`, `-`, `/`)", + crate::speclint::sanitize(p) + )) + } +} + +pub fn snippet(provider: &str, spec: &str) -> Result { + let spec = safe_path(spec)?; + let lock = format!("{spec}.lock.json"); + match provider { + "github" => Ok(format!( + "name: aether-spec\non:\n pull_request:\n paths: ['{spec}']\njobs:\n spec:\n runs-on: ubuntu-latest\n permissions:\n contents: read\n security-events: write\n steps:\n - uses: actions/checkout@v7\n # Install the aether binary first (release download or cargo install).\n - name: Lint (annotations)\n run: aether --spec {spec} lint --best-practices --format github --deny-warnings\n - name: Lint (SARIF for code scanning)\n if: always()\n run: aether --spec {spec} lint --best-practices --format sarif > aether.sarif\n - uses: github/codeql-action/upload-sarif@v4\n if: always()\n with:\n sarif_file: aether.sarif\n - name: Spec drift against the committed lock\n run: aether --spec {spec} spec-lock check --lock {lock}\n" + )), + "gitlab" => Ok(format!( + "aether-spec:\n stage: test\n rules:\n - changes: ['{spec}']\n script:\n - aether --spec {spec} lint --best-practices --format junit --deny-warnings > aether-junit.xml\n - aether --spec {spec} spec-lock check --lock {lock}\n artifacts:\n when: always\n reports:\n junit: aether-junit.xml\n" + )), + "pre-commit" => Ok(format!( + "repos:\n - repo: local\n hooks:\n - id: aether-lint\n name: aether lint\n entry: aether --spec {spec} lint --deny-warnings\n language: system\n pass_filenames: false\n files: '^{pattern}$'\n - id: aether-spec-lock\n name: aether spec-lock check\n entry: aether --spec {spec} spec-lock check --lock {lock}\n language: system\n pass_filenames: false\n files: '^{pattern}$'\n", + pattern = spec.replace('.', "\\.") + )), + other => Err(format!( + "unknown provider `{}` (expected one of: {})", + crate::speclint::sanitize(other), + PROVIDERS.join(", ") + )), + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn every_provider_yields_valid_yaml_with_the_commands() { + for p in PROVIDERS { + let s = snippet(p, "deploy/workload.yaml").unwrap(); + let v: serde_yaml::Value = + serde_yaml::from_str(&s).unwrap_or_else(|e| panic!("{p}: {e}\n{s}")); + assert!(v.is_mapping(), "{p}"); + assert!(s.contains("aether --spec deploy/workload.yaml lint"), "{p}"); + assert!( + s.contains("spec-lock check --lock deploy/workload.yaml.lock.json"), + "{p}" + ); + } + } + + #[test] + fn pre_commit_pattern_escapes_dots() { + let s = snippet("pre-commit", "a.yaml").unwrap(); + assert!(s.contains("files: '^a\\.yaml$'"), "{s}"); + } + + #[test] + fn hostile_paths_and_providers_are_rejected() { + for p in [ + "", + "-x", + "../x", + "a b", + "a;rm -rf /", + "a\nb", + "x'y", + "a$(b)", + ] { + assert!(snippet("github", p).is_err(), "{p:?}"); + } + assert!(snippet("jenkins", "a.yaml") + .unwrap_err() + .contains("expected one of")); + } +} diff --git a/src/specfix.rs b/src/specfix.rs new file mode 100644 index 00000000..a6309e9c --- /dev/null +++ b/src/specfix.rs @@ -0,0 +1,206 @@ +// Copyright 2026 ZyvorAI Labs Private Limited +// SPDX-License-Identifier: LicenseRef-Zyvor-Production-2.0 + +//! Safe auto-fixes for lint findings (`aether lint --fix`). +//! +//! Only edits that cannot change what the engine does are applied: +//! +//! * `W020` with a "did you mean" hint: the misspelt key is renamed to the +//! suggested key (the misspelt key was ignored, so the spec now says what the +//! author meant; this can change behaviour, so it is reported as such). +//! * `I021`: a snake_case alias is renamed to the canonical camelCase key +//! (accepted spellings are equivalent, so behaviour is identical). +//! +//! Edits are textual and line-based so comments and layout survive. After +//! editing, the result is linted again; if it has more errors than before, +//! nothing is applied. Opinionated findings (best-practice `B1xx`) are never +//! auto-fixed. + +use crate::speclint::{self, LintOptions}; +use serde::Serialize; + +#[derive(Debug, Clone, Serialize)] +pub struct Fix { + pub code: String, + pub line: usize, + pub from: String, + pub to: String, + /// True when the old key was silently ignored, so the fix changes behaviour. + pub behaviour_change: bool, +} + +#[derive(Debug, Clone, Serialize)] +pub struct FixResult { + pub fixed: String, + pub applied: Vec, + /// Findings that have a suggestion but could not be edited safely. + pub skipped: Vec, + pub changed: bool, +} + +fn between_backticks(s: &str) -> Option { + let a = s.find('`')? + 1; + let b = s[a..].find('`')? + a; + Some(s[a..b].to_string()) +} + +/// Rename `from` to `to` where `from` is the mapping key on `line` (1-based). +fn rename_key_on_line(lines: &mut [String], line: usize, from: &str, to: &str) -> bool { + let Some(l) = lines.get_mut(line.wrapping_sub(1)) else { + return false; + }; + let trimmed = l.trim_start(); + let indent = l.len() - trimmed.len(); + // A key may follow one or more `- ` sequence markers. + let _ = indent; + let mut rest = trimmed; + while let Some(r) = rest.strip_prefix("- ") { + rest = r.trim_start(); + } + let off = l.len() - rest.len(); + for quote in ["", "\"", "'"] { + let pat = format!("{quote}{from}{quote}"); + if let Some(after) = rest.strip_prefix(&pat) { + if after.trim_start().starts_with(':') { + l.replace_range(off..off + pat.len(), to); + return true; + } + } + } + false +} + +/// Compute fixes for `src`. Never fails: an unparsable spec yields no fixes. +pub fn fix_str(src: &str) -> FixResult { + let before = speclint::lint_with(src, &LintOptions::default()); + let mut lines: Vec = src.split('\n').map(str::to_string).collect(); + let mut applied = Vec::new(); + let mut skipped = Vec::new(); + // Apply from the bottom so earlier line numbers stay valid (renames keep + // the line count, but this keeps the report order deterministic anyway). + let mut diags: Vec<_> = before + .diagnostics + .iter() + .filter(|d| d.code == "W020" || d.code == "I021") + .collect(); + diags.sort_by_key(|d| d.line); + for d in diags { + let Some(from) = between_backticks(&d.message) else { + continue; + }; + let Some(hint) = d.hint.as_deref() else { + skipped.push(format!("line {}: `{}` has no suggestion", d.line, from)); + continue; + }; + let Some(to) = between_backticks(hint) else { + continue; + }; + if rename_key_on_line(&mut lines, d.line, &from, &to) { + applied.push(Fix { + code: d.code.to_string(), + line: d.line, + from, + to, + behaviour_change: d.code == "W020", + }); + } else { + skipped.push(format!( + "line {}: could not edit `{}` safely (flow style or multi-line key)", + d.line, from + )); + } + } + let candidate = lines.join("\n"); + if applied.is_empty() { + return FixResult { + fixed: src.to_string(), + applied, + skipped, + changed: false, + }; + } + let after = speclint::lint_with(&candidate, &LintOptions::default()); + if after.errors > before.errors { + skipped.push("fixes rejected: the edited spec would have more errors".into()); + return FixResult { + fixed: src.to_string(), + applied: Vec::new(), + skipped, + changed: false, + }; + } + FixResult { + fixed: candidate, + applied, + skipped, + changed: true, + } +} + +/// A minimal unified-style diff of changed lines (renames never move lines). +pub fn diff(old: &str, new: &str, file: &str) -> String { + let mut out = String::new(); + for (i, (a, b)) in old.split('\n').zip(new.split('\n')).enumerate() { + if a != b { + out.push_str(&format!("--- {file}:{n}\n-{a}\n+{b}\n", n = i + 1)); + } + } + out +} + +#[cfg(test)] +mod tests { + use super::*; + + const GOOD: &str = "apiVersion: aether/v1\nkind: Workload\nmetadata:\n name: web\n owner: me\n project: p\nbuild:\n context: .\n dockerfile: Dockerfile\n registry: localhost\nrequirements:\n cpu: \"500m\"\n memory: 256Mi\n storage: 1Gi\nruntime:\n preferred: kube\n allow:\n - kube\nnetwork:\n service: true\n ports:\n - containerPort: 80\n servicePort: 80\n"; + + #[test] + fn clean_spec_is_untouched() { + let r = fix_str(GOOD); + assert!(!r.changed && r.applied.is_empty()); + assert_eq!(r.fixed, GOOD); + } + + #[test] + fn typo_is_renamed_and_comments_survive() { + let src = GOOD.replace("service: true", "servicetype: NodePort # keep me"); + let r = fix_str(&src); + assert!(r.changed, "{:?}", r); + assert_eq!(r.applied[0].code, "W020"); + assert!(r.applied[0].behaviour_change); + assert!(r.fixed.contains("serviceType: NodePort # keep me")); + let after = speclint::lint_str(&r.fixed); + assert_eq!(after.warnings, 0, "{:?}", after.diagnostics); + } + + #[test] + fn snake_case_alias_becomes_canonical() { + let src = GOOD.replace("service: true", "service: true\n service_type: NodePort"); + let r = fix_str(&src); + assert_eq!(r.applied.len(), 1, "{:?}", r); + assert_eq!(r.applied[0].code, "I021"); + assert!(!r.applied[0].behaviour_change); + assert!(r.fixed.contains(" serviceType: NodePort")); + } + + #[test] + fn fix_is_idempotent() { + let src = GOOD.replace("service: true", "servicetype: NodePort"); + let once = fix_str(&src); + let twice = fix_str(&once.fixed); + assert!(!twice.changed); + assert_eq!(once.fixed, twice.fixed); + } + + #[test] + fn unparsable_spec_has_no_fixes() { + let r = fix_str("- a\n- b\n"); + assert!(!r.changed); + } + + #[test] + fn diff_lists_changed_lines_only() { + let d = diff("a: 1\nb: 2\n", "a: 1\nc: 2\n", "s.yaml"); + assert!(d.contains("-b: 2") && d.contains("+c: 2") && !d.contains("a: 1")); + } +} diff --git a/src/speclock.rs b/src/speclock.rs new file mode 100644 index 00000000..46a90a37 --- /dev/null +++ b/src/speclock.rs @@ -0,0 +1,224 @@ +// Copyright 2026 ZyvorAI Labs Private Limited +// SPDX-License-Identifier: LicenseRef-Zyvor-Production-2.0 + +//! Spec lock file and drift check (`aether spec-lock write|check`). +//! +//! A lock records the canonical content hash of a spec, overall and per +//! top-level section (see `spec-render`). `check` re-renders the spec and says +//! which sections drifted from the recorded baseline, so CI can fail a change +//! that was not meant to touch, say, `network` or `security`. It is offline: +//! the baseline is a file in the repository, not live cluster state (use +//! `aether diff` for that). +//! +//! The lock contains hashes only, never spec values, so it is safe to commit +//! even when the spec holds secrets. + +use crate::specrender; +use serde::{Deserialize, Serialize}; +use std::collections::BTreeMap; + +pub const LOCK_VERSION: u32 = 1; +const MAX_LOCK_BYTES: usize = 64 * 1024; + +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[serde(deny_unknown_fields)] +pub struct Lock { + pub version: u32, + pub hash: String, + pub sections: BTreeMap, +} + +#[derive(Debug, Clone, Serialize)] +pub struct LockCheck { + pub drift: bool, + pub expected: String, + pub actual: String, + pub changed: Vec, + pub added: Vec, + pub removed: Vec, + /// Sections excluded from the comparison with `--ignore`. + pub ignored: Vec, +} + +impl LockCheck { + pub fn render_text(&self) -> String { + if !self.drift { + return format!("no drift ({})\n", self.actual); + } + let mut out = format!("drift: {} -> {}\n", self.expected, self.actual); + for (label, list) in [ + ("changed", &self.changed), + ("added", &self.added), + ("removed", &self.removed), + ] { + for s in list { + out.push_str(&format!(" {label:<8} {}\n", crate::speclint::sanitize(s))); + } + } + out + } +} + +fn valid_hash(h: &str) -> bool { + h.strip_prefix("sha256:") + .map(|x| x.len() == 64 && x.chars().all(|c| c.is_ascii_hexdigit())) + .unwrap_or(false) +} + +/// Build a lock from spec text. +pub fn make_lock(spec_src: &str) -> Result { + let r = specrender::render_str(spec_src)?; + Ok(Lock { + version: LOCK_VERSION, + hash: r.hash, + sections: r.sections, + }) +} + +/// Lock file text: stable, pretty JSON with a trailing newline. +pub fn lock_text(lock: &Lock) -> String { + let mut s = serde_json::to_string_pretty(lock).unwrap_or_default(); + s.push('\n'); + s +} + +pub fn parse_lock(src: &str) -> Result { + if src.len() > MAX_LOCK_BYTES { + return Err("lock file is too large".into()); + } + let lock: Lock = serde_json::from_str(src).map_err(|e| format!("invalid lock file: {e}"))?; + if lock.version != LOCK_VERSION { + return Err(format!( + "unsupported lock version {} (this build reads version {LOCK_VERSION})", + lock.version + )); + } + if !valid_hash(&lock.hash) || lock.sections.values().any(|h| !valid_hash(h)) { + return Err("invalid lock file: malformed hash".into()); + } + Ok(lock) +} + +/// Compare a spec with a lock. Sections named in `ignore` are not compared; +/// with any ignored section the overall hash is not used for the verdict. +pub fn check(spec_src: &str, lock_src: &str, ignore: &[String]) -> Result { + let lock = parse_lock(lock_src)?; + let now = make_lock(spec_src)?; + let skip = |s: &str| ignore.iter().any(|i| i == s); + let mut changed = Vec::new(); + let mut added = Vec::new(); + let mut removed = Vec::new(); + for (k, h) in &now.sections { + if skip(k) { + continue; + } + match lock.sections.get(k) { + None => added.push(k.clone()), + Some(old) if old != h => changed.push(k.clone()), + _ => {} + } + } + for k in lock.sections.keys() { + if !skip(k) && !now.sections.contains_key(k) { + removed.push(k.clone()); + } + } + let drift = if ignore.is_empty() { + lock.hash != now.hash || !(changed.is_empty() && added.is_empty() && removed.is_empty()) + } else { + !(changed.is_empty() && added.is_empty() && removed.is_empty()) + }; + Ok(LockCheck { + drift, + expected: lock.hash, + actual: now.hash, + changed, + added, + removed, + ignored: ignore.to_vec(), + }) +} + +#[cfg(test)] +mod tests { + use super::*; + + const GOOD: &str = "apiVersion: aether/v1\nkind: Workload\nmetadata:\n name: web\n owner: me\n project: p\nbuild:\n context: .\n dockerfile: Dockerfile\n registry: localhost\nrequirements:\n cpu: \"500m\"\n memory: 256Mi\n storage: 1Gi\nruntime:\n preferred: kube\n allow:\n - kube\nnetwork:\n service: true\n ports:\n - containerPort: 80\n servicePort: 80\n"; + + #[test] + fn unchanged_spec_has_no_drift_even_when_reformatted() { + let lock = lock_text(&make_lock(GOOD).unwrap()); + let reformatted = format!( + "# edited comment\n{}", + GOOD.replace(" owner: me\n project: p\n", " project: p\n owner: me\n") + ); + let c = check(&reformatted, &lock, &[]).unwrap(); + assert!(!c.drift, "{:?}", c); + } + + #[test] + fn drift_names_the_section() { + let lock = lock_text(&make_lock(GOOD).unwrap()); + let c = check(&GOOD.replace("256Mi", "512Mi"), &lock, &[]).unwrap(); + assert!(c.drift); + assert_eq!(c.changed, vec!["requirements"]); + assert!(c.render_text().contains("changed requirements")); + } + + #[test] + fn added_and_removed_sections() { + let lock = lock_text(&make_lock(GOOD).unwrap()); + let with = format!("{GOOD}scaling:\n enabled: true\n minReplicas: 1\n maxReplicas: 3\n cpuTarget: 70\n"); + let c = check(&with, &lock, &[]).unwrap(); + assert!( + c.drift && c.added.contains(&"scaling".to_string()), + "{:?}", + c + ); + let lock2 = lock_text(&make_lock(&with).unwrap()); + let c = check(GOOD, &lock2, &[]).unwrap(); + assert!(c.removed.contains(&"scaling".to_string()), "{:?}", c); + } + + #[test] + fn ignored_sections_do_not_count() { + let lock = lock_text(&make_lock(GOOD).unwrap()); + let c = check( + &GOOD.replace("256Mi", "512Mi"), + &lock, + &["requirements".into()], + ) + .unwrap(); + assert!(!c.drift); + assert_eq!(c.ignored, vec!["requirements"]); + } + + #[test] + fn lock_contains_no_spec_values() { + let spec = format!( + "{GOOD}config:\n secrets:\n - name: db\n data:\n password: hunter2\n" + ); + let text = lock_text(&make_lock(&spec).unwrap()); + assert!(!text.contains("hunter2") && !text.contains("256Mi")); + } + + #[test] + fn bad_locks_are_rejected() { + for bad in [ + "not json", + "{\"version\":2,\"hash\":\"sha256:00\",\"sections\":{}}", + "{\"version\":1,\"hash\":\"nope\",\"sections\":{}}", + "{\"version\":1,\"hash\":\"sha256:00\",\"sections\":{},\"extra\":1}", + ] { + assert!(check(GOOD, bad, &[]).is_err(), "{bad}"); + } + } + + #[test] + fn lock_text_is_deterministic() { + assert_eq!( + lock_text(&make_lock(GOOD).unwrap()), + lock_text(&make_lock(GOOD).unwrap()) + ); + } +} diff --git a/src/specpolicy.rs b/src/specpolicy.rs new file mode 100644 index 00000000..a4842b76 --- /dev/null +++ b/src/specpolicy.rs @@ -0,0 +1,706 @@ +// Copyright 2026 ZyvorAI Labs Private Limited +// SPDX-License-Identifier: LicenseRef-Zyvor-Production-2.0 + +//! Policy-as-code for specs (`aether spec-policy`). +//! +//! Organisation rules live in a YAML rule file, outside the binary, and are +//! evaluated against the spec as written (so every finding carries a source +//! line). Think Conftest / Kubescape controls, but declarative and offline: no +//! Rego runtime, only a small closed set of operators. +//! +//! ```yaml +//! rules: +//! - id: P001 +//! description: every workload names an owner +//! path: metadata.owner +//! op: exists +//! - id: P002 +//! severity: warning +//! path: network.ports[*].containerPort +//! op: gte +//! value: 1024 +//! message: unprivileged ports only +//! - id: P003 +//! path: requirements.memory +//! op: lte +//! value: 8Gi +//! when: { path: runtime.preferred, op: equals, value: kube } +//! ``` +//! +//! A rule passes when its assertion holds on every node the path selects. +//! `[*]` (or a `*` segment) selects every element of a list. A missing value +//! fails every operator except `absent`, `not_equals`, `not_in` and +//! `not_matches`, unless `skip_if_missing: true`. + +use crate::lintfmt::xml_escape; +use crate::resources::parse_cpu; +use crate::speclint::{self, sanitize, LineIndex}; +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use std::collections::BTreeSet; + +pub const MAX_RULE_BYTES: usize = 256 * 1024; +pub const MAX_RULES: usize = 500; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Default)] +#[serde(rename_all = "lowercase")] +pub enum PolicySeverity { + #[default] + Error, + Warning, + Info, +} + +impl PolicySeverity { + fn as_str(self) -> &'static str { + match self { + Self::Error => "error", + Self::Warning => "warning", + Self::Info => "info", + } + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)] +#[serde(rename_all = "snake_case")] +pub enum Op { + Exists, + Absent, + Equals, + NotEquals, + In, + NotIn, + /// Glob match (`*` and `?`) on a string. + Matches, + NotMatches, + Lt, + Lte, + Gt, + Gte, + /// Minimum string length or list length. + MinLen, + MaxLen, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct Condition { + pub path: String, + pub op: Op, + #[serde(default)] + pub value: Option, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct Rule { + pub id: String, + #[serde(default)] + pub description: Option, + #[serde(default)] + pub severity: PolicySeverity, + pub path: String, + pub op: Op, + #[serde(default)] + pub value: Option, + #[serde(default)] + pub when: Option, + #[serde(default)] + pub skip_if_missing: bool, + #[serde(default)] + pub message: Option, +} + +#[derive(Debug, Deserialize)] +#[serde(deny_unknown_fields)] +struct RuleFile { + rules: Vec, +} + +#[derive(Debug, Clone, Serialize)] +pub struct Violation { + pub id: String, + pub severity: PolicySeverity, + pub path: String, + pub line: usize, + pub message: String, +} + +#[derive(Debug, Clone, Serialize)] +pub struct PolicyReport { + pub rules: usize, + pub passed: usize, + pub violations: Vec, + pub errors: usize, + pub warnings: usize, +} + +impl PolicyReport { + pub fn failed(&self, deny_warnings: bool) -> bool { + self.errors > 0 || (deny_warnings && self.warnings > 0) + } + + pub fn render_text(&self, file: &str) -> String { + let mut out = String::new(); + for v in &self.violations { + let loc = if v.line > 0 { + format!("{file}:{}", v.line) + } else { + file.to_string() + }; + out.push_str(&format!( + "{loc}: {}[{}]: {} ({})\n", + v.severity.as_str(), + sanitize(&v.id), + sanitize(&v.message), + sanitize(&v.path) + )); + } + out.push_str(&format!( + "{} rule(s), {} passed, {} error(s), {} warning(s)\n", + self.rules, self.passed, self.errors, self.warnings + )); + out + } + + pub fn render_github(&self, file: &str) -> String { + let esc = |s: &str| { + sanitize(s) + .replace('%', "%25") + .replace('\r', "%0D") + .replace('\n', "%0A") + }; + let mut out = String::new(); + for v in &self.violations { + let level = match v.severity { + PolicySeverity::Error => "error", + PolicySeverity::Warning => "warning", + PolicySeverity::Info => "notice", + }; + out.push_str(&format!( + "::{level} file={},line={},title={}::{}\n", + esc(file).replace(',', "%2C").replace(':', "%3A"), + v.line.max(1), + esc(&v.id).replace(',', "%2C").replace(':', "%3A"), + esc(&v.message) + )); + } + out + } + + pub fn render_junit(&self, file: &str) -> String { + let mut out = String::from("\n"); + out.push_str(&format!( + "\n", + self.rules.max(self.violations.len()), + self.violations.len() + )); + for v in &self.violations { + out.push_str(&format!( + " \n {}:{}\n \n", + xml_escape(file), + xml_escape(&format!("{} {}", v.id, v.path)), + v.severity.as_str(), + xml_escape(&sanitize(&v.message)), + xml_escape(file), + v.line + )); + } + out.push_str("\n"); + out + } +} + +// --------------------------------------------------------------------------- +// Path resolution +// --------------------------------------------------------------------------- + +#[derive(Debug, Clone, PartialEq)] +enum Tok { + Key(String), + Index(usize), + Wild, +} + +fn tokenize(path: &str) -> Result, String> { + if path.is_empty() { + return Err("empty path".into()); + } + let mut toks = Vec::new(); + for seg in path.split('.') { + let (name, mut rest) = match seg.find('[') { + Some(i) => (&seg[..i], &seg[i..]), + None => (seg, ""), + }; + if name == "*" { + toks.push(Tok::Wild); + } else if name.is_empty() && rest.is_empty() { + return Err(format!("empty segment in path `{path}`")); + } else if !name.is_empty() { + toks.push(Tok::Key(name.to_string())); + } + while let Some(r) = rest.strip_prefix('[') { + let end = r + .find(']') + .ok_or_else(|| format!("unclosed `[` in path `{path}`"))?; + let inner = &r[..end]; + if inner == "*" { + toks.push(Tok::Wild); + } else { + toks.push(Tok::Index( + inner + .parse() + .map_err(|_| format!("bad index `{inner}` in path `{path}`"))?, + )); + } + rest = &r[end + 1..]; + } + if !rest.is_empty() { + return Err(format!("unexpected `{rest}` in path `{path}`")); + } + } + Ok(toks) +} + +type Node<'a> = (String, Option<&'a Value>); + +fn resolve<'a>(root: &'a Value, toks: &[Tok]) -> Vec> { + let mut cur: Vec> = vec![(String::new(), Some(root))]; + for t in toks { + let mut next = Vec::new(); + for (p, v) in cur { + match t { + Tok::Key(k) => { + let child = v.and_then(|v| v.get(k.as_str())); + let np = if p.is_empty() { + k.clone() + } else { + format!("{p}.{k}") + }; + next.push((np, child.filter(|c| !c.is_null()))); + } + Tok::Index(i) => { + let child = v.and_then(|v| v.get(*i)); + next.push((format!("{p}[{i}]"), child)); + } + Tok::Wild => match v { + Some(Value::Array(a)) => { + for (i, c) in a.iter().enumerate() { + next.push((format!("{p}[{i}]"), Some(c))); + } + } + Some(Value::Object(m)) => { + for (k, c) in m { + let np = if p.is_empty() { + k.clone() + } else { + format!("{p}.{k}") + }; + next.push((np, Some(c))); + } + } + _ => {} + }, + } + } + cur = next; + } + cur +} + +// --------------------------------------------------------------------------- +// Operators +// --------------------------------------------------------------------------- + +/// Parse a number or a Kubernetes quantity (`500m`, `256Mi`, `2Gi`) to f64. +pub fn quantity(v: &Value) -> Option { + match v { + Value::Number(n) => n.as_f64(), + Value::String(s) => { + let s = s.trim(); + if let Ok(n) = s.parse::() { + return Some(n); + } + const BIN: [(&str, f64); 4] = [ + ("Ki", 1024.0), + ("Mi", 1048576.0), + ("Gi", 1073741824.0), + ("Ti", 1099511627776.0), + ]; + for (suf, mul) in BIN { + if let Some(n) = s.strip_suffix(suf) { + return n.parse::().ok().map(|n| n * mul); + } + } + for (suf, mul) in [("k", 1e3), ("K", 1e3), ("M", 1e6), ("G", 1e9), ("T", 1e12)] { + if let Some(n) = s.strip_suffix(suf) { + return n.parse::().ok().map(|n| n * mul); + } + } + if s.ends_with('m') { + return Some(parse_cpu(s)); + } + None + } + _ => None, + } +} + +/// `*` matches any run, `?` any one character. +pub fn glob(pat: &str, text: &str) -> bool { + let p: Vec = pat.chars().collect(); + let t: Vec = text.chars().collect(); + let (mut pi, mut ti, mut star, mut mark) = (0, 0, None, 0); + while ti < t.len() { + if pi < p.len() && (p[pi] == '?' || p[pi] == t[ti]) { + pi += 1; + ti += 1; + } else if pi < p.len() && p[pi] == '*' { + star = Some(pi); + mark = ti; + pi += 1; + } else if let Some(s) = star { + pi = s + 1; + mark += 1; + ti = mark; + } else { + return false; + } + } + while pi < p.len() && p[pi] == '*' { + pi += 1; + } + pi == p.len() +} + +fn scalar_eq(a: &Value, b: &Value) -> bool { + if let (Some(x), Some(y)) = (quantity_if_numeric(a), quantity_if_numeric(b)) { + return x == y; + } + a == b +} + +fn quantity_if_numeric(v: &Value) -> Option { + v.as_f64() +} + +fn len_of(v: &Value) -> Option { + match v { + Value::String(s) => Some(s.chars().count()), + Value::Array(a) => Some(a.len()), + Value::Object(m) => Some(m.len()), + _ => None, + } +} + +/// True when the assertion holds. `Err` means the operand has the wrong type. +fn holds(op: Op, v: Option<&Value>, want: Option<&Value>) -> Result { + let missing_ok = matches!(op, Op::Absent | Op::NotEquals | Op::NotIn | Op::NotMatches); + let Some(v) = v else { + return Ok(missing_ok); + }; + let need = || want.ok_or_else(|| "rule has no `value`".to_string()); + Ok(match op { + Op::Exists => true, + Op::Absent => false, + Op::Equals => scalar_eq(v, need()?), + Op::NotEquals => !scalar_eq(v, need()?), + Op::In | Op::NotIn => { + let list = need()? + .as_array() + .ok_or_else(|| "`value` must be a list".to_string())?; + let found = list.iter().any(|w| scalar_eq(v, w)); + if op == Op::In { + found + } else { + !found + } + } + Op::Matches | Op::NotMatches => { + let pat = need()? + .as_str() + .ok_or_else(|| "`value` must be a string".to_string())?; + let s = v + .as_str() + .ok_or_else(|| "value is not a string".to_string())?; + let m = glob(pat, s); + if op == Op::Matches { + m + } else { + !m + } + } + Op::Lt | Op::Lte | Op::Gt | Op::Gte => { + let a = quantity(v).ok_or_else(|| "value is not a number or quantity".to_string())?; + let b = quantity(need()?) + .ok_or_else(|| "`value` is not a number or quantity".to_string())?; + match op { + Op::Lt => a < b, + Op::Lte => a <= b, + Op::Gt => a > b, + _ => a >= b, + } + } + Op::MinLen | Op::MaxLen => { + let n = len_of(v).ok_or_else(|| "value has no length".to_string())? as f64; + let b = need()? + .as_f64() + .ok_or_else(|| "`value` must be a number".to_string())?; + if op == Op::MinLen { + n >= b + } else { + n <= b + } + } + }) +} + +fn needs_value(op: Op) -> bool { + !matches!(op, Op::Exists | Op::Absent) +} + +// --------------------------------------------------------------------------- +// Loading and evaluation +// --------------------------------------------------------------------------- + +/// Parse and validate a rule file. +pub fn parse_rules(src: &str) -> Result, String> { + if src.len() > MAX_RULE_BYTES { + return Err(format!("rule file exceeds {MAX_RULE_BYTES} bytes")); + } + speclint::guarded_parse(src).map_err(|d| d.message)?; + let file: RuleFile = + serde_yaml::from_str(src).map_err(|e| format!("invalid rule file: {e}"))?; + if file.rules.len() > MAX_RULES { + return Err(format!("more than {MAX_RULES} rules")); + } + let mut seen = BTreeSet::new(); + for r in &file.rules { + if r.id.trim().is_empty() || r.id.chars().any(|c| c.is_control()) { + return Err("rule id must be non-empty and free of control characters".into()); + } + if !seen.insert(r.id.clone()) { + return Err(format!("duplicate rule id `{}`", sanitize(&r.id))); + } + tokenize(&r.path).map_err(|e| format!("rule {}: {e}", sanitize(&r.id)))?; + if needs_value(r.op) && r.value.is_none() { + return Err(format!( + "rule {}: operator {:?} needs a `value`", + sanitize(&r.id), + r.op + )); + } + if let Some(w) = &r.when { + tokenize(&w.path).map_err(|e| format!("rule {} (when): {e}", sanitize(&r.id)))?; + if needs_value(w.op) && w.value.is_none() { + return Err(format!("rule {} (when): needs a `value`", sanitize(&r.id))); + } + } + } + Ok(file.rules) +} + +/// Evaluate rules against the spec text. +pub fn evaluate(spec_src: &str, rules_src: &str) -> Result { + let rules = parse_rules(rules_src)?; + let yaml = speclint::guarded_parse(spec_src).map_err(|d| d.message)?; + let doc: Value = serde_json::to_value(&yaml).map_err(|e| format!("unsupported spec: {e}"))?; + if !doc.is_object() { + return Err("the spec must be a YAML mapping".into()); + } + let index = LineIndex::build(spec_src); + let mut violations = Vec::new(); + let mut passed = 0usize; + for r in &rules { + if let Some(w) = &r.when { + let toks = tokenize(&w.path)?; + let nodes = resolve(&doc, &toks); + let active = nodes + .iter() + .all(|(_, v)| holds(w.op, *v, w.value.as_ref()).unwrap_or(false)); + if nodes.is_empty() || !active { + passed += 1; + continue; + } + } + let toks = tokenize(&r.path)?; + let before = violations.len(); + for (path, v) in resolve(&doc, &toks) { + if v.is_none() && r.skip_if_missing { + continue; + } + let (ok, why) = match holds(r.op, v, r.value.as_ref()) { + Ok(b) => (b, None), + Err(e) => (false, Some(e)), + }; + if ok { + continue; + } + let base = r + .message + .clone() + .or_else(|| r.description.clone()) + .unwrap_or_else(|| format!("`{}` violates {:?}", r.path, r.op)); + let detail = match (&why, v) { + (Some(w), _) => format!(": {w}"), + (None, None) => ": value is missing".to_string(), + (None, Some(val)) => format!(": found {}", short(val)), + }; + violations.push(Violation { + id: r.id.clone(), + severity: r.severity, + line: index.line_of(&path), + path, + message: format!("{base}{detail}"), + }); + } + if violations.len() == before { + passed += 1; + } + } + violations.sort_by(|a, b| (a.line == 0, a.line, &a.id).cmp(&(b.line == 0, b.line, &b.id))); + let errors = violations + .iter() + .filter(|v| v.severity == PolicySeverity::Error) + .count(); + let warnings = violations + .iter() + .filter(|v| v.severity == PolicySeverity::Warning) + .count(); + Ok(PolicyReport { + rules: rules.len(), + passed, + violations, + errors, + warnings, + }) +} + +fn short(v: &Value) -> String { + let s = v.to_string(); + if s.chars().count() > 60 { + format!("{}...", s.chars().take(57).collect::()) + } else { + s + } +} + +#[cfg(test)] +mod tests { + use super::*; + + const SPEC: &str = "apiVersion: aether/v1\nkind: Workload\nmetadata:\n name: web\n owner: me\nrequirements:\n cpu: \"500m\"\n memory: 256Mi\nruntime:\n preferred: kube\nbuild:\n registry: registry.corp/team\nnetwork:\n ports:\n - containerPort: 80\n - containerPort: 8080\n"; + + fn run(rules: &str) -> PolicyReport { + evaluate(SPEC, rules).unwrap() + } + + #[test] + fn exists_and_absent() { + let r = run("rules:\n - {id: A, path: metadata.owner, op: exists}\n - {id: B, path: metadata.team, op: exists}\n - {id: C, path: metadata.team, op: absent}\n"); + assert_eq!(r.violations.len(), 1); + assert_eq!(r.violations[0].id, "B"); + assert_eq!(r.passed, 2); + assert!(r.violations[0].line > 0); + assert!(r.failed(false)); + } + + #[test] + fn wildcard_over_lists_reports_each_bad_element() { + let r = run("rules:\n - id: P\n severity: warning\n path: network.ports[*].containerPort\n op: gte\n value: 1024\n"); + assert_eq!(r.violations.len(), 1); + assert_eq!(r.violations[0].path, "network.ports[0].containerPort"); + assert_eq!(r.warnings, 1); + assert!(!r.failed(false) && r.failed(true)); + } + + #[test] + fn quantities_compare_across_units() { + let ok = run("rules:\n - {id: M, path: requirements.memory, op: lte, value: 1Gi}\n - {id: C, path: requirements.cpu, op: lte, value: 1}\n"); + assert!(ok.violations.is_empty(), "{:?}", ok.violations); + let bad = run("rules:\n - {id: M, path: requirements.memory, op: lte, value: 128Mi}\n"); + assert_eq!(bad.violations.len(), 1); + assert!(bad.violations[0].message.contains("256Mi")); + } + + #[test] + fn glob_in_and_equals() { + let r = run("rules:\n - {id: G, path: build.registry, op: matches, value: 'registry.corp/*'}\n - {id: I, path: runtime.preferred, op: in, value: [kube, podman]}\n - {id: N, path: runtime.preferred, op: not_equals, value: kubevirt}\n - {id: X, path: build.registry, op: matches, value: 'docker.io/*', message: only docker hub}\n"); + assert_eq!(r.violations.len(), 1); + assert!(r.violations[0].message.starts_with("only docker hub")); + } + + #[test] + fn when_clause_scopes_a_rule() { + let r = run("rules:\n - id: W\n path: requirements.memory\n op: lte\n value: 1Mi\n when: {path: runtime.preferred, op: equals, value: podman}\n"); + assert!(r.violations.is_empty()); + assert_eq!(r.passed, 1); + let r = run("rules:\n - id: W\n path: requirements.memory\n op: lte\n value: 1Mi\n when: {path: runtime.preferred, op: equals, value: kube}\n"); + assert_eq!(r.violations.len(), 1); + } + + #[test] + fn missing_value_fails_unless_skipped() { + let r = run("rules:\n - {id: A, path: requirements.gpu, op: lte, value: 2}\n"); + assert_eq!(r.violations.len(), 1); + assert!(r.violations[0].message.contains("missing")); + let r = run("rules:\n - {id: A, path: requirements.gpu, op: lte, value: 2, skip_if_missing: true}\n"); + assert!(r.violations.is_empty()); + } + + #[test] + fn type_mismatch_is_a_violation_not_a_panic() { + let r = run("rules:\n - {id: T, path: metadata.name, op: gt, value: 3}\n"); + assert_eq!(r.violations.len(), 1); + assert!(r.violations[0].message.contains("not a number")); + } + + #[test] + fn bad_rule_files_are_rejected() { + for (src, needle) in [ + ( + "rules:\n - {id: A, path: x, op: bogus}\n", + "invalid rule file", + ), + ( + "rules:\n - {id: A, path: x, op: exists, extra: 1}\n", + "invalid rule file", + ), + ( + "rules:\n - {id: A, path: x, op: exists}\n - {id: A, path: y, op: exists}\n", + "duplicate", + ), + ( + "rules:\n - {id: A, path: x, op: equals}\n", + "needs a `value`", + ), + ("rules:\n - {id: A, path: 'a[', op: exists}\n", "unclosed"), + ("rules:\n - {id: A, path: '', op: exists}\n", "empty path"), + ] { + let e = parse_rules(src).unwrap_err(); + assert!(e.contains(needle), "{src} -> {e}"); + } + } + + #[test] + fn output_formats_escape_and_carry_lines() { + let r = run( + "rules:\n - {id: 'A<1>', path: metadata.team, op: exists, message: 'needs '}\n", + ); + let x = r.render_junit("s&.yaml"); + assert!( + x.contains("<team>") && x.contains("s&.yaml") && x.contains("failures=\"1\"") + ); + let g = r.render_github("s.yaml"); + assert!(g.starts_with("::error file=s.yaml,line=")); + assert!(r + .render_text("s.yaml") + .contains("1 rule(s), 0 passed, 1 error(s)")); + } + + #[test] + fn glob_matcher() { + assert!(glob("a*c", "abbbc") && glob("a?c", "abc") && glob("*", "") && !glob("a?c", "ac")); + assert!(!glob("a*b", "abc")); + } +} diff --git a/tests/cli_spec_tools.rs b/tests/cli_spec_tools.rs index 7dbae206..2040e24b 100644 --- a/tests/cli_spec_tools.rs +++ b/tests/cli_spec_tools.rs @@ -235,3 +235,262 @@ fn spec_render_json_and_yaml() { .status .success()); } + +// --------------------------------------------------------------------------- +// lint --fix, spec-policy, spec-lock, manifest-check, spec-ci +// --------------------------------------------------------------------------- + +#[test] +fn lint_fix_rewrites_the_file_and_diff_changes_nothing() { + let d = tempfile::tempdir().unwrap(); + let typo = GOOD.replace("service: true", "servicetype: NodePort # keep"); + let spec = write(d.path(), "s.yaml", &typo); + + let o = aether(d.path(), &["--spec", &spec, "lint", "--diff"]); + assert!(o.status.success()); + assert!( + out(&o).contains("- servicetype: NodePort # keep"), + "{}", + out(&o) + ); + assert_eq!( + std::fs::read_to_string(&spec).unwrap(), + typo, + "--diff must not write" + ); + + let o = aether( + d.path(), + &["--spec", &spec, "lint", "--fix", "--deny-warnings"], + ); + assert!( + o.status.success(), + "{}{}", + out(&o), + String::from_utf8_lossy(&o.stderr) + ); + let fixed = std::fs::read_to_string(&spec).unwrap(); + assert!(fixed.contains("serviceType: NodePort # keep")); + assert!(String::from_utf8_lossy(&o.stderr).contains("applied 1 fix(es)")); + + let o = aether(d.path(), &["--spec", &spec, "lint", "--fix"]); + assert!( + !String::from_utf8_lossy(&o.stderr).contains("applied"), + "idempotent" + ); +} + +const RULES: &str = "rules:\n - {id: P1, path: metadata.team, op: exists, message: team required}\n - {id: P2, severity: warning, path: 'network.ports[*].containerPort', op: gte, value: 1024}\n"; + +#[test] +fn spec_policy_formats_and_exit_codes() { + let d = tempfile::tempdir().unwrap(); + let spec = write(d.path(), "s.yaml", GOOD); + let rules = write(d.path(), "r.yaml", RULES); + let o = aether(d.path(), &["--spec", &spec, "spec-policy", &rules]); + assert_eq!(o.status.code(), Some(1)); + let t = out(&o); + assert!( + t.contains("error[P1]") && t.contains("warning[P2]") && t.contains("2 rule(s), 0 passed"), + "{t}" + ); + + let o = aether( + d.path(), + &["--spec", &spec, "spec-policy", &rules, "--format", "json"], + ); + let v: serde_json::Value = serde_json::from_str(&out(&o)).expect("json"); + assert_eq!(v["errors"], 1); + assert_eq!(v["violations"][0]["path"], "metadata.team"); + + let o = aether( + d.path(), + &["--spec", &spec, "spec-policy", &rules, "--format", "github"], + ); + assert!(out(&o).contains("::error file=")); + let o = aether( + d.path(), + &["--spec", &spec, "spec-policy", &rules, "--format", "junit"], + ); + assert!(out(&o).starts_with(" = [ + "kube-deployment-demo-webserver.yaml", + "kube-deployment-k8s-advanced.yaml", + "kube-service-demo-webserver.yaml", + ] + .iter() + .map(|f| format!("{root}/tests/golden/{f}")) + .collect(); + let mut args = vec!["manifest-check", "--strict"]; + args.extend(files.iter().map(String::as_str)); + let o = aether(d.path(), &args); + assert!(o.status.success(), "{}", out(&o)); + assert!( + out(&o).contains("Summary: 3 valid, 0 invalid, 0 errors"), + "{}", + out(&o) + ); +} diff --git a/web/dashboard/package-lock.json b/web/dashboard/package-lock.json index eb055bac..08883f64 100644 --- a/web/dashboard/package-lock.json +++ b/web/dashboard/package-lock.json @@ -24,14 +24,14 @@ "react-router": "^8.5.2" }, "devDependencies": { - "@playwright/test": "^1.49.1", + "@playwright/test": "^1.65.1", + "@tailwindcss/postcss": "^4.3.5", "@types/react": "^19.3.0", "@types/react-dom": "^19.3.0", "@vitejs/plugin-react": "^6.3.0", "ajv": "^8.20.0", - "autoprefixer": "^10.4.20", "postcss": "^8.4.49", - "tailwindcss": "^3.4.17", + "tailwindcss": "^4.3.5", "typescript": "^7.0.2", "vite": "^8.3.8", "vitest": "^5.1.1", @@ -199,6 +199,17 @@ "@jridgewell/trace-mapping": "^0.3.24" } }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.3.tgz", @@ -290,44 +301,6 @@ "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2" } }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/@oxc-project/types": { "version": "0.156.0", "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz", @@ -641,6 +614,343 @@ "dev": true, "license": "MIT" }, + "node_modules/@tailwindcss/node": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.3.5.tgz", + "integrity": "sha512-yT53FzV4ke0cr/BguDxhWMpm5MJu1O2muzk+tKw6lKHjODAsYArBbWwFbJiaksfzFv1tpkO9QHGzmfs1hJT66g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/remapping": "^2.3.5", + "enhanced-resolve": "^5.24.5", + "jiti": "^2.7.0", + "lightningcss": "1.33.0", + "magic-string": "^1.1.0", + "source-map-js": "^1.2.1", + "tailwindcss": "4.3.5" + } + }, + "node_modules/@tailwindcss/oxide": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.3.5.tgz", + "integrity": "sha512-PynqGLZsZvwM9tqD/CUxkOIfyd6K5elZ2MooauzJryP/UqXYgi3yYbtt3N0Xe+MHV/eFKPFQCEfIKAqlAS1CBg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + }, + "optionalDependencies": { + "@tailwindcss/oxide-android-arm64": "4.3.5", + "@tailwindcss/oxide-darwin-arm64": "4.3.5", + "@tailwindcss/oxide-darwin-x64": "4.3.5", + "@tailwindcss/oxide-freebsd-x64": "4.3.5", + "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.5", + "@tailwindcss/oxide-linux-arm64-gnu": "4.3.5", + "@tailwindcss/oxide-linux-arm64-musl": "4.3.5", + "@tailwindcss/oxide-linux-x64-gnu": "4.3.5", + "@tailwindcss/oxide-linux-x64-musl": "4.3.5", + "@tailwindcss/oxide-wasm32-wasi": "4.3.5", + "@tailwindcss/oxide-win32-arm64-msvc": "4.3.5", + "@tailwindcss/oxide-win32-x64-msvc": "4.3.5" + } + }, + "node_modules/@tailwindcss/oxide-android-arm64": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.3.5.tgz", + "integrity": "sha512-Se0z5xMqcSQanJD1IYmO0cGpK3iv0fp3ZsIT7xRJZ1Da5PghvNoc46zz4jIQn+aan3dV9T8AermFNN9QPmsh0Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-darwin-arm64": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.3.5.tgz", + "integrity": "sha512-UPrgTDuUbvmqGMZuCnmI3FKee/tYKzKdp00/kuB4oSGB213VYg8QTdF7lVhnPoBXq/mIfJ+ILoBFqNOboWcMwQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-darwin-x64": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.3.5.tgz", + "integrity": "sha512-E+p7HEtjI0b8D7kbbWxH067cGui6d4c79COGko9fAPVE3rwc1E7ld2HFCbaG86AOGWS5VKQYqZOaf38ya4uxTQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-freebsd-x64": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.3.5.tgz", + "integrity": "sha512-yWEWcWyAG7rWOcTpJTjdhQ3pcaFY2h+0bqTRfgU3G2fz87ZU3AKdvdZKhslD+kyHnjBUWKvNdRYwIYC5dI1tIg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.3.5.tgz", + "integrity": "sha512-WmeVjtJhZlr+smpqcdR2kQkkn6arHIJnUIBxTO2EJcTLGY1ecVXNo2hbSn8xc0IH2aEtys936iMWKGyj0GaKnA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-arm64-gnu": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.3.5.tgz", + "integrity": "sha512-DTCSyucc6ShMp1QMqV5R94Z7xlgNgUzkGmFF1rL5HH2Qjy4eSmEqy+YLGkqqYvWa4sILtgrBt1JjRKbneQtiFQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-arm64-musl": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.3.5.tgz", + "integrity": "sha512-H9lsvO4x9E4nE4Hi8h7NHHw0O/kcVSu+iOyFHNGdYzazGgDjFHZbE6S3hQ8kMcbNXSBlMdNi67LV5EVqtpaJtw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-x64-gnu": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.3.5.tgz", + "integrity": "sha512-4uxQvtBvPuIdl13WfUBj9xMZHH14PtHZ8OZdtLmdyDtG66sCa1t599NZT+jagkUzRtWhuul1qRZQ1nAJscXN5g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-x64-musl": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.3.5.tgz", + "integrity": "sha512-0JQAzs7jwbA7O6+z/adU+Jk3AXwsu3npAhtr5escXS7TqEqWcaDV7qHuI+0Vy/KQRuVGnLQREcSJWYauyV3oqg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.3.5.tgz", + "integrity": "sha512-OJhFmlEfdzMr+avACdi40RPtnkW0B6hXyxL/8r+tnEHBWZji36CYRjEXrrvgBmaYsD3oEOBqwYFRKsYvzFe7Bw==", + "bundleDependencies": [ + "@napi-rs/wasm-runtime", + "@emnapi/core", + "@emnapi/runtime", + "@tybys/wasm-util", + "@emnapi/wasi-threads", + "tslib" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.11.3", + "@emnapi/runtime": "^1.11.3", + "@emnapi/wasi-threads": "^1.2.3", + "@napi-rs/wasm-runtime": "^1.2.2", + "@tybys/wasm-util": "^0.10.3", + "tslib": "^2.8.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/core": { + "version": "1.11.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.2.3", + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/runtime": { + "version": "1.11.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/wasi-threads": { + "version": "1.2.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": { + "version": "1.2.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.3", + "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.3" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@tybys/wasm-util": { + "version": "0.10.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/tslib": { + "version": "2.8.1", + "dev": true, + "inBundle": true, + "license": "0BSD", + "optional": true + }, + "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.5.tgz", + "integrity": "sha512-9o8jgthi+QE5eandnboiJT64VQfnIArfZzSTdgbhEK5aafdiu2jTW9Honi/mwYHxBZuH1vAC57IFyrh+0iK5Gg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-win32-x64-msvc": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.3.5.tgz", + "integrity": "sha512-XiKFfIy1RWe7qK4WqByxNW7Oz1/nkOy8o/BWhHminyV1PmpUd8Eedj5v2A8h2kpqeVlz6xRnwk9Fr/ZXNLcZfg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/postcss": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/postcss/-/postcss-4.3.5.tgz", + "integrity": "sha512-FAV37Tlx9wBiT/hkfgVD0Q6CWsP2oUX3lf28nrfjW8+ksILjnpuFulUqWDfNR4/ZiEHHDRBX8DUTzD1Rys687A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@alloc/quick-lru": "^5.2.0", + "@tailwindcss/node": "4.3.5", + "@tailwindcss/oxide": "4.3.5", + "postcss": "^8.5.25", + "tailwindcss": "4.3.5" + } + }, "node_modules/@tybys/wasm-util": { "version": "0.10.5", "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.5.tgz", @@ -1137,34 +1447,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/any-promise": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", - "dev": true, - "license": "MIT" - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/arg": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", - "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", - "dev": true, - "license": "MIT" - }, "node_modules/assertion-error": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", @@ -1175,195 +1457,16 @@ "node": ">=12" } }, - "node_modules/autoprefixer": { - "version": "10.7.0", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.7.0.tgz", - "integrity": "sha512-M4rWhYFPp8YSAfqLDT/wRN9trfe/Z/aZLPxrLQJUQRTPrChss2T+hmgaV5770J52bLuGOMzt6Hjl8tEb6YWv5Q==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/autoprefixer" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "browserslist": "^4.29.6", - "caniuse-lite": "^1.0.30001826", - "fraction.js": "^5.3.4", - "picocolors": "^1.1.1", - "postcss-value-parser": "^4.2.0" - }, - "bin": { - "autoprefixer": "bin/autoprefixer" - }, - "engines": { - "node": "^10 || ^12 || >=14" - }, - "peerDependencies": { - "postcss": "^8.1.0" - } - }, - "node_modules/baseline-browser-mapping": { - "version": "2.11.39", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.39.tgz", - "integrity": "sha512-Q9buOYhr2ggrEZpImICecZTJHCCd8yXkRUokFlUEQ8uiD6oP82F4W4jWnhOHZYV+wlvrC51V7Wy0ULyWjil5Wg==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "baseline-browser-mapping": "dist/cli.cjs" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/browserslist": { - "version": "4.29.6", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.6.tgz", - "integrity": "sha512-CmVVIQ3RVc5HxYEc9X84GvxK/C8C1wH8TlKAiO7uTxF8PDwt7r8t9Qk3J9NkMOVzX5O/HbLv3yzxZg9HPrnI9w==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "baseline-browser-mapping": "^2.11.37", - "caniuse-lite": "^1.0.30001826", - "electron-to-chromium": "^1.5.486", - "node-releases": "^2.0.64", - "update-browserslist-db": "^1.4.0" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/camelcase-css": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", - "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001827", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001827.tgz", - "integrity": "sha512-YWEDr46gSO81M8w6uPbaIy4++IXsirx2asUqvllNiD4BPf75ibxclUjWEqp8ObCenRv+UM2n5Y8xuRPT8V8FrQ==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "CC-BY-4.0" - }, - "node_modules/chai": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", - "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==", + "node_modules/chai": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", + "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==", "dev": true, "license": "MIT", "engines": { "node": ">=18" } }, - "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dev": true, - "license": "MIT", - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/codemirror": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-6.0.2.tgz", @@ -1379,16 +1482,6 @@ "@codemirror/view": "^6.0.0" } }, - "node_modules/commander": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", - "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, "node_modules/cookie-es": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-3.1.1.tgz", @@ -1418,35 +1511,18 @@ "node": ">=8" } }, - "node_modules/didyoumean": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", - "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/dlv": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", - "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", - "dev": true, - "license": "MIT" - }, - "node_modules/electron-to-chromium": { - "version": "1.5.492", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.492.tgz", - "integrity": "sha512-4uMs7omhajKiud0GqALLTazS/zyvHLTLmDWVTR+e6BnyJo5bSNrph/JoRWEFJJmY75ct9hCiSGsbFF9fLe5gDw==", - "dev": true, - "license": "ISC" - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "node_modules/enhanced-resolve": { + "version": "5.27.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.27.0.tgz", + "integrity": "sha512-Do6BB2xzlcc/odFg+XEYyneAx4T/WfywO71yw9ePS2tVfRsf7JVR4mUeELadIeHzixkzbG5DpluiEFPi2WGfYQ==", "dev": true, "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.3.3" + }, "engines": { - "node": ">= 0.4" + "node": ">=10.13.0" } }, "node_modules/es-module-lexer": { @@ -1456,16 +1532,6 @@ "dev": true, "license": "MIT" }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/estree-walker": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", @@ -1493,36 +1559,6 @@ "dev": true, "license": "MIT" }, - "node_modules/fast-glob": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", - "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.8" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-glob/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/fast-uri": { "version": "3.1.9", "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz", @@ -1540,41 +1576,22 @@ ], "license": "BSD-3-Clause" }, - "node_modules/fastq": { - "version": "1.20.3", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.3.tgz", - "integrity": "sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==", - "dev": true, - "license": "ISC", - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/fraction.js": { - "version": "5.3.4", - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz", - "integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==", + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", "dev": true, "license": "MIT", "engines": { - "node": "*" + "node": ">=12.0.0" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/rawify" + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } } }, "node_modules/fsevents": { @@ -1592,112 +1609,21 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/hasown": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", - "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", - "dev": true, - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "license": "MIT", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-core-module": { - "version": "2.18.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.18.0.tgz", - "integrity": "sha512-qyax9fgaKOEC4qK8WZn7Q4IcoZC9RC1O1fFxRcRTq/oMMkWT/uXpqpXa12kzWR409zAt1drYN9N9BO26UmBCmw==", - "dev": true, - "license": "MIT", - "dependencies": { - "hasown": "^2.0.4" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "node_modules/graceful-fs": { + "version": "4.2.12", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.12.tgz", + "integrity": "sha512-iuyGF2E4oafQfPsRrG2wtY2ILupMhvtdrhzrxB+0VcjsPpSPttpfYdjnGFGsTi5MaJFjI1jOKHPQ6UTbTj9TAw==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } + "license": "BlueOak-1.0.0" }, "node_modules/jiti": { - "version": "1.21.7", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz", - "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz", + "integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==", "dev": true, "license": "MIT", "bin": { - "jiti": "bin/jiti.js" + "jiti": "lib/jiti-cli.mjs" } }, "node_modules/json-schema-traverse": { @@ -1968,30 +1894,10 @@ "url": "https://opencollective.com/parcel" } }, - "node_modules/lilconfig": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.5.tgz", - "integrity": "sha512-aRAOI9Ia43ygL4o1EOmC/sc/0OFxrm7qcQngiIyWaqVnSnz932ybJ07zyCcgMNGSDP8Yxaf88Xj1zHEXmvQ4SA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/antonk52" - } - }, - "node_modules/lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true, - "license": "MIT" - }, "node_modules/lucide-react": { - "version": "1.78.0", - "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.78.0.tgz", - "integrity": "sha512-61NFdT5ZfAY8xs3LWKkB78GVeuiCcjYFEXeHWxWP+mQhP+UWLGsA9hJZQPtIyXRDhOvT8kgmWwAIyH5L7RIhAA==", + "version": "1.79.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.79.0.tgz", + "integrity": "sha512-MDHKxzUobPRyQgt4hHO1z+pUQJKYMvenh8qw+ndWQE0Wg+Hbjli/ZrkZXBGmRBrMvvqDRjkmQj0Z5RbeL/ogNw==", "license": "ISC", "peerDependencies": { "@types/react": "*", @@ -2013,99 +1919,23 @@ "@jridgewell/sourcemap-codec": "^1.6.0" } }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dev": true, - "license": "MIT", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mz": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", - "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "any-promise": "^1.0.0", - "object-assign": "^4.0.1", - "thenify-all": "^1.0.0" - } - }, - "node_modules/nanoid": { - "version": "3.3.20", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", - "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/node-releases": { - "version": "2.0.65", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.65.tgz", - "integrity": "sha512-PfvofsGQ+MiOQIPkX9fU8ELUWmy5zL74CdQaph/ismKszfFkfwXaw0cGiwbwym2hT9k5+mdyl8O5WQ1MD8EHmA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-hash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", - "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, "node_modules/obug": { @@ -2122,13 +1952,6 @@ "node": ">=12.20.0" } }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true, - "license": "MIT" - }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -2137,28 +1960,18 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", - "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", "engines": { - "node": ">=8.6" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/pirates": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", - "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, "node_modules/playwright": { "version": "1.65.1", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.65.1.tgz", @@ -2217,160 +2030,6 @@ "node": "^10 || ^12 || >=14" } }, - "node_modules/postcss-import": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz", - "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==", - "dev": true, - "license": "MIT", - "dependencies": { - "postcss-value-parser": "^4.0.0", - "read-cache": "^1.0.0", - "resolve": "^1.1.7" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "postcss": "^8.0.0" - } - }, - "node_modules/postcss-js": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.1.0.tgz", - "integrity": "sha512-oIAOTqgIo7q2EOwbhb8UalYePMvYoIeRY2YKntdpFQXNosSu3vLrniGgmH9OKs/qAkfoj5oB3le/7mINW1LCfw==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "camelcase-css": "^2.0.1" - }, - "engines": { - "node": "^12 || ^14 || >= 16" - }, - "peerDependencies": { - "postcss": "^8.4.21" - } - }, - "node_modules/postcss-load-config": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", - "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "lilconfig": "^3.1.1" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "jiti": ">=1.21.0", - "postcss": ">=8.0.9", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - }, - "postcss": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/postcss-nested": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.2.0.tgz", - "integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "postcss-selector-parser": "^6.1.1" - }, - "engines": { - "node": ">=12.0" - }, - "peerDependencies": { - "postcss": "^8.2.14" - } - }, - "node_modules/postcss-selector-parser": { - "version": "6.1.6", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.6.tgz", - "integrity": "sha512-BK87/Qgti3DIcgS2PaCVoteFIkjIFvCJBizZDIVSjdlFNg4Jv+SRqbN2JONb/qQUH4ZFqfXYF+izg15W2HVRvA==", - "dev": true, - "license": "MIT", - "dependencies": { - "util-deprecate": "^1.0.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/postcss-value-parser": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", - "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, "node_modules/react": { "version": "19.3.1", "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz", @@ -2422,26 +2081,6 @@ } } }, - "node_modules/read-cache": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.2.tgz", - "integrity": "sha512-/peqiBB/n07gQGLsWaHho3WfvUyRscw0gYTsEFMhrIe/nWLkYaf5SbKYjGYqtRV3aPwykJgF2VEMo1ac4bnsGA==", - "dev": true, - "license": "MIT" - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -2452,39 +2091,6 @@ "node": ">=0.10.0" } }, - "node_modules/resolve": { - "version": "1.22.14", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.14.tgz", - "integrity": "sha512-1ZjYvR9sbkiwC5+9QHetqW5HmA2pHRMaoupD01t2HlYnV/vydC2zPwLixhsMieSWVZt0JJRg5LVIk0Ow1D/TrA==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "is-core-module": "^2.18.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/reusify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", - "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", - "dev": true, - "license": "MIT", - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, "node_modules/rolldown": { "version": "1.2.19", "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.19.tgz", @@ -2520,30 +2126,6 @@ "@rolldown/binding-win32-x64-msvc": "1.2.19" } }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, "node_modules/scheduler": { "version": "0.28.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", @@ -2573,107 +2155,31 @@ "integrity": "sha512-WQ2llCZa9sZSkJA+aOwpg5DkfbAXFKGh//t3MRTBeruFiSBC+GXUmbBzrw3bXyboCWAbtCW9InDfBsXrRD/rAg==", "license": "MIT" }, - "node_modules/sucrase": { - "version": "3.35.1", - "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", - "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==", + "node_modules/tailwindcss": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.5.tgz", + "integrity": "sha512-FcQk9BuffmEHJP2G0XmB2SplU1aLTI7j07Kunk+U74Ny+XiWOtzXz9aujFZ/avntw1e2cOv/3PkgzflQ7gX2vQ==", "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.2", - "commander": "^4.0.0", - "lines-and-columns": "^1.1.6", - "mz": "^2.7.0", - "pirates": "^4.0.1", - "tinyglobby": "^0.2.11", - "ts-interface-checker": "^0.1.9" - }, - "bin": { - "sucrase": "bin/sucrase", - "sucrase-node": "bin/sucrase-node" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - } + "license": "MIT" }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "node_modules/tapable": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.4.tgz", + "integrity": "sha512-NHFiWnAbMJxNNpBwiO7jJVGDuqMxT9/oV8v57RR+fgBQShkJil5inGD8/xWy0hjLyHQyX1tu27QANhlz3KBqCg==", "dev": true, "license": "MIT", "engines": { - "node": ">= 0.4" + "node": ">=6" }, "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/tailwindcss": { - "version": "3.4.19", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz", - "integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@alloc/quick-lru": "^5.2.0", - "arg": "^5.0.2", - "chokidar": "^3.6.0", - "didyoumean": "^1.2.2", - "dlv": "^1.1.3", - "fast-glob": "^3.3.2", - "glob-parent": "^6.0.2", - "is-glob": "^4.0.3", - "jiti": "^1.21.7", - "lilconfig": "^3.1.3", - "micromatch": "^4.0.8", - "normalize-path": "^3.0.0", - "object-hash": "^3.0.0", - "picocolors": "^1.1.1", - "postcss": "^8.4.47", - "postcss-import": "^15.1.0", - "postcss-js": "^4.0.1", - "postcss-load-config": "^4.0.2 || ^5.0 || ^6.0", - "postcss-nested": "^6.2.0", - "postcss-selector-parser": "^6.1.2", - "resolve": "^1.22.8", - "sucrase": "^3.35.0" - }, - "bin": { - "tailwind": "lib/cli.js", - "tailwindcss": "lib/cli.js" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/thenify": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", - "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", - "dev": true, - "license": "MIT", - "dependencies": { - "any-promise": "^1.0.0" - } - }, - "node_modules/thenify-all": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", - "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", - "dev": true, - "license": "MIT", - "dependencies": { - "thenify": ">= 3.1.0 < 4" - }, - "engines": { - "node": ">=0.8" + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, "node_modules/tinybench": { - "version": "6.2.4", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.4.tgz", - "integrity": "sha512-SQ52jEncXxbMCzJuY2A/jGIbbAu6NYsBWW7grz2pNE+EnzQdoGaoBfpk4qC/opE7qiUcGmGgaGIz5EoHdS1O9w==", + "version": "6.2.5", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.5.tgz", + "integrity": "sha512-b/8GRMdnY4cqkfCLyaFpTGIv1qwfi3oT0mWaepwT++6Z/ZrYehNfZZ2JDKVLKGhNoEkS3IIB1ELtCT0XS5DtOA==", "dev": true, "license": "MIT", "engines": { @@ -2707,57 +2213,6 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, - "node_modules/tinyglobby/node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/tinyglobby/node_modules/picomatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", - "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/ts-interface-checker": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", - "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", - "dev": true, - "license": "Apache-2.0" - }, "node_modules/tslib": { "version": "2.9.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", @@ -2801,44 +2256,6 @@ "@typescript/typescript-win32-x64": "7.0.2" } }, - "node_modules/update-browserslist-db": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.4.0.tgz", - "integrity": "sha512-WPJuOnjI9FWDct4fB+ej4Mz8opLaw5CDcZ2t44tFZ0vIQVYWzBhWR3mkixuUj/A7+vY4V9+ApOZ2YYLwdgq46w==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "escalade": "^3.2.0", - "picocolors": "^1.1.1" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true, - "license": "MIT" - }, "node_modules/vite": { "version": "8.3.8", "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.8.tgz", @@ -2917,19 +2334,6 @@ } } }, - "node_modules/vite/node_modules/picomatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", - "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/vitest": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.1.1.tgz", @@ -3013,19 +2417,6 @@ } } }, - "node_modules/vitest/node_modules/picomatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", - "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/w3c-keyname": { "version": "2.2.8", "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", diff --git a/web/dashboard/package.json b/web/dashboard/package.json index aad20675..a954fa32 100644 --- a/web/dashboard/package.json +++ b/web/dashboard/package.json @@ -29,14 +29,14 @@ "react-router": "^8.5.2" }, "devDependencies": { - "@playwright/test": "^1.49.1", + "@playwright/test": "^1.65.1", "@types/react": "^19.3.0", "@types/react-dom": "^19.3.0", "@vitejs/plugin-react": "^6.3.0", "ajv": "^8.20.0", - "autoprefixer": "^10.4.20", "postcss": "^8.4.49", - "tailwindcss": "^3.4.17", + "tailwindcss": "^4.3.5", + "@tailwindcss/postcss": "^4.3.5", "typescript": "^7.0.2", "vite": "^8.3.8", "vitest": "^5.1.1", diff --git a/web/dashboard/postcss.config.js b/web/dashboard/postcss.config.js index 160a66b0..52dc4570 100644 --- a/web/dashboard/postcss.config.js +++ b/web/dashboard/postcss.config.js @@ -3,7 +3,6 @@ export default { plugins: { - tailwindcss: {}, - autoprefixer: {}, + '@tailwindcss/postcss': {}, }, }; diff --git a/web/dashboard/src/components/CommandCenterBriefing.tsx b/web/dashboard/src/components/CommandCenterBriefing.tsx index fb80fbf9..99b02885 100644 --- a/web/dashboard/src/components/CommandCenterBriefing.tsx +++ b/web/dashboard/src/components/CommandCenterBriefing.tsx @@ -215,7 +215,7 @@ export default function CommandCenterBriefing({ onNavigate, refreshKey = 0, clus {topCapacity ? (
@@ -242,7 +242,7 @@ export default function CommandCenterBriefing({ onNavigate, refreshKey = 0, clus {briefing.issues.slice(0, 4).map((issue, i) => (
{issue.title}
{issue.detail}
diff --git a/web/dashboard/src/components/CommandCenterIntentSla.tsx b/web/dashboard/src/components/CommandCenterIntentSla.tsx index abd803d8..3efa3467 100644 --- a/web/dashboard/src/components/CommandCenterIntentSla.tsx +++ b/web/dashboard/src/components/CommandCenterIntentSla.tsx @@ -43,7 +43,7 @@ export default function CommandCenterIntentSla({ refreshKey = 0 }: CommandCenter {report.breaches.slice(0, 4).map((b) => (
  • {b.workload} — {b.current} vs target {b.target}
  • diff --git a/web/dashboard/src/components/CommandCenterNextActions.tsx b/web/dashboard/src/components/CommandCenterNextActions.tsx index 14990c8f..11b604e5 100644 --- a/web/dashboard/src/components/CommandCenterNextActions.tsx +++ b/web/dashboard/src/components/CommandCenterNextActions.tsx @@ -144,7 +144,7 @@ export default function CommandCenterNextActions({
    {actions.length === 0 ? ( -
    +

    Queue is clear

    diff --git a/web/dashboard/src/components/CommandPalette.tsx b/web/dashboard/src/components/CommandPalette.tsx index af2914b5..5cbc941d 100644 --- a/web/dashboard/src/components/CommandPalette.tsx +++ b/web/dashboard/src/components/CommandPalette.tsx @@ -1144,7 +1144,7 @@ export default function CommandPalette({ aria-modal="true" aria-label="Command palette" > -

    +
    setQuery(e.target.value)} onKeyDown={handleKeyDown} placeholder="Search pages, workloads, and actions…" - className="flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-subtle" + className="flex-1 bg-transparent text-sm text-foreground outline-hidden placeholder:text-subtle" autoComplete="off" /> - ESC + ESC
    diff --git a/web/dashboard/src/components/CopilotRail.tsx b/web/dashboard/src/components/CopilotRail.tsx index de976343..b920f784 100644 --- a/web/dashboard/src/components/CopilotRail.tsx +++ b/web/dashboard/src/components/CopilotRail.tsx @@ -228,7 +228,7 @@ export default function CopilotRail({ collapsed: controlledCollapsed, onCollapse
    {messages.length === 0 ? (
    -
    +

    Not a chatbot — an infrastructure co-pilot. Ask about health, cost, migrations, security, or capacity. @@ -269,7 +269,7 @@ export default function CopilotRail({ collapsed: controlledCollapsed, onCollapse ))} {pending.length > 0 ? ( -

    +

    Awaiting confirmation

    diff --git a/web/dashboard/src/components/DestructiveConfirmDialog.tsx b/web/dashboard/src/components/DestructiveConfirmDialog.tsx index a0611c0a..88f088a2 100644 --- a/web/dashboard/src/components/DestructiveConfirmDialog.tsx +++ b/web/dashboard/src/components/DestructiveConfirmDialog.tsx @@ -49,7 +49,7 @@ export default function DestructiveConfirmDialog({ placeholder={resourceName} onChange={(e) => setTyped(e.target.value)} onKeyDown={(e) => e.key === 'Enter' && commit()} - className="w-full rounded-lg border border-rule-strong bg-surface px-3 py-2 font-mono text-[12.5px] text-foreground outline-none focus-visible:ring-2 focus-visible:ring-danger/40" + className="w-full rounded-lg border border-rule-strong bg-surface px-3 py-2 font-mono text-[12.5px] text-foreground outline-hidden focus-visible:ring-2 focus-visible:ring-danger/40" />
    diff --git a/web/dashboard/src/components/UnifiedFabricPanel.tsx b/web/dashboard/src/components/UnifiedFabricPanel.tsx index 8aa8cee1..6d2034e1 100644 --- a/web/dashboard/src/components/UnifiedFabricPanel.tsx +++ b/web/dashboard/src/components/UnifiedFabricPanel.tsx @@ -47,7 +47,7 @@ export default function UnifiedFabricPanel() {
      {(report?.nodes ?? []).slice(0, 12).map((n) => ( -
    • +
    • {n.label} diff --git a/web/dashboard/src/components/VersionRefreshBanner.tsx b/web/dashboard/src/components/VersionRefreshBanner.tsx index 04499431..772d3a8c 100644 --- a/web/dashboard/src/components/VersionRefreshBanner.tsx +++ b/web/dashboard/src/components/VersionRefreshBanner.tsx @@ -75,7 +75,7 @@ export default function VersionRefreshBanner() { @@ -1012,7 +1012,7 @@ export default function WorkloadDetail({ data-testid="workload-shell-button-denied" disabled title="Exec requires Operator or Admin role" - className="px-3 py-1.5 text-sm font-medium rounded bg-slate-600/20 text-subtle border border-slate-600/30 cursor-not-allowed" + className="px-3 py-1.5 text-sm font-medium rounded-sm bg-slate-600/20 text-subtle border border-slate-600/30 cursor-not-allowed" > Exec @@ -1022,7 +1022,7 @@ export default function WorkloadDetail({ key={action} onClick={() => (action === 'delete' ? setConfirmDelete(true) : handleAction(action))} disabled={!!actionLoading} - className={`px-3 py-1.5 text-sm font-medium rounded transition-colors ${ + className={`px-3 py-1.5 text-sm font-medium rounded-sm transition-colors ${ action === 'delete' ? 'bg-danger/20 text-danger hover:bg-danger/40 border border-danger/30' : action === 'rollback' @@ -1037,7 +1037,7 @@ export default function WorkloadDetail({ @@ -1072,7 +1072,7 @@ export default function WorkloadDetail({ setShellWantConnect(false); setShellOpen(true); }} - className="px-3 py-1.5 text-sm font-medium rounded bg-success/20 text-success hover:bg-success/40 border border-success/30 transition-colors" + className="px-3 py-1.5 text-sm font-medium rounded-sm bg-success/20 text-success hover:bg-success/40 border border-success/30 transition-colors" > Exec @@ -1082,7 +1082,7 @@ export default function WorkloadDetail({ data-testid="workload-shell-button-denied" disabled title="Exec requires Operator or Admin role" - className="px-3 py-1.5 text-sm font-medium rounded bg-slate-600/20 text-subtle border border-slate-600/30 cursor-not-allowed" + className="px-3 py-1.5 text-sm font-medium rounded-sm bg-slate-600/20 text-subtle border border-slate-600/30 cursor-not-allowed" > Exec @@ -1090,7 +1090,7 @@ export default function WorkloadDetail({ @@ -1107,7 +1107,7 @@ export default function WorkloadDetail({ void handleAction('scale', next); }} disabled={!!actionLoading} - className="rounded border glass-divider glass-inset-surface px-2 py-1.5 text-sm text-muted hover:bg-white/[0.08] disabled:opacity-50" + className="rounded-sm border glass-divider glass-inset-surface px-2 py-1.5 text-sm text-muted hover:bg-white/[0.08] disabled:opacity-50" title="Scale down by 1" data-testid="workload-scale-down" > @@ -1118,7 +1118,7 @@ export default function WorkloadDetail({ min={0} value={replicasInput} onChange={(e) => setReplicasInput(e.target.value)} - className="w-16 rounded border glass-divider glass-inset-surface px-2 py-1.5 text-sm text-foreground text-center" + className="w-16 rounded-sm border glass-divider glass-inset-surface px-2 py-1.5 text-sm text-foreground text-center" /> @@ -1150,7 +1150,7 @@ export default function WorkloadDetail({ workload: workload.name, q: `Diagnose ${workload.kind ?? 'workload'} ${clusterResourceName} in ${workload.namespace ?? 'default'}`, })} - className="px-3 py-1.5 text-sm font-medium rounded bg-lavender/20 text-lavender hover:bg-lavender/30 border border-lavender/30 transition-colors" + className="px-3 py-1.5 text-sm font-medium rounded-sm bg-lavender/20 text-lavender hover:bg-lavender/30 border border-lavender/30 transition-colors" data-testid="workload-diagnose-link" > Diagnose @@ -1163,7 +1163,7 @@ export default function WorkloadDetail({ kind: workload.kind, workload: workload.name, })} - className="px-3 py-1.5 text-sm font-medium rounded glass-inset-surface text-muted hover:bg-white/[0.08] border glass-divider transition-colors" + className="px-3 py-1.5 text-sm font-medium rounded-sm glass-inset-surface text-muted hover:bg-white/[0.08] border glass-divider transition-colors" data-testid="workload-open-clusters-link" > Open in Clusters @@ -1172,7 +1172,7 @@ export default function WorkloadDetail({ @@ -1249,7 +1249,7 @@ export default function WorkloadDetail({ void copyToClipboard(pod.name); toast(`Copied ${pod.name}`, 'success'); }} - className="rounded px-1.5 py-0.5 text-[11px] text-subtle transition-colors hover:bg-white/5 hover:text-foreground" + className="rounded-sm px-1.5 py-0.5 text-[11px] text-subtle transition-colors hover:bg-white/5 hover:text-foreground" title="Copy pod name" > Copy @@ -1264,7 +1264,7 @@ export default function WorkloadDetail({ setShellPod(pod.name); setShellOpen(true); }} - className="rounded px-1.5 py-0.5 text-[11px] text-subtle transition-colors hover:bg-success/10 hover:text-success" + className="rounded-sm px-1.5 py-0.5 text-[11px] text-subtle transition-colors hover:bg-success/10 hover:text-success" title="Exec into this pod" data-testid={`workload-pod-shell-${pod.name}`} > @@ -1276,7 +1276,7 @@ export default function WorkloadDetail({ type="button" onClick={() => void handleDeletePod(pod.name)} disabled={!!actionLoading} - className="rounded px-1.5 py-0.5 text-[11px] text-subtle transition-colors hover:bg-danger/10 hover:text-danger disabled:opacity-50" + className="rounded-sm px-1.5 py-0.5 text-[11px] text-subtle transition-colors hover:bg-danger/10 hover:text-danger disabled:opacity-50" title="Delete pod (controller recreates it)" data-testid={`workload-pod-delete-${pod.name}`} > @@ -1358,7 +1358,7 @@ export default function WorkloadDetail({
      {(observedImages.length > 0 ? observedImages : containerResources.map((c) => c.image).filter(Boolean) as string[]).map((image) => ( - {image} + {image} ))}
      @@ -1471,7 +1471,7 @@ export default function WorkloadDetail({

      Recent cluster events

      {clusterEvents.map((event, index) => ( -
      +
      {event.type_} @@ -1679,7 +1679,7 @@ export default function WorkloadDetail({ setCopiedCmd('all'); window.setTimeout(() => setCopiedCmd(''), 1500); }} - className="rounded px-2 py-1 text-[11px] font-normal normal-case tracking-normal text-muted transition-colors hover:bg-white/5 hover:text-primary" + className="rounded-sm px-2 py-1 text-[11px] font-normal normal-case tracking-normal text-muted transition-colors hover:bg-white/5 hover:text-primary" data-testid="workload-kubectl-copy-all" > {copiedCmd === 'all' ? 'Copied all' : 'Copy all'} @@ -1704,7 +1704,7 @@ export default function WorkloadDetail({ setCopiedCmd(cmd.label); window.setTimeout(() => setCopiedCmd(''), 1500); }} - className="shrink-0 rounded px-2 py-1 text-[11px] text-muted transition-colors hover:bg-white/5 hover:text-primary" + className="shrink-0 rounded-sm px-2 py-1 text-[11px] text-muted transition-colors hover:bg-white/5 hover:text-primary" > {copiedCmd === cmd.label ? 'Copied' : 'Copy'} @@ -1757,7 +1757,7 @@ export default function WorkloadDetail({ type="button" onClick={() => void rollbackSnapshot(snap.version)} disabled={!!actionLoading} - className="rounded border border-warning/40 px-2 py-1 text-xs text-warning hover:bg-warning/10 disabled:opacity-50" + className="rounded-sm border border-warning/40 px-2 py-1 text-xs text-warning hover:bg-warning/10 disabled:opacity-50" > {actionLoading === `rollback-v${snap.version}` ? 'Rolling back…' : 'Rollback'} @@ -1888,7 +1888,7 @@ export default function WorkloadDetail({ : 'No drift detected'}
      {((driftData as Record).drifts as Array>)?.map((d, i: number) => ( -
      +
      [{d.severity}] @@ -1981,7 +1981,7 @@ export default function WorkloadDetail({
      Exec — {shellPod || workload.name}
      -
      +
      {shellConnected ? 'Connected' : shellWantConnect ? 'Connecting…' : 'Disconnected'}
      {shellPods.length > 0 ? ( @@ -2063,7 +2063,7 @@ export default function WorkloadDetail({ setShellWantConnect(true); }} disabled={shellResolving || !shellPod || !selectedPodExecReady} - className="text-xs px-3 py-1 rounded border border-success bg-success/20 text-success hover:bg-success/30 disabled:opacity-50" + className="text-xs px-3 py-1 rounded-sm border border-success bg-success/20 text-success hover:bg-success/30 disabled:opacity-50" data-testid="workload-shell-connect" > Connect @@ -2077,7 +2077,7 @@ export default function WorkloadDetail({ shellTermRef.current?.writeln('\r\n[aether] Disconnected'); }} disabled={!shellConnected && !shellWantConnect} - className="text-xs px-3 py-1 rounded glass-inset-surface glass-inset-hover text-muted disabled:opacity-50" + className="text-xs px-3 py-1 rounded-sm glass-inset-surface glass-inset-hover text-muted disabled:opacity-50" data-testid="workload-shell-disconnect" > Disconnect @@ -2087,21 +2087,21 @@ export default function WorkloadDetail({ onClick={() => { void copyToClipboard(shellTermRef.current?.getBufferText() ?? ''); }} - className="text-xs px-3 py-1 rounded glass-inset-surface glass-inset-hover text-muted" + className="text-xs px-3 py-1 rounded-sm glass-inset-surface glass-inset-hover text-muted" > Copy @@ -2140,7 +2140,7 @@ export default function WorkloadDetail({ setShellWantConnect(false); setActiveTab('logs'); }} - className="rounded border border-warning/40 bg-warning/15 px-2 py-0.5 text-xs text-warning hover:bg-warning/25" + className="rounded-sm border border-warning/40 bg-warning/15 px-2 py-0.5 text-xs text-warning hover:bg-warning/25" data-testid="workload-shell-open-logs" > Open Logs diff --git a/web/dashboard/src/components/YamlInput.tsx b/web/dashboard/src/components/YamlInput.tsx index 50df95e4..5792ae33 100644 --- a/web/dashboard/src/components/YamlInput.tsx +++ b/web/dashboard/src/components/YamlInput.tsx @@ -121,7 +121,7 @@ export default function YamlInput({ const toolbarBtn = 'quick-link-chip text-xs font-medium disabled:cursor-not-allowed disabled:opacity-40'; const textareaClass = - 'glass-input font-mono leading-relaxed text-muted placeholder-slate-600 resize-y p-4'; + 'glass-input font-mono leading-relaxed text-muted placeholder:text-slate-600 resize-y p-4'; return (
      diff --git a/web/dashboard/src/components/ZyraActionCard.tsx b/web/dashboard/src/components/ZyraActionCard.tsx index a13403d4..1d46367b 100644 --- a/web/dashboard/src/components/ZyraActionCard.tsx +++ b/web/dashboard/src/components/ZyraActionCard.tsx @@ -13,7 +13,7 @@ interface ZyraActionCardProps { export default function ZyraActionCard({ title, summary, actions = [], testId }: ZyraActionCardProps) { return (
      diff --git a/web/dashboard/src/components/ZyraRail.tsx b/web/dashboard/src/components/ZyraRail.tsx index f2d2db44..e4602ab8 100644 --- a/web/dashboard/src/components/ZyraRail.tsx +++ b/web/dashboard/src/components/ZyraRail.tsx @@ -228,7 +228,7 @@ export default function ZyraRail({ collapsed: controlledCollapsed, onCollapsedCh
      {messages.length === 0 ? (
      -
      +

      Not a chatbot — an infrastructure co-pilot. Ask about health, cost, migrations, security, or capacity. @@ -269,7 +269,7 @@ export default function ZyraRail({ collapsed: controlledCollapsed, onCollapsedCh ))} {pending.length > 0 ? ( -

      +

      Awaiting confirmation

      diff --git a/web/dashboard/src/components/layout/AetherSidebar/AetherSidebar.tsx b/web/dashboard/src/components/layout/AetherSidebar/AetherSidebar.tsx index e281a03f..5a9f422d 100644 --- a/web/dashboard/src/components/layout/AetherSidebar/AetherSidebar.tsx +++ b/web/dashboard/src/components/layout/AetherSidebar/AetherSidebar.tsx @@ -56,7 +56,7 @@ function SidebarLink({ aria-current={active ? 'page' : undefined} onClick={() => onNavigate(item.view)} className={cn( - 'relative flex w-full items-center gap-2 rounded-[var(--radius-md)] px-2 py-1.5 text-[13px] leading-none tracking-[-0.005em] transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50', + 'relative flex w-full items-center gap-2 rounded-[var(--radius-md)] px-2 py-1.5 text-[13px] leading-none tracking-[-0.005em] transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/50', active ? 'glass-fill font-medium text-primary shadow-card' : 'text-muted hover:bg-hover hover:text-foreground', className, )} @@ -86,7 +86,7 @@ function SidebarSectionBlock({ type="button" aria-expanded={expanded} onClick={onToggleExpanded} - className="flex w-full items-center gap-1 px-2 py-1 text-left text-[11px] font-semibold uppercase tracking-[var(--tracking-eyebrow)] text-subtle hover:text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50" + className="flex w-full items-center gap-1 px-2 py-1 text-left text-[11px] font-semibold uppercase tracking-[var(--tracking-eyebrow)] text-subtle hover:text-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/50" > {section.label} @@ -155,7 +155,7 @@ export default function AetherSidebar({ return (