アーキテクチャ
ソースレイアウト
Apothem が src/ レイアウトを使用する理由と、ツリーの構成。
Apothem は PyPA の src-layout を採用し、インポート可能なすべての Python を src/apothem/ 配下に配置しています。
src-layout を採用する理由
- インポートの分離。
import apothemはsrc/がパス上にあるときにのみ解決されるため (エンジンはPYTHONPATH=src python -m apothemとして実行されます)、無関係なディレクトリから 作業ツリーが誤ってインポートされることを防ぎます。 - 自己完結型ランタイム。 Apothem は、依存関係を
src/apothem/_vendor/配下にベンダリングした状態で、 チェックアウトから直接実行されます — インストール手順は必要ありません。 src-layout は、そのインポート可能な面を、リポジトリのツール群、テスト、スクリプトからきれいに分離した状態に保ちます。 - クリーンな配布。 同じレイアウトから、整った形式の sdist と wheel(および任意の
pip install -e .による編集可能インストール)が生成され、その内容は出荷されるものと正確に一致し、 余計なトップレベルモジュールが紛れ込むことはありません。
ツリー構造
src/apothem/
agents/ persistent agent definitions (*.md)
audit/ inventory and provenance tools
benchmarks/ performance benchmarks
cli/ Click CLI (top-level commands listed below the tree)
commands/ slash command definitions (*.md)
conformity/ mechanical gate checkers (*_grep.py)
harnesses/ one sub-package per harness adapter (17 adapters)
hooks/ hook dispatcher + message files
lib/ shared Python library
output-styles/ output-style definitions (*.md)
rules/ behavioral rules (*.md)
schemas/ YAML/JSON schemas
skills/ reusable skill templates (folder/SKILL.md)
statuslines/ status-line config (*.json)
templates/ reusable template artifactsCLI コマンド
以下のリストは、Click のコマンドツリーから生成されます。
The cli/ package registers 14 top-level commands:
apothem backupsapothem completionapothem diffapothem doctorapothem harnessesapothem installapothem migrate-workspaceapothem profileapothem quickstartapothem rollbackapothem statusapothem uninstallapothem updateapothem verify
インポート可能なアーティファクトと設定アーティファクト
src/apothem/ 配下の多くの項目は、Python モジュールではなく Markdown の設定アーティファクトです。
インポート可能な Python の面は次のとおりです。
src/apothem/cli/(apothemエントリーポイントとして公開される Click CLI)src/apothem/harnesses/(17 のハーネスアダプターのサブパッケージ)src/apothem/lib/(共有ライブラリ: プロファイル、レジストリ、マテリアライザー、伝播)src/apothem/hooks/(dispatch.py、lib/)src/apothem/conformity/(機械的な grep スクリプト)src/apothem/audit/(インベントリスクリプト)src/apothem/benchmarks/(パフォーマンスベンチマークのドライバー)