From 38a4dcccab34deaccc74232710553cc66ef8e54a Mon Sep 17 00:00:00 2001 From: Christopher Guay Date: Mon, 9 Nov 2026 11:22:21 -0500 Subject: [PATCH 01/10] Package shared formatters and configuration with treefmt-nix --- .gitignore | 2 + .mise/config.toml | 1 + .mise/tasks/format/_default | 4 + .mise/tasks/format/check | 4 + .mise/tasks/test | 4 + README.md | 199 +++--- bin/format | 42 +- configs/oxfmt-generated.json | 4 - configs/oxfmt-toolshed.json | 9 - configs/oxfmt.json | 9 - configs/prettier-backend.json | 8 - configs/prettier-electron-updater.yaml | 6 - configs/prettier-infrastructure.json | 10 - configs/prettier.json | 9 - configs/ruff-analytics.toml | 3 - configs/ruff-caido-private.toml | 2 - configs/ruff.toml | 2 - configs/rustfmt.toml | 11 - configs/rustfmt/cloud-backend.toml | 3 - configs/rustfmt/cogfer.toml | 3 - configs/rustfmt/convert.toml | 1 - configs/rustfmt/proxy-backend.toml | 13 - configs/rustfmt/sqlite-rs.toml | 4 - configs/rustfmt/student-backend.toml | 3 - configs/rustfmt/sync-backend.toml | 3 - .../0001-evaluate-treefmt-nix-in-formatter.md | 25 + docs/audit.md | 2 + examples/github-actions.yml | 13 +- flake.lock | 69 +++ flake.nix | 170 +++++ mise.analytics-ingestion.toml | 2 - mise.caido-private.toml | 2 - mise.cloud-backend.toml | 2 - mise.mise-toolshed.toml | 2 - mise.proxy-desktop.toml | 2 - mise.proxy-e2e.toml | 2 - mise.proxy-extension.toml | 2 - mise.toml | 23 - nix/excludes.nix | 27 + nix/profiles.nix | 583 ++++++++++++++++++ nix/settings.nix | 146 +++++ profiles/analytics-ingestion.toml | 8 - profiles/analytics.toml | 8 - profiles/caido-private.toml | 8 - profiles/cloud-backend.toml | 14 - profiles/cloud-cron.toml | 8 - profiles/cogfer.toml | 9 - profiles/convert.toml | 9 - profiles/electron-updater.toml | 8 - profiles/infrastructure-yaml.toml | 8 - profiles/infrastructure.toml | 8 - profiles/internal-services.toml | 15 - profiles/mise-toolshed.toml | 19 - profiles/nix.toml | 8 - profiles/postgres.toml | 8 - profiles/proxy-backend.toml | 14 - profiles/proxy-desktop.toml | 8 - profiles/proxy-e2e.toml | 9 - profiles/proxy-extension.toml | 8 - profiles/proxy-frontend.toml | 15 - profiles/proxy-playground.toml | 8 - profiles/secrets-sync.toml | 8 - profiles/self.toml | 9 - profiles/sqlite-rs.toml | 9 - profiles/student-backend.toml | 9 - profiles/sync-backend.toml | 9 - tests/test_config.py | 315 ++++++---- treefmt.nix | 104 ++++ treefmt.toml | 62 -- 69 files changed, 1488 insertions(+), 668 deletions(-) create mode 100644 .mise/config.toml create mode 100755 .mise/tasks/format/_default create mode 100755 .mise/tasks/format/check create mode 100755 .mise/tasks/test delete mode 100644 configs/oxfmt-generated.json delete mode 100644 configs/oxfmt-toolshed.json delete mode 100644 configs/oxfmt.json delete mode 100644 configs/prettier-backend.json delete mode 100644 configs/prettier-electron-updater.yaml delete mode 100644 configs/prettier-infrastructure.json delete mode 100644 configs/prettier.json delete mode 100644 configs/ruff-analytics.toml delete mode 100644 configs/ruff-caido-private.toml delete mode 100644 configs/ruff.toml delete mode 100644 configs/rustfmt.toml delete mode 100644 configs/rustfmt/cloud-backend.toml delete mode 100644 configs/rustfmt/cogfer.toml delete mode 100644 configs/rustfmt/convert.toml delete mode 100644 configs/rustfmt/proxy-backend.toml delete mode 100644 configs/rustfmt/sqlite-rs.toml delete mode 100644 configs/rustfmt/student-backend.toml delete mode 100644 configs/rustfmt/sync-backend.toml create mode 100644 docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 mise.analytics-ingestion.toml delete mode 100644 mise.caido-private.toml delete mode 100644 mise.cloud-backend.toml delete mode 100644 mise.mise-toolshed.toml delete mode 100644 mise.proxy-desktop.toml delete mode 100644 mise.proxy-e2e.toml delete mode 100644 mise.proxy-extension.toml delete mode 100644 mise.toml create mode 100644 nix/excludes.nix create mode 100644 nix/profiles.nix create mode 100644 nix/settings.nix delete mode 100644 profiles/analytics-ingestion.toml delete mode 100644 profiles/analytics.toml delete mode 100644 profiles/caido-private.toml delete mode 100644 profiles/cloud-backend.toml delete mode 100644 profiles/cloud-cron.toml delete mode 100644 profiles/cogfer.toml delete mode 100644 profiles/convert.toml delete mode 100644 profiles/electron-updater.toml delete mode 100644 profiles/infrastructure-yaml.toml delete mode 100644 profiles/infrastructure.toml delete mode 100644 profiles/internal-services.toml delete mode 100644 profiles/mise-toolshed.toml delete mode 100644 profiles/nix.toml delete mode 100644 profiles/postgres.toml delete mode 100644 profiles/proxy-backend.toml delete mode 100644 profiles/proxy-desktop.toml delete mode 100644 profiles/proxy-e2e.toml delete mode 100644 profiles/proxy-extension.toml delete mode 100644 profiles/proxy-frontend.toml delete mode 100644 profiles/proxy-playground.toml delete mode 100644 profiles/secrets-sync.toml delete mode 100644 profiles/self.toml delete mode 100644 profiles/sqlite-rs.toml delete mode 100644 profiles/student-backend.toml delete mode 100644 profiles/sync-backend.toml create mode 100644 treefmt.nix delete mode 100644 treefmt.toml diff --git a/.gitignore b/.gitignore index 32fe46a..a585b8d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ node_modules/ __pycache__/ .DS_Store +result +result-* diff --git a/.mise/config.toml b/.mise/config.toml new file mode 100644 index 0000000..06fb201 --- /dev/null +++ b/.mise/config.toml @@ -0,0 +1 @@ +# Optional task runner. The locked Nix flake supplies formatter packages. diff --git a/.mise/tasks/format/_default b/.mise/tasks/format/_default new file mode 100755 index 0000000..0bccb23 --- /dev/null +++ b/.mise/tasks/format/_default @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +#MISE description="Format this repository" +set -eu +exec nix fmt diff --git a/.mise/tasks/format/check b/.mise/tasks/format/check new file mode 100755 index 0000000..965cea2 --- /dev/null +++ b/.mise/tasks/format/check @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +#MISE description="Check formatting in a disposable Nix build" +set -eu +exec nix flake check diff --git a/.mise/tasks/test b/.mise/tasks/test new file mode 100755 index 0000000..9df7e89 --- /dev/null +++ b/.mise/tasks/test @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +#MISE description="Check Nix configuration, formatting and real formatter routing" +set -eu +exec nix flake check diff --git a/README.md b/README.md index 6fb9591..9318fc1 100644 --- a/README.md +++ b/README.md @@ -1,122 +1,163 @@ # Caido formatter -Shared treefmt configuration for Caido projects, with tools managed by mise. +Shared formatting for Caido projects, packaged and configured with [treefmt-nix](https://github.com/numtide/treefmt-nix). -## Usage +Nix supplies the formatter binaries, generates their JSON/TOML settings, and generates treefmt's configuration. Every command points into the Nix store. A caller's npm packages, mise tool versions, or rustup default cannot change the chosen formatters. -Clone this private repository alongside your projects. From this checkout: +## Run a formatter -```sh -mise install +Requires Nix or Lix with `nix-command` and `flakes` enabled. From this checkout: -# Format a project using its existing conventions. -mise exec -- bin/format proxy-frontend --root ../proxy-frontend -mise exec -- bin/format proxy-backend --root ../proxy-backend +```sh +# Format this repository's Nix, Python, shell, JSON, YAML and Markdown. +nix fmt -# Desktop uses an older Prettier version; the mise environment preserves it. -mise --env proxy-desktop exec -- bin/format proxy-desktop --root ../proxy-desktop +# Format another project with its audited preset. +bin/format proxy-backend --root ../proxy-backend +bin/format proxy-frontend --root ../proxy-frontend +bin/format analytics --root ../analytics +bin/format infrastructure --root ../infrastructure -# CI: fail if formatting changes a file. -mise exec -- bin/format proxy-backend --root ../proxy-backend --ci +# Check formatting in a disposable CI checkout. +bin/format proxy-backend --root ../proxy-backend --ci -# Format selected files. Paths are relative to the target root. -mise exec -- bin/format proxy-frontend --root ../proxy-frontend packages/ui/src/App.vue +# Format selected files, relative to the target root. +bin/format proxy-frontend --root ../proxy-frontend packages/ui/src/App.vue ``` -`treefmt --ci` **can rewrite files** before returning a failure. Run it in a CI checkout or on a clean working tree. Use the formatter's own check command when a strictly read-only check is required. +No separate formatter installation step is needed. Nix downloads or builds the selected profile's dependencies on first use and reuses them afterward. The launcher also works from a consuming project: `/path/to/formatter/bin/format proxy-backend` targets the current directory. + +Each preset is a Nix app and package. You can bypass the convenience launcher: -When tools are already supplied by a project's mise environment, install treefmt there and invoke `/path/to/formatter/bin/format ` from the project root. The script uses executables on `PATH`; it does not install tools, change their versions, or load environment files itself. Use the version overrides in `mise..toml` when running from this checkout. +```sh +# Run from proxy-backend's root; treefmt detects that Git worktree. +nix run /path/to/formatter#proxy-backend -- . + +# Explicit target root from another directory. +nix run .#proxy-backend -- --tree-root ../proxy-backend --working-dir ../proxy-backend -## Shared defaults +# Build a standalone treefmt wrapper with all dependencies and settings. +nix build .#proxy-backend +./result/bin/treefmt --tree-root ../proxy-backend --working-dir ../proxy-backend +``` -`treefmt.toml` contains entries for every formatter family found in the audit: +`--ci` can rewrite files before returning a failure. `nix flake check` checks this repository's formatting in a disposable copy and does not modify your checkout. -| Formatter | Files | Default selection | -| --------- | -------------------------------------------------------------------------- | ---------------------------------------------- | -| Oxfmt | TypeScript, JavaScript, Vue, HTML, CSS/SCSS, JSON, GraphQL, Markdown, YAML | Yes | -| rustfmt | Rust, using nightly-2026-04-06 and edition 2024 | Yes | -| Ruff | Python, stubs, notebooks | Yes | -| OpenTofu | Terraform/OpenTofu configuration and variable files | Yes | -| shfmt | Shell files with `.sh`, `.bash`, or `.bats` extensions | Yes | -| StyLua | Lua and Luau | Yes | -| Prettier | Web code and text formats | Alternative to Oxfmt | -| Deno | JavaScript, TypeScript, JSON, Markdown | Alternative to Oxfmt | -| nixfmt | Nix | Optional; installed in backend Nix shells | -| SQLFluff | PostgreSQL SQL | Optional; configuration found in cloud-backend | -| Black | Python and stubs | Legacy; found in archived projects | +## Where the configuration lives -Use `bin/format default` for the shared defaults. This is an opt-in organization baseline, not a claim that every existing project already follows it. The Rust baseline assumes edition 2024. Use the project presets for audited differences. +| File | Responsibility | +| -------------------------- | -------------------------------------------------------------------------------------- | +| `flake.nix` / `flake.lock` | Pin Nixpkgs, treefmt-nix and rust-overlay; export apps, packages, dev shell and checks | +| `treefmt.nix` | Enable native treefmt-nix modules and generate formatter-specific settings | +| `nix/settings.nix` | Shared Oxfmt, Prettier, rustfmt and Ruff style settings | +| `nix/profiles.nix` | Project-specific formatter selection, file patterns, style selection and Rust edition | +| `nix/excludes.nix` | Common dependency and generated-file exclusions | -The alternative entries are disabled in the default selection to prevent two tools from reformatting the same files. Select an optional engine explicitly, for example: +For example, the backend enables the native Prettier module, limits it to GraphQL, and supplies the existing width-100 override through `programs.prettier.settings`. Treefmt-nix writes a Prettier config in `/nix/store`, writes treefmt's TOML with absolute executable/config paths, and wraps treefmt with that TOML. + +The other tools use the same approach. Oxfmt and Ruff settings are generated with `pkgs.formats.json` and `pkgs.formats.toml`; rustfmt uses a Nix-packaged nightly binary directly. There is no runtime `CAIDO_FORMATTER_ROOT`, config copying, or rustup invocation. + +Inspect the generated configuration and locked package versions: ```sh -mise exec -- bin/format default --root ../infrastructure --formatters tofu -bin/format nix --root ../nix-config -bin/format postgres --root ../cloud-backend +cat "$(nix build .#config-proxy-backend --no-link --print-out-paths)" +cat "$(nix build .#versions --no-link --print-out-paths)" +nix eval --json .#lib.profileNames ``` -Deno, nixfmt, SQLFluff, and legacy Black are not installed by the base mise configuration. Supply them through the target project's environment, or explicitly install a chosen version. The audit did not establish a version pin for all of these tools. Never use a PostgreSQL SQL preset on dbt or templated SQL without checking compatibility. +## Profiles and versions -## Project presets +All 26 existing profile names remain available, including `proxy-*`, `analytics`, `caido-private`, `infrastructure`, `mise-toolshed`, `secrets-sync`, the other Rust backends/libraries, `electron-updater`, and the optional `nix`, `postgres`, and legacy Black presets. Optional profiles now get their tools from Nix too. -`profiles/` contains complete treefmt files; treefmt does not merge them with the root config. +`default` selects Oxfmt, rustfmt, Ruff, OpenTofu, shfmt and StyLua. Prettier/Deno and Ruff/Black remain separate choices so competing engines do not rewrite the same files. Treefmt-nix calls the Ruff entry `ruff-format` and the OpenTofu entry `terraform`. -| Preset | Behavior retained | -| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------- | -| `proxy-backend` | Nightly Rust, edition 2024, macro exclusion; Prettier GraphQL at width 100 | -| `proxy-frontend` | Oxfmt at width 80 with grouped/sorted imports and generated-file exclusions | -| `proxy-e2e` | Oxfmt for TS/JS/MJS; excludes plugins, binaries, and Playwright output | -| `proxy-desktop` | Prettier defaults on the four source packages currently covered by lint tasks | -| `proxy-playground`, `proxy-extension` | Prettier formatting; existing ESLint checks remain separate | -| `cloud-backend`, `sync-backend`, `student-backend`, `sqlite-rs`, `cogfer`, `convert` | Existing Rust style settings; edition selected per project | -| `internal-services` | Oxfmt with shared import groups | -| `analytics` | Ruff on the four Python app trees, excluding dbt's transform app | -| `caido-private` | Ruff for Python 3.11, limited to scripts and tests | -| `infrastructure` | OpenTofu files under `tofu/` | -| `infrastructure-yaml` | Existing single-quoted YAML convention, separately opt-in | -| `mise-toolshed` | Oxfmt, shfmt and StyLua; excludes generated mise locks | -| `secrets-sync` | Deno formatting, using the project's Deno configuration | -| `electron-updater` | Existing Prettier width 180, no semicolons, ES5 trailing commas | -| `analytics-ingestion`, `cloud-cron` | Legacy Black presets for archived projects | -| `nix`, `postgres` | Optional infrastructure/database formatting | +This migration also consolidates package versions. The audited settings and scopes are retained, but old per-project mise version overrides are replaced by this lockfile: -The presets centralize formatter style. They do not execute ESLint, Clippy, Ruff lint fixes, typechecking, dbt validation, or infrastructure validation. Keep those checks in the source repositories. Desktop's import ordering is an ESLint rule and is not replaced by running Prettier alone. +| Tool | Nix version | Previous setup | +| -------- | ------------------ | ------------------------------------------- | +| treefmt | 2.6.0 | 2.6.0 | +| Oxfmt | 0.75.0 | 0.53.0 / 0.73.0 | +| Prettier | 3.9.10 | Several versions, including 3.2.5 and 3.7.4 | +| rustfmt | nightly-2026-04-06 | Same pinned nightly | +| Ruff | 0.17.4 | 0.15.16 / 0.16.9 | +| OpenTofu | 1.13.5 | 1.9.1 | +| shfmt | 3.14.1 | 3.14.1 | +| StyLua | 2.6.0 | 2.6.0 | +| Deno | 2.9.8 | Supplied externally | +| nixfmt | 1.5.0 | Supplied externally | +| SQLFluff | 4.5.0 | Supplied externally | +| Black | 26.5.1 | Legacy 25.12.0 / older | -Rust files are passed directly to rustfmt with `skip_children=true`, so formatting one file cannot recursively modify excluded modules. Presets pin the nightly from proxy-backend; projects using floating nightly will need to review that stabilization. Cargo workspaces containing multiple editions need separate formatter entries or a Cargo-aware wrapper. +Version changes can produce additional formatting differences. Review the initial diff when adopting the migration. Updating `flake.lock` updates package versions; the nightly date is also pinned explicitly in `flake.nix`. -`configs/` stores settings that are clearer as companion files, notably Oxfmt import groups. `bin/format` resolves these relative to this checkout through `CAIDO_FORMATTER_ROOT`, even when the target project or shared checkout path contains spaces. Keep the entire checkout available. For direct treefmt use, export that variable first: +Rust still uses explicit editions and `skip_children=true`; the backend macro exclusion stays in treefmt. Analytics still excludes dbt's transform app, and the frontend retains its generated/type-file exclusions. Extensionless shell scripts need explicit patterns; the self profile includes `bin/format`. -```sh -export CAIDO_FORMATTER_ROOT=/absolute/path/to/formatter -treefmt --config-file "$CAIDO_FORMATTER_ROOT/profiles/proxy-backend.toml" +ESLint, Clippy, Ruff lint rules, typechecking, dbt validation and infrastructure validation remain separate project checks. Using a formatter preset does not replace those checks. Cargo workspaces with mixed editions need separate Rust entries or a Cargo-aware wrapper. + +## Use from another flake + +The simplest integration reuses the already-packaged profile. Add the private repository as an input, and expose its wrapper as your project's formatter: + +```nix +{ + inputs.caido-formatter.url = "git+ssh://git@github.com/caido/formatter"; + + outputs = { caido-formatter, ... }: { + formatter = builtins.mapAttrs + (_system: packages: packages.proxy-frontend) + caido-formatter.packages; + }; +} ``` -## Mise integration in a consuming project +The consuming flake's lockfile pins the shared repository and its dependencies. Run `nix fmt` in that project. The standard private Git authentication for your checkout is required when resolving the input. -Pin this repository to a reviewed commit or release, then add tasks that point at the checkout. For example, when the shared checkout is a sibling: +For project overrides, import the exported module into your own treefmt-nix evaluation: -```toml -[tasks.format] -run = 'mise -C ../formatter exec -- bin/format proxy-frontend --root "$MISE_PROJECT_ROOT"' +```nix +treefmtEval = treefmt-nix.lib.evalModule pkgs { + imports = [ caido-formatter.lib.treefmtModule ]; + caido.profile = "proxy-backend"; + settings.excludes = [ "fixtures/*" ]; +}; -[tasks."format:check"] -run = 'mise -C ../formatter exec -- bin/format proxy-frontend --root "$MISE_PROJECT_ROOT" --ci' +# In the consuming flake's outputs for each system: +formatter.${system} = treefmtEval.config.build.wrapper; +checks.${system}.formatting = treefmtEval.config.build.check self; ``` -This repository does not change or migrate consuming projects automatically. Review tool versions, nested configs, generated paths, and the initial formatting diff when adopting a preset. In particular, extensionless shell scripts need explicit project globs; the default shell entry only matches known extensions. +When importing the module, non-Rust package versions come from the `pkgs` passed to that evaluation. Reusing the packaged profile uses this repository's exact locked versions. The exported module retains the pinned nightly via rust-overlay in both cases. + +## Mise and maintenance -## Maintenance +Mise can remain the development-environment/task entry point. This repository uses `.mise/config.toml` and executable task files under `.mise/tasks/`, with no formatter tools to install through mise. The `format`, `format:check` and `test` tasks call Nix. -The [audit report](docs/audit.md) records the scope and findings. [The inventory](docs/inventory.json) pins source commits and lists matching config/task paths for all 169 repositories scanned on 2026-10-28. Forks and archived projects are identified separately; their conventions are not silently promoted to shared defaults. +A consuming project can create executable `.mise/tasks/format/_default`: + +```sh +#!/usr/bin/env sh +set -eu +exec ../formatter/bin/format proxy-frontend --root "$MISE_PROJECT_ROOT" +``` -[A GitHub Actions workflow](examples/github-actions.yml) is included as an example. To activate CI, copy it to `.github/workflows/validate.yml` using a GitHub connection with workflow write permission. The connection used to initialize this repository could upload contents but could not activate workflows. +The corresponding `.mise/tasks/format/check` adds the CI option: ```sh -mise test -mise format -mise format:check +#!/usr/bin/env sh +set -eu +exec ../formatter/bin/format proxy-frontend --root "$MISE_PROJECT_ROOT" --ci ``` -Tests exercise treefmt's real routing and shell invocation with stub formatter executables, including path handling, exclusions, competing engines, and CI failure behavior. Optional formatter engines must also be checked against their real pinned CLI before rollout. +Validation uses the real Nix-packaged binaries, including six-language routing, excluded files, Rust child modules, paths with spaces, idempotence and independence from the host PATH: + +```sh +nix flake check +nix flake check --all-systems --no-build +nix develop +``` + +Supported systems are Apple Silicon macOS (`aarch64-darwin`) and ARM64/x86_64 Linux. The locked Nixpkgs release no longer supports Intel macOS. [The GitHub Actions example](examples/github-actions.yml) installs Nix and runs `nix flake check`. It remains an example; activating it requires workflow write permission. + +The [historical audit](docs/audit.md) and [inventory](docs/inventory.json) record the 169 repositories scanned on 2026-10-28. This migration does not modify consuming repositories. -Initial validation also ran the real Oxfmt 0.53.0, Prettier 3.7.4, nightly-2026-04-06 rustfmt, and OpenTofu 1.9.1 against scratch projects. All Rust presets accepted their configs; the infrastructure preset successfully formatted multiple files in one batch. +[ADR 0001](docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md) records this as a proposed repository-scoped experiment under the engineering tooling standard. It does not approve an organization-wide tooling change. diff --git a/bin/format b/bin/format index 8d5771b..77348fe 100755 --- a/bin/format +++ b/bin/format @@ -2,30 +2,36 @@ set -eu usage() { - echo "Usage: format [--root DIRECTORY] [treefmt options and paths...]" >&2 - echo "Defaults to the current directory; use --ci for CI checks." >&2 + echo "Usage: format [--root DIRECTORY] [treefmt options and paths...]" >&2 + echo "Defaults to the current directory; use --ci for CI checks." >&2 } -if [ "$#" -eq 0 ]; then usage; exit 2; fi +if [ "$#" -eq 0 ]; then + usage + exit 2 +fi profile=$1 shift case "$profile" in - -h|--help) usage; exit 0 ;; - *[!a-z0-9-]*|'') echo "Invalid profile: $profile" >&2; exit 2 ;; +-h | --help) + usage + exit 0 + ;; +*[!a-z0-9-]* | '') + echo "Invalid profile: $profile" >&2 + exit 2 + ;; esac -CAIDO_FORMATTER_ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) -export CAIDO_FORMATTER_ROOT -if [ "$profile" = default ]; then - config="$CAIDO_FORMATTER_ROOT/treefmt.toml" -else - config="$CAIDO_FORMATTER_ROOT/profiles/$profile.toml" -fi -if [ ! -f "$config" ]; then echo "Unknown profile: $profile" >&2; exit 2; fi +formatter_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) if [ "${1:-}" = --root ]; then - if [ "$#" -lt 2 ]; then usage; exit 2; fi - target_root=$(CDPATH= cd -- "$2" && pwd -P) - shift 2 + if [ "$#" -lt 2 ]; then + usage + exit 2 + fi + target_root=$(CDPATH= cd -- "$2" && pwd -P) + shift 2 else - target_root=$(pwd -P) + target_root=$(pwd -P) fi -exec treefmt --config-file "$config" --tree-root "$target_root" --working-dir "$target_root" "$@" +exec nix --extra-experimental-features 'nix-command flakes' run "$formatter_root#$profile" -- \ + --tree-root "$target_root" --working-dir "$target_root" "$@" diff --git a/configs/oxfmt-generated.json b/configs/oxfmt-generated.json deleted file mode 100644 index 996b7c8..0000000 --- a/configs/oxfmt-generated.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "printWidth": 80, - "sortImports": false -} diff --git a/configs/oxfmt-toolshed.json b/configs/oxfmt-toolshed.json deleted file mode 100644 index 67e109c..0000000 --- a/configs/oxfmt-toolshed.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ignorePatterns": [ - "pnpm-lock.yaml", - "dist/", - "node_modules/", - ".agents/", - ".mise/locks/" - ] -} diff --git a/configs/oxfmt.json b/configs/oxfmt.json deleted file mode 100644 index 4b9b1da..0000000 --- a/configs/oxfmt.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "printWidth": 80, - "sortImports": { - "groups": ["builtin", "external", "internal", "parent", "sibling", "index"], - "newlinesBetween": true, - "ignoreCase": true, - "order": "asc" - } -} diff --git a/configs/prettier-backend.json b/configs/prettier-backend.json deleted file mode 100644 index 2fb3389..0000000 --- a/configs/prettier-backend.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "overrides": [ - { - "files": ["*.graphql"], - "options": { "tabWidth": 2, "useTabs": false, "printWidth": 100 } - } - ] -} diff --git a/configs/prettier-electron-updater.yaml b/configs/prettier-electron-updater.yaml deleted file mode 100644 index 9ca9710..0000000 --- a/configs/prettier-electron-updater.yaml +++ /dev/null @@ -1,6 +0,0 @@ -singleQuote: false -semi: false -arrowParens: avoid -trailingComma: es5 -printWidth: 180 -quoteProps: as-needed diff --git a/configs/prettier-infrastructure.json b/configs/prettier-infrastructure.json deleted file mode 100644 index 3ab9aa0..0000000 --- a/configs/prettier-infrastructure.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "overrides": [ - { - "files": ["*.yaml", "*.yml"], - "options": { - "singleQuote": true - } - } - ] -} diff --git a/configs/prettier.json b/configs/prettier.json deleted file mode 100644 index ef41518..0000000 --- a/configs/prettier.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "tabWidth": 2, - "useTabs": false, - "printWidth": 80, - "singleQuote": false, - "semi": true, - "trailingComma": "all", - "arrowParens": "always" -} diff --git a/configs/ruff-analytics.toml b/configs/ruff-analytics.toml deleted file mode 100644 index 47d0c7c..0000000 --- a/configs/ruff-analytics.toml +++ /dev/null @@ -1,3 +0,0 @@ -line-length = 88 -target-version = "py312" -extend-exclude = ["apps/transform"] diff --git a/configs/ruff-caido-private.toml b/configs/ruff-caido-private.toml deleted file mode 100644 index 1d748e3..0000000 --- a/configs/ruff-caido-private.toml +++ /dev/null @@ -1,2 +0,0 @@ -line-length = 88 -target-version = "py311" diff --git a/configs/ruff.toml b/configs/ruff.toml deleted file mode 100644 index 822a974..0000000 --- a/configs/ruff.toml +++ /dev/null @@ -1,2 +0,0 @@ -line-length = 88 -target-version = "py312" diff --git a/configs/rustfmt.toml b/configs/rustfmt.toml deleted file mode 100644 index 972bbb2..0000000 --- a/configs/rustfmt.toml +++ /dev/null @@ -1,11 +0,0 @@ -unstable_features = true - -edition = "2024" - -# Currently rustfmt gives up on long strings -# See https://github.com/rust-lang/rustfmt/issues/3863 -single_line_if_else_max_width = 80 -group_imports = "StdExternalCrate" -imports_granularity = "Module" -error_on_line_overflow = false # We have a couple case where this fails -error_on_unformatted = false diff --git a/configs/rustfmt/cloud-backend.toml b/configs/rustfmt/cloud-backend.toml deleted file mode 100644 index 708c5e3..0000000 --- a/configs/rustfmt/cloud-backend.toml +++ /dev/null @@ -1,3 +0,0 @@ -single_line_if_else_max_width = 80 -group_imports = "StdExternalCrate" -imports_granularity = "Module" diff --git a/configs/rustfmt/cogfer.toml b/configs/rustfmt/cogfer.toml deleted file mode 100644 index 708c5e3..0000000 --- a/configs/rustfmt/cogfer.toml +++ /dev/null @@ -1,3 +0,0 @@ -single_line_if_else_max_width = 80 -group_imports = "StdExternalCrate" -imports_granularity = "Module" diff --git a/configs/rustfmt/convert.toml b/configs/rustfmt/convert.toml deleted file mode 100644 index bf96e77..0000000 --- a/configs/rustfmt/convert.toml +++ /dev/null @@ -1 +0,0 @@ -group_imports = "StdExternalCrate" diff --git a/configs/rustfmt/proxy-backend.toml b/configs/rustfmt/proxy-backend.toml deleted file mode 100644 index 9e305ec..0000000 --- a/configs/rustfmt/proxy-backend.toml +++ /dev/null @@ -1,13 +0,0 @@ -unstable_features = true - -edition = "2024" - -# Currently rustfmt gives up on long strings -# See https://github.com/rust-lang/rustfmt/issues/3863 -single_line_if_else_max_width = 80 -group_imports = "StdExternalCrate" -imports_granularity = "Module" -error_on_line_overflow = false # We have a couple case where this fails -error_on_unformatted = false -# The macro exclusion lives in the treefmt profile. rustfmt resolves `ignore` -# relative to this file, which is outside the consuming project's source tree. diff --git a/configs/rustfmt/sqlite-rs.toml b/configs/rustfmt/sqlite-rs.toml deleted file mode 100644 index cff4e20..0000000 --- a/configs/rustfmt/sqlite-rs.toml +++ /dev/null @@ -1,4 +0,0 @@ -unstable_features = true -group_imports = "StdExternalCrate" -imports_granularity = "Crate" -reorder_imports = true diff --git a/configs/rustfmt/student-backend.toml b/configs/rustfmt/student-backend.toml deleted file mode 100644 index c60c28e..0000000 --- a/configs/rustfmt/student-backend.toml +++ /dev/null @@ -1,3 +0,0 @@ -single_line_if_else_max_width = 80 -group_imports = "StdExternalCrate" -imports_granularity = "module" diff --git a/configs/rustfmt/sync-backend.toml b/configs/rustfmt/sync-backend.toml deleted file mode 100644 index c60c28e..0000000 --- a/configs/rustfmt/sync-backend.toml +++ /dev/null @@ -1,3 +0,0 @@ -single_line_if_else_max_width = 80 -group_imports = "StdExternalCrate" -imports_granularity = "module" diff --git a/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md b/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md new file mode 100644 index 0000000..86cadb0 --- /dev/null +++ b/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md @@ -0,0 +1,25 @@ +# Evaluate treefmt-nix in formatter + +Status: Proposed experiment + +Date: 2026-11-09 + +## Context + +This repository was created to explore shared treefmt configuration for Caido. The requested PR evaluates using treefmt-nix to supply the formatter binaries, their settings and the treefmt configuration together. + +[STD-018](https://github.com/caido/engineering/blob/main/standards/STD-018-tooling.md) requires mise for tool setup and explicitly describes treefmt as an experiment outside the approved tool list. This proposal requests a scoped exception for this experimental repository. It does not claim that an organization-wide exception has already been approved. + +## Proposed decision + +Use a locked Nix flake and treefmt-nix in `caido/formatter` to evaluate reproducible formatter packages and generated configuration. Retain mise as an optional task entry point using the layout in [STD-019](https://github.com/caido/engineering/blob/main/standards/STD-019-mise.md). + +Keep this experiment confined to the shared formatter repository. Do not change the approved tooling standard or migrate consuming repositories as part of this PR. Maintainer acceptance of this proposal and its scoped exception is required before adopting it beyond the experiment. + +## Consequences + +- Formatter commands and settings resolve to immutable Nix store paths. +- Nix or Lix is required to run a formatter profile, and the first invocation may download or build its dependencies. +- Formatter versions come from the locked Nixpkgs revision; existing per-project mise version differences are consolidated and documented in the README. +- The experiment supports Apple Silicon macOS and ARM64/x86_64 Linux. The locked Nixpkgs revision does not support Intel macOS. +- The historical audit remains available. Existing projects keep their current tooling until a separate migration is reviewed. diff --git a/docs/audit.md b/docs/audit.md index e20a390..5bbcf48 100644 --- a/docs/audit.md +++ b/docs/audit.md @@ -1,5 +1,7 @@ # Formatter audit — 2026-10-28 +This is the historical source audit. The treefmt-nix migration retains the audited project settings and file scopes, while package versions now come from `flake.lock`. See the current README for the migration's version changes. + The audit inspected default-branch file trees for all **169** repositories accessible in the Caido organization, including forks and archived repositories. None of the tree responses were truncated. It read **392** matching config/task/manifests from the **99 first-party repositories** (84 active, 15 archived). Forks were scanned for matching filenames and recorded in the inventory; upstream fork settings were not adopted as organization defaults. Files inspected include formatter configs, ESLint configs containing Prettier integrations, Python project settings, package scripts/dependencies, mise tools/tasks, Makefiles and justfiles. Selected Nix shells and CI tasks were also checked. The inventory is evidence of the checked filenames and revisions, not proof that a formatter dependency is actively enforced. Generated/vendored paths were excluded from content inspection. Arbitrary custom scripts or CI workflow names outside these patterns may need a follow-up audit. diff --git a/examples/github-actions.yml b/examples/github-actions.yml index aac24e4..fa8c6e6 100644 --- a/examples/github-actions.yml +++ b/examples/github-actions.yml @@ -11,14 +11,11 @@ permissions: jobs: test: runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 30 steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - uses: caido/action-mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0 + - uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31 with: - version: "2026.10.6" - install: false - - name: Validate configs and file routing - run: | - mise exec treefmt@2.6.0 python@3.12.14 -- treefmt --version - mise exec treefmt@2.6.0 python@3.12.14 -- python3 -m unittest discover -s tests -v + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - name: Validate configuration, formatting and real formatter routing + run: nix flake check --show-trace diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..48ba843 --- /dev/null +++ b/flake.lock @@ -0,0 +1,69 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1794042290, + "narHash": "sha256-ziZn2PvCJE5JEEpqTdxXwJpPB+L3YqoCpTAMCzyaP3U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f4a03c008967841f2a0b3cb7c436fc6fc31671f6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay", + "treefmt-nix": "treefmt-nix" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1794216702, + "narHash": "sha256-J+4v+Olc/2mN/bSc9CuAQ/PB7c0w1mzDJK8JvS7rKmM=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "b70538330f20adc9665afa2976471eb5b85ebd1f", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1791885023, + "narHash": "sha256-C3alQ2MEt0zVrUSho5NUDo3jmhbff72++bfwoqT9Omo=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "0d6d739a833ba9a9c93034862e4a7b061a062a1c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..76c4ddc --- /dev/null +++ b/flake.nix @@ -0,0 +1,170 @@ +{ + description = "Shared Caido formatters, configured and packaged with treefmt-nix"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { + self, + nixpkgs, + treefmt-nix, + rust-overlay, + ... + }: + let + # Current Nixpkgs no longer supports x86_64-darwin. + systems = [ + "aarch64-darwin" + "aarch64-linux" + "x86_64-linux" + ]; + eachSystem = nixpkgs.lib.genAttrs systems; + profiles = import ./nix/profiles.nix; + profileNames = builtins.attrNames profiles; + + sharedModule = { pkgs, lib, ... }: { + imports = [ ./treefmt.nix ]; + # The overlay supplies a rustfmt binary directly. No rustup, host + # toolchain selection, or ambient PATH is needed at runtime. + programs.rustfmt.package = lib.mkDefault ( + (pkgs.extend rust-overlay.overlays.default).rust-bin.nightly."2026-04-06".minimal.override { + extensions = [ "rustfmt" ]; + } + ); + }; + + evaluated = eachSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + nixpkgs.lib.genAttrs profileNames ( + name: + treefmt-nix.lib.evalModule pkgs { + imports = [ sharedModule ]; + caido.profile = name; + } + ) + ); + testProfiles = [ + "default" + "self" + "proxy-backend" + "proxy-frontend" + "analytics" + "caido-private" + "infrastructure" + "mise-toolshed" + ]; + in + { + lib = { + inherit profileNames; + treefmtModule = sharedModule; + settings = import ./nix/settings.nix; + }; + + formatter = eachSystem (system: evaluated.${system}.self.config.build.wrapper); + + packages = eachSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + configs = evaluated.${system}; + wrappers = builtins.mapAttrs (_: value: value.config.build.wrapper) configs; + configFiles = nixpkgs.lib.mapAttrs' ( + name: value: nixpkgs.lib.nameValuePair "config-${name}" value.config.build.configFile + ) configs; + in + wrappers + // configFiles + // { + versions = pkgs.writeText "caido-formatter-versions.json" ( + builtins.toJSON ( + builtins.mapAttrs (_: value: value.version) { + inherit (pkgs) + treefmt + oxfmt + prettier + ruff + opentofu + shfmt + stylua + deno + nixfmt + sqlfluff + black + ; + } + // { + rustfmt = "nightly-2026-04-06"; + } + ) + ); + } + ); + + apps = eachSystem ( + system: + builtins.mapAttrs (_: value: { + type = "app"; + program = "${value.config.build.wrapper}/bin/treefmt"; + }) evaluated.${system} + ); + + devShells = eachSystem (system: { + default = evaluated.${system}.self.config.build.devShell; + }); + + checks = eachSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + configs = evaluated.${system}; + testConfigs = nixpkgs.lib.genAttrs testProfiles (name: { + program = "${configs.${name}.config.build.wrapper}/bin/treefmt"; + config = toString configs.${name}.config.build.configFile; + }); + overridden = treefmt-nix.lib.evalModule pkgs { + imports = [ sharedModule ]; + caido.profile = "proxy-backend"; + programs.rustfmt.enable = pkgs.lib.mkForce false; + settings.excludes = [ "fixtures/*" ]; + }; + in + { + formatting = configs.self.config.build.check self; + # Force module evaluation for every profile, including optional tools, + # without requiring every formatter closure just to validate options. + configuration = + assert !(overridden.config.settings.formatter ? rustfmt); + assert builtins.elem "fixtures/*" overridden.config.settings.excludes; + builtins.deepSeq (builtins.mapAttrs ( + _: value: builtins.removeAttrs value.config.settings [ "global" ] + ) configs) (pkgs.runCommand "caido-formatter-configuration" { } "touch $out"); + routing = + pkgs.runCommand "caido-formatter-routing" + { + nativeBuildInputs = [ pkgs.python3 ]; + CAIDO_TEST_CONFIGS = builtins.toJSON testConfigs; + CAIDO_TEST_SOURCE = self; + CAIDO_TEST_SHELL = pkgs.runtimeShell; + } + '' + python3 ${./tests/test_config.py} + touch "$out" + ''; + } + ); + }; +} diff --git a/mise.analytics-ingestion.toml b/mise.analytics-ingestion.toml deleted file mode 100644 index d520c27..0000000 --- a/mise.analytics-ingestion.toml +++ /dev/null @@ -1,2 +0,0 @@ -[tools] -"pipx:black" = "25.12.0" diff --git a/mise.caido-private.toml b/mise.caido-private.toml deleted file mode 100644 index 25b4a62..0000000 --- a/mise.caido-private.toml +++ /dev/null @@ -1,2 +0,0 @@ -[tools] -ruff = "0.15.16" diff --git a/mise.cloud-backend.toml b/mise.cloud-backend.toml deleted file mode 100644 index aba693f..0000000 --- a/mise.cloud-backend.toml +++ /dev/null @@ -1,2 +0,0 @@ -[tools] -"npm:prettier" = "3.6.2" diff --git a/mise.mise-toolshed.toml b/mise.mise-toolshed.toml deleted file mode 100644 index 3089dc4..0000000 --- a/mise.mise-toolshed.toml +++ /dev/null @@ -1,2 +0,0 @@ -[tools] -"npm:oxfmt" = "0.73.0" diff --git a/mise.proxy-desktop.toml b/mise.proxy-desktop.toml deleted file mode 100644 index f0f88d7..0000000 --- a/mise.proxy-desktop.toml +++ /dev/null @@ -1,2 +0,0 @@ -[tools] -"npm:prettier" = "3.2.5" diff --git a/mise.proxy-e2e.toml b/mise.proxy-e2e.toml deleted file mode 100644 index 3089dc4..0000000 --- a/mise.proxy-e2e.toml +++ /dev/null @@ -1,2 +0,0 @@ -[tools] -"npm:oxfmt" = "0.73.0" diff --git a/mise.proxy-extension.toml b/mise.proxy-extension.toml deleted file mode 100644 index cd9837f..0000000 --- a/mise.proxy-extension.toml +++ /dev/null @@ -1,2 +0,0 @@ -[tools] -"npm:prettier" = "3.5.3" diff --git a/mise.toml b/mise.toml deleted file mode 100644 index da3e025..0000000 --- a/mise.toml +++ /dev/null @@ -1,23 +0,0 @@ -[tools] -treefmt = "2.6.0" -python = "3.12.14" -node = "24.16.0" -"npm:oxfmt" = "0.53.0" -"npm:prettier" = "3.7.4" -ruff = "0.16.9" -opentofu = "1.9.1" -shfmt = "3.14.1" -stylua = "2.6.0" -rust = { version = "nightly-2026-04-06", profile = "minimal", components = "rustfmt" } - -[tasks.format] -description = "Format this repository" -run = "bin/format self" - -[tasks."format:check"] -description = "Check this repository's formatting (may rewrite files, as treefmt --ci does)" -run = "bin/format self --ci" - -[tasks.test] -description = "Check configuration and formatter routing" -run = "python3 -m unittest discover -s tests -v" diff --git a/nix/excludes.nix b/nix/excludes.nix new file mode 100644 index 0000000..c8e7d74 --- /dev/null +++ b/nix/excludes.nix @@ -0,0 +1,27 @@ +# Common generated, dependency, and assistant directories. +[ + ".git/*" + ".formatter/*" + "node_modules/*" + "*/node_modules/*" + "dist/*" + "*/dist/*" + "target/*" + "*/target/*" + "coverage/*" + "*/coverage/*" + ".venv/*" + "*/.venv/*" + ".terraform/*" + "*/.terraform/*" + "*-lock.json" + "pnpm-lock.yaml" + "yarn.lock" + "uv.lock" + "*.min.js" + "*.min.css" + ".agents/*" + ".claude/*" + ".cursor/*" + "**/__generated__/**" +] diff --git a/nix/profiles.nix b/nix/profiles.nix new file mode 100644 index 0000000..78aedff --- /dev/null +++ b/nix/profiles.nix @@ -0,0 +1,583 @@ +# Audited file routing. Style settings are shared through nix/settings.nix. +{ + "proxy-frontend" = { + "formatters" = { + "oxfmt" = { + "includes" = [ + "packages/*.ts" + "packages/*.tsx" + "packages/*.vue" + "packages/*.js" + "packages/*.mjs" + "packages/*.cjs" + "packages/*.json" + "packages/*.css" + "packages/*.scss" + "packages/*.graphql" + "packages/*.md" + "packages/*.yml" + "packages/*.yaml" + "packages/*.html" + "scripts/*.ts" + "scripts/*.mjs" + "scripts/*.js" + ".github/*.yml" + ".github/*.yaml" + ]; + "excludes" = [ + "*.svg" + "*.grammar" + ]; + "style" = "default"; + }; + "oxfmt-root" = { + "includes" = [ + "*.ts" + "*.mjs" + "*.js" + "*.json" + "*.yml" + "*.yaml" + ]; + "excludes" = [ + "*/*" + ]; + "style" = "default"; + }; + }; + "excludes" = [ + "packages/ui/src/@types/modules/vue-router.d.ts" + ]; + }; + "proxy-backend" = { + "formatters" = { + "rustfmt" = { + "includes" = [ + "*.rs" + ]; + "excludes" = [ + "proxy-tests/tests/common/macros/*" + ]; + "style" = "proxy-backend"; + "edition" = "2024"; + }; + "prettier" = { + "includes" = [ + "*.graphql" + ]; + "style" = "backend"; + }; + }; + }; + "proxy-desktop" = { + "formatters" = { + "prettier" = { + "includes" = [ + "packages/main/src/*.ts" + "packages/main/src/*.js" + "packages/ui/src/*.ts" + "packages/ui/src/*.js" + "packages/ui/src/*.vue" + "packages/shared/src/*.ts" + "packages/shared/src/*.js" + "packages/migrations/src/*.ts" + "packages/migrations/src/*.js" + ]; + "style" = "default"; + }; + }; + }; + "proxy-playground" = { + "formatters" = { + "prettier" = { + "includes" = [ + "*.ts" + "*.tsx" + "*.mts" + "*.cts" + "*.js" + "*.jsx" + "*.mjs" + "*.cjs" + "*.vue" + "*.html" + "*.css" + "*.scss" + "*.json" + "*.jsonc" + "*.graphql" + "*.md" + "*.yml" + "*.yaml" + ]; + "style" = "default"; + }; + }; + }; + "postgres" = { + "formatters" = { + "sqlfluff" = { + "includes" = [ + "*.sql" + ]; + }; + }; + }; + "self" = { + "formatters" = { + "prettier" = { + "includes" = [ + "*.json" + "*.yaml" + "*.yml" + "*.md" + ]; + "excludes" = [ + "tests/*" + ]; + "style" = "default"; + }; + "nixfmt" = { + "includes" = [ + "*.nix" + ]; + }; + "ruff" = { + "includes" = [ + "tests/*.py" + ]; + "style" = "default"; + }; + "shfmt" = { + "includes" = [ + "bin/format" + ".mise/tasks/*" + ]; + }; + }; + }; + "cogfer" = { + "formatters" = { + "rustfmt" = { + "includes" = [ + "*.rs" + ]; + "excludes" = [ + "proxy-tests/tests/common/macros/*" + ]; + "style" = "cogfer"; + "edition" = "2024"; + }; + }; + }; + "analytics-ingestion" = { + "formatters" = { + "black" = { + "includes" = [ + "src/*.py" + "src/*.pyi" + ]; + }; + }; + }; + "proxy-extension" = { + "formatters" = { + "prettier" = { + "includes" = [ + "*.ts" + "*.tsx" + "*.mts" + "*.cts" + "*.js" + "*.jsx" + "*.mjs" + "*.cjs" + "*.vue" + "*.html" + "*.css" + "*.scss" + "*.json" + "*.jsonc" + "*.graphql" + "*.md" + "*.yml" + "*.yaml" + ]; + "style" = "default"; + }; + }; + }; + "sqlite-rs" = { + "formatters" = { + "rustfmt" = { + "includes" = [ + "*.rs" + ]; + "excludes" = [ + "proxy-tests/tests/common/macros/*" + ]; + "style" = "sqlite-rs"; + "edition" = "2024"; + }; + }; + }; + "infrastructure" = { + "formatters" = { + "tofu" = { + "includes" = [ + "tofu/*.tf" + "tofu/*.tfvars" + "tofu/*.tftest.hcl" + ]; + }; + }; + }; + "mise-toolshed" = { + "formatters" = { + "oxfmt" = { + "includes" = [ + "*.ts" + "*.tsx" + "*.mts" + "*.cts" + "*.js" + "*.jsx" + "*.mjs" + "*.cjs" + "*.vue" + "*.html" + "*.css" + "*.scss" + "*.json" + "*.jsonc" + "*.graphql" + "*.md" + "*.yml" + "*.yaml" + ]; + "excludes" = [ + "*.svg" + "*.grammar" + ]; + "style" = "toolshed"; + }; + "shfmt" = { + "includes" = [ + "*.sh" + "*.bash" + "*.bats" + ]; + }; + "stylua" = { + "includes" = [ + "*.lua" + "*.luau" + ]; + }; + }; + "excludes" = [ + ".mise/locks/*" + ]; + }; + "student-backend" = { + "formatters" = { + "rustfmt" = { + "includes" = [ + "*.rs" + ]; + "excludes" = [ + "proxy-tests/tests/common/macros/*" + ]; + "style" = "student-backend"; + "edition" = "2024"; + }; + }; + }; + "internal-services" = { + "formatters" = { + "oxfmt" = { + "includes" = [ + "packages/*.ts" + "packages/*.tsx" + "packages/*.vue" + "packages/*.js" + "packages/*.mjs" + "packages/*.cjs" + "packages/*.json" + "packages/*.css" + "packages/*.html" + "apps/*.ts" + "apps/*.json" + "scripts/*.ts" + "scripts/*.mjs" + "scripts/*.js" + ".github/*.yml" + ".github/*.yaml" + ]; + "excludes" = [ + "*.svg" + "*.grammar" + ]; + "style" = "default"; + }; + "oxfmt-root" = { + "includes" = [ + "*.ts" + "*.mjs" + "*.js" + "*.json" + "*.yml" + "*.yaml" + ]; + "excludes" = [ + "*/*" + ]; + "style" = "default"; + }; + }; + }; + "nix" = { + "formatters" = { + "nixfmt" = { + "includes" = [ + "*.nix" + ]; + }; + }; + }; + "convert" = { + "formatters" = { + "rustfmt" = { + "includes" = [ + "*.rs" + ]; + "excludes" = [ + "proxy-tests/tests/common/macros/*" + ]; + "style" = "convert"; + "edition" = "2021"; + }; + }; + }; + "analytics" = { + "formatters" = { + "ruff" = { + "includes" = [ + "apps/event_consumer/*.py" + "apps/event_consumer/*.pyi" + "apps/extract_and_load/*.py" + "apps/extract_and_load/*.pyi" + "apps/reconcile/*.py" + "apps/reconcile/*.pyi" + "apps/reverse_etl/*.py" + "apps/reverse_etl/*.pyi" + ]; + "style" = "analytics"; + }; + }; + "excludes" = [ + "apps/transform/*" + ]; + }; + "caido-private" = { + "formatters" = { + "ruff" = { + "includes" = [ + "scripts/*.py" + "scripts/*.pyi" + "tests/*.py" + "tests/*.pyi" + ]; + "style" = "caido-private"; + }; + }; + }; + "cloud-backend" = { + "formatters" = { + "rustfmt" = { + "includes" = [ + "*.rs" + ]; + "excludes" = [ + "proxy-tests/tests/common/macros/*" + ]; + "style" = "cloud-backend"; + "edition" = "2024"; + }; + "prettier" = { + "includes" = [ + "*.graphql" + ]; + "style" = "default"; + }; + }; + }; + "electron-updater" = { + "formatters" = { + "prettier" = { + "includes" = [ + "*.ts" + "*.tsx" + "*.mts" + "*.cts" + "*.js" + "*.jsx" + "*.mjs" + "*.cjs" + "*.vue" + "*.html" + "*.css" + "*.scss" + "*.json" + "*.jsonc" + "*.graphql" + "*.md" + "*.yml" + "*.yaml" + ]; + "style" = "electron-updater"; + }; + }; + }; + "proxy-e2e" = { + "formatters" = { + "oxfmt" = { + "includes" = [ + "*.ts" + "*.js" + "*.mjs" + ]; + "excludes" = [ + "*.svg" + "*.grammar" + ]; + "style" = "default"; + }; + }; + "excludes" = [ + "plugins/*" + "test-results/*" + "playwright-report/*" + "binaries/*" + ]; + }; + "secrets-sync" = { + "formatters" = { + "deno" = { + "includes" = [ + "*.ts" + "*.tsx" + "*.js" + "*.jsx" + "*.json" + "*.jsonc" + "*.md" + ]; + }; + }; + }; + "sync-backend" = { + "formatters" = { + "rustfmt" = { + "includes" = [ + "*.rs" + ]; + "excludes" = [ + "proxy-tests/tests/common/macros/*" + ]; + "style" = "sync-backend"; + "edition" = "2021"; + }; + }; + }; + "cloud-cron" = { + "formatters" = { + "black" = { + "includes" = [ + "*.py" + "*.pyi" + ]; + }; + }; + }; + "infrastructure-yaml" = { + "formatters" = { + "prettier" = { + "includes" = [ + "*.yaml" + "*.yml" + ]; + "style" = "infrastructure"; + }; + }; + }; + "default" = { + "formatters" = { + "oxfmt" = { + "includes" = [ + "*.ts" + "*.tsx" + "*.mts" + "*.cts" + "*.js" + "*.jsx" + "*.mjs" + "*.cjs" + "*.vue" + "*.html" + "*.css" + "*.scss" + "*.json" + "*.jsonc" + "*.graphql" + "*.md" + "*.yml" + "*.yaml" + ]; + "excludes" = [ + "*.svg" + "*.grammar" + ]; + "style" = "default"; + }; + "rustfmt" = { + "includes" = [ + "*.rs" + ]; + "excludes" = [ + "proxy-tests/tests/common/macros/*" + ]; + "style" = "default"; + "edition" = "2024"; + }; + "ruff" = { + "includes" = [ + "*.py" + "*.pyi" + "*.ipynb" + ]; + "style" = "default"; + }; + "tofu" = { + "includes" = [ + "*.tf" + "*.tfvars" + "*.tftest.hcl" + ]; + }; + "shfmt" = { + "includes" = [ + "*.sh" + "*.bash" + "*.bats" + ]; + }; + "stylua" = { + "includes" = [ + "*.lua" + "*.luau" + ]; + }; + }; + }; +} diff --git a/nix/settings.nix b/nix/settings.nix new file mode 100644 index 0000000..e4865e4 --- /dev/null +++ b/nix/settings.nix @@ -0,0 +1,146 @@ +# Formatter settings are serialized into immutable JSON/TOML files in the Nix store. +{ + "oxfmt" = { + "default" = { + "printWidth" = 80; + "sortImports" = { + "groups" = [ + "builtin" + "external" + "internal" + "parent" + "sibling" + "index" + ]; + "newlinesBetween" = true; + "ignoreCase" = true; + "order" = "asc"; + }; + }; + "generated" = { + "printWidth" = 80; + "sortImports" = false; + }; + "toolshed" = { + "ignorePatterns" = [ + "pnpm-lock.yaml" + "dist/" + "node_modules/" + ".agents/" + ".mise/locks/" + ]; + }; + }; + "prettier" = { + "infrastructure" = { + "overrides" = [ + { + "files" = [ + "*.yaml" + "*.yml" + ]; + "options" = { + "singleQuote" = true; + }; + } + ]; + }; + "default" = { + "tabWidth" = 2; + "useTabs" = false; + "printWidth" = 80; + "singleQuote" = false; + "semi" = true; + "trailingComma" = "all"; + "arrowParens" = "always"; + }; + "backend" = { + "overrides" = [ + { + "files" = [ + "*.graphql" + ]; + "options" = { + "tabWidth" = 2; + "useTabs" = false; + "printWidth" = 100; + }; + } + ]; + }; + "electron-updater" = { + "singleQuote" = false; + "semi" = false; + "arrowParens" = "avoid"; + "trailingComma" = "es5"; + "printWidth" = 180; + "quoteProps" = "as-needed"; + }; + }; + "rustfmt" = { + "default" = { + "unstable_features" = true; + "edition" = "2024"; + "single_line_if_else_max_width" = 80; + "group_imports" = "StdExternalCrate"; + "imports_granularity" = "Module"; + "error_on_line_overflow" = false; + "error_on_unformatted" = false; + }; + "proxy-backend" = { + "unstable_features" = true; + "edition" = "2024"; + "single_line_if_else_max_width" = 80; + "group_imports" = "StdExternalCrate"; + "imports_granularity" = "Module"; + "error_on_line_overflow" = false; + "error_on_unformatted" = false; + }; + "cogfer" = { + "single_line_if_else_max_width" = 80; + "group_imports" = "StdExternalCrate"; + "imports_granularity" = "Module"; + }; + "sqlite-rs" = { + "unstable_features" = true; + "group_imports" = "StdExternalCrate"; + "imports_granularity" = "Crate"; + "reorder_imports" = true; + }; + "student-backend" = { + "single_line_if_else_max_width" = 80; + "group_imports" = "StdExternalCrate"; + "imports_granularity" = "module"; + }; + "convert" = { + "group_imports" = "StdExternalCrate"; + }; + "cloud-backend" = { + "single_line_if_else_max_width" = 80; + "group_imports" = "StdExternalCrate"; + "imports_granularity" = "Module"; + }; + "sync-backend" = { + "single_line_if_else_max_width" = 80; + "group_imports" = "StdExternalCrate"; + "imports_granularity" = "module"; + }; + }; + "ruff" = { + "caido-private" = { + "line-length" = 88; + "target-version" = "py311"; + }; + "default" = { + "line-length" = 88; + "target-version" = "py312"; + }; + "analytics" = { + "line-length" = 88; + "target-version" = "py312"; + "extend-exclude" = [ + "apps/transform" + ]; + }; + }; +} diff --git a/profiles/analytics-ingestion.toml b/profiles/analytics-ingestion.toml deleted file mode 100644 index 449d858..0000000 --- a/profiles/analytics-ingestion.toml +++ /dev/null @@ -1,8 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.black] -command = "black" -options = [] -includes = ["src/*.py", "src/*.pyi"] diff --git a/profiles/analytics.toml b/profiles/analytics.toml deleted file mode 100644 index e5244a4..0000000 --- a/profiles/analytics.toml +++ /dev/null @@ -1,8 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**", "apps/transform/*"] - -[formatter.ruff] -command = "sh" -options = ["-eu", "-c", "exec ruff format --force-exclude --config \"$CAIDO_FORMATTER_ROOT/configs/ruff-analytics.toml\" \"$@\"", "--"] -includes = ["apps/event_consumer/*.py", "apps/event_consumer/*.pyi", "apps/extract_and_load/*.py", "apps/extract_and_load/*.pyi", "apps/reconcile/*.py", "apps/reconcile/*.pyi", "apps/reverse_etl/*.py", "apps/reverse_etl/*.pyi"] diff --git a/profiles/caido-private.toml b/profiles/caido-private.toml deleted file mode 100644 index f8f39cc..0000000 --- a/profiles/caido-private.toml +++ /dev/null @@ -1,8 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.ruff] -command = "sh" -options = ["-eu", "-c", "exec ruff format --force-exclude --config \"$CAIDO_FORMATTER_ROOT/configs/ruff-caido-private.toml\" \"$@\"", "--"] -includes = ["scripts/*.py", "scripts/*.pyi", "tests/*.py", "tests/*.pyi"] diff --git a/profiles/cloud-backend.toml b/profiles/cloud-backend.toml deleted file mode 100644 index 72d2558..0000000 --- a/profiles/cloud-backend.toml +++ /dev/null @@ -1,14 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.rustfmt] -command = "sh" -options = ["-eu", "-c", "exec rustup run nightly-2026-04-06 rustfmt --edition 2024 --config-path \"$CAIDO_FORMATTER_ROOT/configs/rustfmt/cloud-backend.toml\" --config skip_children=true \"$@\"", "--"] -includes = ["*.rs"] -excludes = ["proxy-tests/tests/common/macros/*"] - -[formatter.prettier] -command = "sh" -options = ["-eu", "-c", "exec prettier --write --no-editorconfig --config \"$CAIDO_FORMATTER_ROOT/configs/prettier.json\" \"$@\"", "--"] -includes = ["*.graphql"] diff --git a/profiles/cloud-cron.toml b/profiles/cloud-cron.toml deleted file mode 100644 index 0d25575..0000000 --- a/profiles/cloud-cron.toml +++ /dev/null @@ -1,8 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.black] -command = "black" -options = [] -includes = ["*.py", "*.pyi"] diff --git a/profiles/cogfer.toml b/profiles/cogfer.toml deleted file mode 100644 index 13ba587..0000000 --- a/profiles/cogfer.toml +++ /dev/null @@ -1,9 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.rustfmt] -command = "sh" -options = ["-eu", "-c", "exec rustup run nightly-2026-04-06 rustfmt --edition 2024 --config-path \"$CAIDO_FORMATTER_ROOT/configs/rustfmt/cogfer.toml\" --config skip_children=true \"$@\"", "--"] -includes = ["*.rs"] -excludes = ["proxy-tests/tests/common/macros/*"] diff --git a/profiles/convert.toml b/profiles/convert.toml deleted file mode 100644 index c3d55da..0000000 --- a/profiles/convert.toml +++ /dev/null @@ -1,9 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.rustfmt] -command = "sh" -options = ["-eu", "-c", "exec rustup run nightly-2026-04-06 rustfmt --edition 2021 --config-path \"$CAIDO_FORMATTER_ROOT/configs/rustfmt/convert.toml\" --config skip_children=true \"$@\"", "--"] -includes = ["*.rs"] -excludes = ["proxy-tests/tests/common/macros/*"] diff --git a/profiles/electron-updater.toml b/profiles/electron-updater.toml deleted file mode 100644 index a821c34..0000000 --- a/profiles/electron-updater.toml +++ /dev/null @@ -1,8 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.prettier] -command = "sh" -options = ["-eu", "-c", "exec prettier --write --no-editorconfig --config \"$CAIDO_FORMATTER_ROOT/configs/prettier-electron-updater.yaml\" \"$@\"", "--"] -includes = ["*.ts", "*.tsx", "*.mts", "*.cts", "*.js", "*.jsx", "*.mjs", "*.cjs", "*.vue", "*.html", "*.css", "*.scss", "*.json", "*.jsonc", "*.graphql", "*.md", "*.yml", "*.yaml"] diff --git a/profiles/infrastructure-yaml.toml b/profiles/infrastructure-yaml.toml deleted file mode 100644 index d0458e3..0000000 --- a/profiles/infrastructure-yaml.toml +++ /dev/null @@ -1,8 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.prettier] -command = "sh" -options = ["-eu", "-c", "exec prettier --write --no-editorconfig --config \"$CAIDO_FORMATTER_ROOT/configs/prettier-infrastructure.json\" \"$@\"", "--"] -includes = ["*.yaml", "*.yml"] diff --git a/profiles/infrastructure.toml b/profiles/infrastructure.toml deleted file mode 100644 index 2f97de7..0000000 --- a/profiles/infrastructure.toml +++ /dev/null @@ -1,8 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.tofu] -command = "tofu" -options = ["fmt"] -includes = ["tofu/*.tf", "tofu/*.tfvars", "tofu/*.tftest.hcl"] diff --git a/profiles/internal-services.toml b/profiles/internal-services.toml deleted file mode 100644 index 92a6adc..0000000 --- a/profiles/internal-services.toml +++ /dev/null @@ -1,15 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.oxfmt] -command = "sh" -options = ["-eu", "-c", "exec oxfmt --write --config \"$CAIDO_FORMATTER_ROOT/configs/oxfmt.json\" \"$@\"", "--"] -includes = ["packages/*.ts", "packages/*.tsx", "packages/*.vue", "packages/*.js", "packages/*.mjs", "packages/*.cjs", "packages/*.json", "packages/*.css", "packages/*.html", "apps/*.ts", "apps/*.json", "scripts/*.ts", "scripts/*.mjs", "scripts/*.js", ".github/*.yml", ".github/*.yaml"] -excludes = ["*.svg", "*.grammar"] - -[formatter.oxfmt-root] -command = "sh" -options = ["-eu", "-c", "exec oxfmt --write --config \"$CAIDO_FORMATTER_ROOT/configs/oxfmt.json\" \"$@\"", "--"] -includes = ["*.ts", "*.mjs", "*.js", "*.json", "*.yml", "*.yaml"] -excludes = ["*/*"] diff --git a/profiles/mise-toolshed.toml b/profiles/mise-toolshed.toml deleted file mode 100644 index fbe9116..0000000 --- a/profiles/mise-toolshed.toml +++ /dev/null @@ -1,19 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**", ".mise/locks/*"] - -[formatter.oxfmt] -command = "sh" -options = ["-eu", "-c", "exec oxfmt --write --config \"$CAIDO_FORMATTER_ROOT/configs/oxfmt-toolshed.json\" \"$@\"", "--"] -includes = ["*.ts", "*.tsx", "*.mts", "*.cts", "*.js", "*.jsx", "*.mjs", "*.cjs", "*.vue", "*.html", "*.css", "*.scss", "*.json", "*.jsonc", "*.graphql", "*.md", "*.yml", "*.yaml"] -excludes = ["*.svg", "*.grammar"] - -[formatter.shfmt] -command = "shfmt" -options = ["-w"] -includes = ["*.sh", "*.bash", "*.bats"] - -[formatter.stylua] -command = "stylua" -options = [] -includes = ["*.lua", "*.luau"] diff --git a/profiles/nix.toml b/profiles/nix.toml deleted file mode 100644 index 6919a9d..0000000 --- a/profiles/nix.toml +++ /dev/null @@ -1,8 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.nixfmt] -command = "nixfmt" -options = [] -includes = ["*.nix"] diff --git a/profiles/postgres.toml b/profiles/postgres.toml deleted file mode 100644 index e65e39d..0000000 --- a/profiles/postgres.toml +++ /dev/null @@ -1,8 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.sqlfluff] -command = "sqlfluff" -options = ["format", "--dialect", "postgres"] -includes = ["*.sql"] diff --git a/profiles/proxy-backend.toml b/profiles/proxy-backend.toml deleted file mode 100644 index 1ac0426..0000000 --- a/profiles/proxy-backend.toml +++ /dev/null @@ -1,14 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.rustfmt] -command = "sh" -options = ["-eu", "-c", "exec rustup run nightly-2026-04-06 rustfmt --edition 2024 --config-path \"$CAIDO_FORMATTER_ROOT/configs/rustfmt/proxy-backend.toml\" --config skip_children=true \"$@\"", "--"] -includes = ["*.rs"] -excludes = ["proxy-tests/tests/common/macros/*"] - -[formatter.prettier] -command = "sh" -options = ["-eu", "-c", "exec prettier --write --no-editorconfig --config \"$CAIDO_FORMATTER_ROOT/configs/prettier-backend.json\" \"$@\"", "--"] -includes = ["*.graphql"] diff --git a/profiles/proxy-desktop.toml b/profiles/proxy-desktop.toml deleted file mode 100644 index f9ca2e0..0000000 --- a/profiles/proxy-desktop.toml +++ /dev/null @@ -1,8 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.prettier] -command = "sh" -options = ["-eu", "-c", "exec prettier --write --no-editorconfig --config \"$CAIDO_FORMATTER_ROOT/configs/prettier.json\" \"$@\"", "--"] -includes = ["packages/main/src/*.ts", "packages/main/src/*.js", "packages/ui/src/*.ts", "packages/ui/src/*.js", "packages/ui/src/*.vue", "packages/shared/src/*.ts", "packages/shared/src/*.js", "packages/migrations/src/*.ts", "packages/migrations/src/*.js"] diff --git a/profiles/proxy-e2e.toml b/profiles/proxy-e2e.toml deleted file mode 100644 index e947f92..0000000 --- a/profiles/proxy-e2e.toml +++ /dev/null @@ -1,9 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**", "plugins/*", "test-results/*", "playwright-report/*", "binaries/*"] - -[formatter.oxfmt] -command = "sh" -options = ["-eu", "-c", "exec oxfmt --write --config \"$CAIDO_FORMATTER_ROOT/configs/oxfmt.json\" \"$@\"", "--"] -includes = ["*.ts", "*.js", "*.mjs"] -excludes = ["*.svg", "*.grammar"] diff --git a/profiles/proxy-extension.toml b/profiles/proxy-extension.toml deleted file mode 100644 index 47eaa1c..0000000 --- a/profiles/proxy-extension.toml +++ /dev/null @@ -1,8 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.prettier] -command = "sh" -options = ["-eu", "-c", "exec prettier --write --no-editorconfig --config \"$CAIDO_FORMATTER_ROOT/configs/prettier.json\" \"$@\"", "--"] -includes = ["*.ts", "*.tsx", "*.mts", "*.cts", "*.js", "*.jsx", "*.mjs", "*.cjs", "*.vue", "*.html", "*.css", "*.scss", "*.json", "*.jsonc", "*.graphql", "*.md", "*.yml", "*.yaml"] diff --git a/profiles/proxy-frontend.toml b/profiles/proxy-frontend.toml deleted file mode 100644 index 5d311de..0000000 --- a/profiles/proxy-frontend.toml +++ /dev/null @@ -1,15 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**", "packages/ui/src/@types/modules/vue-router.d.ts"] - -[formatter.oxfmt] -command = "sh" -options = ["-eu", "-c", "exec oxfmt --write --config \"$CAIDO_FORMATTER_ROOT/configs/oxfmt.json\" \"$@\"", "--"] -includes = ["packages/*.ts", "packages/*.tsx", "packages/*.vue", "packages/*.js", "packages/*.mjs", "packages/*.cjs", "packages/*.json", "packages/*.css", "packages/*.scss", "packages/*.graphql", "packages/*.md", "packages/*.yml", "packages/*.yaml", "packages/*.html", "scripts/*.ts", "scripts/*.mjs", "scripts/*.js", ".github/*.yml", ".github/*.yaml"] -excludes = ["*.svg", "*.grammar"] - -[formatter.oxfmt-root] -command = "sh" -options = ["-eu", "-c", "exec oxfmt --write --config \"$CAIDO_FORMATTER_ROOT/configs/oxfmt.json\" \"$@\"", "--"] -includes = ["*.ts", "*.mjs", "*.js", "*.json", "*.yml", "*.yaml"] -excludes = ["*/*"] diff --git a/profiles/proxy-playground.toml b/profiles/proxy-playground.toml deleted file mode 100644 index 47eaa1c..0000000 --- a/profiles/proxy-playground.toml +++ /dev/null @@ -1,8 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.prettier] -command = "sh" -options = ["-eu", "-c", "exec prettier --write --no-editorconfig --config \"$CAIDO_FORMATTER_ROOT/configs/prettier.json\" \"$@\"", "--"] -includes = ["*.ts", "*.tsx", "*.mts", "*.cts", "*.js", "*.jsx", "*.mjs", "*.cjs", "*.vue", "*.html", "*.css", "*.scss", "*.json", "*.jsonc", "*.graphql", "*.md", "*.yml", "*.yaml"] diff --git a/profiles/secrets-sync.toml b/profiles/secrets-sync.toml deleted file mode 100644 index 38fe389..0000000 --- a/profiles/secrets-sync.toml +++ /dev/null @@ -1,8 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.deno] -command = "deno" -options = ["fmt"] -includes = ["*.ts", "*.tsx", "*.js", "*.jsx", "*.json", "*.jsonc", "*.md"] diff --git a/profiles/self.toml b/profiles/self.toml deleted file mode 100644 index db5b055..0000000 --- a/profiles/self.toml +++ /dev/null @@ -1,9 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.prettier] -command = "sh" -options = ["-eu", "-c", "exec prettier --write --no-editorconfig --config \"$CAIDO_FORMATTER_ROOT/configs/prettier.json\" \"$@\"", "--"] -includes = ["*.json", "*.yaml", "*.yml", "*.md"] -excludes = ["tests/*"] diff --git a/profiles/sqlite-rs.toml b/profiles/sqlite-rs.toml deleted file mode 100644 index 84718e4..0000000 --- a/profiles/sqlite-rs.toml +++ /dev/null @@ -1,9 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.rustfmt] -command = "sh" -options = ["-eu", "-c", "exec rustup run nightly-2026-04-06 rustfmt --edition 2024 --config-path \"$CAIDO_FORMATTER_ROOT/configs/rustfmt/sqlite-rs.toml\" --config skip_children=true \"$@\"", "--"] -includes = ["*.rs"] -excludes = ["proxy-tests/tests/common/macros/*"] diff --git a/profiles/student-backend.toml b/profiles/student-backend.toml deleted file mode 100644 index e713bcb..0000000 --- a/profiles/student-backend.toml +++ /dev/null @@ -1,9 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.rustfmt] -command = "sh" -options = ["-eu", "-c", "exec rustup run nightly-2026-04-06 rustfmt --edition 2024 --config-path \"$CAIDO_FORMATTER_ROOT/configs/rustfmt/student-backend.toml\" --config skip_children=true \"$@\"", "--"] -includes = ["*.rs"] -excludes = ["proxy-tests/tests/common/macros/*"] diff --git a/profiles/sync-backend.toml b/profiles/sync-backend.toml deleted file mode 100644 index e9827e2..0000000 --- a/profiles/sync-backend.toml +++ /dev/null @@ -1,9 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] - -[formatter.rustfmt] -command = "sh" -options = ["-eu", "-c", "exec rustup run nightly-2026-04-06 rustfmt --edition 2021 --config-path \"$CAIDO_FORMATTER_ROOT/configs/rustfmt/sync-backend.toml\" --config skip_children=true \"$@\"", "--"] -includes = ["*.rs"] -excludes = ["proxy-tests/tests/common/macros/*"] diff --git a/tests/test_config.py b/tests/test_config.py index 0eb765e..4934596 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,146 +1,227 @@ +"""Integration tests for the actual Nix-packaged formatters and generated config.""" + import json import os from pathlib import Path -import shutil import subprocess +import sys import tempfile import tomllib import unittest -ROOT = Path(__file__).resolve().parents[1] -TREEFMT = shutil.which('treefmt') +PACKAGES = json.loads(os.environ["CAIDO_TEST_CONFIGS"]) class ConfigurationTests(unittest.TestCase): - def test_all_presets_parse_and_have_file_patterns(self): - paths = [ROOT / 'treefmt.toml', *sorted((ROOT / 'profiles').glob('*.toml'))] - for path in paths: - with self.subTest(path=path.name): - data = tomllib.loads(path.read_text()) - for name, formatter in data['formatter'].items(): - self.assertTrue(formatter['command'], name) - self.assertTrue(formatter['includes'], name) - for name in data.get('formatters', data['formatter']): - self.assertIn(name, data['formatter']) + def test_commands_and_companion_configs_are_in_the_store(self): + for name, package in PACKAGES.items(): + data = tomllib.loads(Path(package["config"]).read_text()) + with self.subTest(profile=name): + self.assertTrue(data["formatter"]) + for formatter in data["formatter"].values(): + command = formatter["command"] + self.assertTrue(command.startswith("/nix/store/"), command) + self.assertTrue(os.access(command, os.X_OK), command) + self.assertTrue(formatter["includes"]) + for argument in formatter.get("options", []): + self.assertNotIn("CAIDO_FORMATTER_ROOT", argument) + if argument.startswith("/nix/store/"): + self.assertTrue(Path(argument).exists(), argument) def test_default_avoids_competing_engines(self): - data = tomllib.loads((ROOT / 'treefmt.toml').read_text()) - selected = set(data['formatters']) - self.assertLessEqual(len(selected & {'oxfmt', 'prettier', 'deno'}), 1) - self.assertLessEqual(len(selected & {'ruff', 'black'}), 1) - - def test_companion_configs_exist(self): - import re - for path in [ROOT / 'treefmt.toml', *(ROOT / 'profiles').glob('*.toml')]: - data = tomllib.loads(path.read_text()) - for formatter in data['formatter'].values(): - for argument in formatter.get('options', []): - for name in re.findall(r'\$CAIDO_FORMATTER_ROOT/([^"\s]+)', argument): - self.assertTrue((ROOT / name).is_file(), name) - - -@unittest.skipUnless(TREEFMT, 'treefmt is required for routing tests') + data = tomllib.loads(Path(PACKAGES["default"]["config"]).read_text()) + engines = set(data["formatter"]) + self.assertLessEqual(len(engines & {"oxfmt", "prettier", "deno"}), 1) + self.assertLessEqual(len(engines & {"ruff-format", "black"}), 1) + + def test_backend_and_python_settings_are_generated(self): + backend = tomllib.loads(Path(PACKAGES["proxy-backend"]["config"]).read_text()) + args = backend["formatter"]["prettier"]["options"] + settings = json.loads(Path(args[args.index("--config") + 1]).read_text()) + self.assertEqual(settings["overrides"][0]["options"]["printWidth"], 100) + private = tomllib.loads(Path(PACKAGES["caido-private"]["config"]).read_text()) + args = private["formatter"]["ruff-format"]["options"] + settings = tomllib.loads(Path(args[args.index("--config") + 1]).read_text()) + self.assertEqual(settings["target-version"], "py311") + + class RoutingTests(unittest.TestCase): def setUp(self): - self.temp = tempfile.TemporaryDirectory(prefix='caido formatter ') + self.temp = tempfile.TemporaryDirectory(prefix="caido formatter ") self.addCleanup(self.temp.cleanup) - self.project = Path(self.temp.name) / 'project with spaces' + self.project = Path(self.temp.name) / "project with spaces" self.project.mkdir() - self.bin = Path(self.temp.name) / 'bin' - self.bin.mkdir() - self.log = Path(self.temp.name) / 'calls.jsonl' - # The real shell and treefmt run; only the underlying formatting tools are stubbed. - stub = '''#!/usr/bin/env python3 -import json, os, pathlib, sys -with open(os.environ['FORMAT_TEST_LOG'], 'a') as log: - log.write(json.dumps({'tool': pathlib.Path(sys.argv[0]).name, 'args': sys.argv[1:]}) + '\\n') -for arg in sys.argv[1:]: - path = pathlib.Path(arg) - if path.is_file() and path.resolve().is_relative_to(pathlib.Path.cwd()): - text = path.read_text() - if not text.endswith('\\n'): - path.write_text(text + '\\n') -''' - for tool in ['oxfmt', 'prettier', 'rustup', 'ruff', 'tofu', 'shfmt', 'stylua', 'deno', 'nixfmt', 'sqlfluff', 'black']: - path = self.bin / tool - path.write_text(stub) - path.chmod(0o755) - self.env = dict(os.environ, PATH=str(self.bin) + os.pathsep + os.environ['PATH'], FORMAT_TEST_LOG=str(self.log), XDG_CACHE_HOME=str(Path(self.temp.name) / 'cache')) + self.env = dict(os.environ, XDG_CACHE_HOME=str(Path(self.temp.name) / "cache")) + self.env.pop("CAIDO_FORMATTER_ROOT", None) - def write(self, name, content='unformatted'): + def write(self, name, content="invalid code that must remain excluded"): path = self.project / name path.parent.mkdir(parents=True, exist_ok=True) path.write_text(content) return path def run_formatter(self, profile, *args): - return subprocess.run([str(ROOT / 'bin/format'), profile, '--walk', 'filesystem', '--no-cache', *args], cwd=self.project, env=self.env, capture_output=True, text=True) - - def calls(self): - return [json.loads(line) for line in self.log.read_text().splitlines()] if self.log.exists() else [] - - def test_default_routes_each_language_once_and_skips_generated_files(self): - names = ['src/a.ts', 'src/a.rs', 'src/a.py', 'tofu/a.tf', 'scripts/a.sh', 'lua/a.lua'] - for name in names: - self.write(name) - ignored = [self.write('node_modules/a.ts'), self.write('src/__generated__/a.ts'), self.write('.formatter/config.json')] - result = self.run_formatter('default') - self.assertEqual(result.returncode, 0, result.stderr) - self.assertEqual({call['tool'] for call in self.calls()}, {'oxfmt', 'rustup', 'ruff', 'tofu', 'shfmt', 'stylua'}) - for name in names: - self.assertTrue((self.project / name).read_text().endswith('\n'), name) + return subprocess.run( + [ + PACKAGES[profile]["program"], + "--tree-root", + str(self.project), + "--working-dir", + str(self.project), + "--walk", + "filesystem", + "--no-cache", + *args, + ], + cwd=self.temp.name, + env=self.env, + capture_output=True, + text=True, + ) + + def assert_success(self, result): + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + + def test_default_formats_six_languages_and_skips_generated_files(self): + samples = { + "src/a.ts": 'export const value={foo:"bar"}', + "src/a.rs": 'fn main(){println!("hello");}', + "src/a.py": "answer=1+2", + "tofu/a.tf": 'locals { value="test" }', + "scripts/a.sh": "#!/bin/sh\nif true;then echo ok;fi", + "lua/a.lua": "local answer={1,2,3}", + } + for name, content in samples.items(): + self.write(name, content) + ignored = [ + self.write("node_modules/a.ts"), + self.write("src/__generated__/a.ts"), + self.write(".formatter/config.json"), + ] + self.assert_success(self.run_formatter("default")) + for name, content in samples.items(): + formatted = (self.project / name).read_text() + self.assertNotEqual(formatted, content, name) + for path in ignored: + self.assertEqual(path.read_text(), "invalid code that must remain excluded") + self.assert_success(self.run_formatter("default", "--ci")) + + def test_backend_preserves_macro_exclusion(self): + self.write("schema.graphql", "query Example{viewer{id name}}") + self.write("src/a.rs", "fn main(){let value=1;}") + ignored = self.write("proxy-tests/tests/common/macros/a.rs") + self.assert_success(self.run_formatter("proxy-backend")) + self.assertEqual(ignored.read_text(), "invalid code that must remain excluded") + self.assert_success(self.run_formatter("proxy-backend", "--ci")) + + def test_rustfmt_does_not_recurse_into_unselected_children(self): + self.write("src/lib.rs", "mod child;\npub fn main(){let value=1;}") + child = self.write("src/child.rs", "pub fn child(){let answer=42;}") + before = child.read_text() + self.assert_success(self.run_formatter("proxy-backend", "src/lib.rs")) + self.assertEqual(child.read_text(), before) + + def test_frontend_keeps_source_scopes_and_sorts_imports(self): + source = self.write( + "packages/ui/src/main.ts", + 'import z from "z";\nimport fs from "node:fs";\nexport const x={z,fs};', + ) + self.write("packages/ui/src/main.vue", "") + ignored = [ + self.write("packages/ui/src/@types/modules/vue-router.d.ts"), + self.write("unrelated/example.ts"), + ] + self.assert_success(self.run_formatter("proxy-frontend")) + self.assertTrue(source.read_text().startswith('import fs from "node:fs";')) for path in ignored: - self.assertEqual(path.read_text(), 'unformatted') - - def test_backend_uses_graphql_settings_and_excludes_rust_macros(self): - self.write('schema.graphql') - self.write('src/a.rs') - ignored = self.write('proxy-tests/tests/common/macros/a.rs') - result = self.run_formatter('proxy-backend') - self.assertEqual(result.returncode, 0, result.stderr) - calls = self.calls() - self.assertEqual({c['tool'] for c in calls}, {'rustup', 'prettier'}) - self.assertIn(str(ROOT / 'configs/prettier-backend.json'), next(c['args'] for c in calls if c['tool'] == 'prettier')) - self.assertEqual(ignored.read_text(), 'unformatted') - - def test_frontend_retains_generated_and_type_exclusions(self): - self.write('packages/ui/src/main.ts') - self.write('packages/ui/src/main.vue') - ignored = self.write('packages/ui/src/@types/modules/vue-router.d.ts') - outside = self.write('unrelated/example.ts') - result = self.run_formatter('proxy-frontend') - self.assertEqual(result.returncode, 0, result.stderr) - self.assertEqual({c['tool'] for c in self.calls()}, {'oxfmt'}) - self.assertEqual(ignored.read_text(), 'unformatted') - self.assertEqual(outside.read_text(), 'unformatted') - - def test_analytics_does_not_format_dbt_transform(self): - self.write('apps/event_consumer/src/a.py') - ignored = self.write('apps/transform/a.py') - result = self.run_formatter('analytics') - self.assertEqual(result.returncode, 0, result.stderr) - self.assertEqual({c['tool'] for c in self.calls()}, {'ruff'}) - self.assertEqual(ignored.read_text(), 'unformatted') + self.assertEqual(path.read_text(), "invalid code that must remain excluded") + + def test_analytics_excludes_dbt_and_private_limits_source_scopes(self): + self.write("apps/event_consumer/src/a.py", "answer=1+2") + ignored = self.write("apps/transform/a.py") + self.assert_success(self.run_formatter("analytics")) + self.assertEqual(ignored.read_text(), "invalid code that must remain excluded") + self.write("scripts/a.py", "answer=1+2") + self.write("tests/a.py", "answer=1+2") + outside = self.write("outside/a.py") + self.assert_success(self.run_formatter("caido-private")) + self.assertEqual(outside.read_text(), "invalid code that must remain excluded") + + def test_infrastructure_formats_multiple_files(self): + for name in ["a.tf", "nested/b.tf"]: + self.write("tofu/" + name, 'locals { value="test" }') + self.assert_success(self.run_formatter("infrastructure")) + self.assert_success(self.run_formatter("infrastructure", "--ci")) def test_ci_reports_change_then_succeeds_after_formatting(self): - self.write('a.ts') - first = self.run_formatter('default', '--ci') - self.assertNotEqual(first.returncode, 0) - second = self.run_formatter('default', '--ci') - self.assertEqual(second.returncode, 0, second.stderr) - - def test_unknown_profile_fails_before_running_tools(self): - result = self.run_formatter('unknown') - self.assertEqual(result.returncode, 2) - self.assertFalse(self.calls()) - - def test_explicit_root_formats_the_target_from_another_directory(self): - self.write('a.ts') - result = subprocess.run([str(ROOT / 'bin/format'), 'default', '--root', str(self.project), '--walk', 'filesystem', '--no-cache'], cwd=Path(self.temp.name), env=self.env, capture_output=True, text=True) - self.assertEqual(result.returncode, 0, result.stderr) - self.assertTrue((self.project / 'a.ts').read_text().endswith('\n')) - - -if __name__ == '__main__': + self.write("packages/ui/src/a.ts", "export const a={b:1}") + self.assertNotEqual(self.run_formatter("proxy-frontend", "--ci").returncode, 0) + self.assert_success(self.run_formatter("proxy-frontend", "--ci")) + + def test_packaged_tools_do_not_use_ambient_path(self): + self.write("schema.graphql", "query Example{viewer{id name}}") + self.write("src/a.rs", "fn main(){let answer=42;}") + poison = Path(self.temp.name) / "broken host tools" + poison.mkdir() + for name in ["rustup", "rustfmt", "prettier", "sh", "treefmt"]: + path = poison / name + path.write_text("#!/bin/sh\nexit 99\n") + path.chmod(0o755) + self.env["PATH"] = str(poison) + self.assert_success(self.run_formatter("proxy-backend")) + + +class LauncherTests(unittest.TestCase): + def test_explicit_root_and_arguments_are_forwarded_without_installing_host_tools( + self, + ): + with tempfile.TemporaryDirectory(prefix="caido launcher ") as temp: + temp = Path(temp) + target = temp / "project with spaces" + target.mkdir() + binary_dir = temp / "bin" + binary_dir.mkdir() + capture = temp / "arguments.json" + fake_nix = binary_dir / "nix" + fake_nix.write_text( + f"#!{sys.executable}\n" + "import json, os, sys\n" + "from pathlib import Path\n" + "Path(os.environ['CAPTURE_ARGS']).write_text(json.dumps(sys.argv[1:]))\n" + ) + fake_nix.chmod(0o755) + env = dict( + os.environ, + PATH=str(binary_dir) + os.pathsep + os.environ["PATH"], + CAPTURE_ARGS=str(capture), + ) + launcher = Path(os.environ["CAIDO_TEST_SOURCE"]) / "bin/format" + result = subprocess.run( + [ + os.environ["CAIDO_TEST_SHELL"], + str(launcher), + "proxy-frontend", + "--root", + str(target), + "--ci", + "packages/ui/src/file with spaces.ts", + ], + cwd=temp, + env=env, + capture_output=True, + text=True, + ) + self.assertEqual(result.returncode, 0, result.stderr) + args = json.loads(capture.read_text()) + self.assertIn("run", args) + self.assertTrue(args[args.index("run") + 1].endswith("#proxy-frontend")) + self.assertEqual(args[args.index("--tree-root") + 1], str(target.resolve())) + self.assertEqual( + args[args.index("--working-dir") + 1], str(target.resolve()) + ) + self.assertEqual(args[-2:], ["--ci", "packages/ui/src/file with spaces.ts"]) + + +if __name__ == "__main__": unittest.main() diff --git a/treefmt.nix b/treefmt.nix new file mode 100644 index 0000000..63279e6 --- /dev/null +++ b/treefmt.nix @@ -0,0 +1,104 @@ +{ + config, + lib, + pkgs, + ... +}: +let + profiles = import ./nix/profiles.nix; + styles = import ./nix/settings.nix; + profile = profiles.${config.caido.profile}; + routes = profile.formatters; + route = name: routes.${name} or { }; + style = family: styles.${family}.${(route family).style or "default"}; + json = pkgs.formats.json { }; + toml = pkgs.formats.toml { }; + + # The names used by treefmt-nix for the audited Ruff and OpenTofu entries. + programName = + name: + { + ruff = "ruff-format"; + tofu = "terraform"; + } + .${name} or name; + nativeRoutes = lib.filterAttrs (name: _: name != "oxfmt-root") routes; + # Respect downstream mkForce enable/disable overrides as well as the preset. + enabled = name: config.programs.${programName name}.enable or false; +in +{ + options.caido.profile = lib.mkOption { + type = lib.types.enum (builtins.attrNames profiles); + default = "default"; + description = "Audited Caido formatter profile to use."; + }; + + config = { + # Keep Git/worktree root detection in treefmt itself. In particular, do not + # anchor a packaged formatter to the formatter repository's flake.nix. + projectRootFile = null; + enableDefaultExcludes = false; + settings.on-unmatched = "debug"; + settings.excludes = + import ./nix/excludes.nix + ++ (profile.excludes or [ ]) + ++ [ + "result" + "result-*" + ]; + + programs = lib.mkMerge [ + (lib.mapAttrs' ( + name: value: + lib.nameValuePair (programName name) { + enable = true; + includes = value.includes; + excludes = value.excludes or [ ]; + } + ) nativeRoutes) + { + prettier.settings = style "prettier"; + rustfmt.edition = (route "rustfmt").edition or "2024"; + # Preserve the previous `shfmt -w` behavior; treefmt-nix otherwise adds + # two-space indentation and simplification by default. + shfmt.useEditorConfig = true; + sqlfluff.dialect = "postgres"; + } + ]; + + settings.formatter = lib.mkMerge [ + (lib.mkIf (enabled "oxfmt") { + oxfmt.options = [ + "--write" + "--config" + (toString (json.generate "caido-oxfmt.json" (style "oxfmt"))) + ]; + }) + (lib.mkIf (routes ? oxfmt-root && enabled "oxfmt") { + # A separate root-only entry prevents *.ts from matching unrelated + # subdirectories while retaining the frontend's source scopes. + oxfmt-root = { + command = lib.getExe config.programs.oxfmt.package; + options = config.settings.formatter.oxfmt.options; + inherit (routes.oxfmt-root) includes excludes; + }; + }) + (lib.mkIf (enabled "prettier") { + prettier.options = [ "--no-editorconfig" ]; + }) + (lib.mkIf (enabled "rustfmt") { + rustfmt.options = [ + "--config-path" + (toString (toml.generate "caido-rustfmt.toml" (style "rustfmt"))) + ]; + }) + (lib.mkIf (enabled "ruff") { + ruff-format.options = [ + "--force-exclude" + "--config" + (toString (toml.generate "caido-ruff.toml" (style "ruff"))) + ]; + }) + ]; + }; +} diff --git a/treefmt.toml b/treefmt.toml deleted file mode 100644 index e2dca17..0000000 --- a/treefmt.toml +++ /dev/null @@ -1,62 +0,0 @@ -# Shared Caido formatting. Invoke through bin/format to resolve companion configs. -# Alternative engines are opt-in: never select Oxfmt + Prettier/Deno, or Ruff + Black, for the same files. -on-unmatched = "debug" -excludes = [".git/*", ".formatter/*", "node_modules/*", "*/node_modules/*", "dist/*", "*/dist/*", "target/*", "*/target/*", "coverage/*", "*/coverage/*", ".venv/*", "*/.venv/*", ".terraform/*", "*/.terraform/*", "*-lock.json", "pnpm-lock.yaml", "yarn.lock", "uv.lock", "*.min.js", "*.min.css", ".agents/*", ".claude/*", ".cursor/*", "**/__generated__/**"] -formatters = ["oxfmt", "rustfmt", "ruff", "tofu", "shfmt", "stylua"] - -[formatter.oxfmt] -command = "sh" -options = ["-eu", "-c", "exec oxfmt --write --config \"$CAIDO_FORMATTER_ROOT/configs/oxfmt.json\" \"$@\"", "--"] -includes = ["*.ts", "*.tsx", "*.mts", "*.cts", "*.js", "*.jsx", "*.mjs", "*.cjs", "*.vue", "*.html", "*.css", "*.scss", "*.json", "*.jsonc", "*.graphql", "*.md", "*.yml", "*.yaml"] -excludes = ["*.svg", "*.grammar"] - -[formatter.prettier] -command = "sh" -options = ["-eu", "-c", "exec prettier --write --no-editorconfig --config \"$CAIDO_FORMATTER_ROOT/configs/prettier.json\" \"$@\"", "--"] -includes = ["*.ts", "*.tsx", "*.mts", "*.cts", "*.js", "*.jsx", "*.mjs", "*.cjs", "*.vue", "*.html", "*.css", "*.scss", "*.json", "*.jsonc", "*.graphql", "*.md", "*.yml", "*.yaml"] - -[formatter.rustfmt] -command = "sh" -options = ["-eu", "-c", "exec rustup run nightly-2026-04-06 rustfmt --edition 2024 --config-path \"$CAIDO_FORMATTER_ROOT/configs/rustfmt.toml\" --config skip_children=true \"$@\"", "--"] -includes = ["*.rs"] -excludes = ["proxy-tests/tests/common/macros/*"] - -[formatter.ruff] -command = "sh" -options = ["-eu", "-c", "exec ruff format --force-exclude --config \"$CAIDO_FORMATTER_ROOT/configs/ruff.toml\" \"$@\"", "--"] -includes = ["*.py", "*.pyi", "*.ipynb"] - -[formatter.tofu] -command = "tofu" -options = ["fmt"] -includes = ["*.tf", "*.tfvars", "*.tftest.hcl"] - -[formatter.shfmt] -command = "shfmt" -options = ["-w"] -includes = ["*.sh", "*.bash", "*.bats"] - -[formatter.stylua] -command = "stylua" -options = [] -includes = ["*.lua", "*.luau"] - -[formatter.deno] -command = "deno" -options = ["fmt"] -includes = ["*.ts", "*.tsx", "*.js", "*.jsx", "*.json", "*.jsonc", "*.md"] - -[formatter.nixfmt] -command = "nixfmt" -options = [] -includes = ["*.nix"] - -[formatter.sqlfluff] -command = "sqlfluff" -options = ["format", "--dialect", "postgres"] -includes = ["*.sql"] - -[formatter.black] -command = "black" -options = [] -includes = ["*.py", "*.pyi"] From 675a7af1633e699aba0df9679f28952dd5f29cc3 Mon Sep 17 00:00:00 2001 From: Christopher Guay Date: Mon, 9 Nov 2026 11:33:10 -0500 Subject: [PATCH 02/10] Keep Nix task checks locked and independent --- .mise/tasks/format/_default | 2 +- .mise/tasks/format/check | 2 +- .mise/tasks/test | 4 ++-- README.md | 18 ++++++++++-------- bin/format | 2 +- examples/github-actions.yml | 2 +- flake.nix | 11 +++++++++++ tests/test_config.py | 14 +++++++++++--- 8 files changed, 38 insertions(+), 17 deletions(-) diff --git a/.mise/tasks/format/_default b/.mise/tasks/format/_default index 0bccb23..25dc597 100755 --- a/.mise/tasks/format/_default +++ b/.mise/tasks/format/_default @@ -1,4 +1,4 @@ #!/usr/bin/env sh #MISE description="Format this repository" set -eu -exec nix fmt +exec nix fmt --no-update-lock-file diff --git a/.mise/tasks/format/check b/.mise/tasks/format/check index 965cea2..2411368 100755 --- a/.mise/tasks/format/check +++ b/.mise/tasks/format/check @@ -1,4 +1,4 @@ #!/usr/bin/env sh #MISE description="Check formatting in a disposable Nix build" set -eu -exec nix flake check +exec nix build --no-link --no-update-lock-file .#formatting-check diff --git a/.mise/tasks/test b/.mise/tasks/test index 9df7e89..8cae065 100755 --- a/.mise/tasks/test +++ b/.mise/tasks/test @@ -1,4 +1,4 @@ #!/usr/bin/env sh -#MISE description="Check Nix configuration, formatting and real formatter routing" +#MISE description="Check Nix configuration and real formatter routing" set -eu -exec nix flake check +exec nix build --no-link --no-update-lock-file .#tests diff --git a/README.md b/README.md index 9318fc1..f22cf6d 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Requires Nix or Lix with `nix-command` and `flakes` enabled. From this checkout: ```sh # Format this repository's Nix, Python, shell, JSON, YAML and Markdown. -nix fmt +nix fmt --no-update-lock-file # Format another project with its audited preset. bin/format proxy-backend --root ../proxy-backend @@ -31,13 +31,13 @@ Each preset is a Nix app and package. You can bypass the convenience launcher: ```sh # Run from proxy-backend's root; treefmt detects that Git worktree. -nix run /path/to/formatter#proxy-backend -- . +nix run --no-update-lock-file /path/to/formatter#proxy-backend -- . # Explicit target root from another directory. -nix run .#proxy-backend -- --tree-root ../proxy-backend --working-dir ../proxy-backend +nix run --no-update-lock-file .#proxy-backend -- --tree-root ../proxy-backend --working-dir ../proxy-backend # Build a standalone treefmt wrapper with all dependencies and settings. -nix build .#proxy-backend +nix build --no-update-lock-file .#proxy-backend ./result/bin/treefmt --tree-root ../proxy-backend --working-dir ../proxy-backend ``` @@ -130,7 +130,7 @@ When importing the module, non-Rust package versions come from the `pkgs` passed ## Mise and maintenance -Mise can remain the development-environment/task entry point. This repository uses `.mise/config.toml` and executable task files under `.mise/tasks/`, with no formatter tools to install through mise. The `format`, `format:check` and `test` tasks call Nix. +Mise can remain the development-environment/task entry point. This repository uses `.mise/config.toml` and executable task files under `.mise/tasks/`, with no formatter tools to install through mise. `format` runs the self formatter, `format:check` builds only the formatting check, and `test` builds the configuration/routing checks. These commands reject lockfile updates; update dependencies explicitly with `nix flake update`. A consuming project can create executable `.mise/tasks/format/_default`: @@ -151,9 +151,11 @@ exec ../formatter/bin/format proxy-frontend --root "$MISE_PROJECT_ROOT" --ci Validation uses the real Nix-packaged binaries, including six-language routing, excluded files, Rust child modules, paths with spaces, idempotence and independence from the host PATH: ```sh -nix flake check -nix flake check --all-systems --no-build -nix develop +nix flake check --no-update-lock-file +nix flake check --all-systems --no-build --no-update-lock-file +nix build --no-link --no-update-lock-file .#formatting-check +nix build --no-link --no-update-lock-file .#tests +nix develop --no-update-lock-file ``` Supported systems are Apple Silicon macOS (`aarch64-darwin`) and ARM64/x86_64 Linux. The locked Nixpkgs release no longer supports Intel macOS. [The GitHub Actions example](examples/github-actions.yml) installs Nix and runs `nix flake check`. It remains an example; activating it requires workflow write permission. diff --git a/bin/format b/bin/format index 77348fe..7359645 100755 --- a/bin/format +++ b/bin/format @@ -33,5 +33,5 @@ if [ "${1:-}" = --root ]; then else target_root=$(pwd -P) fi -exec nix --extra-experimental-features 'nix-command flakes' run "$formatter_root#$profile" -- \ +exec nix --extra-experimental-features 'nix-command flakes' run --no-update-lock-file "$formatter_root#$profile" -- \ --tree-root "$target_root" --working-dir "$target_root" "$@" diff --git a/examples/github-actions.yml b/examples/github-actions.yml index fa8c6e6..c17464f 100644 --- a/examples/github-actions.yml +++ b/examples/github-actions.yml @@ -18,4 +18,4 @@ jobs: with: github_access_token: ${{ secrets.GITHUB_TOKEN }} - name: Validate configuration, formatting and real formatter routing - run: nix flake check --show-trace + run: nix flake check --no-update-lock-file --show-trace diff --git a/flake.nix b/flake.nix index 76c4ddc..bb0158a 100644 --- a/flake.nix +++ b/flake.nix @@ -89,6 +89,17 @@ wrappers // configFiles // { + formatting-check = configs.self.config.build.check self; + tests = pkgs.linkFarm "caido-formatter-tests" [ + { + name = "configuration"; + path = self.checks.${system}.configuration; + } + { + name = "routing"; + path = self.checks.${system}.routing; + } + ]; versions = pkgs.writeText "caido-formatter-versions.json" ( builtins.toJSON ( builtins.mapAttrs (_: value: value.version) { diff --git a/tests/test_config.py b/tests/test_config.py index 4934596..329f133 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -155,8 +155,15 @@ def test_infrastructure_formats_multiple_files(self): self.assert_success(self.run_formatter("infrastructure", "--ci")) def test_ci_reports_change_then_succeeds_after_formatting(self): - self.write("packages/ui/src/a.ts", "export const a={b:1}") - self.assertNotEqual(self.run_formatter("proxy-frontend", "--ci").returncode, 0) + source = self.write("packages/ui/src/a.ts", "export const a={b:1}") + before = source.read_text() + first = self.run_formatter("proxy-frontend", "--ci") + self.assertNotEqual(first.returncode, 0) + self.assertIn( + "unexpected changes detected, --fail-on-change is enabled", + first.stdout + first.stderr, + ) + self.assertNotEqual(source.read_text(), before) self.assert_success(self.run_formatter("proxy-frontend", "--ci")) def test_packaged_tools_do_not_use_ambient_path(self): @@ -215,7 +222,8 @@ def test_explicit_root_and_arguments_are_forwarded_without_installing_host_tools self.assertEqual(result.returncode, 0, result.stderr) args = json.loads(capture.read_text()) self.assertIn("run", args) - self.assertTrue(args[args.index("run") + 1].endswith("#proxy-frontend")) + self.assertEqual(args[args.index("run") + 1], "--no-update-lock-file") + self.assertTrue(args[args.index("run") + 2].endswith("#proxy-frontend")) self.assertEqual(args[args.index("--tree-root") + 1], str(target.resolve())) self.assertEqual( args[args.index("--working-dir") + 1], str(target.resolve()) From 285d7301ec9cc4985665d70ebf9e3dea36e748cc Mon Sep 17 00:00:00 2001 From: Christopher Guay Date: Mon, 9 Nov 2026 13:57:59 -0500 Subject: [PATCH 03/10] Use one shared formatting policy for every repository --- .mise/config.toml | 1 - .mise/tasks/format/_default | 4 - .mise/tasks/format/check | 4 - .mise/tasks/test | 4 - README.md | 175 +- bin/format | 37 - .../0001-evaluate-treefmt-nix-in-formatter.md | 12 +- docs/audit.md | 137 - docs/inventory.json | 2256 ----------------- examples/github-actions.yml | 6 +- flake.nix | 178 +- nix/excludes.nix | 27 - nix/profiles.nix | 583 ----- nix/settings.nix | 146 -- support/rustfmt.py | 63 + templates/default/flake.nix | 7 + tests/test_config.py | 370 ++- treefmt.nix | 229 +- 18 files changed, 469 insertions(+), 3770 deletions(-) delete mode 100644 .mise/config.toml delete mode 100755 .mise/tasks/format/_default delete mode 100755 .mise/tasks/format/check delete mode 100755 .mise/tasks/test delete mode 100755 bin/format delete mode 100644 docs/audit.md delete mode 100644 docs/inventory.json delete mode 100644 nix/excludes.nix delete mode 100644 nix/profiles.nix delete mode 100644 nix/settings.nix create mode 100644 support/rustfmt.py create mode 100644 templates/default/flake.nix diff --git a/.mise/config.toml b/.mise/config.toml deleted file mode 100644 index 06fb201..0000000 --- a/.mise/config.toml +++ /dev/null @@ -1 +0,0 @@ -# Optional task runner. The locked Nix flake supplies formatter packages. diff --git a/.mise/tasks/format/_default b/.mise/tasks/format/_default deleted file mode 100755 index 25dc597..0000000 --- a/.mise/tasks/format/_default +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -#MISE description="Format this repository" -set -eu -exec nix fmt --no-update-lock-file diff --git a/.mise/tasks/format/check b/.mise/tasks/format/check deleted file mode 100755 index 2411368..0000000 --- a/.mise/tasks/format/check +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -#MISE description="Check formatting in a disposable Nix build" -set -eu -exec nix build --no-link --no-update-lock-file .#formatting-check diff --git a/.mise/tasks/test b/.mise/tasks/test deleted file mode 100755 index 8cae065..0000000 --- a/.mise/tasks/test +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -#MISE description="Check Nix configuration and real formatter routing" -set -eu -exec nix build --no-link --no-update-lock-file .#tests diff --git a/README.md b/README.md index f22cf6d..b744912 100644 --- a/README.md +++ b/README.md @@ -1,165 +1,72 @@ # Caido formatter -Shared formatting for Caido projects, packaged and configured with [treefmt-nix](https://github.com/numtide/treefmt-nix). +One shared [treefmt-nix](https://github.com/numtide/treefmt-nix) configuration for every repository. Each language always uses the same formatter, version and settings. There are no project presets or local formatter settings to maintain. -Nix supplies the formatter binaries, generates their JSON/TOML settings, and generates treefmt's configuration. Every command points into the Nix store. A caller's npm packages, mise tool versions, or rustup default cannot change the chosen formatters. +## Add to any project -## Run a formatter +Use this identical `flake.nix` in every repository: -Requires Nix or Lix with `nix-command` and `flakes` enabled. From this checkout: - -```sh -# Format this repository's Nix, Python, shell, JSON, YAML and Markdown. -nix fmt --no-update-lock-file - -# Format another project with its audited preset. -bin/format proxy-backend --root ../proxy-backend -bin/format proxy-frontend --root ../proxy-frontend -bin/format analytics --root ../analytics -bin/format infrastructure --root ../infrastructure - -# Check formatting in a disposable CI checkout. -bin/format proxy-backend --root ../proxy-backend --ci +```nix +{ + inputs.caido-formatter.url = "git+ssh://git@github.com/caido/formatter"; -# Format selected files, relative to the target root. -bin/format proxy-frontend --root ../proxy-frontend packages/ui/src/App.vue + outputs = { self, caido-formatter, ... }: + caido-formatter.lib.forProject self; +} ``` -No separate formatter installation step is needed. Nix downloads or builds the selected profile's dependencies on first use and reuses them afterward. The launcher also works from a consuming project: `/path/to/formatter/bin/format proxy-backend` targets the current directory. - -Each preset is a Nix app and package. You can bypass the convenience launcher: +Then run: ```sh -# Run from proxy-backend's root; treefmt detects that Git worktree. -nix run --no-update-lock-file /path/to/formatter#proxy-backend -- . - -# Explicit target root from another directory. -nix run --no-update-lock-file .#proxy-backend -- --tree-root ../proxy-backend --working-dir ../proxy-backend - -# Build a standalone treefmt wrapper with all dependencies and settings. -nix build --no-update-lock-file .#proxy-backend -./result/bin/treefmt --tree-root ../proxy-backend --working-dir ../proxy-backend +nix fmt +nix flake check ``` -`--ci` can rewrite files before returning a failure. `nix flake check` checks this repository's formatting in a disposable copy and does not modify your checkout. +The shared helper checks **your repository's source**. It exports only a `formatting` check and a `formatting-check` package. It does not import the formatter library's tests or check the library's own source instead of yours. An existing flake can merge these outputs with its other outputs; no formatter-specific settings are required. -## Where the configuration lives - -| File | Responsibility | -| -------------------------- | -------------------------------------------------------------------------------------- | -| `flake.nix` / `flake.lock` | Pin Nixpkgs, treefmt-nix and rust-overlay; export apps, packages, dev shell and checks | -| `treefmt.nix` | Enable native treefmt-nix modules and generate formatter-specific settings | -| `nix/settings.nix` | Shared Oxfmt, Prettier, rustfmt and Ruff style settings | -| `nix/profiles.nix` | Project-specific formatter selection, file patterns, style selection and Rust edition | -| `nix/excludes.nix` | Common dependency and generated-file exclusions | - -For example, the backend enables the native Prettier module, limits it to GraphQL, and supplies the existing width-100 override through `programs.prettier.settings`. Treefmt-nix writes a Prettier config in `/nix/store`, writes treefmt's TOML with absolute executable/config paths, and wraps treefmt with that TOML. - -The other tools use the same approach. Oxfmt and Ruff settings are generated with `pkgs.formats.json` and `pkgs.formats.toml`; rustfmt uses a Nix-packaged nightly binary directly. There is no runtime `CAIDO_FORMATTER_ROOT`, config copying, or rustup invocation. - -Inspect the generated configuration and locked package versions: +`nix flake check` runs all entries under `checks`; it has no check-name filter. If your flake adds other checks, run formatting alone with: ```sh -cat "$(nix build .#config-proxy-backend --no-link --print-out-paths)" -cat "$(nix build .#versions --no-link --print-out-paths)" -nix eval --json .#lib.profileNames -``` - -## Profiles and versions - -All 26 existing profile names remain available, including `proxy-*`, `analytics`, `caido-private`, `infrastructure`, `mise-toolshed`, `secrets-sync`, the other Rust backends/libraries, `electron-updater`, and the optional `nix`, `postgres`, and legacy Black presets. Optional profiles now get their tools from Nix too. - -`default` selects Oxfmt, rustfmt, Ruff, OpenTofu, shfmt and StyLua. Prettier/Deno and Ruff/Black remain separate choices so competing engines do not rewrite the same files. Treefmt-nix calls the Ruff entry `ruff-format` and the OpenTofu entry `terraform`. - -This migration also consolidates package versions. The audited settings and scopes are retained, but old per-project mise version overrides are replaced by this lockfile: - -| Tool | Nix version | Previous setup | -| -------- | ------------------ | ------------------------------------------- | -| treefmt | 2.6.0 | 2.6.0 | -| Oxfmt | 0.75.0 | 0.53.0 / 0.73.0 | -| Prettier | 3.9.10 | Several versions, including 3.2.5 and 3.7.4 | -| rustfmt | nightly-2026-04-06 | Same pinned nightly | -| Ruff | 0.17.4 | 0.15.16 / 0.16.9 | -| OpenTofu | 1.13.5 | 1.9.1 | -| shfmt | 3.14.1 | 3.14.1 | -| StyLua | 2.6.0 | 2.6.0 | -| Deno | 2.9.8 | Supplied externally | -| nixfmt | 1.5.0 | Supplied externally | -| SQLFluff | 4.5.0 | Supplied externally | -| Black | 26.5.1 | Legacy 25.12.0 / older | - -Version changes can produce additional formatting differences. Review the initial diff when adopting the migration. Updating `flake.lock` updates package versions; the nightly date is also pinned explicitly in `flake.nix`. - -Rust still uses explicit editions and `skip_children=true`; the backend macro exclusion stays in treefmt. Analytics still excludes dbt's transform app, and the frontend retains its generated/type-file exclusions. Extensionless shell scripts need explicit patterns; the self profile includes `bin/format`. - -ESLint, Clippy, Ruff lint rules, typechecking, dbt validation and infrastructure validation remain separate project checks. Using a formatter preset does not replace those checks. Cargo workspaces with mixed editions need separate Rust entries or a Cargo-aware wrapper. - -## Use from another flake - -The simplest integration reuses the already-packaged profile. Add the private repository as an input, and expose its wrapper as your project's formatter: - -```nix -{ - inputs.caido-formatter.url = "git+ssh://git@github.com/caido/formatter"; - - outputs = { caido-formatter, ... }: { - formatter = builtins.mapAttrs - (_system: packages: packages.proxy-frontend) - caido-formatter.packages; - }; -} +nix build --no-link .#formatting-check ``` -The consuming flake's lockfile pins the shared repository and its dependencies. Run `nix fmt` in that project. The standard private Git authentication for your checkout is required when resolving the input. +This check formats a disposable source copy and leaves your working tree unchanged. Use `--no-update-lock-file` with these commands in CI to reject missing or stale lockfiles. -For project overrides, import the exported module into your own treefmt-nix evaluation: +## The shared configuration -```nix -treefmtEval = treefmt-nix.lib.evalModule pkgs { - imports = [ caido-formatter.lib.treefmtModule ]; - caido.profile = "proxy-backend"; - settings.excludes = [ "fixtures/*" ]; -}; - -# In the consuming flake's outputs for each system: -formatter.${system} = treefmtEval.config.build.wrapper; -checks.${system}.formatting = treefmtEval.config.build.check self; -``` +All formatting policy lives in **`treefmt.nix`**: -When importing the module, non-Rust package versions come from the `pkgs` passed to that evaluation. Reusing the packaged profile uses this repository's exact locked versions. The exported module retains the pinned nightly via rust-overlay in both cases. +| Files | Formatter | +| --------------------------------------------------------------------- | ---------------------------- | +| JavaScript, TypeScript, Vue, HTML, CSS, JSON, GraphQL, Markdown, YAML | Oxfmt | +| Python | Ruff | +| Rust | rustfmt, pinned nightly | +| Terraform/OpenTofu | OpenTofu | +| Shell | shfmt | +| Lua/Luau | StyLua | +| Nix | nixfmt | +| SQL | SQLFluff, PostgreSQL dialect | -## Mise and maintenance +There is one set of language globs and generic dependency/generated-file exclusions. Existing per-repository formatter config files do not select alternate formatting settings. Prettier, Deno and Black are not alternative engines in this setup. -Mise can remain the development-environment/task entry point. This repository uses `.mise/config.toml` and executable task files under `.mise/tasks/`, with no formatter tools to install through mise. `format` runs the self formatter, `format:check` builds only the formatting check, and `test` builds the configuration/routing checks. These commands reject lockfile updates; update dependencies explicitly with `nix flake update`. +Rust's Cargo edition is read automatically so 2015/2018/2021/2024 crates can use the same formatter and shared 2024 style. This is parser metadata from `Cargo.toml`, not a project-specific formatting configuration. Standalone Rust files use edition 2024. Python formatting targets Python 3.11 compatibility everywhere. -A consuming project can create executable `.mise/tasks/format/_default`: +Nix generates the tool configuration files and the treefmt TOML in the Nix store. Nixpkgs and rust-overlay are pinned in `flake.lock`, so formatter binaries do not come from a project's PATH. Update the shared input's lockfile pin to roll out a new version of this configuration. -```sh -#!/usr/bin/env sh -set -eu -exec ../formatter/bin/format proxy-frontend --root "$MISE_PROJECT_ROOT" -``` - -The corresponding `.mise/tasks/format/check` adds the CI option: - -```sh -#!/usr/bin/env sh -set -eu -exec ../formatter/bin/format proxy-frontend --root "$MISE_PROJECT_ROOT" --ci -``` - -Validation uses the real Nix-packaged binaries, including six-language routing, excluded files, Rust child modules, paths with spaces, idempotence and independence from the host PATH: +## Develop this library ```sh +# Same formatter and formatting-only check used by every consumer. +nix fmt --no-update-lock-file nix flake check --no-update-lock-file -nix flake check --all-systems --no-build --no-update-lock-file -nix build --no-link --no-update-lock-file .#formatting-check + +# Library integration tests are explicit, never part of flake check. nix build --no-link --no-update-lock-file .#tests -nix develop --no-update-lock-file -``` -Supported systems are Apple Silicon macOS (`aarch64-darwin`) and ARM64/x86_64 Linux. The locked Nixpkgs release no longer supports Intel macOS. [The GitHub Actions example](examples/github-actions.yml) installs Nix and runs `nix flake check`. It remains an example; activating it requires workflow write permission. +# Inspect the generated shared treefmt configuration. +cat "$(nix build --no-link --print-out-paths .#config)" +``` -The [historical audit](docs/audit.md) and [inventory](docs/inventory.json) record the 169 repositories scanned on 2026-10-28. This migration does not modify consuming repositories. +Requires Nix or Lix with `nix-command` and `flakes` enabled. Supported systems are Apple Silicon macOS and ARM64/x86_64 Linux. Private Git access is needed to fetch the shared input. The same minimal consumer flake is available in `templates/default`. -[ADR 0001](docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md) records this as a proposed repository-scoped experiment under the engineering tooling standard. It does not approve an organization-wide tooling change. +[ADR 0001](docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md) records the proposed tooling experiment. diff --git a/bin/format b/bin/format deleted file mode 100755 index 7359645..0000000 --- a/bin/format +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env sh -set -eu - -usage() { - echo "Usage: format [--root DIRECTORY] [treefmt options and paths...]" >&2 - echo "Defaults to the current directory; use --ci for CI checks." >&2 -} - -if [ "$#" -eq 0 ]; then - usage - exit 2 -fi -profile=$1 -shift -case "$profile" in --h | --help) - usage - exit 0 - ;; -*[!a-z0-9-]* | '') - echo "Invalid profile: $profile" >&2 - exit 2 - ;; -esac -formatter_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) -if [ "${1:-}" = --root ]; then - if [ "$#" -lt 2 ]; then - usage - exit 2 - fi - target_root=$(CDPATH= cd -- "$2" && pwd -P) - shift 2 -else - target_root=$(pwd -P) -fi -exec nix --extra-experimental-features 'nix-command flakes' run --no-update-lock-file "$formatter_root#$profile" -- \ - --tree-root "$target_root" --working-dir "$target_root" "$@" diff --git a/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md b/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md index 86cadb0..b87ccd9 100644 --- a/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md +++ b/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md @@ -8,18 +8,20 @@ Date: 2026-11-09 This repository was created to explore shared treefmt configuration for Caido. The requested PR evaluates using treefmt-nix to supply the formatter binaries, their settings and the treefmt configuration together. -[STD-018](https://github.com/caido/engineering/blob/main/standards/STD-018-tooling.md) requires mise for tool setup and explicitly describes treefmt as an experiment outside the approved tool list. This proposal requests a scoped exception for this experimental repository. It does not claim that an organization-wide exception has already been approved. +[STD-018](https://github.com/caido/engineering/blob/main/standards/STD-018-tooling.md) describes treefmt as an experiment outside the approved tool list. This proposal requests a scoped exception for this Nix-only experimental repository. It does not claim that an organization-wide exception has already been approved. ## Proposed decision -Use a locked Nix flake and treefmt-nix in `caido/formatter` to evaluate reproducible formatter packages and generated configuration. Retain mise as an optional task entry point using the layout in [STD-019](https://github.com/caido/engineering/blob/main/standards/STD-019-mise.md). +Use a locked Nix flake and one shared treefmt-nix configuration in `caido/formatter`. Every repository uses the same formatter per language, the same settings and the same package versions. Remove the project presets, local style variants and profile launcher. + +Repositories use the identical `lib.forProject self` flake wiring to expose `nix fmt` and a formatting-only `nix flake check`. Library integration tests are an explicitly built package, not flake checks exported to consumers. The requested interface is Nix only, with no separate task layer. Keep this experiment confined to the shared formatter repository. Do not change the approved tooling standard or migrate consuming repositories as part of this PR. Maintainer acceptance of this proposal and its scoped exception is required before adopting it beyond the experiment. ## Consequences - Formatter commands and settings resolve to immutable Nix store paths. -- Nix or Lix is required to run a formatter profile, and the first invocation may download or build its dependencies. -- Formatter versions come from the locked Nixpkgs revision; existing per-project mise version differences are consolidated and documented in the README. +- Nix or Lix is required to run the shared formatter, and the first invocation may download or build its dependencies. +- Formatter versions come from the shared lockfile. Changes to the central configuration are rolled out by updating each consumer's shared input pin. - The experiment supports Apple Silicon macOS and ARM64/x86_64 Linux. The locked Nixpkgs revision does not support Intel macOS. -- The historical audit remains available. Existing projects keep their current tooling until a separate migration is reviewed. +- Existing projects keep their current tooling until the shared input is adopted in a separate migration. diff --git a/docs/audit.md b/docs/audit.md deleted file mode 100644 index 5bbcf48..0000000 --- a/docs/audit.md +++ /dev/null @@ -1,137 +0,0 @@ -# Formatter audit — 2026-10-28 - -This is the historical source audit. The treefmt-nix migration retains the audited project settings and file scopes, while package versions now come from `flake.lock`. See the current README for the migration's version changes. - -The audit inspected default-branch file trees for all **169** repositories accessible in the Caido organization, including forks and archived repositories. None of the tree responses were truncated. It read **392** matching config/task/manifests from the **99 first-party repositories** (84 active, 15 archived). Forks were scanned for matching filenames and recorded in the inventory; upstream fork settings were not adopted as organization defaults. - -Files inspected include formatter configs, ESLint configs containing Prettier integrations, Python project settings, package scripts/dependencies, mise tools/tasks, Makefiles and justfiles. Selected Nix shells and CI tasks were also checked. The inventory is evidence of the checked filenames and revisions, not proof that a formatter dependency is actively enforced. Generated/vendored paths were excluded from content inspection. Arbitrary custom scripts or CI workflow names outside these patterns may need a follow-up audit. - -## Findings - -| Tool | Repositories / usage | Configuration differences | Evidence | -| ---------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Oxfmt | proxy-frontend, proxy-e2e, internal-services, mise-toolshed | 0.53.0 in proxy-frontend; 0.73.0 in proxy-e2e and mise-toolshed | [proxy-frontend/oxfmt.config.ts](https://github.com/caido/proxy-frontend/blob/f62fe3513faf4e8d21293d25825db7c0fbb80e4f/oxfmt.config.ts), [proxy-e2e/oxfmt.config.ts](https://github.com/caido/proxy-e2e/blob/96d77b8ab9f522ce297c52cfad6fa38974cfe9dd/oxfmt.config.ts), [mise-toolshed/.oxfmtrc.json](https://github.com/caido/mise-toolshed/blob/204c64626bb57ff214dce99f5d438fef83291d7b/.oxfmtrc.json) | -| Prettier | proxy-desktop, proxy-extension, proxy-playground, backend GraphQL, shared frontend projects | Multiple versions; backend GraphQL width 100; electron-updater width 180 and no semicolons | [proxy-backend/.prettierrc](https://github.com/caido/proxy-backend/blob/f8b300913ff61891ba25ca6b842f52b79eedfe92/.prettierrc), [proxy-desktop/package.json](https://github.com/caido/proxy-desktop/blob/ebf91544a58a8ae7b02cae170cf304920d9fdda9/package.json), [electron-updater/.prettierrc.yaml](https://github.com/caido/electron-updater/blob/02e1e9adc90542eb2174f1bc8424836e4e439f04/.prettierrc.yaml) | -| rustfmt | proxy-backend, cloud-backend, sync-backend, student-backend, sqlite-rs, cogfer, convert; other Rust libraries | Pinned and floating nightlies; Module vs Crate imports; Rust 2021 and 2024 | [proxy-backend/rustfmt.toml](https://github.com/caido/proxy-backend/blob/f8b300913ff61891ba25ca6b842f52b79eedfe92/rustfmt.toml), [sync-backend/rustfmt.toml](https://github.com/caido/sync-backend/blob/285b022d13a9eccd100b49fff086a8ad174a202f/rustfmt.toml), [sqlite-rs/rustfmt.toml](https://github.com/caido/sqlite-rs/blob/938ad8e6c9eae8d3b3e9a1122805a0f96fe6967c/rustfmt.toml) | -| Ruff | analytics, caido-private | 0.16.9 / Python 3.12 vs 0.15.16 / Python 3.11; different source scopes | [analytics/ruff.toml](https://github.com/caido/analytics/blob/af124f8f39ac94204b4c4cac332c840ee2f61728/ruff.toml), [analytics/.mise/tasks/fmt/prod](https://github.com/caido/analytics/blob/af124f8f39ac94204b4c4cac332c840ee2f61728/.mise/tasks/fmt/prod), [caido-private/pyproject.toml](https://github.com/caido/caido-private/blob/4f60e99eee00a5894223c3005b6c8a1d43da09d8/pyproject.toml) | -| OpenTofu | infrastructure | 1.9.1; fmt under tofu/ | [infrastructure/mise.toml](https://github.com/caido/infrastructure/blob/ec721fefae4ea0645956f3cce3913045fc38a834/mise.toml), [infrastructure/justfile](https://github.com/caido/infrastructure/blob/ec721fefae4ea0645956f3cce3913045fc38a834/justfile) | -| shfmt and StyLua | mise-toolshed | 3.14.1 and 2.6.0; shell files are detected by a source script | [mise-toolshed/scripts/format.mjs](https://github.com/caido/mise-toolshed/blob/204c64626bb57ff214dce99f5d438fef83291d7b/scripts/format.mjs), [mise-toolshed/.mise/config.toml](https://github.com/caido/mise-toolshed/blob/204c64626bb57ff214dce99f5d438fef83291d7b/.mise/config.toml) | -| Deno | secrets-sync | Project task runs deno fmt | [secrets-sync/deno.json](https://github.com/caido/secrets-sync/blob/4192fc428c17f6e561cbae375ad67a17b279a9d2/deno.json) | -| nixfmt | proxy-backend Nix environment | Installed tool, not an enforced formatting task; opt-in only | [proxy-backend/flake.nix](https://github.com/caido/proxy-backend/blob/f8b300913ff61891ba25ca6b842f52b79eedfe92/flake.nix) | -| SQLFluff | cloud-backend; installed in backend environments | Postgres dialect; opt-in only | [cloud-backend/.sqlfluff](https://github.com/caido/cloud-backend/blob/8572b09230dc64a23b0a6342e2ed893707c9e5b6/.sqlfluff), [proxy-backend/flake.nix](https://github.com/caido/proxy-backend/blob/f8b300913ff61891ba25ca6b842f52b79eedfe92/flake.nix) | -| Black | analytics-ingestion and cloud-cron (archived) | 25.12.0 vs ^22.1.0; do not enable alongside Ruff | [analytics-ingestion/pyproject.toml](https://github.com/caido/analytics-ingestion/blob/0c525fcc8c473a3ff64e13631a928a93f160d582/pyproject.toml), [cloud-cron/projects/download-statistics/pyproject.toml](https://github.com/caido/cloud-cron/blob/944f6ad3474cbf0b2c11fcc096fe96d461c40f79/projects/download-statistics/pyproject.toml) | - -## Adaptations in the shared presets - -- The existing backend macro exclusion is moved from rustfmt's `ignore` option into treefmt. With a remote/shared rustfmt config, that option resolves against the config directory and can panic when source files are outside it. This was reproduced with the pinned nightly and fixed before publishing. -- `skip_children=true` prevents rustfmt from traversing child modules that treefmt deliberately excluded. Presets set the Rust edition explicitly; Cargo no longer supplies it implicitly. -- Shared Oxfmt JSON config carries the existing import groups. Source-specific generated files, E2E fixtures, and analytics' dbt transform app are excluded at the treefmt layer. -- Ruff lint rules, ESLint rules, and Clippy checks remain in their projects. This repository handles formatting only. -- The default profile selects one web engine and one Python engine. Prettier, Deno, and Black are alternatives, not additional passes on the same files. -- No source repository was modified or migrated as part of this change. - -## First-party repository coverage - -“Matched files” counts filenames matching the audit patterns, including manifests and task files. A match alone does not establish active formatting enforcement. Full filenames, commit SHAs, fork status, and archived status are in [inventory.json](inventory.json). - -| Repository | Status | Matched files | -| ------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------: | -| [.github](https://github.com/caido/.github/tree/e5a39d2939d5c7be9a13e9376a46844700a2adc4) | Active | 0 | -| [action-branch-name](https://github.com/caido/action-branch-name/tree/182b19bdc8ba9bf6023e2501b3c7dd806f349a1e) | Active | 2 | -| [action-issue-triager](https://github.com/caido/action-issue-triager/tree/9a56e18f3375cb76b55401adc7ccfa9648a83d0f) | Active | 3 | -| [action-pr-target](https://github.com/caido/action-pr-target/tree/0152c3fb773e61a36ad6907dd809e7f0d70d2d46) | Active | 2 | -| [actix-sse](https://github.com/caido/actix-sse/tree/7b737412030f206e4b7da5bbbaba10d8cc2bb441) | Active | 0 | -| [ai-ops](https://github.com/caido/ai-ops/tree/749620a84b3041b9e13fe88db3705dd34c5ffc26) | Active | 27 | -| [analytics](https://github.com/caido/analytics/tree/af124f8f39ac94204b4c4cac332c840ee2f61728) | Active | 34 | -| [analytics-ingestion](https://github.com/caido/analytics-ingestion/tree/0c525fcc8c473a3ff64e13631a928a93f160d582) | Archived | 2 | -| [analytics-sync](https://github.com/caido/analytics-sync/tree/304124be3061306cd7498a244eb72dc8565ec02b) | Archived | 3 | -| [async_buf_read](https://github.com/caido/async_buf_read/tree/e3f641f5eadae7adda1c89269c6114271b280228) | Active | 0 | -| [atlas](https://github.com/caido/atlas/tree/7efd2ad867233cad7cd7d66bfcdc07a6dbfa1bb9) | Archived | 3 | -| [blog-frontend](https://github.com/caido/blog-frontend/tree/fab5baee3aad2ed92406be85f5bd58480d4c4778) | Active | 0 | -| [bumpit](https://github.com/caido/bumpit/tree/bc5fca295a7e4108d83be95b9cd4ec1e6102dd11) | Active | 0 | -| [caido](https://github.com/caido/caido/tree/0844e045c160f4fa16579e929e769f72183335aa) | Active | 0 | -| [caido-action](https://github.com/caido/caido-action/tree/f3348ebe1db6db05eda3c455e6eede9729f56798) | Active | 3 | -| [caido-box](https://github.com/caido/caido-box/tree/5f5842dff7967370837df9302340c463f6f6043f) | Archived | 1 | -| [caido-codemirror](https://github.com/caido/caido-codemirror/tree/e1b4b2e78a3cf3dbb89c49a86daf2dc4f03a11b6) | Archived | 4 | -| [caido-dry-run](https://github.com/caido/caido-dry-run/tree/fe9c3d2176798c67aeacd369aa7f7baed136ae1b) | Active | 3 | -| [caido-private](https://github.com/caido/caido-private/tree/4f60e99eee00a5894223c3005b6c8a1d43da09d8) | Active | 9 | -| [capo](https://github.com/caido/capo/tree/dc49f6cce8699e4364b6ffa6d1df4de9ae6fef9d) | Active | 0 | -| [cloud-backend](https://github.com/caido/cloud-backend/tree/8572b09230dc64a23b0a6342e2ed893707c9e5b6) | Active | 11 | -| [cloud-cron](https://github.com/caido/cloud-cron/tree/944f6ad3474cbf0b2c11fcc096fe96d461c40f79) | Archived | 2 | -| [cogfer](https://github.com/caido/cogfer/tree/605e40ba154cd294886581a574e6b26ca3e21e3f) | Active | 2 | -| [common-frontend](https://github.com/caido/common-frontend/tree/c9cc2f39f7477a85e56eca53d4c0c24e72b8e396) | Active | 5 | -| [convert](https://github.com/caido/convert/tree/3aefd155a1ad572bbf50ffe1a9c8edbeadf4c5ee) | Active | 4 | -| [dashboard-frontend](https://github.com/caido/dashboard-frontend/tree/2ebbb610b824426f9b3d14c21436729aaba58229) | Active | 9 | -| [dependency-example](https://github.com/caido/dependency-example/tree/b58c9af13e6ccac5a9c474be3d3f48c563920856) | Active | 1 | -| [design-system](https://github.com/caido/design-system/tree/4ab172f05a7683ef8a7f19f3210d8ff7bb27ee44) | Active | 0 | -| [distribution](https://github.com/caido/distribution/tree/e12b2ff8ead5fbd7d982bc1ef8f6738f51cd60dd) | Active | 0 | -| [doc-developer](https://github.com/caido/doc-developer/tree/7f9c39220f25f1f2f16fa04dafa4754fd82e77b7) | Active | 7 | -| [documentation](https://github.com/caido/documentation/tree/c899c349022be87cf6b8f080840292f3f9a99c5c) | Active | 7 | -| [download-backend](https://github.com/caido/download-backend/tree/9aa41e53278e1daa31838e65c7d4803039bfab20) | Active | 3 | -| [dyper](https://github.com/caido/dyper/tree/fdaee1803436647a6dc286e3672bc1bf43cdb63c) | Archived | 0 | -| [electron-updater](https://github.com/caido/electron-updater/tree/02e1e9adc90542eb2174f1bc8424836e4e439f04) | Active | 3 | -| [emails](https://github.com/caido/emails/tree/3618163991602bb15f359da099a5cbd5dc836622) | Active | 5 | -| [engineering](https://github.com/caido/engineering/tree/b7bb836d703844bc15d2c06610821cb422ffcf4f) | Active | 0 | -| [graphql-explorer](https://github.com/caido/graphql-explorer/tree/d9551063129599eaaf4ecb23152e6fb74ce9436f) | Active | 4 | -| [httpql](https://github.com/caido/httpql/tree/f45361378be5c74ec1c5078fb8d4f83b2e9c6611) | Active | 5 | -| [infrastructure](https://github.com/caido/infrastructure/tree/ec721fefae4ea0645956f3cce3913045fc38a834) | Active | 6 | -| [infrastructure-community](https://github.com/caido/infrastructure-community/tree/9e875aabcf5e6a9a2c46e421817925f26c9841c7) | Active | 0 | -| [infrastructure-dev](https://github.com/caido/infrastructure-dev/tree/b89b34ba4b465e41ef883c5063518b9a1eb8b741) | Active | 1 | -| [infrastructure-staging](https://github.com/caido/infrastructure-staging/tree/8f24f6dbb696a36dc330126d36f96933fd253ea2) | Active | 3 | -| [integrations](https://github.com/caido/integrations/tree/f1b0a848daf600094956b52991635ae090ad39e0) | Active | 0 | -| [internal-services](https://github.com/caido/internal-services/tree/bdc1ade8ab1a2843a730b24ffd18e45bbadc6d84) | Active | 19 | -| [labs](https://github.com/caido/labs/tree/8e325bfcea86e707e7f941fd2cad56b721e5981b) | Active | 0 | -| [libsqlite3](https://github.com/caido/libsqlite3/tree/66154d6006067565d83f1d41e9e4e06edfd5385f) | Active | 0 | -| [ltree-sqlite](https://github.com/caido/ltree-sqlite/tree/669ff93d1fd3c0a253018b19ae31b7437271f4b8) | Active | 4 | -| [management](https://github.com/caido/management/tree/15c8e65af8b2d7b0da8ac9ac4b62ef409ead7f70) | Active | 0 | -| [marketing-frontend](https://github.com/caido/marketing-frontend/tree/f217d4d17b0866ff2e12585e2eab2151202c50a1) | Active | 8 | -| [mascot](https://github.com/caido/mascot/tree/4e11925d59c362e11d85a0ef21cac68dd10bfe92) | Active | 0 | -| [mise-toolshed](https://github.com/caido/mise-toolshed/tree/204c64626bb57ff214dce99f5d438fef83291d7b) | Active | 11 | -| [nexus](https://github.com/caido/nexus/tree/b6d8343b4c6b05ef49e6ecf898a9eb923ce790a9) | Active | 14 | -| [nix-config](https://github.com/caido/nix-config/tree/2b7565df8957f9091be72111031c5bb10f662cd5) | Active | 1 | -| [operations](https://github.com/caido/operations/tree/98b865605bc5abf589a895b1438e5a3e731df55c) | Active | 5 | -| [orchestrator](https://github.com/caido/orchestrator/tree/7101bc1f68ecd76d835b0569594d0f0796c52a37) | Active | 4 | -| [os_name](https://github.com/caido/os_name/tree/45c078dda3fdc3bbd008ba3802593e56d480ea35) | Active | 0 | -| [plugin-e2e](https://github.com/caido/plugin-e2e/tree/3c0be9ec9dfaec62c7017147434ab8fa2e5e8e62) | Archived | 6 | -| [plugin-manifest](https://github.com/caido/plugin-manifest/tree/9269816f49851d143291123b4060e049fd7bb929) | Active | 3 | -| [pnpm-deny](https://github.com/caido/pnpm-deny/tree/a77027a18d4b95e905d399e77abce136d98a9448) | Active | 7 | -| [process_alive](https://github.com/caido/process_alive/tree/297fc56029efc4acd7bb0753e1d07dd9b38ab531) | Active | 0 | -| [proxy-backend](https://github.com/caido/proxy-backend/tree/f8b300913ff61891ba25ca6b842f52b79eedfe92) | Active | 15 | -| [proxy-desktop](https://github.com/caido/proxy-desktop/tree/ebf91544a58a8ae7b02cae170cf304920d9fdda9) | Active | 18 | -| [proxy-e2e](https://github.com/caido/proxy-e2e/tree/96d77b8ab9f522ce297c52cfad6fa38974cfe9dd) | Active | 19 | -| [proxy-extension](https://github.com/caido/proxy-extension/tree/2162848f1e9f5f77bfa4ffcc915f8309f9180465) | Active | 6 | -| [proxy-frontend](https://github.com/caido/proxy-frontend/tree/f62fe3513faf4e8d21293d25825db7c0fbb80e4f) | Active | 38 | -| [proxy-playground](https://github.com/caido/proxy-playground/tree/2c0af3b6d39156efca0cc315f049c19a0dd2cdbd) | Active | 4 | -| [reglite](https://github.com/caido/reglite/tree/2b49ddb3f7eb73b1e54e47bd05d364fbbf1460a2) | Active | 0 | -| [renovate-config](https://github.com/caido/renovate-config/tree/1c891aef743b68af6d75fa65b723b9d7b68ab6e1) | Active | 0 | -| [repro-tauri](https://github.com/caido/repro-tauri/tree/ac35e6e5b30838c9d4fb18bedd674a16cce8efaf) | Archived | 1 | -| [research](https://github.com/caido/research/tree/f064c46dc10cdaa02f47cbf6589d9589fef63f21) | Active | 1 | -| [resources](https://github.com/caido/resources/tree/1c49b86eba85cbd19ea8ce25ee8b1269cea6ae4e) | Active | 0 | -| [rswot](https://github.com/caido/rswot/tree/31629ecd892f0f97287d7a74c750e1b4fab8c46f) | Active | 0 | -| [sales](https://github.com/caido/sales/tree/5eaa35072f9ab8ae81348e0a3936b6ec84c0cc9f) | Active | 2 | -| [schemas](https://github.com/caido/schemas/tree/a95a014219dda1d4c1fef7cb9e2bfc4125d27cf8) | Active | 4 | -| [sdk-js](https://github.com/caido/sdk-js/tree/fb6ec06826144608791fb6d377bb5b8b26162022) | Active | 19 | -| [sea-jet](https://github.com/caido/sea-jet/tree/29c18ed0823e6e2570a9e01640407ca55c263d5b) | Archived | 0 | -| [secrets-sync](https://github.com/caido/secrets-sync/tree/4192fc428c17f6e561cbae375ad67a17b279a9d2) | Active | 4 | -| [serde-content-ref](https://github.com/caido/serde-content-ref/tree/fa1e323ae6beac6276d9974d8f68a228fbf662fc) | Active | 0 | -| [shell_exec](https://github.com/caido/shell_exec/tree/14d946b6915eeb4f350b1f4fae2d7a87568077a8) | Active | 0 | -| [shift-backend](https://github.com/caido/shift-backend/tree/6142a79d4b39c1f7b7c87f3a8fd591a4f5aff23d) | Active | 0 | -| [shift-marketing-frontend](https://github.com/caido/shift-marketing-frontend/tree/69d7c50d2125b00c3b95e0fba0d3d89b00a6db9b) | Active | 1 | -| [skills](https://github.com/caido/skills/tree/41697d8c647c3e61f6efdb3bf01cbfa66c27e2fd) | Active | 1 | -| [sqlite-rs](https://github.com/caido/sqlite-rs/tree/938ad8e6c9eae8d3b3e9a1122805a0f96fe6967c) | Active | 5 | -| [starterkit-plugin](https://github.com/caido/starterkit-plugin/tree/8f937841d4e29328f0cf6ce9b8a8cc221d332e00) | Archived | 3 | -| [starterkit-plugin-frontend](https://github.com/caido/starterkit-plugin-frontend/tree/85942c95fc3f96f2face8808e4e9c46be1cf3fd0) | Archived | 1 | -| [starterkit-workflow](https://github.com/caido/starterkit-workflow/tree/f39f0eb32bcfa1513ed4a7916e9a8738b6a68b5d) | Archived | 1 | -| [store](https://github.com/caido/store/tree/13958088750a8aca200ef0b696cd9dc35b996a52) | Active | 2 | -| [student-backend](https://github.com/caido/student-backend/tree/201ddbb5e144ff4e4efbb18e449867b906952e5f) | Active | 4 | -| [sync-backend](https://github.com/caido/sync-backend/tree/285b022d13a9eccd100b49fff086a8ad174a202f) | Active | 4 | -| [sync-load-test](https://github.com/caido/sync-load-test/tree/7bd8036c2568fa0f49a8ea489ce6ebba955e1ce7) | Active | 0 | -| [test-keyring](https://github.com/caido/test-keyring/tree/473837bfb7041f3b47c6c700e1ed52e62b76919d) | Archived | 0 | -| [test-tokio](https://github.com/caido/test-tokio/tree/2981efbe29ccaace609f1eecb38018e3d48b4f9a) | Archived | 0 | -| [tls-impersonate](https://github.com/caido/tls-impersonate/tree/5924931c83285864481b48853d5f90cd42802d86) | Active | 0 | -| [typescript-configs](https://github.com/caido/typescript-configs/tree/f3fa965cbfb327c7f20812309bd27ea2ae43644a) | Active | 9 | -| [ui-kit](https://github.com/caido/ui-kit/tree/5f03919bc81ce634d754adfd1fc34907bdf9f400) | Active | 10 | -| [windows-setup](https://github.com/caido/windows-setup/tree/6ab48016eb4fc4316aaec2db43e5841310f1e6eb) | Active | 0 | -| [workshop-defcon](https://github.com/caido/workshop-defcon/tree/3dd1d313a2400b5f2837426a6141717efa4e5c05) | Active | 0 | -| [workshop-demo](https://github.com/caido/workshop-demo/tree/bdc413b9ffe4f915ae0a5912425a6cd840a3f7a6) | Active | 1 | -| [workshop-hackfest](https://github.com/caido/workshop-hackfest/tree/81c2ee2a7cc17a47105f25fe312fd23effad28b2) | Active | 14 | diff --git a/docs/inventory.json b/docs/inventory.json deleted file mode 100644 index d0c02e3..0000000 --- a/docs/inventory.json +++ /dev/null @@ -1,2256 +0,0 @@ -{ - "audited_at": "2026-10-28", - "scope": "Default branches of all accessible Caido repositories; fork and archived status recorded separately.", - "repositories": [ - { - "name": "marketing-frontend", - "sha": "f217d4d17b0866ff2e12585e2eab2151202c50a1", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.dev.toml", - ".mise/config.netlify.toml", - ".mise/config.toml", - ".mise/tasks/lint", - "Makefile", - "eslint.config.mjs", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "proxy-frontend", - "sha": "f62fe3513faf4e8d21293d25825db7c0fbb80e4f", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate-pins.yml", - ".github/workflows/validate.yml", - ".mise/config.toml", - ".mise/tasks/format/dev", - ".mise/tasks/format/prod", - ".mise/tasks/lint/debt", - ".mise/tasks/lint/dev", - ".mise/tasks/lint/file", - ".mise/tasks/lint/links", - ".mise/tasks/lint/prod", - ".mise/tasks/lint/suppress", - "eslint.config.mjs", - "flake.nix", - "oxfmt.config.ts", - "oxfmt.generated.config.ts", - "package.json", - "packages/codemirror/package.json", - "packages/components/package.json", - "packages/config/package.json", - "packages/desktop/package.json", - "packages/graphql/package.json", - "packages/i18n/package.json", - "packages/languages/package.json", - "packages/migrations/package.json", - "packages/openapi/package.json", - "packages/repositories/package.json", - "packages/rete/package.json", - "packages/sdk-frontend/package.json", - "packages/sdk-workflow/package.json", - "packages/services/package.json", - "packages/shared-runtime/package.json", - "packages/stores/package.json", - "packages/types/package.json", - "packages/ui/Makefile", - "packages/ui/package.json", - "packages/utils/package.json", - "packages/workers/package.json", - "scripts/format.sh" - ], - "error": null, - "truncated": false - }, - { - "name": "sdk-js", - "sha": "fb6ec06826144608791fb6d377bb5b8b26162022", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.toml", - "eslint.config.mjs", - "package.json", - "packages/quickjs-types/package.json", - "packages/quickjs-types/src/llrt/.prettierrc", - "packages/sdk-backend/package.json", - "packages/sdk-client/examples/base/package.json", - "packages/sdk-client/examples/functionCall/package.json", - "packages/sdk-client/examples/functionCallSpec/package.json", - "packages/sdk-client/examples/pluginEvent/package.json", - "packages/sdk-client/examples/uploadFile/package.json", - "packages/sdk-client/package.json", - "packages/sdk-frontend/package.json", - "packages/sdk-shared/package.json", - "packages/sdk-workflow/package.json", - "packages/server-auth/examples/browser/package.json", - "packages/server-auth/examples/pat/package.json", - "packages/server-auth/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "infrastructure", - "sha": "ec721fefae4ea0645956f3cce3913045fc38a834", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate-pins.yml", - ".mise/config.toml", - ".prettierrc", - "flake.nix", - "justfile", - "mise.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "analytics", - "sha": "af124f8f39ac94204b4c4cac332c840ee2f61728", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate-code.yml", - ".github/workflows/validate-pins.yml", - ".github/workflows/validate-transform.yml", - ".mise/config.agents.toml", - ".mise/config.ci.toml", - ".mise/config.dev.toml", - ".mise/config.render.toml", - ".mise/config.toml", - ".mise/tasks/event_consumer/fmt/dev", - ".mise/tasks/event_consumer/fmt/prod", - ".mise/tasks/event_consumer/lint/dev", - ".mise/tasks/event_consumer/lint/prod", - ".mise/tasks/extract_and_load/fmt/dev", - ".mise/tasks/extract_and_load/fmt/prod", - ".mise/tasks/extract_and_load/lint/dev", - ".mise/tasks/extract_and_load/lint/prod", - ".mise/tasks/fmt/prod", - ".mise/tasks/lint/prod", - ".mise/tasks/reconcile/fmt/dev", - ".mise/tasks/reconcile/fmt/prod", - ".mise/tasks/reconcile/lint/dev", - ".mise/tasks/reconcile/lint/prod", - ".mise/tasks/reverse_etl/fmt/dev", - ".mise/tasks/reverse_etl/fmt/prod", - ".mise/tasks/reverse_etl/lint/dev", - ".mise/tasks/reverse_etl/lint/prod", - "Makefile", - "apps/event_consumer/Makefile", - "apps/event_consumer/pyproject.toml", - "apps/extract_and_load/pyproject.toml", - "apps/reconcile/pyproject.toml", - "apps/reverse_etl/pyproject.toml", - "apps/transform/pyproject.toml", - "ruff.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "infrastructure-staging", - "sha": "8f24f6dbb696a36dc330126d36f96933fd253ea2", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate-pins.yml", - ".github/workflows/validate.yml", - "mise.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "typescript-configs", - "sha": "f3fa965cbfb327c7f20812309bd27ea2ae43644a", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate-pins.yml", - ".github/workflows/validate.yml", - ".mise/config.toml", - "eslint.config.ts", - "mise.toml", - "package.json", - "packages/eslint-config/package.json", - "packages/eslint-config/src/configs/prettier.ts", - "packages/tsconfig/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "proxy-e2e", - "sha": "96d77b8ab9f522ce297c52cfad6fa38974cfe9dd", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.ci.toml", - ".mise/config.dev.toml", - ".mise/tasks/format/dev", - ".mise/tasks/format/prod", - ".mise/tasks/lint/dev", - ".mise/tasks/lint/file", - ".mise/tasks/lint/prod", - "flake.nix", - "oxfmt.config.ts", - "package.json", - "plugins/nullable_plugin/eslint.config.mjs", - "plugins/nullable_plugin/package.json", - "plugins/nullable_plugin/packages/backend/package.json", - "plugins/nullable_plugin/packages/frontend/package.json", - "plugins/sdk-probe/eslint.config.mjs", - "plugins/sdk-probe/package.json", - "plugins/sdk-probe/packages/backend/package.json", - "plugins/sdk-probe/packages/frontend/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "proxy-playground", - "sha": "2c0af3b6d39156efca0cc315f049c19a0dd2cdbd", - "isFork": false, - "isArchived": false, - "files": [ - ".eslintrc.cjs", - ".mise/config.toml", - "flake.nix", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "cloud-backend", - "sha": "8572b09230dc64a23b0a6342e2ed893707c9e5b6", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/lint.yml", - ".mise/config.coverage.toml", - ".mise/config.dev.toml", - ".mise/config.test.toml", - ".mise/config.toml", - ".mise/tasks/fmt", - ".mise/tasks/lint/dev", - ".mise/tasks/lint/prod", - ".sqlfluff", - "flake.nix", - "rustfmt.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "proxy-desktop", - "sha": "ebf91544a58a8ae7b02cae170cf304920d9fdda9", - "isFork": false, - "isArchived": false, - "files": [ - ".eslintrc.cjs", - ".github/workflows/validate.yml", - ".mise/config.toml", - ".mise/tasks/lint/dev", - ".mise/tasks/lint/file", - ".mise/tasks/lint/prod", - "flake.nix", - "package.json", - "packages/main/.eslintrc.cjs", - "packages/main/package.json", - "packages/migrations/.eslintrc.cjs", - "packages/migrations/package.json", - "packages/shared/.eslintrc.cjs", - "packages/shared/package.json", - "packages/ui/.eslintrc.cjs", - "packages/ui/package.json", - "packages/updater/.eslintrc.cjs", - "packages/updater/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "proxy-backend", - "sha": "f8b300913ff61891ba25ca6b842f52b79eedfe92", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/lint.yml", - ".mise/config.bench.toml", - ".mise/config.check.toml", - ".mise/config.dev.toml", - ".mise/config.license.toml", - ".mise/config.lint.toml", - ".mise/config.release.toml", - ".mise/config.test.toml", - ".mise/config.toml", - ".mise/tasks/fmt", - ".mise/tasks/lint/dev", - ".mise/tasks/lint/prod", - ".prettierrc", - "flake.nix", - "rustfmt.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "sync-backend", - "sha": "285b022d13a9eccd100b49fff086a8ad174a202f", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/lint.yml", - ".mise/config.dev.toml", - ".mise/config.toml", - "rustfmt.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "sqlite-rs", - "sha": "938ad8e6c9eae8d3b3e9a1122805a0f96fe6967c", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.toml", - ".mise/tasks/fmt/dev", - ".mise/tasks/fmt/prod", - "rustfmt.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "management", - "sha": "15c8e65af8b2d7b0da8ac9ac4b62ef409ead7f70", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "dependency-async-graphql", - "sha": "75a9d14e8f45176a32bac7f458534c05cabd10cc", - "isFork": true, - "isArchived": false, - "files": [".rustfmt.toml"], - "error": null, - "truncated": false - }, - { - "name": "dependency-chromiumoxide", - "sha": "afcc3a4313f2087249b4490d94e54bf8e3bfaccf", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "proxy-extension", - "sha": "2162848f1e9f5f77bfa4ffcc915f8309f9180465", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.toml", - ".mise/tasks/lint/dev", - ".mise/tasks/lint/prod", - "eslint.config.mjs", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "dashboard-frontend", - "sha": "2ebbb610b824426f9b3d14c21436729aaba58229", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.toml", - ".mise/tasks/lint/dev", - ".mise/tasks/lint/links", - ".mise/tasks/lint/prod", - "Makefile", - "eslint.config.mjs", - "mise.toml", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "dependency-llrt", - "sha": "986fbdfee54f13459466d5b195cc3da783a5cf50", - "isFork": true, - "isArchived": false, - "files": [ - ".prettierignore", - "Makefile", - "example/functions/package.json", - "example/infrastructure/package.json", - "example/llrt-sam/hello-world/package.json", - "fixtures/package.json", - "fixtures/test1245/package.json", - "package.json", - "rustfmt.toml", - "types/.eslintrc.cjs", - "types/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "engineering", - "sha": "b7bb836d703844bc15d2c06610821cb422ffcf4f", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "primitives", - "sha": "b8f5f619203d6049cdfe386c9fd7d2b075a9c924", - "isFork": true, - "isArchived": false, - "files": ["justfile", "rustfmt.toml"], - "error": null, - "truncated": false - }, - { - "name": "skills", - "sha": "41697d8c647c3e61f6efdb3bf01cbfa66c27e2fd", - "isFork": false, - "isArchived": false, - "files": ["skills/caido-mode/package.json"], - "error": null, - "truncated": false - }, - { - "name": "documentation", - "sha": "c899c349022be87cf6b8f080840292f3f9a99c5c", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.toml", - "Makefile", - "eslint.config.mjs", - "package.json", - "scripts/lint-prod.sh", - "scripts/lint.sh" - ], - "error": null, - "truncated": false - }, - { - "name": "ai-ops", - "sha": "749620a84b3041b9e13fe88db3705dd34c5ffc26", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.dev.toml", - ".mise/config.toml", - ".mise/config.workflow.toml", - ".mise/tasks/lint/dev", - ".mise/tasks/lint/file", - ".mise/tasks/lint/prod", - "eslint.config.mjs", - "package.json", - "packages/cli/package.json", - "packages/client/package.json", - "packages/config/package.json", - "packages/domain/package.json", - "packages/evals/package.json", - "packages/evals/scenarios/ts-empty-codebase/eslint.config.mjs", - "packages/evals/scenarios/ts-empty-codebase/package.json", - "packages/evals/scenarios/ts-legacy-codebase/eslint.config.mjs", - "packages/evals/scenarios/ts-legacy-codebase/package.json", - "packages/evals/scenarios/ts-matchers/eslint.config.mjs", - "packages/evals/scenarios/ts-matchers/package.json", - "packages/evals/scenarios/ts-skills-playground/eslint.config.mjs", - "packages/evals/scenarios/ts-skills-playground/package.json", - "packages/evals/scenarios/ts-test-auditor-playground/eslint.config.mjs", - "packages/evals/scenarios/ts-test-auditor-playground/package.json", - "packages/repositories/package.json", - "packages/server/package.json", - "packages/workflows/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "student-backend", - "sha": "201ddbb5e144ff4e4efbb18e449867b906952e5f", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/lint.yml", - ".mise/config.dev.toml", - ".mise/config.toml", - "rustfmt.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "rswot", - "sha": "31629ecd892f0f97287d7a74c750e1b4fab8c46f", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "common-frontend", - "sha": "c9cc2f39f7477a85e56eca53d4c0c24e72b8e396", - "isFork": false, - "isArchived": false, - "files": [ - ".eslintrc.js", - ".github/workflows/validate.yml", - "Makefile", - "mise.toml", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "mise-toolshed", - "sha": "204c64626bb57ff214dce99f5d438fef83291d7b", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.toml", - ".mise/locks/npm-skills/1.7.2/package.json", - ".oxfmtrc.json", - "package.json", - "packages/check-exact-versions/package.json", - "packages/check-lockfiles/package.json", - "packages/check-minimum-release-age/package.json", - "packages/shared/package.json", - "scripts/format.mjs", - "scripts/lint.mjs" - ], - "error": null, - "truncated": false - }, - { - "name": "caido-private", - "sha": "4f60e99eee00a5894223c3005b6c8a1d43da09d8", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.dev.toml", - ".mise/config.toml", - ".mise/tasks/format/dev", - ".mise/tasks/format/prod", - ".mise/tasks/lint/dev", - ".mise/tasks/lint/prod", - "flake.nix", - "pyproject.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "caido", - "sha": "0844e045c160f4fa16579e929e769f72183335aa", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "schemas", - "sha": "a95a014219dda1d4c1fef7cb9e2bfc4125d27cf8", - "isFork": false, - "isArchived": false, - "files": [ - "mise.toml", - "pyproject.toml", - "schemas/proxy/package.json", - "schemas/proxy/pyproject.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "emails", - "sha": "3618163991602bb15f359da099a5cbd5dc836622", - "isFork": false, - "isArchived": false, - "files": [ - ".editorconfig", - "package.json", - "packages/retrieve-spam/package.json", - "packages/send-newsletter/package.json", - "packages/templates/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "infrastructure-community", - "sha": "9e875aabcf5e6a9a2c46e421817925f26c9841c7", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "labs", - "sha": "8e325bfcea86e707e7f941fd2cad56b721e5981b", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "store", - "sha": "13958088750a8aca200ef0b696cd9dc35b996a52", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate-plugin.yml", - ".github/workflows/validate-schema.yml" - ], - "error": null, - "truncated": false - }, - { - "name": "convert", - "sha": "3aefd155a1ad572bbf50ffe1a9c8edbeadf4c5ee", - "isFork": false, - "isArchived": false, - "files": [ - "justfile", - "package.json", - "rustfmt.toml", - "web-tests/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "mascot", - "sha": "4e11925d59c362e11d85a0ef21cac68dd10bfe92", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "two-plz", - "sha": "23a574469dd53d6571755640e4a8759f65fc1374", - "isFork": true, - "isArchived": false, - "files": [ - ".github/workflows/lint.yml", - ".mise/config.toml", - ".mise/tasks/lint/dev", - ".mise/tasks/lint/prod", - "rustfmt.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "ui-kit", - "sha": "5f03919bc81ce634d754adfd1fc34907bdf9f400", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - "eslint.config.mjs", - "mise.toml", - "package.json", - "packages/primevue/Makefile", - "packages/primevue/package.json", - "packages/tailwindcss/package.json", - "packages/tokens/package.json", - "scripts/lint-prod.sh", - "scripts/lint.sh" - ], - "error": null, - "truncated": false - }, - { - "name": "dependency-diesel", - "sha": "0c16ef378803671f19cdc3cdb986990a0c5e6cfd", - "isFork": true, - "isArchived": false, - "files": [".editorconfig"], - "error": null, - "truncated": false - }, - { - "name": "http-plz", - "sha": "4bb74a150b5d17f9a05ed6550e25257411bd15ba", - "isFork": true, - "isArchived": false, - "files": ["justfile", "rustfmt.toml"], - "error": null, - "truncated": false - }, - { - "name": "cogfer", - "sha": "605e40ba154cd294886581a574e6b26ca3e21e3f", - "isFork": false, - "isArchived": false, - "files": ["mise.toml", "rustfmt.toml"], - "error": null, - "truncated": false - }, - { - "name": "infrastructure-dev", - "sha": "b89b34ba4b465e41ef883c5063518b9a1eb8b741", - "isFork": false, - "isArchived": false, - "files": ["Makefile"], - "error": null, - "truncated": false - }, - { - "name": "action-pr-target", - "sha": "0152c3fb773e61a36ad6907dd809e7f0d70d2d46", - "isFork": false, - "isArchived": false, - "files": ["flake.nix", "pyproject.toml"], - "error": null, - "truncated": false - }, - { - "name": "strix", - "sha": "55bc07991aacb1c26a81b43e7ca53148730d2019", - "isFork": true, - "isArchived": false, - "files": [ - ".pre-commit-config.yaml", - "Makefile", - "pyproject.toml", - "strix/interface/viewer/frontend/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "design-system", - "sha": "4ab172f05a7683ef8a7f19f3210d8ff7bb27ee44", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "analytics-sync", - "sha": "304124be3061306cd7498a244eb72dc8565ec02b", - "isFork": false, - "isArchived": true, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.toml", - "pyproject.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "sales", - "sha": "5eaa35072f9ab8ae81348e0a3936b6ec84c0cc9f", - "isFork": false, - "isArchived": false, - "files": [".mise/config.toml", "scripts/generate-pdfs/package.json"], - "error": null, - "truncated": false - }, - { - "name": "doc-developer", - "sha": "7f9c39220f25f1f2f16fa04dafa4754fd82e77b7", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.toml", - "Makefile", - "eslint.config.mjs", - "package.json", - "scripts/lint-prod.sh", - "scripts/lint.sh" - ], - "error": null, - "truncated": false - }, - { - "name": "internal-services", - "sha": "bdc1ade8ab1a2843a730b24ffd18e45bbadc6d84", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.dev.toml", - ".mise/config.toml", - ".mise/config.workflow.toml", - ".mise/tasks/format/dev", - ".mise/tasks/format/prod", - ".mise/tasks/lint/dev", - ".mise/tasks/lint/file", - ".mise/tasks/lint/prod", - "apps/discord-tickets/package.json", - "apps/support-dashboard/package.json", - "oxfmt.config.ts", - "package.json", - "packages/components/package.json", - "packages/discord-tickets/package.json", - "packages/support-dashboard-backend/package.json", - "packages/support-dashboard-contract/package.json", - "packages/support-dashboard-frontend/package.json", - "scripts/format.sh" - ], - "error": null, - "truncated": false - }, - { - "name": "pnpm-deny", - "sha": "a77027a18d4b95e905d399e77abce136d98a9448", - "isFork": false, - "isArchived": false, - "files": [ - ".mise/config.toml", - "eslint.config.ts", - "fixtures/licenses-workspace/package.json", - "package.json", - "packages/cli/package.json", - "packages/core/package.json", - "packages/licenses/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "auto-assign-action", - "sha": "5ffad4f95723a1fc125262f6a253d4f15f0e4bbb", - "isFork": true, - "isArchived": false, - "files": [ - ".mise/config.toml", - ".mise/tasks/format", - ".mise/tasks/format-check", - ".prettierrc.yml", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "graphql-explorer", - "sha": "d9551063129599eaaf4ecb23152e6fb74ce9436f", - "isFork": false, - "isArchived": false, - "files": [ - ".mise/config.toml", - "Makefile", - "eslint.config.js", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "tls-impersonate", - "sha": "5924931c83285864481b48853d5f90cd42802d86", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "research", - "sha": "f064c46dc10cdaa02f47cbf6589d9589fef63f21", - "isFork": false, - "isArchived": false, - "files": [".mise/config.toml"], - "error": null, - "truncated": false - }, - { - "name": "dependency-rig", - "sha": "ecec2b78af5aa71dd543842a07cf0e13fb2ca9ab", - "isFork": true, - "isArchived": false, - "files": [ - ".pre-commit-config.yaml", - "crates/rig-postgres/Makefile", - "flake.nix" - ], - "error": null, - "truncated": false - }, - { - "name": "polis", - "sha": "e13ed6541ec026dc37243f975b6d88be9488b687", - "isFork": true, - "isArchived": false, - "files": [ - ".prettierignore", - ".prettierrc.js", - "eslint.config.cjs", - "internal-ui/package.json", - "migrate-deps/package.json", - "npm/package.json", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "dependency-turms", - "sha": "f903ac36af5018128c003f0f545f103c8d50c11e", - "isFork": true, - "isArchived": false, - "files": [ - "examples/gql-usage/pyproject.toml", - "examples/pydantic-basic/pyproject.toml", - "examples/rath-usage/pyproject.toml", - "pyproject.toml", - "website/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "action-branch-name", - "sha": "182b19bdc8ba9bf6023e2501b3c7dd806f349a1e", - "isFork": false, - "isArchived": false, - "files": ["flake.nix", "pyproject.toml"], - "error": null, - "truncated": false - }, - { - "name": "dependency-paddle", - "sha": "b6c9190bbb06ccf096ad3c9aa5c30a4201859df1", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "httpql", - "sha": "f45361378be5c74ec1c5078fb8d4f83b2e9c6611", - "isFork": false, - "isArchived": false, - "files": [ - "js/eslint.config.mjs", - "js/httpql/package.json", - "js/package.json", - "js/streamql/package.json", - "mise.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "action-mise-action", - "sha": "03d53910f98bfb7555d242a9136d77505539db7a", - "isFork": true, - "isArchived": false, - "files": [ - ".eslintrc.yml", - ".prettierignore", - ".prettierrc.json", - "eslint.config.mjs", - "mise.toml", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "plugin-e2e", - "sha": "3c0be9ec9dfaec62c7017147434ab8fa2e5e8e62", - "isFork": false, - "isArchived": true, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.toml", - "eslint.config.mjs", - "package.json", - "packages/backend/package.json", - "packages/frontend/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "dependency-electron-builder", - "sha": "7a71b0136183b07e78ed6c1185c459673a77a4eb", - "isFork": true, - "isArchived": false, - "files": [ - ".editorconfig", - ".prettierignore", - ".prettierrc.yaml", - "eslint.config.mjs", - "package.json", - "packages/app-builder-lib/package.json", - "packages/builder-util-runtime/package.json", - "packages/builder-util/package.json", - "packages/dmg-builder/package.json", - "packages/electron-builder-squirrel-windows/package.json", - "packages/electron-builder/package.json", - "packages/electron-forge-maker-appimage/package.json", - "packages/electron-forge-maker-nsis-web/package.json", - "packages/electron-forge-maker-nsis/package.json", - "packages/electron-forge-maker-snap/package.json", - "packages/electron-publish/package.json", - "packages/electron-updater/package.json", - "test/fixtures/proton/package.json", - "test/fixtures/test-app-build-sub/package.json", - "test/fixtures/test-app-bun-workspace/package.json", - "test/fixtures/test-app-bun-workspace/packages/app/package.json", - "test/fixtures/test-app-bun-workspace/packages/lib/package.json", - "test/fixtures/test-app-hoisted/package.json", - "test/fixtures/test-app-one/package.json", - "test/fixtures/test-app-symlink-framework/hello-world/package.json", - "test/fixtures/test-app-symlink-framework/package.json", - "test/fixtures/test-app-two-native-modules/app/package.json", - "test/fixtures/test-app-two-native-modules/package.json", - "test/fixtures/test-app-yarn-hoisted/app/package.json", - "test/fixtures/test-app-yarn-hoisted/package.json", - "test/fixtures/test-app-yarn-several-workspace/package.json", - "test/fixtures/test-app-yarn-several-workspace/packages/foo/package.json", - "test/fixtures/test-app-yarn-several-workspace/packages/test-app/package.json", - "test/fixtures/test-app-yarn-workspace-version-conflict/package.json", - "test/fixtures/test-app-yarn-workspace-version-conflict/packages/foo/package.json", - "test/fixtures/test-app-yarn-workspace-version-conflict/packages/test-app/package.json", - "test/fixtures/test-app-yarn-workspace/package.json", - "test/fixtures/test-app-yarn-workspace/packages/test-app/package.json", - "test/fixtures/test-app/app/package.json", - "test/fixtures/test-app/package.json", - "test/package.json", - "website/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "caido-action", - "sha": "f3348ebe1db6db05eda3c455e6eede9729f56798", - "isFork": false, - "isArchived": false, - "files": ["flake.nix", "package.json", "skills/caido-mode/package.json"], - "error": null, - "truncated": false - }, - { - "name": "operations", - "sha": "98b865605bc5abf589a895b1438e5a3e731df55c", - "isFork": false, - "isArchived": false, - "files": [ - "analytics/packages/github-events-viewer/package.json", - "analytics/packages/paddle-report-viewer/package.json", - "analytics/packages/user-ip-viewer/package.json", - "mise.toml", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "windows-setup", - "sha": "6ab48016eb4fc4316aaec2db43e5841310f1e6eb", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "caido-codemirror", - "sha": "e1b4b2e78a3cf3dbb89c49a86daf2dc4f03a11b6", - "isFork": false, - "isArchived": true, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.toml", - "eslint.config.mjs", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "oneone-plz", - "sha": "4c73f0b18e29fa31ec0077c8712527eade219394", - "isFork": true, - "isArchived": false, - "files": ["justfile", "rustfmt.toml"], - "error": null, - "truncated": false - }, - { - "name": "dependency-openssl", - "sha": "af7251dc5b796e82126eb799c2886d90951711e8", - "isFork": true, - "isArchived": false, - "files": [".rustfmt.toml"], - "error": null, - "truncated": false - }, - { - "name": "nexus", - "sha": "b6d8343b4c6b05ef49e6ecf898a9eb923ce790a9", - "isFork": false, - "isArchived": false, - "files": [ - ".mise/config.toml", - ".mise/tasks/lint/dev", - ".mise/tasks/lint/file", - ".mise/tasks/lint/prod", - "eslint.config.mjs", - "package.json", - "packages/frontend-components/package.json", - "packages/frontend-config/package.json", - "packages/frontend-repositories/package.json", - "packages/frontend-services/package.json", - "packages/frontend-stores/package.json", - "packages/frontend-volt/package.json", - "packages/frontend/package.json", - "packages/types/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "ltree-sqlite", - "sha": "669ff93d1fd3c0a253018b19ae31b7437271f4b8", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - ".mise/config.dev.toml", - ".mise/tasks/fmt", - "flake.nix" - ], - "error": null, - "truncated": false - }, - { - "name": "nix-config", - "sha": "2b7565df8957f9091be72111031c5bb10f662cd5", - "isFork": false, - "isArchived": false, - "files": ["flake.nix"], - "error": null, - "truncated": false - }, - { - "name": "dependency-tokio-rustls", - "sha": "853da0345ecd5bb25c36136c2cef9600d3e249f0", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "dependency-rustls-platform-verifier", - "sha": "bbc27c70babe0bab255ec6415cba56bac7f60caf", - "isFork": true, - "isArchived": false, - "files": ["flake.nix"], - "error": null, - "truncated": false - }, - { - "name": "secrets-sync", - "sha": "4192fc428c17f6e561cbae375ad67a17b279a9d2", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - "deno.json", - "flake.nix", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "action-pull-request", - "sha": "6699836a213cf8b28c4f0408a404a6ac79d4458a", - "isFork": true, - "isArchived": false, - "files": [ - ".eslintrc.json", - ".prettierignore", - ".prettierrc.json", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "serde-content-ref", - "sha": "fa1e323ae6beac6276d9974d8f68a228fbf662fc", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "action-osslsigncode", - "sha": "f90327df09bf10401e5d0f87c3af40bdec339915", - "isFork": true, - "isArchived": false, - "files": ["misc/softhsm-example-token/Makefile"], - "error": null, - "truncated": false - }, - { - "name": "orchestrator", - "sha": "7101bc1f68ecd76d835b0569594d0f0796c52a37", - "isFork": false, - "isArchived": false, - "files": [ - ".mise/config.toml", - ".mise/tasks/lint", - "eslint.config.mjs", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "shell_exec", - "sha": "14d946b6915eeb4f350b1f4fae2d7a87568077a8", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "analytics-ingestion", - "sha": "0c525fcc8c473a3ff64e13631a928a93f160d582", - "isFork": false, - "isArchived": true, - "files": [".mise/config.toml", "pyproject.toml"], - "error": null, - "truncated": false - }, - { - "name": "dependency-pogo", - "sha": "62d292f8010bc16de20091846cfb03237c54138c", - "isFork": true, - "isArchived": false, - "files": [".pre-commit-config.yaml", "pyproject.toml"], - "error": null, - "truncated": false - }, - { - "name": "dependency-rquickjs", - "sha": "7ef9dd41dc455c531e8ff3061bb3f4d61909d34b", - "isFork": true, - "isArchived": false, - "files": [".rustfmt.toml", "examples/Makefile", "sys/Makefile"], - "error": null, - "truncated": false - }, - { - "name": "resources", - "sha": "1c49b86eba85cbd19ea8ce25ee8b1269cea6ae4e", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "dependency-rmcp-actix-web", - "sha": "57baf8526624434e745e3f85a2999e038bc6d5e3", - "isFork": true, - "isArchived": false, - "files": [ - "tests/test_with_js/package.json", - "tests/test_with_python/pyproject.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "dependency-graphql-ws-client", - "sha": "fe58978ba6b15f26c5a4f8d13d977065fef2f456", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "plugin-manifest", - "sha": "9269816f49851d143291123b4060e049fd7bb929", - "isFork": false, - "isArchived": false, - "files": ["eslint.config.mjs", "mise.toml", "package.json"], - "error": null, - "truncated": false - }, - { - "name": "dependency-decimal", - "sha": "596c93ae2bfca47e3010922d41cc290ed5a187dd", - "isFork": true, - "isArchived": false, - "files": [".editorconfig", "rustfmt.toml"], - "error": null, - "truncated": false - }, - { - "name": "process_alive", - "sha": "297fc56029efc4acd7bb0753e1d07dd9b38ab531", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "action-release", - "sha": "a0e7822741653f905804157a2fea14e40db10c8c", - "isFork": true, - "isArchived": false, - "files": ["biome.json", "package.json"], - "error": null, - "truncated": false - }, - { - "name": "distribution", - "sha": "e12b2ff8ead5fbd7d982bc1ef8f6738f51cd60dd", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "dependency-tokio", - "sha": "925c614c89d0a26777a334612e2ed6ad0e7935c3", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "action-issue-triager", - "sha": "9a56e18f3375cb76b55401adc7ccfa9648a83d0f", - "isFork": false, - "isArchived": false, - "files": ["eslint.config.mjs", "mise.toml", "package.json"], - "error": null, - "truncated": false - }, - { - "name": "dependency-tracing", - "sha": "c297a37096ae1562d453624984aa5f924ab490a1", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "dependency-tracing-bunyan-formatter", - "sha": "8c0ed4353f2cca2d2d878f9f1cf173c918b61a42", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "download-backend", - "sha": "9aa41e53278e1daa31838e65c7d4803039bfab20", - "isFork": false, - "isArchived": false, - "files": [ - ".github/workflows/validate.yml", - "eslint.config.mjs", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "actix-sse", - "sha": "7b737412030f206e4b7da5bbbaba10d8cc2bb441", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "shift-marketing-frontend", - "sha": "69d7c50d2125b00c3b95e0fba0d3d89b00a6db9b", - "isFork": false, - "isArchived": false, - "files": ["Makefile"], - "error": null, - "truncated": false - }, - { - "name": "bumpit", - "sha": "bc5fca295a7e4108d83be95b9cd4ec1e6102dd11", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "shift-backend", - "sha": "6142a79d4b39c1f7b7c87f3a8fd591a4f5aff23d", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "dependency-graphql-client", - "sha": "46791c831654e4bef8d71701a1eaf8f26481afa9", - "isFork": true, - "isArchived": false, - "files": [".editorconfig", ".prettierignore"], - "error": null, - "truncated": false - }, - { - "name": "async_buf_read", - "sha": "e3f641f5eadae7adda1c89269c6114271b280228", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "D2G", - "sha": "0868b9ca98116e80b2ea1a8a4d1514a8cef7b39e", - "isFork": true, - "isArchived": false, - "files": [".github/workflows/lint.yml", "pyproject.toml"], - "error": null, - "truncated": false - }, - { - "name": "terraform-gcp-terrateam-setup", - "sha": "ca6d09ccbf918312da99515f8410d44bb329d736", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "atlas", - "sha": "7efd2ad867233cad7cd7d66bfcdc07a6dbfa1bb9", - "isFork": false, - "isArchived": true, - "files": ["Makefile", "eslint.config.mjs", "package.json"], - "error": null, - "truncated": false - }, - { - "name": "sync-load-test", - "sha": "7bd8036c2568fa0f49a8ea489ce6ebba955e1ce7", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "electron-updater", - "sha": "02e1e9adc90542eb2174f1bc8424836e4e439f04", - "isFork": false, - "isArchived": false, - "files": [".prettierrc.yaml", "eslint.config.mjs", "package.json"], - "error": null, - "truncated": false - }, - { - "name": "renovate-config", - "sha": "1c891aef743b68af6d75fa65b723b9d7b68ab6e1", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "os_name", - "sha": "45c078dda3fdc3bbd008ba3802593e56d480ea35", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "cloud-cron", - "sha": "944f6ad3474cbf0b2c11fcc096fe96d461c40f79", - "isFork": false, - "isArchived": true, - "files": ["Makefile", "projects/download-statistics/pyproject.toml"], - "error": null, - "truncated": false - }, - { - "name": "dependency-websocket-lite", - "sha": "f37f975d1f3e19680ba6f06f55ec95f082b6b78c", - "isFork": true, - "isArchived": false, - "files": ["rustfmt.toml"], - "error": null, - "truncated": false - }, - { - "name": "caido-dry-run", - "sha": "fe9c3d2176798c67aeacd369aa7f7baed136ae1b", - "isFork": false, - "isArchived": false, - "files": [ - "sdk-frontend/package.json", - "sdk-workflow/Makefile", - "sdk-workflow/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "doc-typedoc-plugin-markdown", - "sha": "11b68315df502bd641fab6eaf17db9c7d64c8ded", - "isFork": true, - "isArchived": false, - "files": [ - ".editorconfig", - ".prettierrc.json", - "devtools/examples/docusaurus/package.json", - "devtools/examples/vitepress/package.json", - "devtools/examples/vuepress1/package.json", - "devtools/examples/vuepress2/package.json", - "devtools/packages/helpers/package.json", - "devtools/packages/prebuild-options/package.json", - "devtools/packages/testing/package.json", - "docs/package.json", - "eslint.config.mjs", - "package.json", - "packages/docusaurus-plugin-typedoc/package.json", - "packages/typedoc-github-wiki-theme/package.json", - "packages/typedoc-gitlab-wiki-theme/package.json", - "packages/typedoc-plugin-frontmatter/package.json", - "packages/typedoc-plugin-markdown/package.json", - "packages/typedoc-plugin-markdown/test/fixtures/package.json", - "packages/typedoc-plugin-markdown/test/fixtures/prettier-config/.prettierrc.json", - "packages/typedoc-plugin-markdown/test/fixtures/src/packages/package-1/package.json", - "packages/typedoc-plugin-markdown/test/fixtures/src/packages/package-1b/package.json", - "packages/typedoc-plugin-markdown/test/fixtures/src/packages/package-2/package.json", - "packages/typedoc-plugin-markdown/test/fixtures/src/packages/package-3/package.json", - "packages/typedoc-plugin-markdown/test/fixtures/src/packages/package-4/package.json", - "packages/typedoc-plugin-markdown/test/fixtures/src/packages/package-5/package.json", - "packages/typedoc-plugin-markdown/test/fixtures/src/packages/package-6/package.json", - "packages/typedoc-plugin-markdown/test/fixtures/src/packages/package-7/package.json", - "packages/typedoc-plugin-markdown/test/fixtures/src/utils/prettier.ts", - "packages/typedoc-plugin-remark/package.json", - "packages/typedoc-vitepress-theme/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "action-setup-wsl", - "sha": "3d42bb08fcd4729645bee8273cb0ee23cb4353d6", - "isFork": true, - "isArchived": false, - "files": [ - ".github/workflows/validate-gradle-wrapper.main.kts", - ".github/workflows/validate-gradle-wrapper.yaml" - ], - "error": null, - "truncated": false - }, - { - "name": "action-setup-rust", - "sha": "f3c84ee10bf5a86e7a5d607d487bf17d57670965", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "action-publish-crates", - "sha": "93732b1aad8551d028a5b440f133c4c6ce28fe48", - "isFork": true, - "isArchived": false, - "files": [ - ".eslintrc.json", - ".prettierignore", - ".prettierrc.json", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "dependency-rudder", - "sha": "56355c8d0bd7163062af02cc1eec6124d72fc269", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "dependency-sea-orm", - "sha": "5d0efaa91b33ebcb1570b72404b08ee1529653ef", - "isFork": true, - "isArchived": false, - "files": [ - "examples/loco_example/.rustfmt.toml", - "examples/loco_example/frontend/.eslintrc.cjs", - "examples/loco_example/frontend/package.json", - "examples/loco_seaography/.rustfmt.toml", - "examples/loco_starter/.rustfmt.toml", - "examples/react_admin/backend/.rustfmt.toml", - "examples/react_admin/frontend/.eslintrc.js", - "examples/react_admin/frontend/package.json", - "examples/react_admin/frontend/prettier.config.js", - "rustfmt.toml", - "sea-orm-codegen/rustfmt.toml" - ], - "error": null, - "truncated": false - }, - { - "name": "starterkit-plugin", - "sha": "8f937841d4e29328f0cf6ce9b8a8cc221d332e00", - "isFork": false, - "isArchived": true, - "files": [ - "package.json", - "packages/backend/package.json", - "packages/frontend/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "blog-frontend", - "sha": "fab5baee3aad2ed92406be85f5bd58480d4c4778", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "dependency-sqlite-loadable-rs", - "sha": "2c5c049c0c9e010a70b458fde459facf294befce", - "isFork": true, - "isArchived": false, - "files": [ - "Makefile", - "benchmarks/Makefile", - "tests/static_hello/Makefile" - ], - "error": null, - "truncated": false - }, - { - "name": "dependency-actix-net", - "sha": "a4b6943ddc07176ec3a9913e51eafa103688481a", - "isFork": true, - "isArchived": false, - "files": [ - ".github/workflows/lint.yml", - ".rustfmt.toml", - "flake.nix", - "justfile" - ], - "error": null, - "truncated": false - }, - { - "name": "dependency-zip", - "sha": "7d96484fff3616987df0c7f1a8f67cd1ec34b184", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "workshop-hackfest", - "sha": "81c2ee2a7cc17a47105f25fe312fd23effad28b2", - "isFork": false, - "isArchived": false, - "files": [ - "exercise-2/solution/package.json", - "exercise-2/starter/package.json", - "exercise-3/solution/package.json", - "exercise-3/starter/package.json", - "exercise-4/solution/package.json", - "exercise-4/solution/packages/backend/package.json", - "exercise-4/starter/package.json", - "exercise-4/starter/packages/backend/package.json", - "exercise-5/solution/package.json", - "exercise-5/solution/packages/backend/package.json", - "exercise-5/solution/packages/frontend/package.json", - "exercise-5/starter/package.json", - "exercise-5/starter/packages/backend/package.json", - "exercise-5/starter/packages/frontend/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "sphinx", - "sha": "8e257e2ae250e3b6dca6f58d64873a901370c64c", - "isFork": true, - "isArchived": false, - "files": ["Makefile"], - "error": null, - "truncated": false - }, - { - "name": "dependency-kayvee-go", - "sha": "f9811c461a07f479b0dfe909f9248b56bb789122", - "isFork": true, - "isArchived": false, - "files": ["Makefile"], - "error": null, - "truncated": false - }, - { - "name": "workshop-defcon", - "sha": "3dd1d313a2400b5f2837426a6141717efa4e5c05", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "action-json-schema-validate", - "sha": "3d80261c1f49e8664a6311b08c5809127cfc4a91", - "isFork": true, - "isArchived": false, - "files": [ - ".github/linters/.eslintrc.yml", - ".github/workflows/linter.yml", - ".prettierignore", - ".prettierrc.json", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "dependency-tokio-socks", - "sha": "2eeb99ccf290f787e549ffb35b05ad4e3e1a20c2", - "isFork": true, - "isArchived": false, - "files": ["rustfmt.toml"], - "error": null, - "truncated": false - }, - { - "name": "yarn-plugin-licenses", - "sha": "035df51ee8ca89a6f7c2ffa69354c078d26c137e", - "isFork": true, - "isArchived": false, - "files": [ - ".editorconfig", - ".eslintrc.js", - ".prettierignore", - ".prettierrc", - ".yarn/sdks/eslint/package.json", - ".yarn/sdks/prettier/package.json", - ".yarn/sdks/typescript/package.json", - "package.json", - "src/__tests__/integration/fixtures/test-package-node-modules-aliases/package.json", - "src/__tests__/integration/fixtures/test-package-node-modules/package.json", - "src/__tests__/integration/fixtures/test-package-node-modules/packages/package1/package.json", - "src/__tests__/integration/fixtures/test-package-node-modules/packages/package2/package.json", - "src/__tests__/integration/fixtures/test-package-pnp/package.json", - "src/__tests__/integration/fixtures/test-package-pnp/packages/package1/package.json", - "src/__tests__/integration/fixtures/test-package-pnp/packages/package2/package.json", - "src/__tests__/integration/fixtures/test-package-pnpm/package.json", - "src/__tests__/integration/fixtures/test-package-pnpm/packages/package1/package.json", - "src/__tests__/integration/fixtures/test-package-pnpm/packages/package2/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "starterkit-plugin-frontend", - "sha": "85942c95fc3f96f2face8808e4e9c46be1cf3fd0", - "isFork": false, - "isArchived": true, - "files": ["package.json"], - "error": null, - "truncated": false - }, - { - "name": "starterkit-workflow", - "sha": "f39f0eb32bcfa1513ed4a7916e9a8738b6a68b5d", - "isFork": false, - "isArchived": true, - "files": ["package.json"], - "error": null, - "truncated": false - }, - { - "name": "javascript", - "sha": "b3775dc544f97b66cee02dc324c0cd6f5a532dea", - "isFork": true, - "isArchived": false, - "files": ["package.json"], - "error": null, - "truncated": false - }, - { - "name": "dependency-example", - "sha": "b58c9af13e6ccac5a9c474be3d3f48c563920856", - "isFork": false, - "isArchived": false, - "files": ["package.json"], - "error": null, - "truncated": false - }, - { - "name": "dependency-actix", - "sha": "fe8355dd4856f8ac4e3dd57d8b3cd9bad416ddfc", - "isFork": true, - "isArchived": false, - "files": [".prettierrc.yml", ".rustfmt.toml"], - "error": null, - "truncated": false - }, - { - "name": "dependency-bytes", - "sha": "86694b05649c0c1666044b2ba5c386c2328aac18", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "dependency_read_until_slice", - "sha": "096c66cebf20c5509b0d4cc944358311e13b2464", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": ".github", - "sha": "e5a39d2939d5c7be9a13e9376a46844700a2adc4", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "android-ssl-pinning-demo", - "sha": "9c27e625f51643e35e8f046fddf312ee74bfa14b", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "dependency-tauri-plugins-workspace", - "sha": "dbe0277824676b978ed616ddb28f988689df6f7e", - "isFork": true, - "isArchived": false, - "files": [ - ".eslintrc.json", - ".github/workflows/lint-javascript.yml", - ".github/workflows/lint-rust.yml", - ".prettierignore", - "package.json", - "plugins/authenticator/package.json", - "plugins/autostart/package.json", - "plugins/fs-extra/package.json", - "plugins/fs-watch/package.json", - "plugins/log/package.json", - "plugins/positioner/package.json", - "plugins/single-instance/examples/vanilla/package.json", - "plugins/single-instance/examples/vanilla/src-tauri/rustfmt.toml", - "plugins/sql/package.json", - "plugins/store/examples/AppSettingsManager/package.json", - "plugins/store/package.json", - "plugins/stronghold/package.json", - "plugins/upload/package.json", - "plugins/websocket/examples/tauri-app/package.json", - "plugins/websocket/examples/tauri-app/src-tauri/rustfmt.toml", - "plugins/websocket/package.json", - "plugins/window-state/package.json", - "shared/template/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "dependency-eslint-plugin-vue-pug", - "sha": "9a71f95d911c27de605724cb0ed1ef19d7966ba8", - "isFork": true, - "isArchived": false, - "files": [ - ".editorconfig", - ".eslintrc.js", - ".prettierrc", - "docs/.eslintrc.js", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "capo", - "sha": "dc49f6cce8699e4364b6ffa6d1df4de9ae6fef9d", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "workshop-demo", - "sha": "bdc413b9ffe4f915ae0a5912425a6cd840a3f7a6", - "isFork": false, - "isArchived": false, - "files": ["pyproject.toml"], - "error": null, - "truncated": false - }, - { - "name": "reglite", - "sha": "2b49ddb3f7eb73b1e54e47bd05d364fbbf1460a2", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "dependency-sqlite-regex", - "sha": "5fe28e3c7a978c621082cfef0ae6dea9a71167ee", - "isFork": true, - "isArchived": false, - "files": [ - "Makefile", - "benchmarks/Makefile", - "bindings/sqlite-utils/pyproject.toml", - "deno/deno.json", - "npm/sqlite-regex-darwin-arm64/package.json", - "npm/sqlite-regex-darwin-x64/package.json", - "npm/sqlite-regex-linux-x64/package.json", - "npm/sqlite-regex-windows-x64/package.json", - "npm/sqlite-regex/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "test-tokio", - "sha": "2981efbe29ccaace609f1eecb38018e3d48b4f9a", - "isFork": false, - "isArchived": true, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "ios-ssl-pinning-demo", - "sha": "4ee845482b202946627009df5d795fa0add21a8a", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "integrations", - "sha": "f1b0a848daf600094956b52991635ae090ad39e0", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "kratos", - "sha": "405a1cef652656214f8181f9ce19485e0917756d", - "isFork": true, - "isArchived": false, - "files": [ - ".editorconfig", - ".prettierignore", - "Makefile", - "package.json", - "test/e2e/package.json", - "test/e2e/proxy/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "dependency-sea-query", - "sha": "6f39795dfe11528f6bf3145e6eda95f29959dbbc", - "isFork": true, - "isArchived": false, - "files": ["rustfmt.toml"], - "error": null, - "truncated": false - }, - { - "name": "dependency-tauri", - "sha": "2e1bd04775c0f05f1c0b67605e6abec4465dbf84", - "isFork": true, - "isArchived": false, - "files": [ - ".editorconfig", - ".github/workflows/lint-fmt-cli.yml", - ".github/workflows/lint-fmt-core.yml", - ".github/workflows/lint-js.yml", - ".prettierignore", - ".prettierrc.js", - "examples/api/package.json", - "examples/resources/package.json", - "examples/sidecar/package.json", - "examples/updater/package.json", - "examples/web/package.json", - "package.json", - "rustfmt.toml", - "tooling/api/.eslintrc.cjs", - "tooling/api/.prettierrc.cjs", - "tooling/api/package.json", - "tooling/cli/node/npm/darwin-arm64/package.json", - "tooling/cli/node/npm/darwin-x64/package.json", - "tooling/cli/node/npm/linux-arm-gnueabihf/package.json", - "tooling/cli/node/npm/linux-arm64-gnu/package.json", - "tooling/cli/node/npm/linux-arm64-musl/package.json", - "tooling/cli/node/npm/linux-x64-gnu/package.json", - "tooling/cli/node/npm/linux-x64-musl/package.json", - "tooling/cli/node/npm/win32-ia32-msvc/package.json", - "tooling/cli/node/npm/win32-x64-msvc/package.json", - "tooling/cli/node/package.json", - "tooling/cli/node/test/jest/fixtures/app/package.json", - "tooling/cli/node/test/jest/fixtures/app/src-tauri/rustfmt.toml", - "tooling/cli/node/test/jest/fixtures/empty/package.json", - "tooling/cli/templates/plugin/backend/.github/workflows/format.yml", - "tooling/cli/templates/plugin/backend/.github/workflows/lint.yml", - "tooling/cli/templates/plugin/backend/examples/vanilla/package.json", - "tooling/cli/templates/plugin/backend/examples/vanilla/src-tauri/rustfmt.toml", - "tooling/cli/templates/plugin/with-api/.github/workflows/format.yml", - "tooling/cli/templates/plugin/with-api/examples/svelte-app/package.json", - "tooling/cli/templates/plugin/with-api/examples/svelte-app/src-tauri/rustfmt.toml", - "tooling/cli/templates/plugin/with-api/package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "action-cache-s3", - "sha": "43f80f94ffa888eefcee15b2b2038b30792ce4ca", - "isFork": true, - "isArchived": false, - "files": ["package.json"], - "error": null, - "truncated": false - }, - { - "name": "dependency-view", - "sha": "97c5b7eae771c0b47af2dde013ddc3fc336b9ee0", - "isFork": true, - "isArchived": false, - "files": ["package.json"], - "error": null, - "truncated": false - }, - { - "name": "dependency-csv", - "sha": "41c71ed353a71526c52633d854466c1619dacae4", - "isFork": true, - "isArchived": false, - "files": ["rustfmt.toml"], - "error": null, - "truncated": false - }, - { - "name": "action-variable-mapper", - "sha": "3681b75f5c6c00162721168fb91ab74925eaebcb", - "isFork": true, - "isArchived": false, - "files": [ - ".eslintrc.json", - ".prettierignore", - ".prettierrc.json", - "package.json" - ], - "error": null, - "truncated": false - }, - { - "name": "dyper", - "sha": "fdaee1803436647a6dc286e3672bc1bf43cdb63c", - "isFork": false, - "isArchived": true, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "repro-tauri", - "sha": "ac35e6e5b30838c9d4fb18bedd674a16cce8efaf", - "isFork": false, - "isArchived": true, - "files": ["src-ui/package.json"], - "error": null, - "truncated": false - }, - { - "name": "dependency-jwt-simple", - "sha": "dedee9b1bcddf5b9e55df8d63eef7eee8f83284c", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "test-keyring", - "sha": "473837bfb7041f3b47c6c700e1ed52e62b76919d", - "isFork": false, - "isArchived": true, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "action-json-bump", - "sha": "4f1ebaa43e6952d3686fcfbc78d99ee2ad389c68", - "isFork": true, - "isArchived": true, - "files": ["package.json"], - "error": null, - "truncated": false - }, - { - "name": "dependency-utoipa", - "sha": "baa394717f52f0007f9d4cc5dff077e92328cf7d", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "caido-box", - "sha": "5f5842dff7967370837df9302340c463f6f6043f", - "isFork": false, - "isArchived": true, - "files": ["Makefile"], - "error": null, - "truncated": false - }, - { - "name": "action-cache", - "sha": "49f1c15c4cbce112b4eca729f031b08ea214fcfc", - "isFork": true, - "isArchived": false, - "files": [".eslintrc.json", ".prettierrc.json", "package.json"], - "error": null, - "truncated": false - }, - { - "name": "dependency-like", - "sha": "080a89c8e0f08964262d228fdf383483be640e62", - "isFork": true, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "action-cargo-bump", - "sha": "415e4cf50b63ae74db56c23143f0d7cca45c06db", - "isFork": true, - "isArchived": true, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "libsqlite3", - "sha": "66154d6006067565d83f1d41e9e4e06edfd5385f", - "isFork": false, - "isArchived": false, - "files": [], - "error": null, - "truncated": false - }, - { - "name": "sea-jet", - "sha": "29c18ed0823e6e2570a9e01640407ca55c263d5b", - "isFork": false, - "isArchived": true, - "files": [], - "error": null, - "truncated": false - } - ] -} diff --git a/examples/github-actions.yml b/examples/github-actions.yml index c17464f..f3d95ab 100644 --- a/examples/github-actions.yml +++ b/examples/github-actions.yml @@ -1,4 +1,4 @@ -name: Validate formatter configuration +name: Check formatting on: pull_request: @@ -9,7 +9,7 @@ permissions: contents: read jobs: - test: + formatting: runs-on: ubuntu-latest timeout-minutes: 30 steps: @@ -17,5 +17,5 @@ jobs: - uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31 with: github_access_token: ${{ secrets.GITHUB_TOKEN }} - - name: Validate configuration, formatting and real formatter routing + - name: Check formatting only run: nix flake check --no-update-lock-file --show-trace diff --git a/flake.nix b/flake.nix index bb0158a..4f966ac 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "Shared Caido formatters, configured and packaged with treefmt-nix"; + description = "One shared formatter configuration for every Caido repository"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; @@ -22,154 +22,56 @@ ... }: let - # Current Nixpkgs no longer supports x86_64-darwin. systems = [ "aarch64-darwin" "aarch64-linux" "x86_64-linux" ]; eachSystem = nixpkgs.lib.genAttrs systems; - profiles = import ./nix/profiles.nix; - profileNames = builtins.attrNames profiles; + pkgsFor = + system: + import nixpkgs { + inherit system; + overlays = [ rust-overlay.overlays.default ]; + }; + evaluated = eachSystem (system: treefmt-nix.lib.evalModule (pkgsFor system) ./treefmt.nix); + wrappers = eachSystem (system: evaluated.${system}.config.build.wrapper); - sharedModule = { pkgs, lib, ... }: { - imports = [ ./treefmt.nix ]; - # The overlay supplies a rustfmt binary directly. No rustup, host - # toolchain selection, or ambient PATH is needed at runtime. - programs.rustfmt.package = lib.mkDefault ( - (pkgs.extend rust-overlay.overlays.default).rust-bin.nightly."2026-04-06".minimal.override { - extensions = [ "rustfmt" ]; - } - ); + # Only the source being checked differs between callers. Formatter + # selection, settings, versions and file routing are identical everywhere. + forProject = source: { + formatter = wrappers; + checks = eachSystem (system: { + formatting = evaluated.${system}.config.build.check source; + }); + packages = eachSystem (system: { + formatting-check = evaluated.${system}.config.build.check source; + }); }; - - evaluated = eachSystem ( - system: - let - pkgs = nixpkgs.legacyPackages.${system}; - in - nixpkgs.lib.genAttrs profileNames ( - name: - treefmt-nix.lib.evalModule pkgs { - imports = [ sharedModule ]; - caido.profile = name; - } - ) - ); - testProfiles = [ - "default" - "self" - "proxy-backend" - "proxy-frontend" - "analytics" - "caido-private" - "infrastructure" - "mise-toolshed" - ]; + project = forProject self; in { - lib = { - inherit profileNames; - treefmtModule = sharedModule; - settings = import ./nix/settings.nix; - }; - - formatter = eachSystem (system: evaluated.${system}.self.config.build.wrapper); + lib = { inherit forProject; }; + inherit (project) formatter checks; packages = eachSystem ( system: let - pkgs = nixpkgs.legacyPackages.${system}; - configs = evaluated.${system}; - wrappers = builtins.mapAttrs (_: value: value.config.build.wrapper) configs; - configFiles = nixpkgs.lib.mapAttrs' ( - name: value: nixpkgs.lib.nameValuePair "config-${name}" value.config.build.configFile - ) configs; + pkgs = pkgsFor system; in - wrappers - // configFiles + project.packages.${system} // { - formatting-check = configs.self.config.build.check self; - tests = pkgs.linkFarm "caido-formatter-tests" [ - { - name = "configuration"; - path = self.checks.${system}.configuration; - } - { - name = "routing"; - path = self.checks.${system}.routing; - } - ]; - versions = pkgs.writeText "caido-formatter-versions.json" ( - builtins.toJSON ( - builtins.mapAttrs (_: value: value.version) { - inherit (pkgs) - treefmt - oxfmt - prettier - ruff - opentofu - shfmt - stylua - deno - nixfmt - sqlfluff - black - ; - } - // { - rustfmt = "nightly-2026-04-06"; - } - ) - ); - } - ); - - apps = eachSystem ( - system: - builtins.mapAttrs (_: value: { - type = "app"; - program = "${value.config.build.wrapper}/bin/treefmt"; - }) evaluated.${system} - ); - - devShells = eachSystem (system: { - default = evaluated.${system}.self.config.build.devShell; - }); - - checks = eachSystem ( - system: - let - pkgs = nixpkgs.legacyPackages.${system}; - configs = evaluated.${system}; - testConfigs = nixpkgs.lib.genAttrs testProfiles (name: { - program = "${configs.${name}.config.build.wrapper}/bin/treefmt"; - config = toString configs.${name}.config.build.configFile; - }); - overridden = treefmt-nix.lib.evalModule pkgs { - imports = [ sharedModule ]; - caido.profile = "proxy-backend"; - programs.rustfmt.enable = pkgs.lib.mkForce false; - settings.excludes = [ "fixtures/*" ]; - }; - in - { - formatting = configs.self.config.build.check self; - # Force module evaluation for every profile, including optional tools, - # without requiring every formatter closure just to validate options. - configuration = - assert !(overridden.config.settings.formatter ? rustfmt); - assert builtins.elem "fixtures/*" overridden.config.settings.excludes; - builtins.deepSeq (builtins.mapAttrs ( - _: value: builtins.removeAttrs value.config.settings [ "global" ] - ) configs) (pkgs.runCommand "caido-formatter-configuration" { } "touch $out"); - routing = - pkgs.runCommand "caido-formatter-routing" + default = wrappers.${system}; + config = evaluated.${system}.config.build.configFile; + # These are this library's own tests, never exported as flake checks + # or included in a consuming project's formatting check. + tests = + assert builtins.attrNames project.checks.${system} == [ "formatting" ]; + pkgs.runCommand "caido-formatter-tests" { nativeBuildInputs = [ pkgs.python3 ]; - CAIDO_TEST_CONFIGS = builtins.toJSON testConfigs; - CAIDO_TEST_SOURCE = self; - CAIDO_TEST_SHELL = pkgs.runtimeShell; + CAIDO_FORMATTER = "${wrappers.${system}}/bin/treefmt"; + CAIDO_FORMATTER_CONFIG = toString evaluated.${system}.config.build.configFile; } '' python3 ${./tests/test_config.py} @@ -177,5 +79,19 @@ ''; } ); + + apps = eachSystem (system: { + default = { + type = "app"; + program = "${wrappers.${system}}/bin/treefmt"; + }; + }); + devShells = eachSystem (system: { + default = evaluated.${system}.config.build.devShell; + }); + templates.default = { + path = ./templates/default; + description = "Identical shared formatting integration for any Caido repository"; + }; }; } diff --git a/nix/excludes.nix b/nix/excludes.nix deleted file mode 100644 index c8e7d74..0000000 --- a/nix/excludes.nix +++ /dev/null @@ -1,27 +0,0 @@ -# Common generated, dependency, and assistant directories. -[ - ".git/*" - ".formatter/*" - "node_modules/*" - "*/node_modules/*" - "dist/*" - "*/dist/*" - "target/*" - "*/target/*" - "coverage/*" - "*/coverage/*" - ".venv/*" - "*/.venv/*" - ".terraform/*" - "*/.terraform/*" - "*-lock.json" - "pnpm-lock.yaml" - "yarn.lock" - "uv.lock" - "*.min.js" - "*.min.css" - ".agents/*" - ".claude/*" - ".cursor/*" - "**/__generated__/**" -] diff --git a/nix/profiles.nix b/nix/profiles.nix deleted file mode 100644 index 78aedff..0000000 --- a/nix/profiles.nix +++ /dev/null @@ -1,583 +0,0 @@ -# Audited file routing. Style settings are shared through nix/settings.nix. -{ - "proxy-frontend" = { - "formatters" = { - "oxfmt" = { - "includes" = [ - "packages/*.ts" - "packages/*.tsx" - "packages/*.vue" - "packages/*.js" - "packages/*.mjs" - "packages/*.cjs" - "packages/*.json" - "packages/*.css" - "packages/*.scss" - "packages/*.graphql" - "packages/*.md" - "packages/*.yml" - "packages/*.yaml" - "packages/*.html" - "scripts/*.ts" - "scripts/*.mjs" - "scripts/*.js" - ".github/*.yml" - ".github/*.yaml" - ]; - "excludes" = [ - "*.svg" - "*.grammar" - ]; - "style" = "default"; - }; - "oxfmt-root" = { - "includes" = [ - "*.ts" - "*.mjs" - "*.js" - "*.json" - "*.yml" - "*.yaml" - ]; - "excludes" = [ - "*/*" - ]; - "style" = "default"; - }; - }; - "excludes" = [ - "packages/ui/src/@types/modules/vue-router.d.ts" - ]; - }; - "proxy-backend" = { - "formatters" = { - "rustfmt" = { - "includes" = [ - "*.rs" - ]; - "excludes" = [ - "proxy-tests/tests/common/macros/*" - ]; - "style" = "proxy-backend"; - "edition" = "2024"; - }; - "prettier" = { - "includes" = [ - "*.graphql" - ]; - "style" = "backend"; - }; - }; - }; - "proxy-desktop" = { - "formatters" = { - "prettier" = { - "includes" = [ - "packages/main/src/*.ts" - "packages/main/src/*.js" - "packages/ui/src/*.ts" - "packages/ui/src/*.js" - "packages/ui/src/*.vue" - "packages/shared/src/*.ts" - "packages/shared/src/*.js" - "packages/migrations/src/*.ts" - "packages/migrations/src/*.js" - ]; - "style" = "default"; - }; - }; - }; - "proxy-playground" = { - "formatters" = { - "prettier" = { - "includes" = [ - "*.ts" - "*.tsx" - "*.mts" - "*.cts" - "*.js" - "*.jsx" - "*.mjs" - "*.cjs" - "*.vue" - "*.html" - "*.css" - "*.scss" - "*.json" - "*.jsonc" - "*.graphql" - "*.md" - "*.yml" - "*.yaml" - ]; - "style" = "default"; - }; - }; - }; - "postgres" = { - "formatters" = { - "sqlfluff" = { - "includes" = [ - "*.sql" - ]; - }; - }; - }; - "self" = { - "formatters" = { - "prettier" = { - "includes" = [ - "*.json" - "*.yaml" - "*.yml" - "*.md" - ]; - "excludes" = [ - "tests/*" - ]; - "style" = "default"; - }; - "nixfmt" = { - "includes" = [ - "*.nix" - ]; - }; - "ruff" = { - "includes" = [ - "tests/*.py" - ]; - "style" = "default"; - }; - "shfmt" = { - "includes" = [ - "bin/format" - ".mise/tasks/*" - ]; - }; - }; - }; - "cogfer" = { - "formatters" = { - "rustfmt" = { - "includes" = [ - "*.rs" - ]; - "excludes" = [ - "proxy-tests/tests/common/macros/*" - ]; - "style" = "cogfer"; - "edition" = "2024"; - }; - }; - }; - "analytics-ingestion" = { - "formatters" = { - "black" = { - "includes" = [ - "src/*.py" - "src/*.pyi" - ]; - }; - }; - }; - "proxy-extension" = { - "formatters" = { - "prettier" = { - "includes" = [ - "*.ts" - "*.tsx" - "*.mts" - "*.cts" - "*.js" - "*.jsx" - "*.mjs" - "*.cjs" - "*.vue" - "*.html" - "*.css" - "*.scss" - "*.json" - "*.jsonc" - "*.graphql" - "*.md" - "*.yml" - "*.yaml" - ]; - "style" = "default"; - }; - }; - }; - "sqlite-rs" = { - "formatters" = { - "rustfmt" = { - "includes" = [ - "*.rs" - ]; - "excludes" = [ - "proxy-tests/tests/common/macros/*" - ]; - "style" = "sqlite-rs"; - "edition" = "2024"; - }; - }; - }; - "infrastructure" = { - "formatters" = { - "tofu" = { - "includes" = [ - "tofu/*.tf" - "tofu/*.tfvars" - "tofu/*.tftest.hcl" - ]; - }; - }; - }; - "mise-toolshed" = { - "formatters" = { - "oxfmt" = { - "includes" = [ - "*.ts" - "*.tsx" - "*.mts" - "*.cts" - "*.js" - "*.jsx" - "*.mjs" - "*.cjs" - "*.vue" - "*.html" - "*.css" - "*.scss" - "*.json" - "*.jsonc" - "*.graphql" - "*.md" - "*.yml" - "*.yaml" - ]; - "excludes" = [ - "*.svg" - "*.grammar" - ]; - "style" = "toolshed"; - }; - "shfmt" = { - "includes" = [ - "*.sh" - "*.bash" - "*.bats" - ]; - }; - "stylua" = { - "includes" = [ - "*.lua" - "*.luau" - ]; - }; - }; - "excludes" = [ - ".mise/locks/*" - ]; - }; - "student-backend" = { - "formatters" = { - "rustfmt" = { - "includes" = [ - "*.rs" - ]; - "excludes" = [ - "proxy-tests/tests/common/macros/*" - ]; - "style" = "student-backend"; - "edition" = "2024"; - }; - }; - }; - "internal-services" = { - "formatters" = { - "oxfmt" = { - "includes" = [ - "packages/*.ts" - "packages/*.tsx" - "packages/*.vue" - "packages/*.js" - "packages/*.mjs" - "packages/*.cjs" - "packages/*.json" - "packages/*.css" - "packages/*.html" - "apps/*.ts" - "apps/*.json" - "scripts/*.ts" - "scripts/*.mjs" - "scripts/*.js" - ".github/*.yml" - ".github/*.yaml" - ]; - "excludes" = [ - "*.svg" - "*.grammar" - ]; - "style" = "default"; - }; - "oxfmt-root" = { - "includes" = [ - "*.ts" - "*.mjs" - "*.js" - "*.json" - "*.yml" - "*.yaml" - ]; - "excludes" = [ - "*/*" - ]; - "style" = "default"; - }; - }; - }; - "nix" = { - "formatters" = { - "nixfmt" = { - "includes" = [ - "*.nix" - ]; - }; - }; - }; - "convert" = { - "formatters" = { - "rustfmt" = { - "includes" = [ - "*.rs" - ]; - "excludes" = [ - "proxy-tests/tests/common/macros/*" - ]; - "style" = "convert"; - "edition" = "2021"; - }; - }; - }; - "analytics" = { - "formatters" = { - "ruff" = { - "includes" = [ - "apps/event_consumer/*.py" - "apps/event_consumer/*.pyi" - "apps/extract_and_load/*.py" - "apps/extract_and_load/*.pyi" - "apps/reconcile/*.py" - "apps/reconcile/*.pyi" - "apps/reverse_etl/*.py" - "apps/reverse_etl/*.pyi" - ]; - "style" = "analytics"; - }; - }; - "excludes" = [ - "apps/transform/*" - ]; - }; - "caido-private" = { - "formatters" = { - "ruff" = { - "includes" = [ - "scripts/*.py" - "scripts/*.pyi" - "tests/*.py" - "tests/*.pyi" - ]; - "style" = "caido-private"; - }; - }; - }; - "cloud-backend" = { - "formatters" = { - "rustfmt" = { - "includes" = [ - "*.rs" - ]; - "excludes" = [ - "proxy-tests/tests/common/macros/*" - ]; - "style" = "cloud-backend"; - "edition" = "2024"; - }; - "prettier" = { - "includes" = [ - "*.graphql" - ]; - "style" = "default"; - }; - }; - }; - "electron-updater" = { - "formatters" = { - "prettier" = { - "includes" = [ - "*.ts" - "*.tsx" - "*.mts" - "*.cts" - "*.js" - "*.jsx" - "*.mjs" - "*.cjs" - "*.vue" - "*.html" - "*.css" - "*.scss" - "*.json" - "*.jsonc" - "*.graphql" - "*.md" - "*.yml" - "*.yaml" - ]; - "style" = "electron-updater"; - }; - }; - }; - "proxy-e2e" = { - "formatters" = { - "oxfmt" = { - "includes" = [ - "*.ts" - "*.js" - "*.mjs" - ]; - "excludes" = [ - "*.svg" - "*.grammar" - ]; - "style" = "default"; - }; - }; - "excludes" = [ - "plugins/*" - "test-results/*" - "playwright-report/*" - "binaries/*" - ]; - }; - "secrets-sync" = { - "formatters" = { - "deno" = { - "includes" = [ - "*.ts" - "*.tsx" - "*.js" - "*.jsx" - "*.json" - "*.jsonc" - "*.md" - ]; - }; - }; - }; - "sync-backend" = { - "formatters" = { - "rustfmt" = { - "includes" = [ - "*.rs" - ]; - "excludes" = [ - "proxy-tests/tests/common/macros/*" - ]; - "style" = "sync-backend"; - "edition" = "2021"; - }; - }; - }; - "cloud-cron" = { - "formatters" = { - "black" = { - "includes" = [ - "*.py" - "*.pyi" - ]; - }; - }; - }; - "infrastructure-yaml" = { - "formatters" = { - "prettier" = { - "includes" = [ - "*.yaml" - "*.yml" - ]; - "style" = "infrastructure"; - }; - }; - }; - "default" = { - "formatters" = { - "oxfmt" = { - "includes" = [ - "*.ts" - "*.tsx" - "*.mts" - "*.cts" - "*.js" - "*.jsx" - "*.mjs" - "*.cjs" - "*.vue" - "*.html" - "*.css" - "*.scss" - "*.json" - "*.jsonc" - "*.graphql" - "*.md" - "*.yml" - "*.yaml" - ]; - "excludes" = [ - "*.svg" - "*.grammar" - ]; - "style" = "default"; - }; - "rustfmt" = { - "includes" = [ - "*.rs" - ]; - "excludes" = [ - "proxy-tests/tests/common/macros/*" - ]; - "style" = "default"; - "edition" = "2024"; - }; - "ruff" = { - "includes" = [ - "*.py" - "*.pyi" - "*.ipynb" - ]; - "style" = "default"; - }; - "tofu" = { - "includes" = [ - "*.tf" - "*.tfvars" - "*.tftest.hcl" - ]; - }; - "shfmt" = { - "includes" = [ - "*.sh" - "*.bash" - "*.bats" - ]; - }; - "stylua" = { - "includes" = [ - "*.lua" - "*.luau" - ]; - }; - }; - }; -} diff --git a/nix/settings.nix b/nix/settings.nix deleted file mode 100644 index e4865e4..0000000 --- a/nix/settings.nix +++ /dev/null @@ -1,146 +0,0 @@ -# Formatter settings are serialized into immutable JSON/TOML files in the Nix store. -{ - "oxfmt" = { - "default" = { - "printWidth" = 80; - "sortImports" = { - "groups" = [ - "builtin" - "external" - "internal" - "parent" - "sibling" - "index" - ]; - "newlinesBetween" = true; - "ignoreCase" = true; - "order" = "asc"; - }; - }; - "generated" = { - "printWidth" = 80; - "sortImports" = false; - }; - "toolshed" = { - "ignorePatterns" = [ - "pnpm-lock.yaml" - "dist/" - "node_modules/" - ".agents/" - ".mise/locks/" - ]; - }; - }; - "prettier" = { - "infrastructure" = { - "overrides" = [ - { - "files" = [ - "*.yaml" - "*.yml" - ]; - "options" = { - "singleQuote" = true; - }; - } - ]; - }; - "default" = { - "tabWidth" = 2; - "useTabs" = false; - "printWidth" = 80; - "singleQuote" = false; - "semi" = true; - "trailingComma" = "all"; - "arrowParens" = "always"; - }; - "backend" = { - "overrides" = [ - { - "files" = [ - "*.graphql" - ]; - "options" = { - "tabWidth" = 2; - "useTabs" = false; - "printWidth" = 100; - }; - } - ]; - }; - "electron-updater" = { - "singleQuote" = false; - "semi" = false; - "arrowParens" = "avoid"; - "trailingComma" = "es5"; - "printWidth" = 180; - "quoteProps" = "as-needed"; - }; - }; - "rustfmt" = { - "default" = { - "unstable_features" = true; - "edition" = "2024"; - "single_line_if_else_max_width" = 80; - "group_imports" = "StdExternalCrate"; - "imports_granularity" = "Module"; - "error_on_line_overflow" = false; - "error_on_unformatted" = false; - }; - "proxy-backend" = { - "unstable_features" = true; - "edition" = "2024"; - "single_line_if_else_max_width" = 80; - "group_imports" = "StdExternalCrate"; - "imports_granularity" = "Module"; - "error_on_line_overflow" = false; - "error_on_unformatted" = false; - }; - "cogfer" = { - "single_line_if_else_max_width" = 80; - "group_imports" = "StdExternalCrate"; - "imports_granularity" = "Module"; - }; - "sqlite-rs" = { - "unstable_features" = true; - "group_imports" = "StdExternalCrate"; - "imports_granularity" = "Crate"; - "reorder_imports" = true; - }; - "student-backend" = { - "single_line_if_else_max_width" = 80; - "group_imports" = "StdExternalCrate"; - "imports_granularity" = "module"; - }; - "convert" = { - "group_imports" = "StdExternalCrate"; - }; - "cloud-backend" = { - "single_line_if_else_max_width" = 80; - "group_imports" = "StdExternalCrate"; - "imports_granularity" = "Module"; - }; - "sync-backend" = { - "single_line_if_else_max_width" = 80; - "group_imports" = "StdExternalCrate"; - "imports_granularity" = "module"; - }; - }; - "ruff" = { - "caido-private" = { - "line-length" = 88; - "target-version" = "py311"; - }; - "default" = { - "line-length" = 88; - "target-version" = "py312"; - }; - "analytics" = { - "line-length" = 88; - "target-version" = "py312"; - "extend-exclude" = [ - "apps/transform" - ]; - }; - }; -} diff --git a/support/rustfmt.py b/support/rustfmt.py new file mode 100644 index 0000000..790c604 --- /dev/null +++ b/support/rustfmt.py @@ -0,0 +1,63 @@ +"""Apply one Rust style while respecting Cargo's parser edition metadata.""" + +from collections import defaultdict +from pathlib import Path +import subprocess +import sys +import tomllib + + +def read_manifest(path): + return tomllib.loads(path.read_text()) + + +def edition_for(source): + for parent in Path(source).resolve().parents: + manifest = parent / "Cargo.toml" + if not manifest.is_file(): + continue + package = read_manifest(manifest).get("package") + if package is None: + continue + edition = package.get("edition", "2015") + if isinstance(edition, str): + return edition + if edition.get("workspace") is not True: + raise ValueError(f"Invalid edition in {manifest}") + roots = ( + [(parent / package["workspace"]).resolve()] + if "workspace" in package + else [parent, *parent.parents] + ) + for root in roots: + workspace_manifest = root / "Cargo.toml" + if workspace_manifest.is_file(): + workspace = read_manifest(workspace_manifest).get("workspace") + if workspace is not None: + inherited = workspace.get("package", {}).get("edition") + if not isinstance(inherited, str): + raise ValueError( + f"No workspace.package.edition in {workspace_manifest}" + ) + return inherited + raise ValueError(f"No workspace found for {manifest}") + return "2024" + + +def main(): + binary, settings, *files = sys.argv[1:] + groups = defaultdict(list) + for source in files: + groups[edition_for(source)].append(source) + for edition, sources in groups.items(): + result = subprocess.run( + [binary, "--config-path", settings, "--edition", edition, *sources], + check=False, + ) + if result.returncode: + return result.returncode + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/templates/default/flake.nix b/templates/default/flake.nix new file mode 100644 index 0000000..6bf9da8 --- /dev/null +++ b/templates/default/flake.nix @@ -0,0 +1,7 @@ +{ + inputs.caido-formatter.url = "git+ssh://git@github.com/caido/formatter"; + + outputs = + { self, caido-formatter, ... }: + caido-formatter.lib.forProject self; +} diff --git a/tests/test_config.py b/tests/test_config.py index 329f133..4142a71 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,234 +1,190 @@ -"""Integration tests for the actual Nix-packaged formatters and generated config.""" +"""Exercise the one shared configuration with real Nix-packaged formatters.""" -import json import os from pathlib import Path import subprocess -import sys import tempfile import tomllib import unittest -PACKAGES = json.loads(os.environ["CAIDO_TEST_CONFIGS"]) - - -class ConfigurationTests(unittest.TestCase): - def test_commands_and_companion_configs_are_in_the_store(self): - for name, package in PACKAGES.items(): - data = tomllib.loads(Path(package["config"]).read_text()) - with self.subTest(profile=name): - self.assertTrue(data["formatter"]) - for formatter in data["formatter"].values(): - command = formatter["command"] - self.assertTrue(command.startswith("/nix/store/"), command) - self.assertTrue(os.access(command, os.X_OK), command) - self.assertTrue(formatter["includes"]) - for argument in formatter.get("options", []): - self.assertNotIn("CAIDO_FORMATTER_ROOT", argument) - if argument.startswith("/nix/store/"): - self.assertTrue(Path(argument).exists(), argument) - - def test_default_avoids_competing_engines(self): - data = tomllib.loads(Path(PACKAGES["default"]["config"]).read_text()) - engines = set(data["formatter"]) - self.assertLessEqual(len(engines & {"oxfmt", "prettier", "deno"}), 1) - self.assertLessEqual(len(engines & {"ruff-format", "black"}), 1) - - def test_backend_and_python_settings_are_generated(self): - backend = tomllib.loads(Path(PACKAGES["proxy-backend"]["config"]).read_text()) - args = backend["formatter"]["prettier"]["options"] - settings = json.loads(Path(args[args.index("--config") + 1]).read_text()) - self.assertEqual(settings["overrides"][0]["options"]["printWidth"], 100) - private = tomllib.loads(Path(PACKAGES["caido-private"]["config"]).read_text()) - args = private["formatter"]["ruff-format"]["options"] - settings = tomllib.loads(Path(args[args.index("--config") + 1]).read_text()) - self.assertEqual(settings["target-version"], "py311") - - -class RoutingTests(unittest.TestCase): +PROGRAM = os.environ["CAIDO_FORMATTER"] +CONFIG = tomllib.loads(Path(os.environ["CAIDO_FORMATTER_CONFIG"]).read_text()) +SAMPLES = { + "src/example.ts": 'import z from "z";\nimport fs from "node:fs";\nexport const x={z,fs};', + "src/example.py": 'answer={"value":1+2}', + "src/example.rs": 'fn main(){println!("hello");}', + "infra/example.tf": 'locals { value="test" }', + "scripts/example.sh": '#!/bin/sh\ncase "$1" in value) echo "hello";; esac\nif true;then echo "hello";fi', + "src/example.lua": 'local answer={"hello",2,3}', + "example.nix": '{ value="test"; }', + "sql/example.sql": "select a,b from test_table where a=1;\n", + "src/example.vue": '', + "schema/example.graphql": "query Example{viewer{id name}}", +} + + +def write(root, name, content): + path = root / name + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(content) + return path + + +def run(root, *args, env=None): + return subprocess.run( + [ + PROGRAM, + "--tree-root", + str(root), + "--working-dir", + str(root), + "--walk", + "filesystem", + "--no-cache", + *args, + ], + cwd=root.parent, + env=dict(os.environ, XDG_CACHE_HOME=str(root.parent / "cache")) + if env is None + else env, + capture_output=True, + text=True, + ) + + +class SharedConfigurationTests(unittest.TestCase): def setUp(self): - self.temp = tempfile.TemporaryDirectory(prefix="caido formatter ") + self.temp = tempfile.TemporaryDirectory(prefix="shared formatter ") self.addCleanup(self.temp.cleanup) - self.project = Path(self.temp.name) / "project with spaces" - self.project.mkdir() - self.env = dict(os.environ, XDG_CACHE_HOME=str(Path(self.temp.name) / "cache")) - self.env.pop("CAIDO_FORMATTER_ROOT", None) - - def write(self, name, content="invalid code that must remain excluded"): - path = self.project / name - path.parent.mkdir(parents=True, exist_ok=True) - path.write_text(content) - return path - - def run_formatter(self, profile, *args): - return subprocess.run( - [ - PACKAGES[profile]["program"], - "--tree-root", - str(self.project), - "--working-dir", - str(self.project), - "--walk", - "filesystem", - "--no-cache", - *args, - ], - cwd=self.temp.name, - env=self.env, - capture_output=True, - text=True, - ) + self.root = Path(self.temp.name) / "checkout with spaces" + self.root.mkdir() def assert_success(self, result): self.assertEqual(result.returncode, 0, result.stdout + result.stderr) - def test_default_formats_six_languages_and_skips_generated_files(self): - samples = { - "src/a.ts": 'export const value={foo:"bar"}', - "src/a.rs": 'fn main(){println!("hello");}', - "src/a.py": "answer=1+2", - "tofu/a.tf": 'locals { value="test" }', - "scripts/a.sh": "#!/bin/sh\nif true;then echo ok;fi", - "lua/a.lua": "local answer={1,2,3}", - } - for name, content in samples.items(): - self.write(name, content) + def test_one_engine_per_language_and_store_paths(self): + self.assertEqual( + set(CONFIG["formatter"]), + { + "oxfmt", + "ruff-format", + "rustfmt", + "terraform", + "shfmt", + "stylua", + "nixfmt", + "sqlfluff", + }, + ) + for formatter in CONFIG["formatter"].values(): + self.assertTrue(formatter["command"].startswith("/nix/store/")) + self.assertTrue(os.access(formatter["command"], os.X_OK)) + self.assertTrue(formatter["includes"]) + + def test_all_languages_format_and_are_idempotent(self): + for name, content in SAMPLES.items(): + write(self.root, name, content) + self.assert_success(run(self.root)) + for name, before in SAMPLES.items(): + self.assertNotEqual((self.root / name).read_text(), before, name) + self.assert_success(run(self.root, "--ci")) + + def test_two_repositories_use_identical_settings_despite_local_configs(self): + other = Path(self.temp.name) / "another checkout" + other.mkdir() + for root in [self.root, other]: + for name, content in SAMPLES.items(): + write(root, name, content) + write(other, ".oxfmtrc.json", '{"singleQuote":true,"tabWidth":7}') + write(other, "src/.oxfmtrc.json", '{"semi":false,"printWidth":180}') + write(other, ".prettierignore", "src/example.ts\n") + write( + other, + ".editorconfig", + "root=true\n[*]\nindent_size=7\nindent_style=tab\n" + "binary_next_line=true\nswitch_case_indent=true\nspace_redirects=true\n", + ) + write(other, "pyproject.toml", '[tool.ruff.format]\nquote-style="single"\n') + write(other, "rustfmt.toml", "hard_tabs=true\n") + write(other, "stylua.toml", 'quote_style="ForceSingle"\nindent_type="Tabs"\n') + write(other, ".styluaignore", "src/example.lua\n") + write(other, ".sqlfluff", "[sqlfluff]\ndialect=sqlite\nmax_line_length=180\n") + write(other, ".sqlfluffignore", "sql/example.sql\n") + self.assert_success(run(self.root, *SAMPLES)) + self.assert_success(run(other, *SAMPLES)) + for name in SAMPLES: + self.assertEqual( + (self.root / name).read_bytes(), (other / name).read_bytes(), name + ) + + def test_generic_dependency_and_generated_exclusions(self): ignored = [ - self.write("node_modules/a.ts"), - self.write("src/__generated__/a.ts"), - self.write(".formatter/config.json"), + write(self.root, name, "invalid code") + for name in [ + "node_modules/broken.ts", + "src/__generated__/broken.ts", + ".venv/broken.py", + "dist/broken.lua", + ] ] - self.assert_success(self.run_formatter("default")) - for name, content in samples.items(): - formatted = (self.project / name).read_text() - self.assertNotEqual(formatted, content, name) + write(self.root, "any/directory/valid.ts", "export const x={a:1}") + self.assert_success(run(self.root)) for path in ignored: - self.assertEqual(path.read_text(), "invalid code that must remain excluded") - self.assert_success(self.run_formatter("default", "--ci")) - - def test_backend_preserves_macro_exclusion(self): - self.write("schema.graphql", "query Example{viewer{id name}}") - self.write("src/a.rs", "fn main(){let value=1;}") - ignored = self.write("proxy-tests/tests/common/macros/a.rs") - self.assert_success(self.run_formatter("proxy-backend")) - self.assertEqual(ignored.read_text(), "invalid code that must remain excluded") - self.assert_success(self.run_formatter("proxy-backend", "--ci")) - - def test_rustfmt_does_not_recurse_into_unselected_children(self): - self.write("src/lib.rs", "mod child;\npub fn main(){let value=1;}") - child = self.write("src/child.rs", "pub fn child(){let answer=42;}") + self.assertEqual(path.read_text(), "invalid code") + + def test_rust_editions_are_metadata_and_share_one_style(self): + for name, edition in [("older", "2021"), ("newer", "2024")]: + write( + self.root, + f"{name}/Cargo.toml", + f'[package]\nname="{name}"\nversion="0.1.0"\nedition="{edition}"\n', + ) + write(self.root, f"{name}/src/lib.rs", "pub fn value()->u32{42}") + self.assert_success(run(self.root)) + self.assertEqual( + (self.root / "older/src/lib.rs").read_bytes(), + (self.root / "newer/src/lib.rs").read_bytes(), + ) + write(self.root, "older/src/lib.rs", "pub fn gen()->u32{42}") + self.assert_success(run(self.root)) + + def test_workspace_edition_inheritance(self): + write( + self.root, + "Cargo.toml", + '[workspace]\nmembers=["member"]\n[workspace.package]\nedition="2021"\n', + ) + write( + self.root, + "member/Cargo.toml", + '[package]\nname="member"\nversion="0.1.0"\nedition.workspace=true\n', + ) + write(self.root, "member/src/lib.rs", "pub fn gen()->u32{42}") + self.assert_success(run(self.root)) + + def test_rustfmt_does_not_touch_unselected_children(self): + write(self.root, "src/lib.rs", "mod child;\npub fn value()->u32{42}") + child = write(self.root, "src/child.rs", "pub fn child(){let value=1;}") before = child.read_text() - self.assert_success(self.run_formatter("proxy-backend", "src/lib.rs")) + self.assert_success(run(self.root, "src/lib.rs")) self.assertEqual(child.read_text(), before) - def test_frontend_keeps_source_scopes_and_sorts_imports(self): - source = self.write( - "packages/ui/src/main.ts", - 'import z from "z";\nimport fs from "node:fs";\nexport const x={z,fs};', - ) - self.write("packages/ui/src/main.vue", "") - ignored = [ - self.write("packages/ui/src/@types/modules/vue-router.d.ts"), - self.write("unrelated/example.ts"), - ] - self.assert_success(self.run_formatter("proxy-frontend")) - self.assertTrue(source.read_text().startswith('import fs from "node:fs";')) - for path in ignored: - self.assertEqual(path.read_text(), "invalid code that must remain excluded") - - def test_analytics_excludes_dbt_and_private_limits_source_scopes(self): - self.write("apps/event_consumer/src/a.py", "answer=1+2") - ignored = self.write("apps/transform/a.py") - self.assert_success(self.run_formatter("analytics")) - self.assertEqual(ignored.read_text(), "invalid code that must remain excluded") - self.write("scripts/a.py", "answer=1+2") - self.write("tests/a.py", "answer=1+2") - outside = self.write("outside/a.py") - self.assert_success(self.run_formatter("caido-private")) - self.assertEqual(outside.read_text(), "invalid code that must remain excluded") - - def test_infrastructure_formats_multiple_files(self): - for name in ["a.tf", "nested/b.tf"]: - self.write("tofu/" + name, 'locals { value="test" }') - self.assert_success(self.run_formatter("infrastructure")) - self.assert_success(self.run_formatter("infrastructure", "--ci")) - - def test_ci_reports_change_then_succeeds_after_formatting(self): - source = self.write("packages/ui/src/a.ts", "export const a={b:1}") + def test_ci_failure_is_detected_formatting_changes(self): + source = write(self.root, "any/path/example.ts", "export const x={a:1}") before = source.read_text() - first = self.run_formatter("proxy-frontend", "--ci") + first = run(self.root, "--ci") self.assertNotEqual(first.returncode, 0) - self.assertIn( - "unexpected changes detected, --fail-on-change is enabled", - first.stdout + first.stderr, - ) + self.assertIn("--fail-on-change is enabled", first.stdout + first.stderr) self.assertNotEqual(source.read_text(), before) - self.assert_success(self.run_formatter("proxy-frontend", "--ci")) - - def test_packaged_tools_do_not_use_ambient_path(self): - self.write("schema.graphql", "query Example{viewer{id name}}") - self.write("src/a.rs", "fn main(){let answer=42;}") - poison = Path(self.temp.name) / "broken host tools" - poison.mkdir() - for name in ["rustup", "rustfmt", "prettier", "sh", "treefmt"]: - path = poison / name - path.write_text("#!/bin/sh\nexit 99\n") - path.chmod(0o755) - self.env["PATH"] = str(poison) - self.assert_success(self.run_formatter("proxy-backend")) - - -class LauncherTests(unittest.TestCase): - def test_explicit_root_and_arguments_are_forwarded_without_installing_host_tools( - self, - ): - with tempfile.TemporaryDirectory(prefix="caido launcher ") as temp: - temp = Path(temp) - target = temp / "project with spaces" - target.mkdir() - binary_dir = temp / "bin" - binary_dir.mkdir() - capture = temp / "arguments.json" - fake_nix = binary_dir / "nix" - fake_nix.write_text( - f"#!{sys.executable}\n" - "import json, os, sys\n" - "from pathlib import Path\n" - "Path(os.environ['CAPTURE_ARGS']).write_text(json.dumps(sys.argv[1:]))\n" - ) - fake_nix.chmod(0o755) - env = dict( - os.environ, - PATH=str(binary_dir) + os.pathsep + os.environ["PATH"], - CAPTURE_ARGS=str(capture), - ) - launcher = Path(os.environ["CAIDO_TEST_SOURCE"]) / "bin/format" - result = subprocess.run( - [ - os.environ["CAIDO_TEST_SHELL"], - str(launcher), - "proxy-frontend", - "--root", - str(target), - "--ci", - "packages/ui/src/file with spaces.ts", - ], - cwd=temp, - env=env, - capture_output=True, - text=True, - ) - self.assertEqual(result.returncode, 0, result.stderr) - args = json.loads(capture.read_text()) - self.assertIn("run", args) - self.assertEqual(args[args.index("run") + 1], "--no-update-lock-file") - self.assertTrue(args[args.index("run") + 2].endswith("#proxy-frontend")) - self.assertEqual(args[args.index("--tree-root") + 1], str(target.resolve())) - self.assertEqual( - args[args.index("--working-dir") + 1], str(target.resolve()) - ) - self.assertEqual(args[-2:], ["--ci", "packages/ui/src/file with spaces.ts"]) + self.assert_success(run(self.root, "--ci")) + + def test_runtime_does_not_depend_on_host_formatters(self): + write(self.root, "src/example.ts", "export const x={a:1}") + write(self.root, "src/example.rs", "fn main(){let value=1;}") + empty_path = Path(self.temp.name) / "no host tools" + empty_path.mkdir() + self.assert_success(run(self.root, env=dict(os.environ, PATH=str(empty_path)))) if __name__ == "__main__": diff --git a/treefmt.nix b/treefmt.nix index 63279e6..8f12fa8 100644 --- a/treefmt.nix +++ b/treefmt.nix @@ -1,104 +1,151 @@ -{ - config, - lib, - pkgs, - ... -}: +{ pkgs, ... }: let - profiles = import ./nix/profiles.nix; - styles = import ./nix/settings.nix; - profile = profiles.${config.caido.profile}; - routes = profile.formatters; - route = name: routes.${name} or { }; - style = family: styles.${family}.${(route family).style or "default"}; json = pkgs.formats.json { }; toml = pkgs.formats.toml { }; - - # The names used by treefmt-nix for the audited Ruff and OpenTofu entries. - programName = - name: - { - ruff = "ruff-format"; - tofu = "terraform"; - } - .${name} or name; - nativeRoutes = lib.filterAttrs (name: _: name != "oxfmt-root") routes; - # Respect downstream mkForce enable/disable overrides as well as the preset. - enabled = name: config.programs.${programName name}.enable or false; + rustfmt = pkgs.rust-bin.nightly."2026-04-06".minimal.override { + extensions = [ "rustfmt" ]; + }; + rustSettings = toml.generate "caido-rustfmt.toml" { + unstable_features = true; + style_edition = "2024"; + group_imports = "StdExternalCrate"; + imports_granularity = "Module"; + single_line_if_else_max_width = 80; + skip_children = true; + }; + # Cargo's language edition is parser metadata, not a formatting preset. + # Every crate uses the same rustfmt binary and the same style settings. + rustCommand = pkgs.writeShellScriptBin "caido-rustfmt" '' + exec ${pkgs.python3}/bin/python3 ${./support/rustfmt.py} \ + ${rustfmt}/bin/rustfmt ${rustSettings} "$@" + ''; + sqlSettings = (pkgs.formats.ini { }).generate "caido-sqlfluff.cfg" { + sqlfluff = { + dialect = "postgres"; + max_line_length = 80; + }; + }; in { - options.caido.profile = lib.mkOption { - type = lib.types.enum (builtins.attrNames profiles); - default = "default"; - description = "Audited Caido formatter profile to use."; - }; + projectRootFile = null; + settings.on-unmatched = "debug"; + settings.excludes = [ + ".git/*" + "node_modules/*" + "*/node_modules/*" + "dist/*" + "*/dist/*" + "target/*" + "*/target/*" + "coverage/*" + "*/coverage/*" + ".venv/*" + "*/.venv/*" + ".terraform/*" + "*/.terraform/*" + "**/__generated__/**" + "*.min.js" + "*.min.css" + "result" + "result-*" + ]; - config = { - # Keep Git/worktree root detection in treefmt itself. In particular, do not - # anchor a packaged formatter to the formatter repository's flake.nix. - projectRootFile = null; - enableDefaultExcludes = false; - settings.on-unmatched = "debug"; - settings.excludes = - import ./nix/excludes.nix - ++ (profile.excludes or [ ]) - ++ [ - "result" - "result-*" + programs = { + oxfmt.enable = true; + ruff-format = { + enable = true; + includes = [ + "*.py" + "*.pyi" + "*.ipynb" ]; + }; + terraform.enable = true; + shfmt = { + enable = true; + indent_size = 2; + simplify = false; + includes = [ + "*.sh" + "*.bash" + "*.bats" + "*.envrc" + ]; + }; + stylua = { + enable = true; + includes = [ + "*.lua" + "*.luau" + ]; + settings = { + column_width = 80; + line_endings = "Unix"; + indent_type = "Spaces"; + indent_width = 2; + quote_style = "AutoPreferDouble"; + call_parentheses = "Always"; + collapse_simple_statement = "Never"; + sort_requires.enabled = false; + }; + }; + nixfmt.enable = true; + sqlfluff = { + enable = true; + dialect = "postgres"; + }; + }; - programs = lib.mkMerge [ - (lib.mapAttrs' ( - name: value: - lib.nameValuePair (programName name) { - enable = true; - includes = value.includes; - excludes = value.excludes or [ ]; + settings.formatter = { + oxfmt.options = [ + "--write" + "--config" + (toString ( + json.generate "caido-oxfmt.json" { + printWidth = 80; + tabWidth = 2; + useTabs = false; + semi = true; + singleQuote = false; + trailingComma = "all"; + endOfLine = "lf"; + sortImports = { + groups = [ + "builtin" + "external" + "internal" + "parent" + "sibling" + "index" + ]; + newlinesBetween = true; + ignoreCase = true; + order = "asc"; + }; } - ) nativeRoutes) - { - prettier.settings = style "prettier"; - rustfmt.edition = (route "rustfmt").edition or "2024"; - # Preserve the previous `shfmt -w` behavior; treefmt-nix otherwise adds - # two-space indentation and simplification by default. - shfmt.useEditorConfig = true; - sqlfluff.dialect = "postgres"; - } + )) + "--disable-nested-config" + "--ignore-path" + (toString (pkgs.writeText "caido-oxfmt-ignore" "")) ]; - - settings.formatter = lib.mkMerge [ - (lib.mkIf (enabled "oxfmt") { - oxfmt.options = [ - "--write" - "--config" - (toString (json.generate "caido-oxfmt.json" (style "oxfmt"))) - ]; - }) - (lib.mkIf (routes ? oxfmt-root && enabled "oxfmt") { - # A separate root-only entry prevents *.ts from matching unrelated - # subdirectories while retaining the frontend's source scopes. - oxfmt-root = { - command = lib.getExe config.programs.oxfmt.package; - options = config.settings.formatter.oxfmt.options; - inherit (routes.oxfmt-root) includes excludes; - }; - }) - (lib.mkIf (enabled "prettier") { - prettier.options = [ "--no-editorconfig" ]; - }) - (lib.mkIf (enabled "rustfmt") { - rustfmt.options = [ - "--config-path" - (toString (toml.generate "caido-rustfmt.toml" (style "rustfmt"))) - ]; - }) - (lib.mkIf (enabled "ruff") { - ruff-format.options = [ - "--force-exclude" - "--config" - (toString (toml.generate "caido-ruff.toml" (style "ruff"))) - ]; - }) + ruff-format.options = [ + "--config" + (toString ( + toml.generate "caido-ruff.toml" { + line-length = 88; + target-version = "py311"; + } + )) + ]; + rustfmt = { + command = rustCommand; + includes = [ "*.rs" ]; + }; + sqlfluff.options = [ + "--ignore-local-config" + "--disregard-sqlfluffignores" + "--config" + (toString sqlSettings) ]; }; } From 03d8b411305b23cad87e93d497c66b9719c2e35b Mon Sep 17 00:00:00 2001 From: Christopher Guay Date: Mon, 9 Nov 2026 14:47:01 -0500 Subject: [PATCH 04/10] Pin checkout v6 and disable persisted credentials --- examples/github-actions.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/github-actions.yml b/examples/github-actions.yml index f3d95ab..d91124d 100644 --- a/examples/github-actions.yml +++ b/examples/github-actions.yml @@ -13,7 +13,9 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 30 steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31 with: github_access_token: ${{ secrets.GITHUB_TOKEN }} From 5b8c1fa2da10588fa3047431a737fbca1322fbd2 Mon Sep 17 00:00:00 2001 From: Christopher Guay Date: Mon, 9 Nov 2026 14:50:15 -0500 Subject: [PATCH 05/10] Require Rust 2024 and remove rustfmt edition adapter --- README.md | 2 +- support/rustfmt.py | 63 -------------------------------------------- tests/test_config.py | 32 +--------------------- treefmt.nix | 13 +++++---- 4 files changed, 8 insertions(+), 102 deletions(-) delete mode 100644 support/rustfmt.py diff --git a/README.md b/README.md index b744912..972b717 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ All formatting policy lives in **`treefmt.nix`**: There is one set of language globs and generic dependency/generated-file exclusions. Existing per-repository formatter config files do not select alternate formatting settings. Prettier, Deno and Black are not alternative engines in this setup. -Rust's Cargo edition is read automatically so 2015/2018/2021/2024 crates can use the same formatter and shared 2024 style. This is parser metadata from `Cargo.toml`, not a project-specific formatting configuration. Standalone Rust files use edition 2024. Python formatting targets Python 3.11 compatibility everywhere. +All Rust files use edition 2024 and the shared 2024 style. Projects must update their `Cargo.toml` edition and migrate any incompatible code before adopting the shared formatter. Python formatting targets Python 3.11 compatibility everywhere. Nix generates the tool configuration files and the treefmt TOML in the Nix store. Nixpkgs and rust-overlay are pinned in `flake.lock`, so formatter binaries do not come from a project's PATH. Update the shared input's lockfile pin to roll out a new version of this configuration. diff --git a/support/rustfmt.py b/support/rustfmt.py deleted file mode 100644 index 790c604..0000000 --- a/support/rustfmt.py +++ /dev/null @@ -1,63 +0,0 @@ -"""Apply one Rust style while respecting Cargo's parser edition metadata.""" - -from collections import defaultdict -from pathlib import Path -import subprocess -import sys -import tomllib - - -def read_manifest(path): - return tomllib.loads(path.read_text()) - - -def edition_for(source): - for parent in Path(source).resolve().parents: - manifest = parent / "Cargo.toml" - if not manifest.is_file(): - continue - package = read_manifest(manifest).get("package") - if package is None: - continue - edition = package.get("edition", "2015") - if isinstance(edition, str): - return edition - if edition.get("workspace") is not True: - raise ValueError(f"Invalid edition in {manifest}") - roots = ( - [(parent / package["workspace"]).resolve()] - if "workspace" in package - else [parent, *parent.parents] - ) - for root in roots: - workspace_manifest = root / "Cargo.toml" - if workspace_manifest.is_file(): - workspace = read_manifest(workspace_manifest).get("workspace") - if workspace is not None: - inherited = workspace.get("package", {}).get("edition") - if not isinstance(inherited, str): - raise ValueError( - f"No workspace.package.edition in {workspace_manifest}" - ) - return inherited - raise ValueError(f"No workspace found for {manifest}") - return "2024" - - -def main(): - binary, settings, *files = sys.argv[1:] - groups = defaultdict(list) - for source in files: - groups[edition_for(source)].append(source) - for edition, sources in groups.items(): - result = subprocess.run( - [binary, "--config-path", settings, "--edition", edition, *sources], - check=False, - ) - if result.returncode: - return result.returncode - return 0 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/tests/test_config.py b/tests/test_config.py index 4142a71..ab5aa7d 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -13,7 +13,7 @@ SAMPLES = { "src/example.ts": 'import z from "z";\nimport fs from "node:fs";\nexport const x={z,fs};', "src/example.py": 'answer={"value":1+2}', - "src/example.rs": 'fn main(){println!("hello");}', + "src/example.rs": 'async fn example(){println!("hello");}', "infra/example.tf": 'locals { value="test" }', "scripts/example.sh": '#!/bin/sh\ncase "$1" in value) echo "hello";; esac\nif true;then echo "hello";fi', "src/example.lua": 'local answer={"hello",2,3}', @@ -133,36 +133,6 @@ def test_generic_dependency_and_generated_exclusions(self): for path in ignored: self.assertEqual(path.read_text(), "invalid code") - def test_rust_editions_are_metadata_and_share_one_style(self): - for name, edition in [("older", "2021"), ("newer", "2024")]: - write( - self.root, - f"{name}/Cargo.toml", - f'[package]\nname="{name}"\nversion="0.1.0"\nedition="{edition}"\n', - ) - write(self.root, f"{name}/src/lib.rs", "pub fn value()->u32{42}") - self.assert_success(run(self.root)) - self.assertEqual( - (self.root / "older/src/lib.rs").read_bytes(), - (self.root / "newer/src/lib.rs").read_bytes(), - ) - write(self.root, "older/src/lib.rs", "pub fn gen()->u32{42}") - self.assert_success(run(self.root)) - - def test_workspace_edition_inheritance(self): - write( - self.root, - "Cargo.toml", - '[workspace]\nmembers=["member"]\n[workspace.package]\nedition="2021"\n', - ) - write( - self.root, - "member/Cargo.toml", - '[package]\nname="member"\nversion="0.1.0"\nedition.workspace=true\n', - ) - write(self.root, "member/src/lib.rs", "pub fn gen()->u32{42}") - self.assert_success(run(self.root)) - def test_rustfmt_does_not_touch_unselected_children(self): write(self.root, "src/lib.rs", "mod child;\npub fn value()->u32{42}") child = write(self.root, "src/child.rs", "pub fn child(){let value=1;}") diff --git a/treefmt.nix b/treefmt.nix index 8f12fa8..285c780 100644 --- a/treefmt.nix +++ b/treefmt.nix @@ -7,18 +7,13 @@ let }; rustSettings = toml.generate "caido-rustfmt.toml" { unstable_features = true; + edition = "2024"; style_edition = "2024"; group_imports = "StdExternalCrate"; imports_granularity = "Module"; single_line_if_else_max_width = 80; skip_children = true; }; - # Cargo's language edition is parser metadata, not a formatting preset. - # Every crate uses the same rustfmt binary and the same style settings. - rustCommand = pkgs.writeShellScriptBin "caido-rustfmt" '' - exec ${pkgs.python3}/bin/python3 ${./support/rustfmt.py} \ - ${rustfmt}/bin/rustfmt ${rustSettings} "$@" - ''; sqlSettings = (pkgs.formats.ini { }).generate "caido-sqlfluff.cfg" { sqlfluff = { dialect = "postgres"; @@ -138,8 +133,12 @@ in )) ]; rustfmt = { - command = rustCommand; + command = "${rustfmt}/bin/rustfmt"; includes = [ "*.rs" ]; + options = [ + "--config-path" + (toString rustSettings) + ]; }; sqlfluff.options = [ "--ignore-local-config" From d6cd419d8da27f8aa3bcea2af895f131c7fffc5e Mon Sep 17 00:00:00 2001 From: Christopher Guay Date: Mon, 9 Nov 2026 14:57:31 -0500 Subject: [PATCH 06/10] Rely on treefmt-nix validation instead of custom integration tests --- README.md | 8 +- .../0001-evaluate-treefmt-nix-in-formatter.md | 2 +- flake.nix | 17 -- tests/test_config.py | 161 ------------------ 4 files changed, 6 insertions(+), 182 deletions(-) delete mode 100644 tests/test_config.py diff --git a/README.md b/README.md index 972b717..041af7b 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ nix fmt nix flake check ``` -The shared helper checks **your repository's source**. It exports only a `formatting` check and a `formatting-check` package. It does not import the formatter library's tests or check the library's own source instead of yours. An existing flake can merge these outputs with its other outputs; no formatter-specific settings are required. +The shared helper checks **your repository's source**. It exports only a `formatting` check and a `formatting-check` package. It checks the consuming repository rather than the library's source. An existing flake can merge these outputs with its other outputs; no formatter-specific settings are required. `nix flake check` runs all entries under `checks`; it has no check-name filter. If your flake adds other checks, run formatting alone with: @@ -55,13 +55,15 @@ Nix generates the tool configuration files and the treefmt TOML in the Nix store ## Develop this library +Configuration validation uses treefmt-nix’s module option types and config generation. Formatter-specific settings passed through as data or arguments may still be rejected at runtime; there is no custom formatter test suite. + ```sh # Same formatter and formatting-only check used by every consumer. nix fmt --no-update-lock-file nix flake check --no-update-lock-file -# Library integration tests are explicit, never part of flake check. -nix build --no-link --no-update-lock-file .#tests +# Evaluate module options and flake outputs on all supported systems without running checks. +nix flake check --all-systems --no-build --no-update-lock-file # Inspect the generated shared treefmt configuration. cat "$(nix build --no-link --print-out-paths .#config)" diff --git a/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md b/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md index b87ccd9..6289861 100644 --- a/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md +++ b/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md @@ -14,7 +14,7 @@ This repository was created to explore shared treefmt configuration for Caido. T Use a locked Nix flake and one shared treefmt-nix configuration in `caido/formatter`. Every repository uses the same formatter per language, the same settings and the same package versions. Remove the project presets, local style variants and profile launcher. -Repositories use the identical `lib.forProject self` flake wiring to expose `nix fmt` and a formatting-only `nix flake check`. Library integration tests are an explicitly built package, not flake checks exported to consumers. The requested interface is Nix only, with no separate task layer. +Repositories use the identical `lib.forProject self` flake wiring to expose `nix fmt` and a formatting-only `nix flake check`. Use treefmt-nix’s module evaluation and standard formatting check without a custom test suite. The requested interface is Nix only, with no separate task layer. Keep this experiment confined to the shared formatter repository. Do not change the approved tooling standard or migrate consuming repositories as part of this PR. Maintainer acceptance of this proposal and its scoped exception is required before adopting it beyond the experiment. diff --git a/flake.nix b/flake.nix index 4f966ac..2ce5df0 100644 --- a/flake.nix +++ b/flake.nix @@ -56,27 +56,10 @@ packages = eachSystem ( system: - let - pkgs = pkgsFor system; - in project.packages.${system} // { default = wrappers.${system}; config = evaluated.${system}.config.build.configFile; - # These are this library's own tests, never exported as flake checks - # or included in a consuming project's formatting check. - tests = - assert builtins.attrNames project.checks.${system} == [ "formatting" ]; - pkgs.runCommand "caido-formatter-tests" - { - nativeBuildInputs = [ pkgs.python3 ]; - CAIDO_FORMATTER = "${wrappers.${system}}/bin/treefmt"; - CAIDO_FORMATTER_CONFIG = toString evaluated.${system}.config.build.configFile; - } - '' - python3 ${./tests/test_config.py} - touch "$out" - ''; } ); diff --git a/tests/test_config.py b/tests/test_config.py deleted file mode 100644 index ab5aa7d..0000000 --- a/tests/test_config.py +++ /dev/null @@ -1,161 +0,0 @@ -"""Exercise the one shared configuration with real Nix-packaged formatters.""" - -import os -from pathlib import Path -import subprocess -import tempfile -import tomllib -import unittest - - -PROGRAM = os.environ["CAIDO_FORMATTER"] -CONFIG = tomllib.loads(Path(os.environ["CAIDO_FORMATTER_CONFIG"]).read_text()) -SAMPLES = { - "src/example.ts": 'import z from "z";\nimport fs from "node:fs";\nexport const x={z,fs};', - "src/example.py": 'answer={"value":1+2}', - "src/example.rs": 'async fn example(){println!("hello");}', - "infra/example.tf": 'locals { value="test" }', - "scripts/example.sh": '#!/bin/sh\ncase "$1" in value) echo "hello";; esac\nif true;then echo "hello";fi', - "src/example.lua": 'local answer={"hello",2,3}', - "example.nix": '{ value="test"; }', - "sql/example.sql": "select a,b from test_table where a=1;\n", - "src/example.vue": '', - "schema/example.graphql": "query Example{viewer{id name}}", -} - - -def write(root, name, content): - path = root / name - path.parent.mkdir(parents=True, exist_ok=True) - path.write_text(content) - return path - - -def run(root, *args, env=None): - return subprocess.run( - [ - PROGRAM, - "--tree-root", - str(root), - "--working-dir", - str(root), - "--walk", - "filesystem", - "--no-cache", - *args, - ], - cwd=root.parent, - env=dict(os.environ, XDG_CACHE_HOME=str(root.parent / "cache")) - if env is None - else env, - capture_output=True, - text=True, - ) - - -class SharedConfigurationTests(unittest.TestCase): - def setUp(self): - self.temp = tempfile.TemporaryDirectory(prefix="shared formatter ") - self.addCleanup(self.temp.cleanup) - self.root = Path(self.temp.name) / "checkout with spaces" - self.root.mkdir() - - def assert_success(self, result): - self.assertEqual(result.returncode, 0, result.stdout + result.stderr) - - def test_one_engine_per_language_and_store_paths(self): - self.assertEqual( - set(CONFIG["formatter"]), - { - "oxfmt", - "ruff-format", - "rustfmt", - "terraform", - "shfmt", - "stylua", - "nixfmt", - "sqlfluff", - }, - ) - for formatter in CONFIG["formatter"].values(): - self.assertTrue(formatter["command"].startswith("/nix/store/")) - self.assertTrue(os.access(formatter["command"], os.X_OK)) - self.assertTrue(formatter["includes"]) - - def test_all_languages_format_and_are_idempotent(self): - for name, content in SAMPLES.items(): - write(self.root, name, content) - self.assert_success(run(self.root)) - for name, before in SAMPLES.items(): - self.assertNotEqual((self.root / name).read_text(), before, name) - self.assert_success(run(self.root, "--ci")) - - def test_two_repositories_use_identical_settings_despite_local_configs(self): - other = Path(self.temp.name) / "another checkout" - other.mkdir() - for root in [self.root, other]: - for name, content in SAMPLES.items(): - write(root, name, content) - write(other, ".oxfmtrc.json", '{"singleQuote":true,"tabWidth":7}') - write(other, "src/.oxfmtrc.json", '{"semi":false,"printWidth":180}') - write(other, ".prettierignore", "src/example.ts\n") - write( - other, - ".editorconfig", - "root=true\n[*]\nindent_size=7\nindent_style=tab\n" - "binary_next_line=true\nswitch_case_indent=true\nspace_redirects=true\n", - ) - write(other, "pyproject.toml", '[tool.ruff.format]\nquote-style="single"\n') - write(other, "rustfmt.toml", "hard_tabs=true\n") - write(other, "stylua.toml", 'quote_style="ForceSingle"\nindent_type="Tabs"\n') - write(other, ".styluaignore", "src/example.lua\n") - write(other, ".sqlfluff", "[sqlfluff]\ndialect=sqlite\nmax_line_length=180\n") - write(other, ".sqlfluffignore", "sql/example.sql\n") - self.assert_success(run(self.root, *SAMPLES)) - self.assert_success(run(other, *SAMPLES)) - for name in SAMPLES: - self.assertEqual( - (self.root / name).read_bytes(), (other / name).read_bytes(), name - ) - - def test_generic_dependency_and_generated_exclusions(self): - ignored = [ - write(self.root, name, "invalid code") - for name in [ - "node_modules/broken.ts", - "src/__generated__/broken.ts", - ".venv/broken.py", - "dist/broken.lua", - ] - ] - write(self.root, "any/directory/valid.ts", "export const x={a:1}") - self.assert_success(run(self.root)) - for path in ignored: - self.assertEqual(path.read_text(), "invalid code") - - def test_rustfmt_does_not_touch_unselected_children(self): - write(self.root, "src/lib.rs", "mod child;\npub fn value()->u32{42}") - child = write(self.root, "src/child.rs", "pub fn child(){let value=1;}") - before = child.read_text() - self.assert_success(run(self.root, "src/lib.rs")) - self.assertEqual(child.read_text(), before) - - def test_ci_failure_is_detected_formatting_changes(self): - source = write(self.root, "any/path/example.ts", "export const x={a:1}") - before = source.read_text() - first = run(self.root, "--ci") - self.assertNotEqual(first.returncode, 0) - self.assertIn("--fail-on-change is enabled", first.stdout + first.stderr) - self.assertNotEqual(source.read_text(), before) - self.assert_success(run(self.root, "--ci")) - - def test_runtime_does_not_depend_on_host_formatters(self): - write(self.root, "src/example.ts", "export const x={a:1}") - write(self.root, "src/example.rs", "fn main(){let value=1;}") - empty_path = Path(self.temp.name) / "no host tools" - empty_path.mkdir() - self.assert_success(run(self.root, env=dict(os.environ, PATH=str(empty_path)))) - - -if __name__ == "__main__": - unittest.main() From b992ab29ee004fd10aeec6547361adb628ca8bec Mon Sep 17 00:00:00 2001 From: Christopher Guay Date: Mon, 9 Nov 2026 15:06:45 -0500 Subject: [PATCH 07/10] Keep shared formatter settings in native config files --- README.md | 19 +++++- configs/oxfmt.json | 15 +++++ configs/ruff.toml | 2 + configs/rustfmt.toml | 7 ++ configs/sqlfluff.ini | 3 + configs/stylua.toml | 10 +++ .../0001-evaluate-treefmt-nix-in-formatter.md | 2 +- treefmt.nix | 65 ++----------------- 8 files changed, 61 insertions(+), 62 deletions(-) create mode 100644 configs/oxfmt.json create mode 100644 configs/ruff.toml create mode 100644 configs/rustfmt.toml create mode 100644 configs/sqlfluff.ini create mode 100644 configs/stylua.toml diff --git a/README.md b/README.md index 041af7b..3b5591d 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,20 @@ This check formats a disposable source copy and leaves your working tree unchang ## The shared configuration -All formatting policy lives in **`treefmt.nix`**: +`treefmt.nix` selects formatter packages, file patterns and generic exclusions. Formatter-specific settings live in their native files: + +```text +configs/ + oxfmt.json + ruff.toml + rustfmt.toml + stylua.toml + sqlfluff.ini +``` + +Shell flags stay in `treefmt.nix`; nixfmt and OpenTofu use their defaults. Every consuming repository shares these same files. + +The language mapping is: | Files | Formatter | | --------------------------------------------------------------------- | ---------------------------- | @@ -51,11 +64,11 @@ There is one set of language globs and generic dependency/generated-file exclusi All Rust files use edition 2024 and the shared 2024 style. Projects must update their `Cargo.toml` edition and migrate any incompatible code before adopting the shared formatter. Python formatting targets Python 3.11 compatibility everywhere. -Nix generates the tool configuration files and the treefmt TOML in the Nix store. Nixpkgs and rust-overlay are pinned in `flake.lock`, so formatter binaries do not come from a project's PATH. Update the shared input's lockfile pin to roll out a new version of this configuration. +Nix parses the JSON/TOML settings during evaluation and generates the tool configuration files and treefmt TOML in the Nix store. SQLFluff uses the shared INI file directly from the store. Nixpkgs and rust-overlay are pinned in `flake.lock`, so formatter binaries do not come from a project's PATH. Update the shared input's lockfile pin to roll out a new version of this configuration. ## Develop this library -Configuration validation uses treefmt-nix’s module option types and config generation. Formatter-specific settings passed through as data or arguments may still be rejected at runtime; there is no custom formatter test suite. +Configuration validation uses JSON/TOML parsing, treefmt-nix’s module option types and config generation. The SQLFluff INI file is passed through without Nix-side parsing. Formatter-specific settings passed through as data or arguments may still be rejected at runtime; there is no custom formatter test suite. ```sh # Same formatter and formatting-only check used by every consumer. diff --git a/configs/oxfmt.json b/configs/oxfmt.json new file mode 100644 index 0000000..a645a5c --- /dev/null +++ b/configs/oxfmt.json @@ -0,0 +1,15 @@ +{ + "printWidth": 80, + "tabWidth": 2, + "useTabs": false, + "semi": true, + "singleQuote": false, + "trailingComma": "all", + "endOfLine": "lf", + "sortImports": { + "groups": ["builtin", "external", "internal", "parent", "sibling", "index"], + "newlinesBetween": true, + "ignoreCase": true, + "order": "asc" + } +} diff --git a/configs/ruff.toml b/configs/ruff.toml new file mode 100644 index 0000000..1d748e3 --- /dev/null +++ b/configs/ruff.toml @@ -0,0 +1,2 @@ +line-length = 88 +target-version = "py311" diff --git a/configs/rustfmt.toml b/configs/rustfmt.toml new file mode 100644 index 0000000..5b5236f --- /dev/null +++ b/configs/rustfmt.toml @@ -0,0 +1,7 @@ +unstable_features = true +edition = "2024" +style_edition = "2024" +group_imports = "StdExternalCrate" +imports_granularity = "Module" +single_line_if_else_max_width = 80 +skip_children = true diff --git a/configs/sqlfluff.ini b/configs/sqlfluff.ini new file mode 100644 index 0000000..29b22c2 --- /dev/null +++ b/configs/sqlfluff.ini @@ -0,0 +1,3 @@ +[sqlfluff] +dialect = postgres +max_line_length = 80 diff --git a/configs/stylua.toml b/configs/stylua.toml new file mode 100644 index 0000000..8811fc1 --- /dev/null +++ b/configs/stylua.toml @@ -0,0 +1,10 @@ +column_width = 80 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "Always" +collapse_simple_statement = "Never" + +[sort_requires] +enabled = false diff --git a/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md b/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md index 6289861..4cd3c5f 100644 --- a/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md +++ b/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md @@ -12,7 +12,7 @@ This repository was created to explore shared treefmt configuration for Caido. T ## Proposed decision -Use a locked Nix flake and one shared treefmt-nix configuration in `caido/formatter`. Every repository uses the same formatter per language, the same settings and the same package versions. Remove the project presets, local style variants and profile launcher. +Use a locked Nix flake and one shared treefmt-nix configuration in `caido/formatter`. Every repository uses the same formatter per language, the same settings and the same package versions. Keep package selection and file routing in `treefmt.nix`, and formatter-specific settings in shared native JSON/TOML/INI files under `configs/`. Remove the project presets, local style variants and profile launcher. Repositories use the identical `lib.forProject self` flake wiring to expose `nix fmt` and a formatting-only `nix flake check`. Use treefmt-nix’s module evaluation and standard formatting check without a custom test suite. The requested interface is Nix only, with no separate task layer. diff --git a/treefmt.nix b/treefmt.nix index 285c780..c41fdb3 100644 --- a/treefmt.nix +++ b/treefmt.nix @@ -5,21 +5,8 @@ let rustfmt = pkgs.rust-bin.nightly."2026-04-06".minimal.override { extensions = [ "rustfmt" ]; }; - rustSettings = toml.generate "caido-rustfmt.toml" { - unstable_features = true; - edition = "2024"; - style_edition = "2024"; - group_imports = "StdExternalCrate"; - imports_granularity = "Module"; - single_line_if_else_max_width = 80; - skip_children = true; - }; - sqlSettings = (pkgs.formats.ini { }).generate "caido-sqlfluff.cfg" { - sqlfluff = { - dialect = "postgres"; - max_line_length = 80; - }; - }; + readTOML = path: builtins.fromTOML (builtins.readFile path); + rustSettings = toml.generate "caido-rustfmt.toml" (readTOML ./configs/rustfmt.toml); in { projectRootFile = null; @@ -73,22 +60,10 @@ in "*.lua" "*.luau" ]; - settings = { - column_width = 80; - line_endings = "Unix"; - indent_type = "Spaces"; - indent_width = 2; - quote_style = "AutoPreferDouble"; - call_parentheses = "Always"; - collapse_simple_statement = "Never"; - sort_requires.enabled = false; - }; + settings = readTOML ./configs/stylua.toml; }; nixfmt.enable = true; - sqlfluff = { - enable = true; - dialect = "postgres"; - }; + sqlfluff.enable = true; }; settings.formatter = { @@ -96,28 +71,7 @@ in "--write" "--config" (toString ( - json.generate "caido-oxfmt.json" { - printWidth = 80; - tabWidth = 2; - useTabs = false; - semi = true; - singleQuote = false; - trailingComma = "all"; - endOfLine = "lf"; - sortImports = { - groups = [ - "builtin" - "external" - "internal" - "parent" - "sibling" - "index" - ]; - newlinesBetween = true; - ignoreCase = true; - order = "asc"; - }; - } + json.generate "caido-oxfmt.json" (builtins.fromJSON (builtins.readFile ./configs/oxfmt.json)) )) "--disable-nested-config" "--ignore-path" @@ -125,12 +79,7 @@ in ]; ruff-format.options = [ "--config" - (toString ( - toml.generate "caido-ruff.toml" { - line-length = 88; - target-version = "py311"; - } - )) + (toString (toml.generate "caido-ruff.toml" (readTOML ./configs/ruff.toml))) ]; rustfmt = { command = "${rustfmt}/bin/rustfmt"; @@ -144,7 +93,7 @@ in "--ignore-local-config" "--disregard-sqlfluffignores" "--config" - (toString sqlSettings) + "${./configs/sqlfluff.ini}" ]; }; } From 32ddd4b79b3c41ae08de2c8be40652a14973541b Mon Sep 17 00:00:00 2001 From: Christopher Guay Date: Mon, 9 Nov 2026 15:16:39 -0500 Subject: [PATCH 08/10] Validate shared formatter configuration in GitHub Actions --- .github/workflows/validate.yml | 27 +++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..f1c17d7 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,27 @@ +name: Validate formatter + +on: + pull_request: + push: + branches: [main] + +permissions: + contents: read + +jobs: + validate: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false + - uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - name: Evaluate configuration on all supported systems + run: nix flake check --all-systems --no-build --no-update-lock-file --show-trace + - name: Build generated treefmt configuration + run: nix build --no-link --no-update-lock-file .#config + - name: Check formatting + run: nix flake check --no-update-lock-file --show-trace diff --git a/README.md b/README.md index 3b5591d..3bf8600 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ Nix parses the JSON/TOML settings during evaluation and generates the tool confi Configuration validation uses JSON/TOML parsing, treefmt-nix’s module option types and config generation. The SQLFluff INI file is passed through without Nix-side parsing. Formatter-specific settings passed through as data or arguments may still be rejected at runtime; there is no custom formatter test suite. +The [validation workflow](.github/workflows/validate.yml) runs on pull requests and pushes to `main`. It evaluates all supported systems, builds the generated treefmt configuration on Linux and checks repository formatting with the committed lockfile. + ```sh # Same formatter and formatting-only check used by every consumer. nix fmt --no-update-lock-file From d0a71b255f4980b947c906051c85230dc7cd7ba0 Mon Sep 17 00:00:00 2001 From: Christopher Guay Date: Mon, 9 Nov 2026 15:19:21 -0500 Subject: [PATCH 09/10] Use Determinate installer and Magic Nix Cache in CI --- .github/workflows/validate.yml | 6 ++++-- README.md | 2 +- examples/github-actions.yml | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index f1c17d7..91412a8 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -16,9 +16,11 @@ jobs: - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: persist-credentials: false - - uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31 + - uses: DeterminateSystems/nix-installer-action@3138316df39ed29be04236d7ffc686fa525866aa # v23 + - uses: DeterminateSystems/magic-nix-cache-action@84c0677f58dcedf3b91f8223ce36a9ea5b3c84b7 # v15 with: - github_access_token: ${{ secrets.GITHUB_TOKEN }} + use-gha-cache: true + use-flakehub: false - name: Evaluate configuration on all supported systems run: nix flake check --all-systems --no-build --no-update-lock-file --show-trace - name: Build generated treefmt configuration diff --git a/README.md b/README.md index 3bf8600..6fb25fc 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Nix parses the JSON/TOML settings during evaluation and generates the tool confi Configuration validation uses JSON/TOML parsing, treefmt-nix’s module option types and config generation. The SQLFluff INI file is passed through without Nix-side parsing. Formatter-specific settings passed through as data or arguments may still be rejected at runtime; there is no custom formatter test suite. -The [validation workflow](.github/workflows/validate.yml) runs on pull requests and pushes to `main`. It evaluates all supported systems, builds the generated treefmt configuration on Linux and checks repository formatting with the committed lockfile. +The [validation workflow](.github/workflows/validate.yml) runs on pull requests and pushes to `main`. It uses the Determinate Nix installer and Magic Nix Cache backed by GitHub Actions. It evaluates all supported systems, builds the generated treefmt configuration on Linux and checks repository formatting with the committed lockfile. ```sh # Same formatter and formatting-only check used by every consumer. diff --git a/examples/github-actions.yml b/examples/github-actions.yml index d91124d..0007afa 100644 --- a/examples/github-actions.yml +++ b/examples/github-actions.yml @@ -16,8 +16,10 @@ jobs: - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: persist-credentials: false - - uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31 + - uses: DeterminateSystems/nix-installer-action@3138316df39ed29be04236d7ffc686fa525866aa # v23 + - uses: DeterminateSystems/magic-nix-cache-action@84c0677f58dcedf3b91f8223ce36a9ea5b3c84b7 # v15 with: - github_access_token: ${{ secrets.GITHUB_TOKEN }} + use-gha-cache: true + use-flakehub: false - name: Check formatting only run: nix flake check --no-update-lock-file --show-trace From 77eed0a688bbcdcef78afe04c856bc92f083c9e1 Mon Sep 17 00:00:00 2001 From: Christopher Guay Date: Mon, 9 Nov 2026 15:40:52 -0500 Subject: [PATCH 10/10] Give formatting an independent CI result --- .github/workflows/validate.yml | 15 +++++++++++++++ README.md | 2 +- .../0001-evaluate-treefmt-nix-in-formatter.md | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 91412a8..69863a7 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -10,6 +10,7 @@ permissions: jobs: validate: + name: Validate configuration runs-on: ubuntu-latest timeout-minutes: 30 steps: @@ -25,5 +26,19 @@ jobs: run: nix flake check --all-systems --no-build --no-update-lock-file --show-trace - name: Build generated treefmt configuration run: nix build --no-link --no-update-lock-file .#config + + formatting: + name: Check formatting + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false + - uses: DeterminateSystems/nix-installer-action@3138316df39ed29be04236d7ffc686fa525866aa # v23 + - uses: DeterminateSystems/magic-nix-cache-action@84c0677f58dcedf3b91f8223ce36a9ea5b3c84b7 # v15 + with: + use-gha-cache: true + use-flakehub: false - name: Check formatting run: nix flake check --no-update-lock-file --show-trace diff --git a/README.md b/README.md index 6fb25fc..7280c79 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Nix parses the JSON/TOML settings during evaluation and generates the tool confi Configuration validation uses JSON/TOML parsing, treefmt-nix’s module option types and config generation. The SQLFluff INI file is passed through without Nix-side parsing. Formatter-specific settings passed through as data or arguments may still be rejected at runtime; there is no custom formatter test suite. -The [validation workflow](.github/workflows/validate.yml) runs on pull requests and pushes to `main`. It uses the Determinate Nix installer and Magic Nix Cache backed by GitHub Actions. It evaluates all supported systems, builds the generated treefmt configuration on Linux and checks repository formatting with the committed lockfile. +The [validation workflow](.github/workflows/validate.yml) runs on pull requests and pushes to `main`. It uses the Determinate Nix installer and Magic Nix Cache backed by GitHub Actions. One job evaluates all supported systems and builds the generated treefmt configuration on Linux. A separate job checks repository formatting with the committed lockfile, so formatting has its own CI result. ```sh # Same formatter and formatting-only check used by every consumer. diff --git a/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md b/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md index 4cd3c5f..56294c7 100644 --- a/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md +++ b/docs/adrs/0001-evaluate-treefmt-nix-in-formatter.md @@ -16,6 +16,8 @@ Use a locked Nix flake and one shared treefmt-nix configuration in `caido/format Repositories use the identical `lib.forProject self` flake wiring to expose `nix fmt` and a formatting-only `nix flake check`. Use treefmt-nix’s module evaluation and standard formatting check without a custom test suite. The requested interface is Nix only, with no separate task layer. +CI uses the Determinate Nix installer and Magic Nix Cache, as explicitly requested for this experiment. This includes a scoped exception proposal to [STD-021](https://github.com/caido/engineering/blob/main/standards/STD-021-ci-caching.md), which otherwise limits CI caching to Rust work. Configuration validation and formatting run as separate jobs under STD-005. + Keep this experiment confined to the shared formatter repository. Do not change the approved tooling standard or migrate consuming repositories as part of this PR. Maintainer acceptance of this proposal and its scoped exception is required before adopting it beyond the experiment. ## Consequences