feat(page-cluster)!: add landmark position + chrome reporting#926
Merged
Conversation
…fication Add line/column position reporting for header/footer/nav/aside/form/ search/main landmark instances, with chrome-vs-content classification for the six excisable types against each final cluster's shell tokens. - extractLandmarks now also extracts <main>/role="main" - resolvePageClusterKeys* accept includeLandmarkPositions to return PageClusterKeyResult[] (clusterKey + PageLandmarkReport) instead of string[]; not supported on the streaming path (over 20,000 pages) - CLI gains --include-landmark-positions BREAKING CHANGE: ExtractLandmarksResult's six landmark fields change from string[] (raw HTML) to LandmarkInstance[] (html + position). A new `main` field is added. Callers reading .header/.footer/etc. as strings must switch to .html on each instance.
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
extractLandmarksに<main>/role="main"の抽出を追加し、header/footer/nav/aside/form/search/main の全インスタンスに HTML 内の位置(1-based line/column と文字列オフセット)を持たせたresolvePageClusterKeys/resolvePageClusterKeysFromArray/resolvePageClusterKeysInMemoryにincludeLandmarkPositionsオプションを追加。trueを渡すとclusterKeyに加えて、そのページが属する最終クラスタの頻度分析(shellQuorum)に基づく chrome/content 判定(isChrome)付きのランドマーク位置レポートを返す--include-landmark-positionsフラグを追加。20,000 ページ超のストリーミング経路では非対応(RangeErrorで早期に失敗)ExtractLandmarksResultの各ランドマークフィールドがstring[](生HTML)からLandmarkInstance[](html+ 位置情報)に変更。.header/.footer等を文字列として読んでいた既存コードは.htmlを参照するよう変更が必要(本パッケージは他パッケージから依存されていないため、影響はpage-cluster内に閉じる。バージョンは0.3.1で SemVer 上マイグレーションガイドは不要)Test plan
yarn build— リポジトリ全体でパスyarn lint— エラー0(既存コードにあった警告2件はスコープ外、修正せず)yarn test— リポジトリ全体 117 ファイル / 1660 件パス(page-cluster単体 46 ファイル / 813 件)offset-to-line-column(改行境界・CRLF・インデックス再利用)、main の複数収集/ネスト除去/excise対象外/section-local navの非消失、shellQuorum(JSDoc記載のギャップケース含む)、isChromeLandmarkInstance(閾値境界)、buildPageLandmarkReport、resolvePageClusterKeysInMemoryのincludeLandmarkPositions(複数クラスタでのshell独立性を含む)、ストリーミング境界でのRangeError、CLI 新フラグ🤖 Generated with Claude Code