Skip to content

docs: GitHub Wikiの作成とMarkdown品質管理の導入#8

Merged
9c5s merged 18 commits intomainfrom
docs/github-wiki
Mar 21, 2026
Merged

docs: GitHub Wikiの作成とMarkdown品質管理の導入#8
9c5s merged 18 commits intomainfrom
docs/github-wiki

Conversation

@9c5s
Copy link
Copy Markdown
Owner

@9c5s 9c5s commented Mar 21, 2026

概要

GitHub Wikiを docs/wiki/ で一元管理し、mainプッシュ時にGitHub Actionsで自動同期する仕組みを構築。markdownlint-cli2 + textlint による日本語ドキュメントの品質管理も導入。

変更内容

Markdown品質管理

  • markdownlint-cli2 導入 (日本語環境向け: MD013/MD024/MD033/MD041/MD060無効化)
  • textlint 導入 (ja-technical-writingプリセット、体言止め許容)
  • lefthook に mdlint/textlint ジョブ追加
  • .changeset用のmarkdownlintオーバーライド

GitHub Actions

  • wiki-sync.yaml: docs/wiki変更時にGitHub Wikiへ自動同期 (Andrew-Chen-Wang/github-wiki-action、SHAピン固定)

Wikiページ (7ページ)

  • Home: 概要とナビゲーション
  • Getting Started: インストール、接続、メタデータ取得の最小例
  • API Reference: TCNetConfiguration/TCNetClient/パケット型/Enumの全リファレンス
  • PRO DJ LINK Bridge: 通信制約、データ制限、パケットタイミング実測、トラブルシューティング
  • TCNet Protocol: ノードロール、ポート、Management Header、パケット構造、値エンコーディング
  • Implementation Status: 実装済み/未実装一覧、仕様差異、バグ修正履歴
  • Contributing: ビルド、lefthook、Conventional Commits、changeset、PR手順

README日本語化

  • 英語→日本語に全面書き換え
  • コード例を実際に動作するものに更新
  • Wikiへのリンクを追加
  • 文体: 体言止め基調、簡潔で端的

その他

  • .gitignore: docs/docs/superpowers (docs/wikiを追跡対象に)
  • commitlint.config.js: ESM形式に更新、subject-case無効化
  • package.json homepage: 9c5s/node-tcnetに修正

文体

全ドキュメントを「だ・である」調 + 体言止めで統一。冗長な「である」は省略し、簡潔で端的な表現を採用。textlintで品質を自動チェック。

9c5s added 15 commits March 21, 2026 18:26
- markdownlint-cli2をdevDependenciesに追加
- README.MDの文法エラー修正 (tries implements -> implements, procotol -> protocol)
- package.json homepage URLを9c5s/node-tcnetに修正
- PRO-DJ-LINK-Bridge.md Timeパケット頻度を約32回/secに修正
- TCNet-Protocol.md ポート60002を追加
- TCNet-Protocol.md Statusパケットbyte 85-171を追記
- Getting-Started.md connect前にイベントハンドラ登録するよう修正
- API-Reference.md broadcastInterface自動計算条件を補足
- TCNet-Protocol.md PitchBendのInt16LE読み取りについて注記追加
- docs/wiki間の相互リンクを強化
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 21, 2026

Summary by CodeRabbit

リリースノート

  • Documentation

    • 包括的なWiki(API参照、導入、実装状況、ブリッジ情報、貢献ガイド等)を日本語で追加・整備し、READMEを日本語に翻訳・更新
  • Chores

    • Wiki同期の自動化ワークフローを追加
  • Style / Tooling

    • マークダウン/テキストリンティング設定とフォーマットスクリプトを導入・拡張
    • コミット検証設定とpre-commitフックを更新
  • Ignore

    • ドキュメント関連およびビルド生成物の無視設定を調整

Walkthrough

マークダウン/textlint 設定と開発スクリプト・依存の追加、README の日本語化と docs/wiki の複数ページ追加、Wiki 同期用 GitHub Actions ワークフロー追加、lefthook と commitlint 設定更新、.gitignore の微修正を行います。

Changes

Cohort / File(s) Summary
Markdown/Textlint 設定
\.changeset\/\.markdownlint\.jsonc, \.markdownlint-cli2\.jsonc, \.textlintrc\.json
新規追加:markdownlint/mardownlint-cli2 設定(例: first-line-heading 無効化)および textlint 設定(日本語技術文書プリセットとルール調整)。
Docs / Wiki ページ
docs\/wiki\/API-Reference.md, docs\/wiki\/Contributing.md, docs\/wiki\/Getting-Started.md, docs\/wiki\/Home.md, docs\/wiki\/Implementation-Status.md, docs\/wiki\/PRO-DJ-LINK-Bridge.md, docs\/wiki\/TCNet-Protocol.md, README\.MD
README を日本語に更新。docs/wiki 配下に7件の新規ドキュメントを追加(API、導入、実装状況、プロトコル、Bridge、貢献ガイド等)。
CI / ワークフロー
\.github\/workflows\/wiki-sync\.yaml
新規ワークフロー追加:docs/wiki/** を GitHub Wiki に同期する job を main ブランチ push でトリガー(concurrency、最小権限、Andrew-Chen-Wang/github-wiki-action を使用)。
Git フック / commitlint
lefthook\.yml, commitlint\.config\.js, commitlint\.config.mjs
lefthook の pre-commit に markdown/textlint ジョブ追加および jsonc をフォーマット対象に追加。commitlint 設定を ESM 形式へ変更と新規 .mjs 設定追加、subject-case を無効化。
package metadata / scripts / devDeps
package\.json
homepage 更新、jsonc を含むフォーマットスクリプト拡張、markdown/textlint 用の npm スクリプトと devDependencies を追加、空 dependencies フィールド削除。
バージョン管理除外 (.gitignore)
\.gitignore
!commitlint.config.js!commitlint.config.mjs へ更新、docs/docs/superpowers のみ無視へ変更、.tsbuildinfo*.tsbuildinfo に変更・改行追加。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed PRタイトルは「docs: GitHub Wikiの作成とMarkdown品質管理の導入」で、変更セットの主要な変更である GitHub Wiki の作成、GitHub Actions による自動同期、および Markdown 品質管理ツールの導入を明確に説明している。
Description check ✅ Passed PR説明は「概要」「変更内容」「文体」のセクションに分かれており、GitHub Wiki の一元管理、自動同期の仕組み、Markdown 品質管理ツール(markdownlint-cli2、textlint)の導入、7つの Wiki ページの追加、README の日本語化、その他の関連変更について詳細に説明している。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/github-wiki

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

このプルリクエストは、プロジェクトのドキュメント体制を大幅に強化し、開発体験を向上させることを目的としています。GitHub Wikiをコードベースで管理し、自動同期する仕組みを導入することで、ドキュメントの鮮度と一貫性を保ちます。また、markdownlintとtextlintによる日本語ドキュメントの品質管理を導入し、可読性と保守性を高めました。これにより、新規ユーザーのオンボーディングがスムーズになり、貢献者がより容易にプロジェクトに参加できるようになります。

Highlights

  • Markdown品質管理の導入: markdownlint-cli2とtextlintを導入し、日本語ドキュメントの品質管理を強化しました。lefthookにlintジョブを追加し、.changeset用のmarkdownlintオーバーライドも設定しました。
  • GitHub Wikiの自動同期: docs/wiki/ディレクトリの変更をGitHub Actions (wiki-sync.yaml) を使用してGitHub Wikiに自動同期する仕組みを構築しました。
  • 7つのWikiページ追加: プロジェクトの概要、APIリファレンス、PRO DJ LINK Bridgeに関する情報、TCNetプロトコル詳細、実装状況、貢献ガイドなど、7つの新しいWikiページを追加しました。
  • READMEの日本語化と更新: README.MDを全面的に日本語に書き換え、コード例を動作するものに更新し、新しいWikiへのリンクを追加しました。
  • 設定ファイルの更新: .gitignoreでdocs/wikiを追跡対象に変更し、commitlint.config.jsをESM形式に更新してsubject-caseルールを無効化、package.jsonのhomepageを修正しました。
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/wiki-sync.yaml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

このプルリクエストは素晴らしいですね。GitHub Wikiのコンテンツをリポジトリで一元管理し、GitHub Actionsで自動同期する仕組みは非常に効果的です。また、markdownlint-cli2textlintを導入し、lefthookで品質を自動チェックすることで、ドキュメントの品質を高く維持する基盤が整いました。特に、日本語ドキュメントの品質管理に注力されている点は高く評価します。
READMEの日本語化や詳細なWikiページの作成により、このプロジェクトは日本の開発者にとってより使いやすく、貢献しやすくなるでしょう。
1点だけ、package.jsonのスクリプトとlefthook.ymlの設定の整合性について、改善提案をさせていただきました。全体として、非常に質の高い貢献です。

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.gitignore:
- Line 33: The .gitignore currently lists the literal entry ".tsbuildinfo",
which misses files like "tsconfig.tsbuildinfo"; update the ignore pattern to a
wildcard such as "*.tsbuildinfo" (or "**/*.tsbuildinfo" if you want to cover
subdirectories) by replacing the ".tsbuildinfo" entry with the wildcard pattern
so all generated tsbuildinfo files are ignored.

In @.textlintrc.json:
- Around line 1-13: Prettier formatting issues found in .textlintrc.json; run
the formatter to fix spacing/quotes and JSON style. Execute npx prettier --write
.textlintrc.json (or apply your project's Prettier config) to reformat the file
while keeping the existing rules like "preset-ja-technical-writing",
"sentence-length", "max-comma", "no-exclamation-question-mark", and
"no-mix-dearu-desumasu" intact. Ensure the file remains valid JSON and commit
the formatted file.

In `@commitlint.config.js`:
- Around line 1-6: The config currently uses ESM "export default" in
commitlint.config.js but package.json lacks "type":"module"; either rename the
file to commitlint.config.mjs (preferred) to keep the current ESM content, or
convert to CommonJS by replacing the top-level "export default { ... }" with
"module.exports = { extends: [\"@commitlint/config-conventional\"], rules: {
\"subject-case\": [0] } }" so commitlint can load the configuration without
syntax errors.

In `@docs/wiki/API-Reference.md`:
- Around line 208-209:
現在の文「毎秒ポート60001で受信する。」は周期を断定して誤解を招くので、タイムコードパケットの受信ポートは60001であることを明示しつつ、到着頻度は固定ではなく通常はフレーム周期(数十ミリ秒程度)の間隔で届くことを記述に反映してください(例:ポート60001で受信、到着は映像フレーム周期に同期することが多く頻度は環境によって変動する)。該当箇所は「タイムコードパケット」の説明文を修正してください。

In `@docs/wiki/Implementation-Status.md`:
- Line 53: The table entry for "Pitch Bend" incorrectly shows the UInt16LE range
as "0-65536"; update the cell containing "UInt16LE(0-65536, 32768=100%)" to the
correct range "UInt16LE(0-65535, 32768=100%)" so the documentation accurately
reflects UInt16LE's 0–65535 range.

In `@README.MD`:
- Around line 15-35: The README sample uses top-level await which breaks in
CommonJS consumers; wrap the example body in an async function (e.g., async
function main()) and call it with main().catch(console.error) so the code works
in both ESM and CommonJS, keeping the existing calls to TCNetClient.connect(),
requestData(TCNetDataPacketType.MetaData, 0) and TCNetClient.disconnect() inside
that async wrapper.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e36edc36-3bcb-4cb8-b8bb-fb79931ce2ca

📥 Commits

Reviewing files that changed from the base of the PR and between bd8b681 and bd60d11.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (16)
  • .changeset/.markdownlint.jsonc
  • .github/workflows/wiki-sync.yaml
  • .gitignore
  • .markdownlint-cli2.jsonc
  • .textlintrc.json
  • README.MD
  • commitlint.config.js
  • docs/wiki/API-Reference.md
  • docs/wiki/Contributing.md
  • docs/wiki/Getting-Started.md
  • docs/wiki/Home.md
  • docs/wiki/Implementation-Status.md
  • docs/wiki/PRO-DJ-LINK-Bridge.md
  • docs/wiki/TCNet-Protocol.md
  • lefthook.yml
  • package.json
📜 Review details
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2026-03-21T05:02:24.940Z
Learnt from: 9c5s
Repo: 9c5s/node-tcnet PR: 2
File: src/tcnet.ts:397-400
Timestamp: 2026-03-21T05:02:24.940Z
Learning: In the `node-tcnet` repository (`src/network.ts`, `src/tcnet.ts`), `TCNetDataPacket.write()` has no callers. `TCNetDataPacket` objects are only ever deserialized on receive paths (`read()`), never serialized and sent. The only outbound packet carrying a layer field is `TCNetRequestPacket`, constructed inside `requestData()` in `src/tcnet.ts`. Suggesting to move layer conversion logic into `TCNetDataPacket.write()` is inappropriate because that method is dead code.

Applied to files:

  • docs/wiki/API-Reference.md
📚 Learning: 2026-03-21T05:30:28.194Z
Learnt from: 9c5s
Repo: 9c5s/node-tcnet PR: 2
File: src/tcnet.ts:249-255
Timestamp: 2026-03-21T05:30:28.194Z
Learning: In `src/network.ts` of the `node-tcnet` repository: `TCNetDataPacket.read()` (class defined at line 321, read() at line 330) converts the wire-format 1-based layer to 0-based by doing `this.layer = this.buffer.readUInt8(25) - 1`. In contrast, `TCNetRequestPacket.read()` (class defined at line 225, read() at line 231) does NOT subtract 1: `this.layer = this.buffer.readUInt8(25)`. Therefore, `dataPacket.layer` from a received `TCNetDataPacket` is already 0-based and correctly matches the 0-based key stored in `requestData()`. Flagging a missing `-1` in `TCNetDataPacket.read()` is a false positive.

Applied to files:

  • docs/wiki/API-Reference.md
📚 Learning: 2026-03-20T23:10:22.895Z
Learnt from: 9c5s
Repo: 9c5s/node-tcnet PR: 1
File: lefthook.yml:0-0
Timestamp: 2026-03-20T23:10:22.895Z
Learning: In the `node-tcnet` repository's `lefthook.yml`, the `run` value for jobs must use `>` (YAML folded scalar) and unquoted strings. Using `|` (block scalar) or `"` (double-quoted strings) breaks lefthook's YAML parser on Windows environments. This applies to all job `run` entries in lefthook.yml.

Applied to files:

  • lefthook.yml
🪛 GitHub Actions: CI Checks
.textlintrc.json

[warning] 1-1: Prettier --check reported a formatting issue: "Code style issues found in the above file. Forgot to run Prettier?"

package.json

[error] 1-1: Command failed: "npm run format:check" (exit code 1) because Prettier --check detected formatting problems.

🔇 Additional comments (13)
.changeset/.markdownlint.jsonc (1)

1-3: LGTM!

changesetファイルはYAMLフロントマターで始まるため、first-line-headingルールの無効化は適切。

docs/wiki/Home.md (1)

1-24: LGTM!

構成が明確で、利用者向け・開発者向けセクションが適切に分かれている。GitHub Wiki形式のリンク記法も正しい。

.markdownlint-cli2.jsonc (1)

1-9: LGTM!

日本語ドキュメントに対してline-length無効化は妥当。他のルール無効化もドキュメント用途として合理的な設定。

lefthook.yml (1)

47-54: LGTM!

mdlinttextlintのジョブ追加は適切。既存の単一行コマンドと同じパターンに従っている。excludeパターンも妥当。

package.json (3)

15-15: LGTM!

homepageのURL更新は適切。


30-34: LGTM!

mdlintとtextlintのスクリプト追加は適切。lefthook.ymlのジョブと対象パスが一致している。


45-50: LGTM!

ドキュメントリント用のdevDependencies追加は適切。バージョン指定も妥当。

.github/workflows/wiki-sync.yaml (1)

1-28: 承認します。セキュリティベストプラクティスに従っています。

以下の点が適切に実装されています:

  • SHAでピン固定されたアクション
  • 最小権限の原則(デフォルト{}、ジョブレベルでcontents: writeのみ)
  • persist-credentials: falseによる認証情報の保護
  • 同時実行制御による競合防止

GitHub Wikiへの書き込みに必要なcontents: write権限も正しく設定されています。GitHubのWikiはリポジトリの一部として扱われるため、このパーミッションでWiki用の別リポジトリ(<owner>/<repo>.wiki.git)への書き込みが可能です。Andrew-Chen-Wang/github-wiki-actionは標準的にこの設定で動作します。

docs/wiki/Getting-Started.md (1)

19-41: await 使用形の懸念はREADME側コメントと同一。

同一の根本原因(トップレベル await の環境依存)としてREADMEで指摘済みのため、ここでは重複コメントを避ける。

docs/wiki/TCNet-Protocol.md (1)

160-160: Pitch Bend範囲表記の懸念はImplementation-Status側コメントと同一。

同一根因(UInt16LE上限の誤記)として既に指摘済みのため、ここでは重複扱い。

docs/wiki/PRO-DJ-LINK-Bridge.md (1)

1-79: 実運用に必要な制約と回避策が整理されており有用。

制約・実測値・トラブルシュートの接続が明確で、利用者が詰まりやすい点を先回りできている。

docs/wiki/Contributing.md (1)

1-108: コントリビューション導線が実務的で明確。

環境要件、フック、規約、PR作成時のフォーク注意点まで一連でまとまっており、初回参加者の迷いを減らせる内容。

docs/wiki/API-Reference.md (1)

86-87: API ドキュメントとコード実装は一致しており、修正は不要です。

実装を確認した結果、sendServer メソッド(src/tcnet.ts:339-345)は this.broadcastSocket を使用しており、API リファレンス(86 行目)の説明「ブロードキャストソケット(ポート60000)から送信する」と一貫しています。不一致は存在しません。

			> Likely an incorrect or invalid review comment.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.MD`:
- Around line 31-33: TCNetDataPacketMetadata's property is named data in the
implementation but the README example (and docs/wiki/API-Reference.md Line 197)
uses info; change all uses of meta.info to meta.data in examples and tests and
update the API docs text to state "dataプロパティを持つ" so runtime property access
matches the implementation (search for TCNetDataPacketMetadata, meta.info, and
the README example and replace accordingly).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9b6c510d-18e8-48dd-acb4-1323bc543695

📥 Commits

Reviewing files that changed from the base of the PR and between 2d3aeb8 and fe43d16.

📒 Files selected for processing (9)
  • .changeset/.markdownlint.jsonc
  • .gitignore
  • .markdownlint-cli2.jsonc
  • README.MD
  • commitlint.config.mjs
  • docs/wiki/API-Reference.md
  • docs/wiki/Implementation-Status.md
  • lefthook.yml
  • package.json
📜 Review details
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2026-03-20T23:10:22.895Z
Learnt from: 9c5s
Repo: 9c5s/node-tcnet PR: 1
File: lefthook.yml:0-0
Timestamp: 2026-03-20T23:10:22.895Z
Learning: In the `node-tcnet` repository's `lefthook.yml`, the `run` value for jobs must use `>` (YAML folded scalar) and unquoted strings. Using `|` (block scalar) or `"` (double-quoted strings) breaks lefthook's YAML parser on Windows environments. This applies to all job `run` entries in lefthook.yml.

Applied to files:

  • lefthook.yml
📚 Learning: 2026-03-20T23:04:37.903Z
Learnt from: 9c5s
Repo: 9c5s/node-tcnet PR: 1
File: lefthook.yml:20-28
Timestamp: 2026-03-20T23:04:37.903Z
Learning: In the `node-tcnet` repository's `lefthook.yml`, `bunx` (Bun's package runner) is intentionally used instead of `npx` for `actionlint`, `zizmor`, and `lefthook` commands because: (1) the `actionlint` npm package is only a stale wasm wrapper (last release Dec 2022) and is not executable via `npx`; (2) `zizmor` has no npm package and is only available via PyPI, Cargo, or system package managers; (3) `lefthook` is a Go binary whose npm wrapper has low reliability. `bunx` is the correct and practical choice for these tools in this project.

Applied to files:

  • lefthook.yml
  • package.json
📚 Learning: 2026-03-21T05:30:28.194Z
Learnt from: 9c5s
Repo: 9c5s/node-tcnet PR: 2
File: src/tcnet.ts:249-255
Timestamp: 2026-03-21T05:30:28.194Z
Learning: In `src/network.ts` of the `node-tcnet` repository: `TCNetDataPacket.read()` (class defined at line 321, read() at line 330) converts the wire-format 1-based layer to 0-based by doing `this.layer = this.buffer.readUInt8(25) - 1`. In contrast, `TCNetRequestPacket.read()` (class defined at line 225, read() at line 231) does NOT subtract 1: `this.layer = this.buffer.readUInt8(25)`. Therefore, `dataPacket.layer` from a received `TCNetDataPacket` is already 0-based and correctly matches the 0-based key stored in `requestData()`. Flagging a missing `-1` in `TCNetDataPacket.read()` is a false positive.

Applied to files:

  • docs/wiki/Implementation-Status.md
  • docs/wiki/API-Reference.md
  • README.MD
📚 Learning: 2026-03-21T05:02:24.940Z
Learnt from: 9c5s
Repo: 9c5s/node-tcnet PR: 2
File: src/tcnet.ts:397-400
Timestamp: 2026-03-21T05:02:24.940Z
Learning: In the `node-tcnet` repository (`src/network.ts`, `src/tcnet.ts`), `TCNetDataPacket.write()` has no callers. `TCNetDataPacket` objects are only ever deserialized on receive paths (`read()`), never serialized and sent. The only outbound packet carrying a layer field is `TCNetRequestPacket`, constructed inside `requestData()` in `src/tcnet.ts`. Suggesting to move layer conversion logic into `TCNetDataPacket.write()` is inappropriate because that method is dead code.

Applied to files:

  • docs/wiki/API-Reference.md
  • README.MD
🔇 Additional comments (12)
commitlint.config.mjs (1)

1-6: commitlint設定のESM化とルール調整は妥当です。

Line 1-6 は .mjs 形式・Conventional preset 継承・subject-case 無効化の意図が明確で、フック実行時の設定解決とも整合しています。

.gitignore (1)

25-33: .gitignore の更新内容は目的に沿っており問題ありません。

Line 25・Line 28・Line 33 の変更は、commitlint.config.mjs の追跡、Wiki配下の管理、tsbuildinfo 生成物の包括的除外の観点で適切です。

.changeset/.markdownlint.jsonc (1)

1-3: LGTM!

changesetファイルは自動生成フォーマットのため、first-line-headingルールの無効化は妥当。

.markdownlint-cli2.jsonc (1)

1-9: LGTM!

日本語ドキュメント向けのルール無効化は妥当。特にline-length(日本語の文字数カウント問題)とno-duplicate-heading(セクション名重複許容)は適切な選択。

package.json (2)

28-34: LGTM!

リントスクリプトの追加は適切。mdlintCHANGELOG.mdを除外し、textlintでWikiとREADMEを対象としている点も妥当。


45-50: LGTM!

日本語ドキュメント向けのtextlintプリセット(ja-technical-writing)と追加ルールの選択は適切。

lefthook.yml (2)

32-34: LGTM!

jsonc拡張子の追加でJSONC設定ファイルもPrettierの対象に含まれるようになった。


47-54: LGTM!

mdlinttextlintジョブの追加は適切。npxの使用は正しい(学習によるとbunxactionlintzizmorlefthookのみに使用)。

docs/wiki/API-Reference.md (2)

1-95: LGTM!

API Referenceは包括的で、コードの実装(src/tcnet.tssrc/network.ts)と整合している。メソッドシグネチャ、enum値、パケット構造の記述が正確。


79-87: このコメントは削除してください。

Line 86の説明「内部ではブロードキャストソケット(ポート60000)から送信する」は正確です。src/tcnet.ts:344sendServerメソッドがthis.broadcastSocketを使用していることが確認されました。PR #2の修正が正しく適用されており、ドキュメントと実装に矛盾はありません。

README.MD (1)

1-76: LGTM!

日本語READMEへの翻訳は適切で、Wikiへのリンク、前提条件、機能一覧が明確に記述されている。async function main()ラッパーによりCommonJS/ESM両環境で動作する。

docs/wiki/Implementation-Status.md (1)

1-73: LGTM!

実装状況ドキュメントは詳細で正確。メッセージタイプ、DataPacketタイプ、仕様との差異、PR #2のバグ修正履歴が明確に記述されている。コード実装(src/network.tssrc/tcnet.ts)との整合性も確認できる。

@9c5s 9c5s merged commit dd1e65e into main Mar 21, 2026
2 checks passed
@9c5s 9c5s deleted the docs/github-wiki branch March 21, 2026 11:58
9c5s added a commit that referenced this pull request Mar 24, 2026
- convergeToAdapter()でbroadcastAddress更新 (#1)
- waitConnected()の二重close防止 (#2)
- disconnectSockets()でserver=nullリセット (#3)
- connect()失敗時のソケットクリーンアップ (#4)
- waitConnected()タイムアウトをdetectionTimeoutに変更 (#5)
- detectingAdapterフラグで経路識別を明示化 (#6)
- listNetworkAdapters()の重複呼び出し削減 (#7)
- findIPv4Address()ヘルパーで述語重複を解消 (#8)
- privateフィールドの命名規則統一 (#9)
- announceApp()の検出中送信を並列化 (#10)
- announcementIntervalの型安全性改善 (#11)
- announceApp()のエラーハンドリング追加 (#12)
- selectedAdapterのセット順統一 (#13)
- closeSocketをfunction宣言に変更 (#14)
9c5s added a commit that referenced this pull request Mar 24, 2026
* feat: listNetworkAdapters()の型定義と実装を追加

* feat: TCNetConfiguration拡張と基盤インスタンス変数を追加

* refactor: disconnectSockets()分離とdisconnect()/waitConnected()リファクタリング

* feat: connect()をマルチソケット検出+即resolveに書き換え

- connect()を全non-internal IPv4アダプタにソケット作成する方式に変更
- Master検出を待たず即座にresolveするように変更
- Master OptIn検出時にアダプタ収束(convergeToAdapter)を実装
- 検出タイムアウトでdetectionTimeoutイベントを発火
- connectToAdapter()内部メソッドを追加(switchAdapter用)
- selectedAdapter/isConnectedプロパティを追加
- receiveBroadcastにadapterName引数を追加してマルチソケット対応
- announceApp()にbroadcastSocket nullガードを追加

* feat: announceApp/broadcastPacket/receiveTimestampのガード追加

- announceApp(): 検出中は全broadcastSocketsに送信するマルチソケット対応
- broadcastPacket(): エラーメッセージを "Adapter not yet selected" に統一
- sendServer(): _switchingフラグによるガード追加
- requestData(): _switchingフラグによるガード追加
- receiveTimestamp(): connected未確定時はtimeイベントを発火しないガード追加

* feat: switchAdapter()のバリデーションと切り替えロジックを実装

* test: switchAdapter()のリトライとエッジケーステストを追加

* docs: Wiki更新 - アダプタ自動検出・切り替えAPIの追加

* fix: コードレビュー指摘13件の修正

- convergeToAdapter()でbroadcastAddress更新 (#1)
- waitConnected()の二重close防止 (#2)
- disconnectSockets()でserver=nullリセット (#3)
- connect()失敗時のソケットクリーンアップ (#4)
- waitConnected()タイムアウトをdetectionTimeoutに変更 (#5)
- detectingAdapterフラグで経路識別を明示化 (#6)
- listNetworkAdapters()の重複呼び出し削減 (#7)
- findIPv4Address()ヘルパーで述語重複を解消 (#8)
- privateフィールドの命名規則統一 (#9)
- announceApp()の検出中送信を並列化 (#10)
- announcementIntervalの型安全性改善 (#11)
- announceApp()のエラーハンドリング追加 (#12)
- selectedAdapterのセット順統一 (#13)
- closeSocketをfunction宣言に変更 (#14)

* fix: CodeRabbitレビュー指摘5件の修正とchangeset追加

- waitConnected()のPromiseハング防止 (CR-3)
- switchAdapter()最終リトライ失敗時のクリーンアップ (CR-4)
- broadcastPacket()にswitchingガード追加 (CR-5)
- connect()の再入防止ガード強化 (CR-2)
- findIPv4Address()のAPI Reference記載 (CR-1)
- changeset追加 (minor)

* fix: announceApp()がswitchingガードに阻害される問題を修正

announceApp()が公開APIのbroadcastPacket()/sendServer()を経由していたため、
switchAdapter()中のconnectToAdapter()からの呼び出し時にswitchingガードに
ブロックされていた。内部メソッドのsendPacket()を直接使用するよう変更。

* fix: CodeRabbit 2回目レビュー指摘2件の修正

- requestTimeoutの説明を旧挙動から修正 (CR-new-1)
- waitConnected()にtimeoutMsパラメータ追加、detectionTimeout=0でもhangしない (CR-new-3)
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