davinci-cli 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. davinci_cli-1.0.1/.claude-plugin/marketplace.json +16 -0
  2. davinci_cli-1.0.1/.github/workflows/ci.yml +59 -0
  3. davinci_cli-1.0.1/.github/workflows/publish.yml +20 -0
  4. davinci_cli-1.0.1/.gitignore +49 -0
  5. davinci_cli-1.0.1/CHANGELOG.md +90 -0
  6. davinci_cli-1.0.1/LICENSE +21 -0
  7. davinci_cli-1.0.1/PKG-INFO +29 -0
  8. davinci_cli-1.0.1/README.ja.md +384 -0
  9. davinci_cli-1.0.1/README.md +384 -0
  10. davinci_cli-1.0.1/plugin/.claude-plugin/plugin.json +19 -0
  11. davinci_cli-1.0.1/plugin/skills/davinci-cli/SKILL.md +307 -0
  12. davinci_cli-1.0.1/pyproject.toml +67 -0
  13. davinci_cli-1.0.1/scripts/check_version_sync.py +75 -0
  14. davinci_cli-1.0.1/scripts/sync_version.py +78 -0
  15. davinci_cli-1.0.1/src/davinci_cli/__init__.py +3 -0
  16. davinci_cli-1.0.1/src/davinci_cli/cli.py +109 -0
  17. davinci_cli-1.0.1/src/davinci_cli/commands/__init__.py +0 -0
  18. davinci_cli-1.0.1/src/davinci_cli/commands/beat_markers.py +239 -0
  19. davinci_cli-1.0.1/src/davinci_cli/commands/clip.py +457 -0
  20. davinci_cli-1.0.1/src/davinci_cli/commands/color.py +1045 -0
  21. davinci_cli-1.0.1/src/davinci_cli/commands/deliver.py +647 -0
  22. davinci_cli-1.0.1/src/davinci_cli/commands/gallery.py +366 -0
  23. davinci_cli-1.0.1/src/davinci_cli/commands/mcp_cmd.py +183 -0
  24. davinci_cli-1.0.1/src/davinci_cli/commands/media.py +673 -0
  25. davinci_cli-1.0.1/src/davinci_cli/commands/project.py +422 -0
  26. davinci_cli-1.0.1/src/davinci_cli/commands/schema.py +58 -0
  27. davinci_cli-1.0.1/src/davinci_cli/commands/system.py +229 -0
  28. davinci_cli-1.0.1/src/davinci_cli/commands/timeline.py +989 -0
  29. davinci_cli-1.0.1/src/davinci_cli/core/__init__.py +0 -0
  30. davinci_cli-1.0.1/src/davinci_cli/core/connection.py +79 -0
  31. davinci_cli-1.0.1/src/davinci_cli/core/edition.py +77 -0
  32. davinci_cli-1.0.1/src/davinci_cli/core/environment.py +92 -0
  33. davinci_cli-1.0.1/src/davinci_cli/core/exceptions.py +104 -0
  34. davinci_cli-1.0.1/src/davinci_cli/core/logging.py +66 -0
  35. davinci_cli-1.0.1/src/davinci_cli/core/validation.py +118 -0
  36. davinci_cli-1.0.1/src/davinci_cli/decorators.py +86 -0
  37. davinci_cli-1.0.1/src/davinci_cli/mcp/__init__.py +0 -0
  38. davinci_cli-1.0.1/src/davinci_cli/mcp/instructions.py +66 -0
  39. davinci_cli-1.0.1/src/davinci_cli/mcp/mcp_server.py +1671 -0
  40. davinci_cli-1.0.1/src/davinci_cli/output/__init__.py +0 -0
  41. davinci_cli-1.0.1/src/davinci_cli/output/formatter.py +70 -0
  42. davinci_cli-1.0.1/src/davinci_cli/schema_registry.py +21 -0
  43. davinci_cli-1.0.1/tests/__init__.py +0 -0
  44. davinci_cli-1.0.1/tests/e2e/__init__.py +0 -0
  45. davinci_cli-1.0.1/tests/e2e/mock_resolve.py +76 -0
  46. davinci_cli-1.0.1/tests/e2e/test_smoke.py +173 -0
  47. davinci_cli-1.0.1/tests/mocks/__init__.py +0 -0
  48. davinci_cli-1.0.1/tests/mocks/resolve_mock.py +175 -0
  49. davinci_cli-1.0.1/tests/unit/__init__.py +0 -0
  50. davinci_cli-1.0.1/tests/unit/test_beat_markers.py +422 -0
  51. davinci_cli-1.0.1/tests/unit/test_ci_config.py +41 -0
  52. davinci_cli-1.0.1/tests/unit/test_cli.py +121 -0
  53. davinci_cli-1.0.1/tests/unit/test_clip.py +222 -0
  54. davinci_cli-1.0.1/tests/unit/test_color.py +550 -0
  55. davinci_cli-1.0.1/tests/unit/test_connection.py +83 -0
  56. davinci_cli-1.0.1/tests/unit/test_decorators.py +86 -0
  57. davinci_cli-1.0.1/tests/unit/test_deliver.py +408 -0
  58. davinci_cli-1.0.1/tests/unit/test_e2e_api_audit.py +829 -0
  59. davinci_cli-1.0.1/tests/unit/test_edition.py +126 -0
  60. davinci_cli-1.0.1/tests/unit/test_environment.py +105 -0
  61. davinci_cli-1.0.1/tests/unit/test_exceptions.py +85 -0
  62. davinci_cli-1.0.1/tests/unit/test_formatter.py +104 -0
  63. davinci_cli-1.0.1/tests/unit/test_gallery.py +303 -0
  64. davinci_cli-1.0.1/tests/unit/test_logging.py +56 -0
  65. davinci_cli-1.0.1/tests/unit/test_mcp_cmd.py +292 -0
  66. davinci_cli-1.0.1/tests/unit/test_mcp_server.py +538 -0
  67. davinci_cli-1.0.1/tests/unit/test_media.py +339 -0
  68. davinci_cli-1.0.1/tests/unit/test_project.py +246 -0
  69. davinci_cli-1.0.1/tests/unit/test_project_setup.py +22 -0
  70. davinci_cli-1.0.1/tests/unit/test_resolve_mock.py +66 -0
  71. davinci_cli-1.0.1/tests/unit/test_schema.py +71 -0
  72. davinci_cli-1.0.1/tests/unit/test_skill_md.py +48 -0
  73. davinci_cli-1.0.1/tests/unit/test_system.py +159 -0
  74. davinci_cli-1.0.1/tests/unit/test_timeline.py +556 -0
  75. davinci_cli-1.0.1/tests/unit/test_validation.py +154 -0
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "davinci-cli",
3
+ "owner": {
4
+ "name": "M.Endo",
5
+ "email": "motoki@clockwork-sound.com"
6
+ },
7
+ "plugins": [
8
+ {
9
+ "name": "davinci-cli",
10
+ "source": "./plugin",
11
+ "description": "DaVinci Resolve CLI / MCP — agent-first interface for full Resolve control",
12
+ "version": "1.0.1"
13
+ }
14
+ ],
15
+ "version": "1.0.1"
16
+ }
@@ -0,0 +1,59 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ check-version:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: actions/setup-python@v5
15
+ with:
16
+ python-version: "3.12"
17
+ - run: python scripts/check_version_sync.py
18
+
19
+ test:
20
+ runs-on: ${{ matrix.os }}
21
+ strategy:
22
+ matrix:
23
+ os: [macos-latest, windows-latest]
24
+ python-version: ["3.10", "3.11", "3.12"]
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ - uses: actions/setup-python@v5
28
+ with:
29
+ python-version: ${{ matrix.python-version }}
30
+ - name: Install dependencies
31
+ run: pip install -e ".[dev]"
32
+ - name: Run pytest
33
+ run: python -m pytest tests/unit/ -v --tb=short --cov=davinci_cli --cov-report=term-missing
34
+
35
+ lint:
36
+ runs-on: ubuntu-latest
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+ - uses: actions/setup-python@v5
40
+ with:
41
+ python-version: "3.12"
42
+ - name: Install dependencies
43
+ run: pip install -e ".[dev]"
44
+ - name: Run ruff check
45
+ run: ruff check src/ tests/
46
+ - name: Run ruff format check
47
+ run: ruff format --check src/ tests/
48
+
49
+ type-check:
50
+ runs-on: ubuntu-latest
51
+ steps:
52
+ - uses: actions/checkout@v4
53
+ - uses: actions/setup-python@v5
54
+ with:
55
+ python-version: "3.12"
56
+ - name: Install dependencies
57
+ run: pip install -e ".[dev]"
58
+ - name: Run mypy
59
+ run: mypy src/davinci_cli/
@@ -0,0 +1,20 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.12"
18
+ - run: pip install build
19
+ - run: python -m build
20
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,49 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ *.egg
7
+ dist/
8
+ build/
9
+ *.whl
10
+
11
+ # Virtual environments
12
+ .venv/
13
+ venv/
14
+ env/
15
+
16
+ # IDE
17
+ .idea/
18
+ .vscode/
19
+ *.swp
20
+ *.swo
21
+ *~
22
+
23
+ # Testing
24
+ .pytest_cache/
25
+ .coverage
26
+ htmlcov/
27
+ .mypy_cache/
28
+ .ruff_cache/
29
+
30
+ # OS
31
+ .DS_Store
32
+ Thumbs.db
33
+
34
+ # Environment
35
+ .env
36
+ .env.local
37
+
38
+ # Dev-only (internal plans, handover notes)
39
+ HANDOVER.md
40
+ CLAUDE.md
41
+ docs/plans/
42
+ tests/smoke_test_real.py
43
+ 2026-*.md
44
+
45
+ # Worktrees
46
+ .worktrees/
47
+
48
+ # Claude Code
49
+ .claude/
@@ -0,0 +1,90 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [1.0.1] - 2026-03-09
6
+
7
+ ### Added
8
+ - `dr mcp install/uninstall/status/test` — Claude Desktop / Cowork 設定ファイルへの MCP サーバー自動登録 (lightroom-cli と UX 統一)
9
+ - Claude Code Marketplace 対応 (`marketplace.json`, `plugin.json`)
10
+ - バージョン同期スクリプトが Marketplace JSON もカバー
11
+
12
+ ### Fixed
13
+ - Linux の Claude config パスのケーシング修正 (`claude` → `Claude`)
14
+ - `test_dr_version` のバージョンハードコード除去
15
+
16
+ ### Changed
17
+ - README を lightroom-cli 構成に合わせて全面改訂 (Architecture 図、Option A/B/C、Project Structure 等)
18
+ - 内部ドキュメント (`docs/plans/`) をリポジトリから除外
19
+
20
+ ## [1.0.0] - 2026-03-09
21
+
22
+ Initial public release — CLI and MCP server wrapping the DaVinci Resolve Python API with an agent-first design.
23
+
24
+ ### Highlights
25
+ - **CLI tool (`dr`)** with 9 command groups covering ~90 operations
26
+ - **MCP Server** with ~90 tools for AI agent integration (FastMCP)
27
+ - **Agent-first design** — `--json` input, `--fields` filtering, `--dry-run` preview, `dr schema` for runtime discovery
28
+ - **Environment auto-detection** for macOS and Windows (Linux not yet supported)
29
+ - **536+ tests** (unit + E2E smoke tests)
30
+
31
+ ### Added
32
+
33
+ #### Command Groups
34
+ - **system** — `ping`, `version`, `edition`, `info`, `page get/set`, `keyframe-mode get/set`
35
+ - **project** — `list`, `open`, `close`, `create`, `delete`, `save`, `info`, `settings`, `rename`
36
+ - **timeline** — `list`, `current`, `switch`, `create`, `delete`, `export`, `marker list/add/delete`, `timecode get/set`, `current-item`, `track list/add/delete/enable/lock`, `duplicate`, `detect-scene-cuts`, `create-subtitles`
37
+ - **clip** — `list`, `info`, `select`, `property get/set`, `enable`, `color get/set/clear`, `flag add/list/clear`
38
+ - **color** — `apply-lut`, `reset`, `reset-all`, `copy-grade`, `version list/current/add/load/delete/rename`, `node list/lut-set/lut-get/enable`, `cdl set`, `lut-export`, `still list/grab`
39
+ - **media** — `list`, `import`, `move`, `delete`, `relink`, `unlink`, `metadata get/set`, `export-metadata`, `transcribe`, `folder list/create/delete`
40
+ - **deliver** — `presets list/load`, `add-job`, `list-jobs`, `start`, `stop`, `status`, `delete-job`, `delete-all-jobs`, `job-status`, `is-rendering`, `format list`, `codec list`, `preset import/export`
41
+ - **gallery** — `album list/current/set/create`, `still list/grab/export/import/delete`
42
+ - **schema** — `show`, `list` for runtime JSON Schema discovery
43
+
44
+ #### Special Features
45
+ - **Beat markers** — `dr timeline marker beats` for BPM-based marker placement on clips
46
+
47
+ #### MCP Server
48
+ - **~90 MCP tools** — all `_impl` functions exposed via FastMCP for Claude Desktop / AI agent integration
49
+ - **Agent instruction guide** — built-in Getting Started, Safety Rules, Error Recovery, and Workflow documentation
50
+ - **English metadata tags** on all tool descriptions for better agent comprehension
51
+
52
+ #### Agent-First Design
53
+ - **`--json` input** — structured JSON input via Pydantic v2 models for all commands
54
+ - **`--fields` filter** — select specific output fields (`--fields name,fps`)
55
+ - **`--dry-run`** — preview destructive operations before execution
56
+ - **Schema registry** — `dr schema show <command>` returns JSON Schema for any command
57
+ - **Structured error output** — typed exceptions with consistent exit codes (1-5)
58
+ - **Output format auto-detection** — NDJSON when piped, JSON for dicts, Rich tables for TTY
59
+
60
+ #### Environment & Platform
61
+ - **macOS/Windows auto-detection** — `RESOLVE_SCRIPT_API`, `RESOLVE_SCRIPT_LIB`, `RESOLVE_MODULES` environment variables set automatically
62
+ - **Free/Studio edition detection** — `core/edition.py` identifies DaVinci Resolve edition
63
+
64
+ ### Technical
65
+
66
+ #### Architecture
67
+ - **`_impl` pure function pattern** — all business logic in `<command>_impl()` functions, shared by both CLI (Click) and MCP (FastMCP) entry points
68
+ - **Environment-Injected Direct Call** — connects to DaVinci Resolve Python API via environment variables (no socket/HTTP bridge)
69
+ - **Click CLI framework** with `DavinciCLIGroup` for global error handling
70
+ - **Common decorators** — `@json_input_option`, `@fields_option`, `@dry_run_option` for consistent command interfaces
71
+ - **lru_cache connection** — Resolve API connection cached with `clear_resolve_cache()` for test isolation
72
+
73
+ #### Dependencies
74
+ - Python 3.10+, Click, FastMCP, Pydantic v2, Rich, pytest
75
+
76
+ #### Security
77
+ - **Path traversal protection** — segment-level `..` detection in `core/validation.py`
78
+ - **Input validation** — Pydantic v2 models with type coercion and constraint enforcement
79
+ - **Injection prevention** — null byte and suspicious pattern rejection
80
+ - **API return value checking** — all mutating Resolve API calls verify return values to prevent false success reports
81
+
82
+ #### Testing
83
+ - **536+ tests** — unit tests and E2E smoke tests
84
+ - **MockResolve** — full Resolve API mock in `tests/mocks/resolve_mock.py` for testing without DaVinci Resolve
85
+ - **E2E smoke tests** — all command groups exercised against MockResolve
86
+
87
+ #### CI/CD
88
+ - **GitHub Actions** — pytest + ruff + mypy (strict mode) on macOS and Windows matrix
89
+ - **Linting** — ruff with RUF002/RUF003 exclusions for Japanese strings
90
+ - **Type checking** — mypy in strict mode
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 M.Endo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.4
2
+ Name: davinci-cli
3
+ Version: 1.0.1
4
+ Summary: DaVinci Resolve CLI / MCP — agent-first design
5
+ Project-URL: Homepage, https://github.com/znznzna/davinci-cli
6
+ Project-URL: Repository, https://github.com/znznzna/davinci-cli
7
+ Project-URL: Issues, https://github.com/znznzna/davinci-cli/issues
8
+ Author: M.Endo
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: MacOS
14
+ Classifier: Operating System :: Microsoft :: Windows
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Multimedia :: Video
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: click>=8.1
22
+ Requires-Dist: fastmcp>=0.1
23
+ Requires-Dist: pydantic>=2.0
24
+ Requires-Dist: rich>=13.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: mypy>=1.10; extra == 'dev'
27
+ Requires-Dist: pytest-cov; extra == 'dev'
28
+ Requires-Dist: pytest>=7.0; extra == 'dev'
29
+ Requires-Dist: ruff>=0.4; extra == 'dev'
@@ -0,0 +1,384 @@
1
+ [English](README.md)
2
+
3
+ # davinci-cli
4
+
5
+ [![CI](https://github.com/znznzna/davinci-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/znznzna/davinci-cli/actions/workflows/ci.yml)
6
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
+
9
+ **DaVinci Resolve をコマンドラインから完全操作 — エージェントファースト設計、約90コマンド。**
10
+
11
+ プロジェクト管理、タイムライン操作、クリップ編集、カラーグレーディング、メディアプール、レンダリング、ギャラリー操作を CLI または AI エージェント経由で制御できます。`_impl` 関数パターンにより CLI (Click) と MCP (FastMCP) でロジックを共有しています。
12
+
13
+ ## Architecture
14
+
15
+ ```
16
+ +---------------------+ Python Scripting API +--------------+
17
+ | DaVinci Resolve |<----------------------------->| Python SDK |
18
+ | (Free / Studio) | Direct API connection | |
19
+ +---------------------+ +------+-------+
20
+ |
21
+ +----------+----------+
22
+ | |
23
+ +------+-------+ +------+------+
24
+ | CLI (dr) | | MCP Server |
25
+ | Click app | | (dr-mcp) |
26
+ +--------------+ +-------------+
27
+ ```
28
+
29
+ CLI と MCP サーバーは DaVinci Resolve の Python スクリプティング API に直接接続します。プラグインのインストールは不要です — DaVinci Resolve が起動していれば OK です。
30
+
31
+ ## Quick Start
32
+
33
+ ### Prerequisites
34
+
35
+ - **Python 3.10+**
36
+ - **DaVinci Resolve** (Free または Studio、起動済みであること)
37
+ - macOS / Windows
38
+
39
+ ### Installation
40
+
41
+ ```bash
42
+ pip install davinci-cli
43
+ ```
44
+
45
+ DaVinci Resolve がインストール・起動済みである必要があります。CLI はスクリプティング API に直接接続するため、プラグインのインストールは不要です。
46
+
47
+ ### Upgrading
48
+
49
+ ```bash
50
+ pip install --upgrade davinci-cli
51
+ ```
52
+
53
+ ### 利用方法を選択
54
+
55
+ #### Option A: Claude Code(SKILL ベース)
56
+
57
+ **Claude Code** ユーザー向け — Claude Code Plugin をインストールすると、エージェントが SKILL ファイルを通じて全約90コマンドを発見・利用できます:
58
+
59
+ ```bash
60
+ /plugin marketplace add znznzna/davinci-cli
61
+ /plugin install davinci-cli@davinci-cli
62
+ ```
63
+
64
+ エージェントは `SKILL.md` を読んで利用可能なコマンド、パラメータ、ワークフローを把握します。手動でコマンドを打つ必要はありません。
65
+
66
+ #### Option B: Claude Desktop / Cowork(MCP Server)
67
+
68
+ **Claude Desktop** または **Cowork** ユーザー向け — MCP サーバーを登録してください:
69
+
70
+ ```bash
71
+ dr mcp install
72
+ ```
73
+
74
+ Claude Desktop / Cowork を再起動してください。全約90コマンドが snake_case 命名の MCP ツールとして利用可能です(例: `project_open`, `clip_list`)。
75
+
76
+ MCP のステータス確認:
77
+
78
+ ```bash
79
+ dr mcp status
80
+ dr mcp test # DaVinci Resolve への接続テスト
81
+ ```
82
+
83
+ CLI との主な違い:
84
+
85
+ - 変更系ツールはデフォルト `dry_run=True`(CLI のデフォルトは `False`)
86
+ - ツール説明にメタデータタグ付き: `[risk_level]`, `[mutating]`, `[supports_dry_run]`
87
+ - エージェント向けオンボーディング命令を内蔵
88
+
89
+ #### Option C: 直接 CLI / スクリプト
90
+
91
+ `dr` コマンドを直接使ってシェルスクリプトや自動化に活用できます:
92
+
93
+ ```bash
94
+ dr system ping
95
+ dr project list --fields name
96
+ dr color apply-lut 1 /path/to/lut.cube --dry-run
97
+ ```
98
+
99
+ ### 接続確認
100
+
101
+ 1. DaVinci Resolve を起動
102
+ 2. 以下のコマンドを実行:
103
+
104
+ ```bash
105
+ dr system ping
106
+ # -> pong
107
+
108
+ dr system info
109
+ # -> バージョン、エディション、現在のプロジェクト、現在のページ
110
+ ```
111
+
112
+ ## Usage Examples
113
+
114
+ ```bash
115
+ # プロジェクト一覧
116
+ dr project list --fields name
117
+
118
+ # プロジェクトを開く (まず dry-run)
119
+ dr project open "MyProject" --dry-run
120
+ dr project open "MyProject"
121
+
122
+ # タイムラインとクリップの一覧
123
+ dr timeline list --fields name
124
+ dr clip list --fields index,name
125
+
126
+ # カラーグレーディング (必ずバージョンを先に作成 — Undo 機能はありません)
127
+ dr color version add 1 "before-edit"
128
+ dr color apply-lut 1 /path/to/lut.cube
129
+ dr color copy-grade --from 1 --to 2
130
+
131
+ # メディアプール
132
+ dr media list --fields clip_name,file_path
133
+ dr media folder create "B-Roll"
134
+ dr media import /path/to/file.mov
135
+
136
+ # レンダリング
137
+ dr deliver preset list
138
+ dr deliver preset load "YouTube 1080p"
139
+ dr deliver add-job --json '{"output_dir": "/output", "filename": "final"}'
140
+ dr deliver start
141
+
142
+ # スキーマ探索 (エージェント向け)
143
+ dr schema list
144
+ dr schema show project.open
145
+ ```
146
+
147
+ ## Command Groups
148
+
149
+ | Group | Commands | Description |
150
+ |-------|----------|-------------|
151
+ | [`dr system`](#dr-system) | 6 | 接続確認、バージョン/エディション情報、ページ・キーフレームモード制御 |
152
+ | [`dr project`](#dr-project) | 9 | 一覧、開く、閉じる、作成、削除、保存、リネーム、情報、設定 |
153
+ | [`dr timeline`](#dr-timeline) | 15+ | 一覧、切替、作成、削除、エクスポート、マーカー、タイムコード、トラック、複製、シーンカット、字幕 |
154
+ | [`dr clip`](#dr-clip) | 9+ | 一覧、情報、選択、プロパティ、有効/無効、カラーラベル、フラグ |
155
+ | [`dr color`](#dr-color) | 14+ | LUT 適用、グレードリセット/コピー、カラーバージョン、ノード LUT、CDL、LUT エクスポート、スチル |
156
+ | [`dr media`](#dr-media) | 13+ | インポート、一覧、移動、削除、リリンク、メタデータ、文字起こし、フォルダ |
157
+ | [`dr deliver`](#dr-deliver) | 14+ | レンダープリセット、ジョブ、開始/停止、ステータス、フォーマット/コーデック、プリセット読込/書出 |
158
+ | [`dr gallery`](#dr-gallery) | 9 | ギャラリーアルバム (一覧/現在/設定/作成)、スチル (一覧/グラブ/エクスポート/インポート/削除) |
159
+ | [`dr schema`](#dr-schema) | 2 | コマンド探索: 全コマンド一覧、JSON Schema 表示 |
160
+
161
+ ### dr system
162
+
163
+ ```bash
164
+ dr system ping # 接続テスト
165
+ dr system version # API バージョン
166
+ dr system edition # Free or Studio
167
+ dr system info # 全システム情報
168
+ dr system page get # 現在のページ (Edit, Color 等)
169
+ dr system keyframe-mode get # キーフレームモード
170
+ ```
171
+
172
+ ### dr project
173
+
174
+ ```bash
175
+ dr project list --fields name # プロジェクト一覧
176
+ dr project open "Name" --dry-run # 開く (プレビュー)
177
+ dr project open "Name" # プロジェクトを開く
178
+ dr project close # プロジェクトを閉じる
179
+ dr project create "Name" --dry-run # 作成 (プレビュー)
180
+ dr project save # 保存
181
+ dr project info # プロジェクト詳細
182
+ dr project settings # プロジェクト設定
183
+ dr project rename "NewName" # リネーム
184
+ ```
185
+
186
+ ### dr timeline
187
+
188
+ ```bash
189
+ dr timeline list --fields name # タイムライン一覧
190
+ dr timeline current # 現在のタイムライン情報
191
+ dr timeline switch "Name" # タイムライン切替
192
+ dr timeline create "Name" # タイムライン作成
193
+ dr timeline delete "Name" --dry-run # 削除 (プレビュー)
194
+ dr timeline marker list # マーカー一覧
195
+ dr timeline marker add --frame 100 --name "Note" --color Blue
196
+ dr timeline timecode get # タイムコード取得
197
+ dr timeline track list # トラック一覧
198
+ dr timeline duplicate # タイムライン複製
199
+ ```
200
+
201
+ ### dr clip
202
+
203
+ ```bash
204
+ dr clip list --fields index,name # クリップ一覧
205
+ dr clip info 1 # クリップ詳細
206
+ dr clip select 1 # クリップ選択
207
+ dr clip property get 1 "Pan" # プロパティ取得
208
+ dr clip enable 1 --toggle # 有効/無効トグル
209
+ dr clip color set 1 Orange # カラーラベル設定
210
+ dr clip flag add 1 --flag-color Blue
211
+ ```
212
+
213
+ ### dr color
214
+
215
+ ```bash
216
+ dr color apply-lut 1 /path/to/lut.cube --dry-run
217
+ dr color reset 1 # グレードリセット
218
+ dr color copy-grade --from 1 --to 2 # グレードコピー
219
+ dr color version list 1 # バージョン一覧
220
+ dr color version add 1 "checkpoint" # バージョン保存
221
+ dr color version load 1 "checkpoint"
222
+ dr color node list 1 # ノード一覧
223
+ dr color cdl set 1 --slope 1.1,1.0,0.9
224
+ dr color still grab 1 # スチルグラブ
225
+ ```
226
+
227
+ ### dr media
228
+
229
+ ```bash
230
+ dr media list --fields clip_name,file_path
231
+ dr media import /path/to/file.mov
232
+ dr media folder create "B-Roll"
233
+ dr media folder list
234
+ dr media move --clip-names "file.mov" --target-folder "B-Roll"
235
+ dr media metadata get <clip> "Clip Name"
236
+ dr media transcribe <clip>
237
+ ```
238
+
239
+ ### dr deliver
240
+
241
+ ```bash
242
+ dr deliver preset list # プリセット一覧
243
+ dr deliver preset load "YouTube 1080p"
244
+ dr deliver add-job --json '{"output_dir": "/output", "filename": "final"}'
245
+ dr deliver start --dry-run # レンダー (プレビュー)
246
+ dr deliver start # レンダー開始
247
+ dr deliver status # 進捗確認
248
+ dr deliver stop # レンダー停止
249
+ dr deliver format list # 利用可能なフォーマット
250
+ dr deliver codec list "mp4" # フォーマットのコーデック
251
+ ```
252
+
253
+ ### dr gallery
254
+
255
+ ```bash
256
+ dr gallery album list # アルバム一覧
257
+ dr gallery album current # 現在のアルバム
258
+ dr gallery album set "Stills" # アルバム設定
259
+ dr gallery album create "New Album"
260
+ dr gallery still list # スチル一覧
261
+ dr gallery still export --folder-path /output --format png
262
+ ```
263
+
264
+ ### dr schema
265
+
266
+ ```bash
267
+ dr schema list # 全コマンド一覧
268
+ dr schema show project.open # コマンドの JSON Schema
269
+ ```
270
+
271
+ ## Global Options
272
+
273
+ ```bash
274
+ dr --pretty ... # Rich フォーマット出力 (TTY のみ)
275
+ dr --fields f1,f2 ... # 出力フィールドのフィルタ
276
+ dr --json '{...}' ... # JSON 構造化入力
277
+ dr --dry-run ... # 破壊的操作のプレビュー
278
+ ```
279
+
280
+ ## Configuration
281
+
282
+ | 環境変数 | 説明 |
283
+ |---------|------|
284
+ | `RESOLVE_SCRIPT_API` | DaVinci Resolve スクリプティング API のパス |
285
+ | `RESOLVE_SCRIPT_LIB` | DaVinci Resolve 共有ライブラリのパス |
286
+ | `RESOLVE_MODULES` | DaVinci Resolve Python モジュールのパス |
287
+
288
+ macOS / Windows では未設定時に自動検出されます。
289
+
290
+ ## Features
291
+
292
+ - **エージェントファースト設計** — JSON 構造化 I/O、`--json` 入力、`--fields` フィルタ、`--dry-run` による破壊的操作の事前確認
293
+ - **スキーマファースト探索** — `dr schema list` / `dr schema show <command>` でランタイム JSON Schema を取得
294
+ - **出力形式自動判定** — パイプ/エージェント向け NDJSON、TTY 向け Rich テーブル
295
+ - **環境自動設定** — macOS / Windows で DaVinci Resolve API パスを自動検出
296
+ - **Pydantic v2 バリデーション** — パストラバーサル・インジェクション防御付き
297
+ - **MCP Server** — Claude Desktop および Cowork とのネイティブ連携
298
+
299
+ ## Known Limitations
300
+
301
+ - **DaVinci Resolve API に Undo はありません** — 全書き込み操作は不可逆です。必ず `--dry-run` を使い、グレーディング前にカラーバージョンを作成してください。
302
+ - **ExportStills API バグ** — DaVinci Resolve 20.x の `ExportStills()` は実際の成否に関わらず常に `False` を返します。
303
+ - **ビートマーカー** — 整数フレーム丸めにより +/-0.5 フレーム (+/-21ms @24fps) のタイミングオフセットが発生します。
304
+ - **MediaStorage / Fusion 非対応** — メディア操作は MediaPool API のみ使用します。
305
+ - **Studio 限定機能** — 一部の操作は DaVinci Resolve Studio (有料版) が必要です。`dr system edition` で確認してください。
306
+
307
+ ## Development
308
+
309
+ ### コントリビューター向け
310
+
311
+ > **一般ユーザーはこのセクションをスキップしてください。** `pip install davinci-cli` だけで利用できます。
312
+
313
+ ```bash
314
+ git clone https://github.com/znznzna/davinci-cli.git
315
+ cd davinci-cli
316
+ pip install -e ".[dev]"
317
+ ```
318
+
319
+ ```bash
320
+ # テスト実行
321
+ python -m pytest tests/unit/ -v
322
+
323
+ # カバレッジ付き
324
+ python -m pytest tests/unit/ -v --cov=davinci_cli
325
+
326
+ # Lint
327
+ ruff check src/ tests/
328
+
329
+ # 型チェック
330
+ mypy src/
331
+ ```
332
+
333
+ ## Project Structure
334
+
335
+ ```
336
+ davinci-cli/
337
+ ├── src/davinci_cli/ # メインパッケージ
338
+ │ ├── cli.py # Click エントリポイント (dr コマンド)
339
+ │ ├── schema_registry.py # コマンド → Pydantic Schema マッピング
340
+ │ ├── decorators.py # 共有デコレータ
341
+ │ ├── core/ # 接続・環境・バリデーション・例外
342
+ │ │ ├── connection.py # lru_cache Resolve API 接続
343
+ │ │ ├── environment.py # macOS/Windows 自動検出
344
+ │ │ ├── validation.py # パストラバーサル / インジェクション防御
345
+ │ │ ├── exceptions.py # DavinciCLIError 階層 (exit codes)
346
+ │ │ └── edition.py # Free/Studio 判定
347
+ │ ├── output/
348
+ │ │ └── formatter.py # NDJSON / JSON / Rich 自動判定
349
+ │ ├── commands/ # コマンドグループ
350
+ │ │ ├── system.py # dr system
351
+ │ │ ├── project.py # dr project
352
+ │ │ ├── timeline.py # dr timeline
353
+ │ │ ├── clip.py # dr clip
354
+ │ │ ├── color.py # dr color
355
+ │ │ ├── media.py # dr media
356
+ │ │ ├── deliver.py # dr deliver
357
+ │ │ ├── gallery.py # dr gallery
358
+ │ │ └── schema.py # dr schema
359
+ │ └── mcp/
360
+ │ ├── mcp_server.py # FastMCP サーバー (約90ツール、_impl 再利用)
361
+ │ └── instructions.py # エージェントオンボーディング命令
362
+ ├── tests/ # pytest テストスイート
363
+ ├── plugin/ # Claude Code Plugin
364
+ │ └── skills/davinci-cli/
365
+ │ └── SKILL.md # エージェントスキルファイル
366
+ └── scripts/ # バージョン同期ユーティリティ
367
+ ```
368
+
369
+ ## Requirements
370
+
371
+ - Python >= 3.10
372
+ - DaVinci Resolve (Free または Studio)
373
+ - macOS / Windows
374
+
375
+ ### Python Dependencies
376
+
377
+ - [click](https://click.palletsprojects.com/) >= 8.1 — CLI フレームワーク
378
+ - [rich](https://rich.readthedocs.io/) >= 13.0 — テーブル出力
379
+ - [pydantic](https://docs.pydantic.dev/) >= 2.0 — データバリデーション
380
+ - [fastmcp](https://github.com/jlowin/fastmcp) >= 0.1 — MCP サーバーフレームワーク
381
+
382
+ ## License
383
+
384
+ [MIT](LICENSE)