Skip to content

Add ts dev lint domains + ts dev install-hooks#733

Draft
aram356 wants to merge 1 commit into
mainfrom
feature/check-domains-spec
Draft

Add ts dev lint domains + ts dev install-hooks#733
aram356 wants to merge 1 commit into
mainfrom
feature/check-domains-spec

Conversation

@aram356

@aram356 aram356 commented May 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds ts dev lint domains — a pure-Rust source/config/docs linter that flags non-allowlisted URL hosts in four modes (--staged, --changed-vs <ref>, full-repo, explicit paths). All git operations go through gitoxide (no shelling out to git).
  • Adds ts dev install-hooks — installs a managed pre-commit hook that runs ts dev lint domains --staged, with foreign core.hooksPath preflight, unmanaged-clobber refusal, and --force with timestamped backup.
  • Refactors the existing ts dev leaf into a subcommand group: ts dev serve preserves the prior surface; lint and install-hooks are siblings.

Stacked on #669 — base branch is feature/ts-cli. Merge that PR first.

Design

Allowlists: EXACT_HOSTS, SUBDOMAIN_HOSTS, REFERENCE_HOSTS, plus RFC 2606 reserved TLDs. Suppression marker: // allow-domain: host (and #, <!--, * comment forms). Scanned extensions cover Rust, TS/JS, configs, Markdown, CSS, HTML, env files, and Dockerfiles. Exit codes: 0 clean, 1 violations, 2 environment error, 130 cancelled.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --workspace --exclude trusted-server-cli --all-targets --all-features -- -D warnings
  • cargo clippy --package trusted-server-cli --target <host> --all-targets -- -D warnings
  • cargo test --package trusted-server-cli --target <host> — 132 tests pass
  • cd crates/js/lib && npx vitest run — 291 tests pass
  • cd crates/js/lib && npm run format
  • cd docs && npm run format
  • cargo test --workspace --exclude trusted-server-cli — one pre-existing failure on the base (test_env_var_roundtrip_normalizes_integration_types) reproduces on origin/feature/ts-cli with zero files touched in trusted-server-core/ on this branch; not a regression from this work.

@aram356 aram356 marked this pull request as draft May 23, 2026 20:19
@aram356 aram356 self-assigned this May 27, 2026
@aram356 aram356 deleted the branch main July 7, 2026 21:43
@aram356 aram356 closed this Jul 7, 2026
@aram356 aram356 deleted the feature/check-domains-spec branch July 7, 2026 21:43
@aram356 aram356 restored the feature/check-domains-spec branch July 9, 2026 22:07
@aram356 aram356 reopened this Jul 9, 2026
@aram356 aram356 changed the base branch from feature/ts-cli to main July 9, 2026 22:12
Port the pure-Rust URL-host linter (`ts dev lint domains`) and the
pre-commit hook installer (`ts dev install-hooks`) onto main's
restructured CLI. Both are cross-host (all git access via gitoxide, no
`git` subprocess) and register as siblings of the macOS-only
`ts dev proxy`.

Adapt to main's layout:
- Move the feature under `src/commands/dev/{lint,install_hooks}` and add
  the `Lint` / `InstallHooks` variants to `DevCommand`, replacing the
  prior empty-enum handling.
- Reintroduce a small `CliError` (`Io`, `Json`, `EnvironmentError`,
  `ViolationsFound`) plus `output::write_{stdout,stderr}_line` /
  `write_json`; `output` becomes cross-host while `info` / `warn` stay
  macOS-only.
- Map the linter's results to the exit contract (0 clean, 1 violations,
  2 environment error) in `commands::dev::run`.
- Scope `error-stack` / `derive_more` cross-host and add `gix` /
  `gix-config`; add `assert_cmd` / `predicates` / `temp-env` dev-deps.

The former `serve` subcommand is not restored — main replaced it with
`ts dev proxy` independently of this work.
@aram356 aram356 force-pushed the feature/check-domains-spec branch from fcff9ed to 30f2cc1 Compare July 10, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant