Branch: feat/frontend-zod-validation · 83 commits ahead of main
Last updated: 2026-05-26
The work tracked here is the migration described in
C:\Users\Hossein Sanaei\.claude\plans\zod-soft-feather.md — replacing the
class-based xray models (models/inbound.ts, models/outbound.ts) with Zod
schemas as the single source of truth, standardizing every form on AntD
Form.useForm + antdRule(schema.shape.X), and tightening
@typescript-eslint/no-explicit-any to error.
Verify state: npm run typecheck clean, npm run lint clean,
npm run test 302/302, snapshot baselines 172/172.
parseMsg helper)go-playground/validatortools/openapigen) emitting zod.ts + types.tsantdRule(schema) helper bridging Zod issues to AntD form rulesfrontend/src/schemas/primitives/ — port, protocol, sniffing, atomic dictionariesprotocols/inbound/* — 10 protocols as leaf schemasprotocols/outbound/* — 11 protocols as leaf schemasprotocols/stream/* — 7 networks (tcp/kcp/ws/grpc/httpupgrade/xhttp/hysteria)protocols/security/* — 3 securities (none/tls/reality)forms/inbound-form.ts — InboundFormValues discriminated unionforms/outbound-form.ts — OutboundFormValues discriminated unionz.discriminatedUnion with intersectionfrontend/src/lib/xray/headers.ts — toHeaders, toV2Headers, getHeaderValueinbound-link.ts — genVmessLink, genVlessLink, genTrojanLink,
genShadowsocksLink, genHysteriaLink, Wireguard link/configoutbound-link-parser.ts — vmess/vless/trojan/shadowsocks/hysteria2inbound-defaults.ts — createDefault{Vmess,Vless,...}{Client,InboundSettings}outbound-defaults.ts — settings factories + dispatcheroutbound-form-adapter.ts — raw ↔ OutboundFormValues round-tripprotocol-capabilities.ts — capability predicates as pure functionsInboundFormModal.tsx — full rewrite, atomic-swapped from .new.tsx
OutboundFormModal.tsx — full rewrite, atomic-swapped from .new.tsx
FinalMaskForm rewritten to Pattern A (Form.List-driven) and wired
into both stream tabs (Inbound + Outbound). Covers TCP/UDP mask
arrays, all 13 UDP mask types, header-custom nested groups, noise
items, and the QUIC params sub-form.test/golden/fixtures/)@typescript-eslint/no-explicit-any: 'error' enforced.github/workflows/ci.yml runs typecheck + test before buildDBInbound, Status, AllSetting legacy classes — flagged as out of
scope in zod-soft-feather.md. The mainline migration of
models/inbound.ts / models/outbound.ts cannot delete them entirely
while DBInbound.toInbound() still imports.sid= multi-value parsing in share-link import
(outbound reality only carries a single shortId — this is server-side
state)fm= (FinalMask) param in share-link importxmux nested JSON parsing (currently round-trips at the
XHTTP top level; nested xmux object is left empty).loose() removal in schemas/api/inbound.ts,
schemas/api/client.ts, schemas/xray.ts — gated on Step 6 of the plan
(currently held because the codegen tool still emits one or two loose
fields the panel writes back)git checkout feat/frontend-zod-validationcd frontend && npm install && npm run typecheck && npm run testC:\Users\Hossein Sanaei\.claude\plans\zod-soft-feather.md —
Steps 1–5 are done. Step 6 (tighten .loose()) and Step 7 (lint/CI
tightening) are partially done.