purpose
src/pipeline.ts (1658 行) を per-surface モジュール群 (src/pipeline/*.ts) に分割する。 src/pipeline.ts は再エクスポートのみのバレルに縮退させ、 consumer (src/poller.ts / src/webhook.ts) の import 修正なしで完結させる。 読みやすさと修正局所性を上げ、 surface 単位での将来追加 (例: 新 GitHub event タイプ) の影響範囲を限定する。
premise
- 単一ファイルに embedding pipeline / vector ID 生成 / ingest filter / hash utility / per-surface upsert (issue・release・doc・wiki・diff・comment) が同居している
- consumer は
poller.ts (cron 経由) と webhook.ts (event 経由) の 2 ファイルのみ
- 両 consumer は
from "./pipeline.js" で named import している (リスト確認済み)
src/types.ts の Record 型 / src/fts.ts の upsertFtsRow / deleteFtsRow を依存先として使用
constraints
- 動作変更なし (refactor のみ)
- consumer 側 import 修正なし (barrel が backward-compat 保証)
- type signature 変更なし
- 既存 export は全て barrel 経由で publish され続けること
- tsc --noEmit clean & wrangler deploy --dry-run pass
target files
新規 (src/pipeline/)
embedding.ts — generateEmbedding, generateEmbeddingBatch, MAX_EMBEDDING_INPUT_CHARS, MAX_EMBEDDING_BATCH_SIZE, MAX_VECTORIZE_UPSERT_BATCH_SIZE
vector-id.ts — stableVectorId (private), vectorId, releaseVectorId, docVectorId, wikiDocVectorId, diffVectorId, issueCommentVectorId, prReviewVectorId, prReviewCommentVectorId
ingest-filter.ts — isBotSender, isBodyTooShort, MIN_COMMENT_BODY_CHARS
hash.ts — computeBodyHash, prepareEmbeddingInput, base64UrlEncode, base64UrlEncodeBytes (private), sha256Hex, prepareDiffEmbeddingInput, prepareCommentEmbeddingInput
types.ts — 共有型 (UpsertResult, DiffUpsertResult, CommentUpsertResult 等の per-module 跨ぎ)
embed-issue.ts — processAndUpsertIssue, GitHubIssueData
embed-release.ts — processAndUpsertRelease, GitHubReleaseData
embed-doc.ts — processAndUpsertDoc, processAndUpsertWikiDoc
embed-diff.ts — fetchCommitDetail, normaliseFileStatus (private), processAndUpsertCommitDiff, GitHubCommitDetail
embed-comment.ts — ingestIssueComment, ingestPRReview, ingestPRReviewComment, GitHubCommentData, GitHubPRReviewData, GitHubPRReviewCommentData
縮退
src/pipeline.ts — 全 export を pipeline/* から再エクスポートするバレル
expected outcome
src/pipeline.ts が ~30 行のバレルになる
src/pipeline/*.ts が 10 ファイル前後に分割される
src/poller.ts / src/webhook.ts の import 文は無変更
tsc --noEmit clean、 wrangler deploy --dry-run 成功
label
- type: enhancement
- maturity: ready
purpose
src/pipeline.ts(1658 行) を per-surface モジュール群 (src/pipeline/*.ts) に分割する。src/pipeline.tsは再エクスポートのみのバレルに縮退させ、 consumer (src/poller.ts/src/webhook.ts) の import 修正なしで完結させる。 読みやすさと修正局所性を上げ、 surface 単位での将来追加 (例: 新 GitHub event タイプ) の影響範囲を限定する。premise
poller.ts(cron 経由) とwebhook.ts(event 経由) の 2 ファイルのみfrom "./pipeline.js"で named import している (リスト確認済み)src/types.tsの Record 型 /src/fts.tsのupsertFtsRow/deleteFtsRowを依存先として使用constraints
target files
新規 (src/pipeline/)
embedding.ts—generateEmbedding,generateEmbeddingBatch,MAX_EMBEDDING_INPUT_CHARS,MAX_EMBEDDING_BATCH_SIZE,MAX_VECTORIZE_UPSERT_BATCH_SIZEvector-id.ts—stableVectorId(private),vectorId,releaseVectorId,docVectorId,wikiDocVectorId,diffVectorId,issueCommentVectorId,prReviewVectorId,prReviewCommentVectorIdingest-filter.ts—isBotSender,isBodyTooShort,MIN_COMMENT_BODY_CHARShash.ts—computeBodyHash,prepareEmbeddingInput,base64UrlEncode,base64UrlEncodeBytes(private),sha256Hex,prepareDiffEmbeddingInput,prepareCommentEmbeddingInputtypes.ts— 共有型 (UpsertResult,DiffUpsertResult,CommentUpsertResult等の per-module 跨ぎ)embed-issue.ts—processAndUpsertIssue,GitHubIssueDataembed-release.ts—processAndUpsertRelease,GitHubReleaseDataembed-doc.ts—processAndUpsertDoc,processAndUpsertWikiDocembed-diff.ts—fetchCommitDetail,normaliseFileStatus(private),processAndUpsertCommitDiff,GitHubCommitDetailembed-comment.ts—ingestIssueComment,ingestPRReview,ingestPRReviewComment,GitHubCommentData,GitHubPRReviewData,GitHubPRReviewCommentData縮退
src/pipeline.ts— 全 export をpipeline/*から再エクスポートするバレルexpected outcome
src/pipeline.tsが ~30 行のバレルになるsrc/pipeline/*.tsが 10 ファイル前後に分割されるsrc/poller.ts/src/webhook.tsの import 文は無変更tsc --noEmitclean、wrangler deploy --dry-run成功label