コミットするごとにテスト実行・ドキュメント生成・AGENTS.md の自動更新を行うパイプライン
Project description
agents-docs-sync
agents-docs-sync は、ソースコードのコミットごとに自動的に以下を実行するパイプラインです。
- テスト実行 –
pytestを使って単体・統合テストを走らせます。カバレッジはpytest-covで測定し、結果が失敗した場合はコミットをブロックします。 - ドキュメント生成 – プロジェクト内の Markdown / reStructuredText を収集・整形して最新の API ドキュメント(例:Sphinx の
docs/ディレクトリ)へ書き出し、GitHub Actions などで自動公開されます。 - AGENTS.md 自動更新 – YAML 設定ファイルからエージェント情報を抽出し、プロジェクトのルートにある
AGENTS.mdを再生成します。これによりドキュメントと実装が常に同期した状態になります。
主な特徴
| 機能 | 詳細 |
|---|---|
| Python + Shell | パイプラインロジックはシェルスクリプトで書かれ、Python ランタイム(uv で管理)を呼び出します。 |
| 依存関係の宣言 | pyproject.toml に pyyaml, pytest, pytest-cov, pytest-mock 等が列挙されており、CI 環境でも安定してインストール可能です。 |
| 高速な環境構築 | uv install --no-dev で依存のみを解決し、開発時は --dev を付けることでテスト用パッケージも取得します。 |
| 柔軟な設定 | .agents.yaml(または同等の名前)にエージェントごとのメタデータを書き込み、スクリプトが自動で AGENTS.md を更新できます。 |
使い方
# 開発環境をセットアップ
uv sync --dev # 必要なパッケージ(テスト含む)をインストール
# パイプライン手動実行例
./scripts/run_pipeline.sh # テスト → ドキュメント生成 → AGENTS.md 更新
# CI での利用は以下のように YAML に記述します。
# .github/workflows/pipeline.yml
name: Agents Docs Sync
on:
push:
branches: [ main ]
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
run: curl https://astral.sh/uv/install.sh | sh && echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Sync pipeline
run: ./scripts/run_pipeline.sh
開発フロー
- コード変更 –
src/...内で機能追加・修正を行う。 - ローカルテスト & ドキュメント確認 – 上記シェルスクリプトで実行し、生成されたドキュメントや
AGENTS.mdを確認する。 - コミット & プッシュ – コミット時に GitHub Actions が自動的にパイプラインを走らせます。失敗した場合は PR のマージがブロックされ、品質保証になります。
依存関係の概要
| パッケージ | バージョン |
|---|---|
pyyaml |
≥6.0.3 |
pytest |
≥7.4.0 |
pytest-cov |
≥4.1.0 |
pytest-mock |
≥3.11.1 |
これらはすべて Python の仮想環境内で管理され、CI では uv lock によって固定化されています。
このプロジェクトにより、エージェントの実装とドキュメントが常に同期し、開発者間で最新情報を共有できるようになります。ぜひローカル環境や CI パイプラインへ組み込んでご活用ください。
graph TB
%% Auto-generated architecture diagram
subgraph agents_docs_sync [fa:fa-python agents-docs-sync]
direction TB
subgraph docgen [docgen]
direction TB
docgen_collectors["collectors"]:::moduleStyle
subgraph docgen_utils [utils]
direction TB
docgen_utils_llm["llm"]:::moduleStyle
end
class docgen_utils moduleStyle
subgraph docgen_cli [cli]
direction TB
docgen_cli_commands["commands"]:::moduleStyle
end
class docgen_cli moduleStyle
docgen_models["models"]:::moduleStyle
subgraph docgen_archgen [archgen]
direction TB
docgen_archgen_detectors["detectors"]:::moduleStyle
docgen_archgen_generators["generators"]:::moduleStyle
end
class docgen_archgen moduleStyle
docgen_benchmark["benchmark"]:::moduleStyle
docgen_detectors["detectors"]:::moduleStyle
subgraph docgen_generators [generators]
direction TB
docgen_generators_services["services"]:::moduleStyle
docgen_generators_parsers["parsers"]:::moduleStyle
end
class docgen_generators moduleStyle
subgraph docgen_rag [rag]
direction TB
docgen_rag_strategies["strategies"]:::moduleStyle
end
class docgen_rag moduleStyle
docgen_config["config"]:::moduleStyle
end
class docgen moduleStyle
end
docgen_collectors --> docgen_models
docgen_collectors --> docgen_utils
docgen_utils --> docgen_detectors
docgen_utils --> docgen_models
docgen_utils_llm --> docgen_models
docgen_cli --> docgen_archgen
docgen_cli --> docgen_generators
docgen_cli --> docgen_rag
docgen_cli --> docgen_utils
docgen_cli_commands --> docgen_rag
docgen_cli_commands --> docgen_utils
docgen_archgen --> docgen_detectors
docgen_archgen --> docgen_generators
docgen_archgen --> docgen_models
docgen_archgen --> docgen_utils
docgen_archgen_detectors --> docgen_models
docgen_archgen_generators --> docgen_models
docgen_benchmark --> docgen_models
docgen_benchmark --> docgen_utils
docgen_detectors --> docgen_models
docgen_detectors --> docgen_utils
docgen_generators --> docgen_archgen
docgen_generators --> docgen_collectors
docgen_generators --> docgen_detectors
docgen_generators --> docgen_models
docgen_generators --> docgen_utils
docgen_generators_parsers --> docgen_detectors
docgen_generators_parsers --> docgen_models
docgen_generators_parsers --> docgen_utils
docgen_rag --> docgen_utils
docgen_rag_strategies --> docgen_utils
classDef pythonStyle fill:#3776ab,stroke:#ffd43b,stroke-width:2px,color:#fff
classDef dockerStyle fill:#2496ed,stroke:#1d63ed,stroke-width:2px,color:#fff
classDef dbStyle fill:#336791,stroke:#6b9cd6,stroke-width:2px,color:#fff
classDef moduleStyle fill:#f9f9f9,stroke:#333,stroke-width:2px
Services
agents-docs-sync
- Type: python
- Description: コミットするごとにテスト実行・ドキュメント生成・AGENTS.md の自動更新を行うパイプライン
- Dependencies: anthropic, hnswlib, httpx, jinja2, openai, outlines, pip-licenses, psutil, pydantic, pytest, pytest-cov, pytest-mock, pyyaml, ruff, sentence-transformers, torch
使用技術
- Python
- Shell
依存関係
- Python:
pyproject.tomlまたはrequirements.txtを参照
セットアップ
前提条件
- Python 3.12以上
インストール
Python
# uvを使用する場合
uv sync
LLM環境のセットアップ
APIを使用する場合
-
APIキーの取得と設定
- OpenAI APIキーを取得: https://platform.openai.com/api-keys
- 環境変数に設定:
export OPENAI_API_KEY=your-api-key-here
-
API使用時の注意事項
- APIレート制限に注意してください
- コスト管理のために使用量を監視してください
ローカルLLMを使用する場合
-
ローカルLLMのインストール
- Ollamaをインストール: https://ollama.ai/
- モデルをダウンロード:
ollama pull llama3 - サービスを起動:
ollama serve
-
ローカルLLM使用時の注意事項
- モデルが起動していることを確認してください
- ローカルリソース(メモリ、CPU)を監視してください
ビルドおよびテスト
ビルド
uv sync
uv build
uv run python3 docgen/docgen.py
テスト
bash scripts/run_tests.sh
uv run pytest tests/ -v --tb=short
コマンド
プロジェクトで利用可能なスクリプト:
| コマンド | 説明 |
|---|---|
agents_docs_sync |
docgen.docgen:main |
agents-docs-sync |
docgen.docgen:main |
agents_docs_sync のオプション
| オプション | 説明 |
|---|---|
--config |
設定ファイルのパス |
--quiet |
詳細メッセージを抑制 |
--detect-only |
言語検出のみ実行 |
--no-api-doc |
APIドキュメントを生成しない |
--no-readme |
READMEを更新しない |
--build-index |
RAGインデックスをビルド |
--use-rag |
RAGを使用してドキュメント生成 |
--generate-arch |
アーキテクチャ図を生成(Mermaid形式) |
agents-docs-sync のオプション
| オプション | 説明 |
|---|---|
--config |
設定ファイルのパス |
--quiet |
詳細メッセージを抑制 |
--detect-only |
言語検出のみ実行 |
--no-api-doc |
APIドキュメントを生成しない |
--no-readme |
READMEを更新しない |
--build-index |
RAGインデックスをビルド |
--use-rag |
RAGを使用してドキュメント生成 |
--generate-arch |
アーキテクチャ図を生成(Mermaid形式) |
このREADME.mdは自動生成されています。最終更新: 2025-12-24 05:48:47
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agents_docs_sync-0.2.0.tar.gz.
File metadata
- Download URL: agents_docs_sync-0.2.0.tar.gz
- Upload date:
- Size: 371.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b86fc54d8114df8f2fd5e356a865d770e7818a12dcbab6883336056e927ecfe
|
|
| MD5 |
20fdb60715e752cac83777cc524689c3
|
|
| BLAKE2b-256 |
c2d30a080bbc1ef389c1dc27242016c9048824bb0550b1777773e196eb565a14
|
File details
Details for the file agents_docs_sync-0.2.0-py3-none-any.whl.
File metadata
- Download URL: agents_docs_sync-0.2.0-py3-none-any.whl
- Upload date:
- Size: 234.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0e26febcd1fbc19f770a51d6605de2c01489071f974fe1cee75f34556b73ac4
|
|
| MD5 |
7336a30fa6e6c3322ddccccb6b69e941
|
|
| BLAKE2b-256 |
27c42fef55b60c00ea7bb74b9ad4cbdb19ee4c060aa8cec45003f8856c84c709
|