Skip to content

refactor: simplify codebase with type dedup, shared analysis module, and consistent naming#373

Merged
jackwener merged 1 commit intomainfrom
claude/vigilant-ardinghelli
Mar 24, 2026
Merged

refactor: simplify codebase with type dedup, shared analysis module, and consistent naming#373
jackwener merged 1 commit intomainfrom
claude/vigilant-ardinghelli

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • Remove unused re-exports from registry.tsserializeArg, serializeCommand etc. were re-exported but never imported through this path
  • Unify snapshot option typesFormatOptions in snapshotFormatter.ts was a subset of SnapshotOptions from types.ts; renamed dom-snapshot's SnapshotOptions to DomSnapshotOptions to avoid collision
  • Extract shared analysis.ts from explore.ts and record.ts, eliminating ~200 lines of duplicated logic (urlToPattern, findArrayPath, inferCapabilityName, inferStrategy, detectAuth*, classifyQueryParams)
  • Merge snapshotFormatter from 7-pass to 4-pass pipeline (combine parse+filter with subtree skipping; merge three dedup passes into one)
  • Unify CLI adapter naming — rename all shared.ts/common.ts to utils.ts across 8 site adapters (boss, douban, doubao, doubao-app, jike, medium, sinablog, substack); merge douban's shared.ts into existing utils.ts

Net effect: -54 lines, cleaner type hierarchy, less duplication, consistent naming.

Test plan

  • tsc --noEmit passes
  • All 252 unit tests pass
  • npm run build succeeds (328 manifest entries)
  • Smoke tests pass after rebuild

…and consistent naming

- Remove unused re-exports from registry.ts (serializeArg, serializeCommand, etc.)
- Unify FormatOptions into SnapshotOptions from types.ts; rename dom-snapshot's
  SnapshotOptions to DomSnapshotOptions to avoid name collision
- Extract shared analysis.ts module from explore.ts and record.ts, eliminating
  ~200 lines of duplicated logic (urlToPattern, findArrayPath, inferCapabilityName,
  inferStrategy, detectAuth*, classifyQueryParams)
- Merge snapshotFormatter from 7-pass to 4-pass pipeline by combining parse+filter
  with ad/boilerplate subtree skipping, and merging three dedup passes into one
- Rename all CLI adapter shared files to consistent utils.ts naming
  (boss/common.ts, douban/shared.ts, doubao*/common.ts, jike/shared.ts,
  medium/shared.ts, sinablog/shared.ts, substack/shared.ts)
- Merge douban/shared.ts into douban/utils.ts
@jackwener jackwener force-pushed the claude/vigilant-ardinghelli branch from b6d0fd7 to 541baa8 Compare March 24, 2026 13:19
@jackwener jackwener merged commit 94c3ef9 into main Mar 24, 2026
11 checks passed
@jackwener jackwener deleted the claude/vigilant-ardinghelli branch March 24, 2026 13:20
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