Skip to content

feat(page-cluster)!: trim options, add CLI and onProgress#918

Merged
YusukeHirao merged 1 commit into
devfrom
feat/page-cluster-productionize
Jul 14, 2026
Merged

feat(page-cluster)!: trim options, add CLI and onProgress#918
YusukeHirao merged 1 commit into
devfrom
feat/page-cluster-productionize

Conversation

@YusukeHirao

Copy link
Copy Markdown
Member

Summary

前 PR #917(streaming API)に続く実用化整備。オプション削減、公式 CLI、進捗コールバック、公開 API 表面の縮小を一括で入れる。

BREAKING CHANGES

  • resolvePageClusterKeys から 3 オプションを撤去:
    • mergeRareLandmarkClusters / landmarkRarityThreshold / landmarkGateSimilarityThreshold — 実データ未検証のフラグ。関連する mergeLandmarkAffinedClusters 実装ごと削除
    • autoCapMainDepth — 常時 ON に固定。既存デフォルト true と挙動同一
  • package.jsonexports17 → 4 サブパスに削減:
    • . (tokenize) / ./extract-landmarks / ./resolve-landmark-variant-keys / ./resolve-page-cluster-keys
    • 内部ヘルパは src/ に残置。パッケージ内相互 import は継続

追加

  • 公式 CLI: bin: page-cluster。JSONL 入出力、--content-block-attribute フラグ、--help / --version、stderr 進捗ログ。Node 標準 API のみ使用
  • onProgress コールバック: resolvePageClusterKeys のオプションに追加。ProgressEvent 判別共用体で pass0 / pass1 / pass1b / stage-b 開始をイベント化
  • derivePathClusterKeys: URL パス深さの auto-cut ベース自己決定関数。resolveBlockingGroupKeyspathDepth: 'auto' として opt-in。resolvePageClusterKeys は現時点で有効化しない(既存回帰保証、実データ検証は後続 PR)
  • @example: 4 公開 API 全てに runnable example を付与
  • README 刷新: 外部ユーザー向け・CLI メイン。Quickstart(CLI)→ API brief → Algorithm walkthrough(ASCII フロー図 + 箇条書き)→ Notes 構成

検証

  • yarn build / yarn lint / yarn test(759 spec)all pass
  • 既存 4 コーパス(302 / 8,936 / 1,416 / 89 ページ)で 9 / 21 / 63 / 3 clusters、前 PR ゲート値と完全一致
  • CLI パイプで既存 JSONL 実行、stderr 進捗ログの体裁確認

意図的に本 PR に含めない

  • derivePathClusterKeys の main 経路への配線(実データ検証を要するので別 PR)
  • Stage B の per-round onProgress イベント(現在は開始 1 回のみ発火。将来拡張)

Test plan

  • yarn build / yarn lint / yarn test all pass
  • 既存 4 コーパスで前 PR ゲート値維持
  • CLI 動作確認(--help / --version / JSONL パイプ / stderr 進捗)

🤖 Generated with Claude Code

… API

BREAKING CHANGE: the `mergeRareLandmarkClusters`,
`landmarkRarityThreshold`, `landmarkGateSimilarityThreshold`, and
`autoCapMainDepth` options are removed from `resolvePageClusterKeys`. The
`autoCapMainDepth`-driven <main> depth cap is now unconditional and
matches the previous default (`true`); the rare-landmark merge feature was
never validated on real crawl data and is dropped along with its
`mergeLandmarkAffinedClusters` implementation.

BREAKING CHANGE: `package.json` `exports` shrinks from 17 subpaths to 4
(`.` / `./extract-landmarks` / `./resolve-landmark-variant-keys` /
`./resolve-page-cluster-keys`). Internal helpers stay in `src/` for
in-package imports; downstream callers relying on removed subpaths must
build against the public surface.

New:

- `bin: page-cluster` CLI. JSONL in, JSONL out, single `--content-block-
  attribute` flag, `--help` / `--version`, stderr progress lines. Uses
  Node standard APIs only.
- `resolvePageClusterKeys` `onProgress` callback + `ProgressEvent`
  discriminated union covering pass0 / pass1 / pass1b / stage-b start.
- `derivePathClusterKeys` — auto-cut-driven URL-path depth selector.
  Exported as a building block and reachable via
  `resolveBlockingGroupKeys`'s new `pathDepth: 'auto'`; `resolvePage-
  ClusterKeys` continues to use static depth 1 for now (opt-in staging,
  same as previous auto-cut adoptions).
- `@example` blocks on the 4 public APIs.
- Rewritten README aimed at external users, CLI-first.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@YusukeHirao YusukeHirao requested a review from yusasa16 as a code owner July 14, 2026 07:14
@YusukeHirao YusukeHirao merged commit 728818f into dev Jul 14, 2026
6 checks passed
@YusukeHirao YusukeHirao deleted the feat/page-cluster-productionize branch July 14, 2026 07:17
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