ae-agent-setup 0.2.0

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 (34) hide show
  1. package/CSXS/manifest.xml +44 -0
  2. package/README.ja.md +249 -0
  3. package/README.md +249 -0
  4. package/bin/ae-agent-setup.mjs +337 -0
  5. package/client/CSInterface.js +1291 -0
  6. package/client/index.html +64 -0
  7. package/client/lib/bridge_utils.js +56 -0
  8. package/client/lib/logging.js +10 -0
  9. package/client/lib/request_handlers.js +468 -0
  10. package/client/lib/request_handlers_essential.js +35 -0
  11. package/client/lib/request_handlers_layer_structure.js +180 -0
  12. package/client/lib/request_handlers_scene.js +38 -0
  13. package/client/lib/request_handlers_shape.js +288 -0
  14. package/client/lib/request_handlers_timeline.js +115 -0
  15. package/client/lib/runtime.js +35 -0
  16. package/client/lib/server.js +33 -0
  17. package/client/main.js +1 -0
  18. package/host/index.jsx +11 -0
  19. package/host/json2.js +504 -0
  20. package/host/lib/common.jsx +128 -0
  21. package/host/lib/mutation_handlers.jsx +358 -0
  22. package/host/lib/mutation_keyframe_handlers.jsx +265 -0
  23. package/host/lib/mutation_layer_structure_handlers.jsx +235 -0
  24. package/host/lib/mutation_scene_handlers.jsx +1226 -0
  25. package/host/lib/mutation_shape_handlers.jsx +358 -0
  26. package/host/lib/mutation_timeline_handlers.jsx +137 -0
  27. package/host/lib/property_utils.jsx +105 -0
  28. package/host/lib/query_handlers.jsx +427 -0
  29. package/package.json +21 -0
  30. package/scripts/signing/build-zxp.sh +56 -0
  31. package/scripts/signing/create-dev-cert.sh +97 -0
  32. package/scripts/signing/install-zxp.sh +29 -0
  33. package/templates/skills/aftereffects-cli.SKILL.md +74 -0
  34. package/templates/skills/aftereffects-declarative.SKILL.md +112 -0
@@ -0,0 +1,44 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ExtensionManifest Version="7.0" ExtensionBundleId="com.yumehiko.aeagentskill" ExtensionBundleVersion="0.2.0" ExtensionBundleName="ae-agent-skill" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3
+ <ExtensionList>
4
+ <Extension Id="com.yumehiko.aeagentskill.panel" Version="0.2.0" />
5
+ </ExtensionList>
6
+ <ExecutionEnvironment>
7
+ <HostList>
8
+ <Host Name="AEFT" Version="[13.0,99.9]" />
9
+ </HostList>
10
+ <LocaleList>
11
+ <Locale Code="All" />
12
+ </LocaleList>
13
+ <RequiredRuntimeList>
14
+ <RequiredRuntime Name="CSXS" Version="7.0" />
15
+ </RequiredRuntimeList>
16
+ </ExecutionEnvironment>
17
+ <DispatchInfoList>
18
+ <Extension Id="com.yumehiko.aeagentskill.panel">
19
+ <DispatchInfo>
20
+ <Resources>
21
+ <MainPath>./client/index.html</MainPath>
22
+ <ScriptPath>./host/index.jsx</ScriptPath>
23
+ <CEFCommandLine>
24
+ <Parameter>--enable-nodejs</Parameter>
25
+ <Parameter>--allow-file-access-from-files</Parameter>
26
+ </CEFCommandLine>
27
+ </Resources>
28
+ <Lifecycle>
29
+ <AutoVisible>true</AutoVisible>
30
+ </Lifecycle>
31
+ <UI>
32
+ <Type>Panel</Type>
33
+ <Menu>ae-agent-skill</Menu>
34
+ <Geometry>
35
+ <Size>
36
+ <Height>500</Height>
37
+ <Width>300</Width>
38
+ </Size>
39
+ </Geometry>
40
+ </UI>
41
+ </DispatchInfo>
42
+ </Extension>
43
+ </DispatchInfoList>
44
+ </ExtensionManifest>
package/README.ja.md ADDED
@@ -0,0 +1,249 @@
1
+ # ae-agent-skills
2
+
3
+ After Effects の CEP HTTP ブリッジを、MCP 非依存で操作するためのリポジトリです。
4
+
5
+ English README は [README.md](README.md) を参照してください。
6
+
7
+ ## Quick Links
8
+
9
+ - English README: [README.md](README.md)
10
+ - 日本語 README: [README.ja.md](README.ja.md)
11
+ - Onboarding skill: [.codex/skills/aftereffects-onboarding/SKILL.md](.codex/skills/aftereffects-onboarding/SKILL.md)
12
+ - 宣言型 skill: [.codex/skills/aftereffects-declarative/SKILL.md](.codex/skills/aftereffects-declarative/SKILL.md)
13
+ - レガシー CLI skill: [.codex/skills/aftereffects-cli/SKILL.md](.codex/skills/aftereffects-cli/SKILL.md)
14
+
15
+ ## このリポジトリでできること
16
+
17
+ - `ae-cli` で以下を実行
18
+ - レイヤー/プロパティ取得
19
+ - expression エラー診断(`expression-errors`)
20
+ - expression 適用
21
+ - エフェクト追加
22
+ - Essential Graphics プロパティ追加
23
+ - レイヤー追加
24
+ - 宣言的シーン適用(`apply-scene`)
25
+ - タイムライン操作(`set-in-out-point`, `move-layer-time`, `set-cti`, `set-work-area`)
26
+ - レイヤー構造操作(`parent-layer`, `precompose`, `duplicate-layer`, `move-layer-order`, `delete-layer`, `delete-comp`)
27
+ - Codex/Gemini 向け skill を同梱
28
+ - `.codex/skills/aftereffects-cli/SKILL.md`
29
+ - `.codex/skills/aftereffects-onboarding/SKILL.md`
30
+
31
+ ## 前提
32
+
33
+ - macOS
34
+ - Adobe After Effects(CEP 拡張が動作する環境)
35
+ - Python 3.10+
36
+
37
+ ## 1コマンド導入(clone不要)
38
+
39
+ clone なしで導入する場合は次を実行します。
40
+
41
+ ```bash
42
+ npx github:yumehiko/ae-agent-skills install
43
+ ```
44
+
45
+ 補足:
46
+
47
+ - `--agent` を省略すると、インストーラーが英語でエージェント選択(`codex` / `gemini` / `both`)を表示します。
48
+ - 処理は「署名済み ZXP 導入(UPIA/ExManCmd) -> `ae-cli` 導入 -> skill 導入」を順に試みます。
49
+ - 固定する場合は `--agent codex`(または `gemini`, `both`)を指定します。
50
+
51
+ ### CEP Debug 設定(未署名拡張向け)
52
+
53
+ このリポジトリの拡張は開発用途を想定しているため、環境によっては `PlayerDebugMode=1` が必要です。
54
+
55
+ ```bash
56
+ defaults domains | tr ',' '\n' | rg 'com\.adobe\.CSXS\.'
57
+ # 例: com.adobe.CSXS.11 が見つかった場合
58
+ defaults write com.adobe.CSXS.11 PlayerDebugMode 1
59
+ ```
60
+
61
+ 設定後は After Effects を完全終了して再起動してください。
62
+
63
+ ## クイックスタート(推奨)
64
+
65
+ エージェントに onboarding を依頼してください。
66
+
67
+ 依頼例:
68
+
69
+ - `このリポジトリで aftereffects-onboarding を進めて。`
70
+ - `Please run aftereffects-onboarding for this repository.`
71
+
72
+ onboarding では次を段階的に確認します。
73
+
74
+ - CEP extension の配置/リンク
75
+ - Python 仮想環境構築
76
+ - `pip install -e .`
77
+ - ブリッジ疎通確認(`ae-cli health`, `ae-cli layers`)
78
+
79
+ ## クローン
80
+
81
+ ```bash
82
+ git clone https://github.com/yumehiko/ae-agent-skills.git
83
+ cd ae-agent-skills
84
+ ```
85
+
86
+ ## 手動で CLI を使う場合
87
+
88
+ ```bash
89
+ ae-cli --help
90
+ ae-cli health
91
+ ae-cli layers
92
+ ae-cli list-comps
93
+ ae-cli create-comp --name "Main" --width 1920 --height 1080 --duration 8 --frame-rate 30
94
+ ae-cli set-active-comp --comp-name "Main"
95
+ ae-cli selected-properties
96
+ ae-cli expression-errors
97
+ ae-cli properties --layer-name "Title" --include-group "ADBE Effect Parade" --include-group-children --time 2.0
98
+ ae-cli set-expression --layer-name "Title" --property-path "Transform > Position" --expression "wiggle(2,30)"
99
+ ae-cli set-property --layer-id 1 --property-path "ADBE Transform Group.ADBE Position" --value "[960,540]"
100
+ ae-cli set-keyframe --layer-id 1 --property-path "ADBE Transform Group.ADBE Position" --time 0.5 --value "[960,540]"
101
+ ae-cli set-keyframe --layer-id 1 --property-path "ADBE Transform Group.ADBE Position" --time 1.0 --value "[960,300]" --in-interp bezier --out-interp bezier --ease-in "[0,80]" --ease-out "[0,40]"
102
+ ae-cli add-essential-property --layer-name "Title" --property-path "ADBE Text Properties.ADBE Text Document" --essential-name "Search Word"
103
+ ae-cli add-effect --layer-id 1 --effect-match-name "ADBE Slider Control" --effect-name "Speed"
104
+ ae-cli add-layer --layer-type text --name "Title" --text "Hello from CLI"
105
+ ae-cli add-layer --layer-type solid --name "BG" --width 1920 --height 1080 --color 32 64 128 --duration 10
106
+ ae-cli add-layer --layer-type shape --name "BurstCircle" --shape-type ellipse --shape-size 720 720 --shape-fill-color 255 128 0 --shape-stroke-color 255 255 255 --shape-stroke-width 8
107
+ ae-cli add-shape-repeater --layer-name "BurstCircle" --group-index 1 --copies 12 --rotation 30 --end-opacity 0
108
+ ae-cli set-in-out-point --layer-name "Title" --in-point 0.5 --out-point 6.5
109
+ ae-cli move-layer-time --layer-name "Title" --delta 0.25
110
+ ae-cli set-cti --time 2.0
111
+ ae-cli set-work-area --start 1.0 --duration 4.0
112
+ ae-cli parent-layer --child-layer-id 2 --parent-layer-id 1
113
+ ae-cli parent-layer --child-layer-id 2 --clear-parent
114
+ ae-cli precompose --layer-id 3 --layer-id 2 --name "Shot_A" --move-all-attributes
115
+ ae-cli duplicate-layer --layer-id 1
116
+ ae-cli move-layer-order --layer-id 4 --to-top
117
+ ae-cli move-layer-order --layer-id 4 --before-layer-id 2
118
+ ae-cli delete-layer --layer-id 4
119
+ ae-cli delete-comp --comp-name "Shot_A"
120
+ ae-cli apply-scene --scene-file examples/scene.example.json --validate-only
121
+ ae-cli apply-scene --scene-file examples/scene.example.json
122
+ ae-cli apply-scene --scene-file examples/scene.example.json --mode replace-managed
123
+ ae-cli apply-scene --scene-file examples/scene.example.json --mode clear-all
124
+ ```
125
+
126
+ `ae-cli` が `PATH` にない場合は、次で実行できます。
127
+
128
+ ```bash
129
+ PYTHONPATH=src python3 -m ae_cli.main --help
130
+ ```
131
+
132
+ `--base-url` 未指定時は `AE_BRIDGE_URL`、なければ `http://127.0.0.1:8080` を使用します。
133
+
134
+ ### 宣言的 Scene JSON(`apply-scene`)
135
+
136
+ 1つの JSON で comp/layer 構成を一括適用できます。
137
+
138
+ ```bash
139
+ ae-cli apply-scene --scene-file examples/scene.example.json --validate-only
140
+ ae-cli apply-scene --scene-file examples/scene.example.json
141
+ ae-cli apply-scene --scene-file examples/scene.example.json --mode replace-managed
142
+ ae-cli apply-scene --scene-file examples/scene.example.json --mode clear-all
143
+ ```
144
+
145
+ スキーマ参照:
146
+
147
+ - `schemas/scene.schema.json`
148
+
149
+ 最小構成の例:
150
+
151
+ ```json
152
+ {
153
+ "composition": {
154
+ "name": "Main",
155
+ "width": 1920,
156
+ "height": 1080,
157
+ "duration": 8,
158
+ "frameRate": 30
159
+ },
160
+ "layers": [
161
+ {
162
+ "id": "title",
163
+ "type": "text",
164
+ "name": "Title",
165
+ "text": "Hello Agent",
166
+ "transform": { "position": [960, 540] },
167
+ "animations": [
168
+ {
169
+ "propertyPath": "ADBE Transform Group.ADBE Position",
170
+ "keyframes": [
171
+ { "time": 0, "value": [960, 700] },
172
+ { "time": 1, "value": [960, 540], "inInterp": "bezier", "easeIn": [0, 80] }
173
+ ]
174
+ }
175
+ ]
176
+ }
177
+ ]
178
+ }
179
+ ```
180
+
181
+ 主なトップレベル項目:
182
+
183
+ - `composition`: 対象 comp の指定/作成設定(`compId`, `compName`, `name`, `width`, `height`, `duration`, `frameRate`, `pixelAspect`, `createIfMissing`, `setActive`)
184
+ - `layers[]`: レイヤー定義(`type`, `name`, `text`, shape/solid オプション, `timing`, `transform`, `propertyValues`, `effects`, `animations`)
185
+ - `layers[].id`: upsert 再利用用の安定ID。既存IDが見つかった場合は新規作成せず、そのレイヤーを更新します。
186
+ - `layers[].parentId`: scene id を使った親子定義(`null` 指定で親解除)
187
+ - `layers[].expressions[]`: expression 定義(`propertyPath`, `expression`)
188
+ - `layers[].essentialProperties[]`: Essential Graphics 追加(`propertyPath`, 任意で `essentialName`)
189
+ - `layers[].repeaters[]`: shape の Repeater 定義(`add-shape-repeater` 相当オプション)
190
+ - `layers[].effects[].params[]`: effect パラメータ設定(`propertyPath` / `matchName` / `propertyIndex` のいずれか + `value`)
191
+ - 3D ベクトル系プロパティに対しては、`[x, y]` の2次元入力を `[x, y, 0]` として自動補完します。
192
+
193
+ `apply-scene` の mode:
194
+
195
+ - `merge`(デフォルト): upsert のみ。宣言したレイヤーは更新/作成、未宣言レイヤーは保持。
196
+ - `replace-managed`: 現在の scene に含まれない管理対象レイヤー(`aeSceneId:*`)だけ削除してから適用。
197
+ - `clear-all`: 対象 comp の全レイヤーを削除してから適用。
198
+
199
+ expression の移植性メモ:
200
+
201
+ - effect パラメータ参照は、表示名(例: `(\"Slider\")`)よりも matchName(例: `(\"ADBE Slider Control-0001\")`)を優先する。
202
+
203
+ ## 開発向け
204
+
205
+ 開発用依存を入れる:
206
+
207
+ ```bash
208
+ python3 -m pip install -e ".[dev]"
209
+ ```
210
+
211
+ テスト実行:
212
+
213
+ ```bash
214
+ PYTHONPATH=src pytest
215
+ ```
216
+
217
+ ### Python CLI の構成
218
+
219
+ - `src/ae_cli/cli_parser.py`: 引数定義とコマンド定義
220
+ - `src/ae_cli/cli_runner.py`: コマンドディスパッチとエラーハンドリング
221
+ - `src/ae_cli/client.py`: CEP ブリッジへの HTTP クライアント
222
+ - `src/ae_cli/main.py`: エントリポイント(`ae-cli`)
223
+
224
+ ### ExtendScript host の構成
225
+
226
+ - `host/index.jsx`: モジュールローダー(エントリポイント)
227
+ - `host/lib/common.jsx`: ログ出力・JSON 初期化・共通ヘルパー
228
+ - `host/lib/property_utils.jsx`: プロパティ探索の共通ヘルパー
229
+ - `host/lib/query_handlers.jsx`: 読み取り系ハンドラ(`getLayers`, `getProperties`, `getSelectedProperties`, `getExpressionErrors`)
230
+ - `host/lib/mutation_handlers.jsx`: 更新系ハンドラ(コア: `setExpression`, `addEffect`, `addEssentialProperty`, `setPropertyValue`, `createComp`, `setActiveComp`)
231
+ - `host/lib/mutation_keyframe_handlers.jsx`: キーフレーム系ハンドラ(`setKeyframe`)と補間/ease ヘルパー
232
+ - `host/lib/mutation_shape_handlers.jsx`: shape 系ハンドラ(`addLayer`, `addShapeRepeater`)
233
+ - `host/lib/mutation_timeline_handlers.jsx`: タイムライン操作ハンドラ(`setInOutPoint`, `moveLayerTime`, `setCTI`, `setWorkArea`)
234
+ - `host/lib/mutation_layer_structure_handlers.jsx`: レイヤー構造操作ハンドラ(`parentLayer`, `precomposeLayers`, `duplicateLayer`, `moveLayerOrder`, `deleteLayer`, `deleteComp`)
235
+ - `host/lib/mutation_scene_handlers.jsx`: 宣言的 scene 一括適用ハンドラ(`applyScene`)
236
+
237
+ ### CEP パネル client の構成
238
+
239
+ - `client/main.js`: 起動エントリポイント
240
+ - `client/lib/runtime.js`: CEP/Node 初期化と host script 呼び出し
241
+ - `client/lib/logging.js`: パネルログ出力ヘルパー
242
+ - `client/lib/bridge_utils.js`: JSON/body 解析と bridge 応答ヘルパー
243
+ - `client/lib/request_handlers_shape.js`: shape 系リクエストハンドラ(`addLayer`, `addShapeRepeater`)
244
+ - `client/lib/request_handlers_scene.js`: 宣言的 scene リクエストハンドラ(`applyScene`)
245
+ - `client/lib/request_handlers_essential.js`: Essential Graphics 系ハンドラ(`addEssentialProperty`)
246
+ - `client/lib/request_handlers_timeline.js`: タイムライン系ハンドラ(`setInOutPoint`, `moveLayerTime`, `setCTI`, `setWorkArea`)
247
+ - `client/lib/request_handlers_layer_structure.js`: レイヤー構造系ハンドラ(`parentLayer`, `precomposeLayers`, `duplicateLayer`, `moveLayerOrder`, `deleteLayer`, `deleteComp`)
248
+ - `client/lib/request_handlers.js`: コアルーターと共通エンドポイントハンドラ
249
+ - `client/lib/server.js`: HTTP サーバーの起動/エラーハンドリング
package/README.md ADDED
@@ -0,0 +1,249 @@
1
+ # ae-agent-skills
2
+
3
+ Simple MCP-free tooling to control an After Effects CEP HTTP bridge.
4
+
5
+ Japanese README is available at [README.ja.md](README.ja.md).
6
+
7
+ ## Quick Links
8
+
9
+ - English README: [README.md](README.md)
10
+ - Japanese README: [README.ja.md](README.ja.md)
11
+ - Onboarding skill: [.codex/skills/aftereffects-onboarding/SKILL.md](.codex/skills/aftereffects-onboarding/SKILL.md)
12
+ - Declarative skill: [.codex/skills/aftereffects-declarative/SKILL.md](.codex/skills/aftereffects-declarative/SKILL.md)
13
+ - Legacy CLI skill: [.codex/skills/aftereffects-cli/SKILL.md](.codex/skills/aftereffects-cli/SKILL.md)
14
+
15
+ ## What this repo includes
16
+
17
+ - `ae-cli` for:
18
+ - listing layers/properties
19
+ - expression error diagnostics (`expression-errors`)
20
+ - applying expressions
21
+ - adding effects
22
+ - adding Essential Graphics properties
23
+ - adding layers
24
+ - declarative scene apply (`apply-scene`)
25
+ - timeline operations (`set-in-out-point`, `move-layer-time`, `set-cti`, `set-work-area`)
26
+ - layer structure operations (`parent-layer`, `precompose`, `duplicate-layer`, `move-layer-order`, `delete-layer`, `delete-comp`)
27
+ - Agent skills for Codex/Gemini workflows:
28
+ - `.codex/skills/aftereffects-cli/SKILL.md`
29
+ - `.codex/skills/aftereffects-onboarding/SKILL.md`
30
+
31
+ ## Requirements
32
+
33
+ - macOS
34
+ - Adobe After Effects (CEP-capable environment)
35
+ - Python 3.10+
36
+
37
+ ## One-line setup (No clone)
38
+
39
+ If you want a clone-free onboarding path, run:
40
+
41
+ ```bash
42
+ npx github:yumehiko/ae-agent-skills install
43
+ ```
44
+
45
+ Notes:
46
+
47
+ - If `--agent` is omitted, the installer shows an interactive agent choice (`codex` / `gemini` / `both`) in English.
48
+ - The installer attempts: signed ZXP install (UPIA/ExManCmd) -> `ae-cli` install -> skill install.
49
+ - You can force a target via `--agent codex` (or `gemini`, `both`).
50
+
51
+ ### CEP Debug Setting (for unsigned extensions)
52
+
53
+ This extension is intended for development use, so some environments require `PlayerDebugMode=1`.
54
+
55
+ ```bash
56
+ defaults domains | tr ',' '\n' | rg 'com\.adobe\.CSXS\.'
57
+ # Example: if com.adobe.CSXS.11 exists
58
+ defaults write com.adobe.CSXS.11 PlayerDebugMode 1
59
+ ```
60
+
61
+ After setting it, fully quit and relaunch After Effects.
62
+
63
+ ## Quick Start (Recommended)
64
+
65
+ Use an agent and ask it to run onboarding for this repository.
66
+
67
+ Example prompts:
68
+
69
+ - `Please run aftereffects-onboarding for this repository.`
70
+ - `このリポジトリで aftereffects-onboarding を進めて。`
71
+
72
+ The onboarding flow covers:
73
+
74
+ - CEP extension placement/linking
75
+ - Python virtual environment setup
76
+ - `pip install -e .`
77
+ - bridge connectivity checks (`ae-cli health`, `ae-cli layers`)
78
+
79
+ ## Clone
80
+
81
+ ```bash
82
+ git clone https://github.com/yumehiko/ae-agent-skills.git
83
+ cd ae-agent-skills
84
+ ```
85
+
86
+ ## Manual CLI usage
87
+
88
+ ```bash
89
+ ae-cli --help
90
+ ae-cli health
91
+ ae-cli layers
92
+ ae-cli list-comps
93
+ ae-cli create-comp --name "Main" --width 1920 --height 1080 --duration 8 --frame-rate 30
94
+ ae-cli set-active-comp --comp-name "Main"
95
+ ae-cli selected-properties
96
+ ae-cli expression-errors
97
+ ae-cli properties --layer-name "Title" --include-group "ADBE Effect Parade" --include-group-children --time 2.0
98
+ ae-cli set-expression --layer-name "Title" --property-path "Transform > Position" --expression "wiggle(2,30)"
99
+ ae-cli set-property --layer-id 1 --property-path "ADBE Transform Group.ADBE Position" --value "[960,540]"
100
+ ae-cli set-keyframe --layer-id 1 --property-path "ADBE Transform Group.ADBE Position" --time 0.5 --value "[960,540]"
101
+ ae-cli set-keyframe --layer-id 1 --property-path "ADBE Transform Group.ADBE Position" --time 1.0 --value "[960,300]" --in-interp bezier --out-interp bezier --ease-in "[0,80]" --ease-out "[0,40]"
102
+ ae-cli add-essential-property --layer-name "Title" --property-path "ADBE Text Properties.ADBE Text Document" --essential-name "Search Word"
103
+ ae-cli add-effect --layer-id 1 --effect-match-name "ADBE Slider Control" --effect-name "Speed"
104
+ ae-cli add-layer --layer-type text --name "Title" --text "Hello from CLI"
105
+ ae-cli add-layer --layer-type solid --name "BG" --width 1920 --height 1080 --color 32 64 128 --duration 10
106
+ ae-cli add-layer --layer-type shape --name "BurstCircle" --shape-type ellipse --shape-size 720 720 --shape-fill-color 255 128 0 --shape-stroke-color 255 255 255 --shape-stroke-width 8
107
+ ae-cli add-shape-repeater --layer-name "BurstCircle" --group-index 1 --copies 12 --rotation 30 --end-opacity 0
108
+ ae-cli set-in-out-point --layer-name "Title" --in-point 0.5 --out-point 6.5
109
+ ae-cli move-layer-time --layer-name "Title" --delta 0.25
110
+ ae-cli set-cti --time 2.0
111
+ ae-cli set-work-area --start 1.0 --duration 4.0
112
+ ae-cli parent-layer --child-layer-id 2 --parent-layer-id 1
113
+ ae-cli parent-layer --child-layer-id 2 --clear-parent
114
+ ae-cli precompose --layer-id 3 --layer-id 2 --name "Shot_A" --move-all-attributes
115
+ ae-cli duplicate-layer --layer-id 1
116
+ ae-cli move-layer-order --layer-id 4 --to-top
117
+ ae-cli move-layer-order --layer-id 4 --before-layer-id 2
118
+ ae-cli delete-layer --layer-id 4
119
+ ae-cli delete-comp --comp-name "Shot_A"
120
+ ae-cli apply-scene --scene-file examples/scene.example.json --validate-only
121
+ ae-cli apply-scene --scene-file examples/scene.example.json
122
+ ae-cli apply-scene --scene-file examples/scene.example.json --mode replace-managed
123
+ ae-cli apply-scene --scene-file examples/scene.example.json --mode clear-all
124
+ ```
125
+
126
+ If `ae-cli` is not on your `PATH`, run it with:
127
+
128
+ ```bash
129
+ PYTHONPATH=src python3 -m ae_cli.main --help
130
+ ```
131
+
132
+ By default, the CLI uses `AE_BRIDGE_URL` or falls back to `http://127.0.0.1:8080`.
133
+
134
+ ### Declarative Scene JSON (`apply-scene`)
135
+
136
+ Use one JSON file to apply a composition/layer setup in batch:
137
+
138
+ ```bash
139
+ ae-cli apply-scene --scene-file examples/scene.example.json --validate-only
140
+ ae-cli apply-scene --scene-file examples/scene.example.json
141
+ ae-cli apply-scene --scene-file examples/scene.example.json --mode replace-managed
142
+ ae-cli apply-scene --scene-file examples/scene.example.json --mode clear-all
143
+ ```
144
+
145
+ Schema reference:
146
+
147
+ - `schemas/scene.schema.json`
148
+
149
+ Minimal shape:
150
+
151
+ ```json
152
+ {
153
+ "composition": {
154
+ "name": "Main",
155
+ "width": 1920,
156
+ "height": 1080,
157
+ "duration": 8,
158
+ "frameRate": 30
159
+ },
160
+ "layers": [
161
+ {
162
+ "id": "title",
163
+ "type": "text",
164
+ "name": "Title",
165
+ "text": "Hello Agent",
166
+ "transform": { "position": [960, 540] },
167
+ "animations": [
168
+ {
169
+ "propertyPath": "ADBE Transform Group.ADBE Position",
170
+ "keyframes": [
171
+ { "time": 0, "value": [960, 700] },
172
+ { "time": 1, "value": [960, 540], "inInterp": "bezier", "easeIn": [0, 80] }
173
+ ]
174
+ }
175
+ ]
176
+ }
177
+ ]
178
+ }
179
+ ```
180
+
181
+ Top-level fields:
182
+
183
+ - `composition`: target comp options (`compId`, `compName`, `name`, `width`, `height`, `duration`, `frameRate`, `pixelAspect`, `createIfMissing`, `setActive`)
184
+ - `layers[]`: layer specs (`type`, `name`, `text`, shape/solid options, `timing`, `transform`, `propertyValues`, `effects`, `animations`)
185
+ - `layers[].id`: stable scene id for upsert reuse. If the id already exists, `apply-scene` updates that layer instead of creating a new one.
186
+ - `layers[].parentId`: declarative parent relation by scene id (`null` to clear parent)
187
+ - `layers[].expressions[]`: expression bindings (`propertyPath`, `expression`)
188
+ - `layers[].essentialProperties[]`: Essential Graphics exports (`propertyPath`, optional `essentialName`)
189
+ - `layers[].repeaters[]`: shape repeater definitions (same options as `add-shape-repeater`)
190
+ - `layers[].effects[].params[]`: effect parameter assignments (selector: one of `propertyPath`/`matchName`/`propertyIndex`, plus `value`)
191
+ - For 3D vector properties, 2D input like `[x, y]` is accepted and normalized to `[x, y, 0]`.
192
+
193
+ `apply-scene` modes:
194
+
195
+ - `merge` (default): upsert only. Declared layers are updated/created, undeclared layers are kept.
196
+ - `replace-managed`: delete only managed layers (`aeSceneId:*`) that are not in the current scene, then apply.
197
+ - `clear-all`: delete all layers in the target comp, then apply.
198
+
199
+ Expression portability tip:
200
+
201
+ - Prefer matchName-based references in expressions for effect params (for example `("ADBE Slider Control-0001")`), rather than localized display names like `("Slider")`.
202
+
203
+ ## Development
204
+
205
+ Install dev dependencies:
206
+
207
+ ```bash
208
+ python3 -m pip install -e ".[dev]"
209
+ ```
210
+
211
+ Run tests:
212
+
213
+ ```bash
214
+ PYTHONPATH=src pytest
215
+ ```
216
+
217
+ ### Python CLI structure
218
+
219
+ - `src/ae_cli/cli_parser.py`: argument parser and command definitions
220
+ - `src/ae_cli/cli_runner.py`: command dispatch and error handling
221
+ - `src/ae_cli/client.py`: HTTP client to the CEP bridge
222
+ - `src/ae_cli/main.py`: thin entrypoint (`ae-cli`)
223
+
224
+ ### ExtendScript host structure
225
+
226
+ - `host/index.jsx`: module loader entrypoint
227
+ - `host/lib/common.jsx`: logging/json bootstrap/common helpers
228
+ - `host/lib/property_utils.jsx`: shared property-tree helpers
229
+ - `host/lib/query_handlers.jsx`: read-only handlers (`getLayers`, `getProperties`, `getSelectedProperties`, `getExpressionErrors`)
230
+ - `host/lib/mutation_handlers.jsx`: write handlers core (`setExpression`, `addEffect`, `addEssentialProperty`, `setPropertyValue`, `createComp`, `setActiveComp`)
231
+ - `host/lib/mutation_keyframe_handlers.jsx`: keyframe handlers (`setKeyframe`) and interpolation/ease helpers
232
+ - `host/lib/mutation_shape_handlers.jsx`: shape write handlers (`addLayer`, `addShapeRepeater`)
233
+ - `host/lib/mutation_timeline_handlers.jsx`: timeline handlers (`setInOutPoint`, `moveLayerTime`, `setCTI`, `setWorkArea`)
234
+ - `host/lib/mutation_layer_structure_handlers.jsx`: layer structure handlers (`parentLayer`, `precomposeLayers`, `duplicateLayer`, `moveLayerOrder`, `deleteLayer`, `deleteComp`)
235
+ - `host/lib/mutation_scene_handlers.jsx`: declarative scene apply handler (`applyScene`)
236
+
237
+ ### CEP panel client structure
238
+
239
+ - `client/main.js`: startup entrypoint
240
+ - `client/lib/runtime.js`: CEP/Node bootstrap and host script evaluation
241
+ - `client/lib/logging.js`: panel log output helpers
242
+ - `client/lib/bridge_utils.js`: JSON/body parsing and bridge response helpers
243
+ - `client/lib/request_handlers_shape.js`: shape-specific request handlers (`addLayer`, `addShapeRepeater`)
244
+ - `client/lib/request_handlers_scene.js`: declarative scene request handler (`applyScene`)
245
+ - `client/lib/request_handlers_essential.js`: Essential Graphics handlers (`addEssentialProperty`)
246
+ - `client/lib/request_handlers_timeline.js`: timeline handlers (`setInOutPoint`, `moveLayerTime`, `setCTI`, `setWorkArea`)
247
+ - `client/lib/request_handlers_layer_structure.js`: layer structure handlers (`parentLayer`, `precomposeLayers`, `duplicateLayer`, `moveLayerOrder`, `deleteLayer`, `deleteComp`)
248
+ - `client/lib/request_handlers.js`: core route dispatch and shared endpoint handlers
249
+ - `client/lib/server.js`: HTTP server lifecycle