Add ts dev lint domains + ts dev install-hooks#733
Draft
aram356 wants to merge 1 commit into
Draft
Conversation
3 tasks
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.
fcff9ed to
30f2cc1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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 togit).ts dev install-hooks— installs a managedpre-commithook that runsts dev lint domains --staged, with foreigncore.hooksPathpreflight, unmanaged-clobber refusal, and--forcewith timestamped backup.ts devleaf into a subcommand group:ts dev servepreserves the prior surface;lintandinstall-hooksare 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 -- --checkcargo clippy --workspace --exclude trusted-server-cli --all-targets --all-features -- -D warningscargo clippy --package trusted-server-cli --target <host> --all-targets -- -D warningscargo test --package trusted-server-cli --target <host>— 132 tests passcd crates/js/lib && npx vitest run— 291 tests passcd crates/js/lib && npm run formatcd docs && npm run formatcargo test --workspace --exclude trusted-server-cli— one pre-existing failure on the base (test_env_var_roundtrip_normalizes_integration_types) reproduces onorigin/feature/ts-cliwith zero files touched intrusted-server-core/on this branch; not a regression from this work.