playcanvas-agent-bridge-cli 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.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: playcanvas-agent-bridge-cli
3
+ description: Control an already-open PlayCanvas Editor scene through pcbridge CLI commands and the bundled Chrome extension. Use for PlayCanvas Editor inspection, entity/asset/script edits, eval snippets, and viewport captures without DevTools or browser automation.
4
+ ---
5
+
6
+ # PlayCanvas Agent Bridge CLI
7
+
8
+ Use `pcbridge` as the only interface. Start with:
9
+
10
+ ```bash
11
+ pcbridge doctor
12
+ pcbridge daemon status
13
+ pcbridge targets
14
+ ```
15
+
16
+ If the daemon is offline, ask the user to run `pcbridge daemon start` in another terminal. If no PlayCanvas target appears, ask the user to run `pcbridge install-extension`, load the printed directory in `chrome://extensions`, and refresh the Editor tab.
17
+
18
+ Prefer structured commands:
19
+
20
+ ```bash
21
+ pcbridge entity list --target current --limit 50
22
+ pcbridge entity create --target current --json ./entity.json
23
+ pcbridge entity patch --target current --id <resource_id> --set position='[0,1,0]'
24
+ pcbridge entity set-material --target current --id <resource_id> --material-id <material_asset_id>
25
+ pcbridge entity add-script --target current --id <resource_id> --asset-id <script_asset_id> --attributes '{"speed":2.4}'
26
+ pcbridge asset list --target current --type script
27
+ pcbridge asset folder ensure --target current --path "AI Agent Bridge/My Task/Textures"
28
+ pcbridge asset upload --target current --file ./texture.png --name TaskTexture --folder "AI Agent Bridge/My Task/Textures"
29
+ pcbridge material create --target current --name TaskMaterial --folder "AI Agent Bridge/My Task/Materials" --diffuse-map <texture_asset_id>
30
+ pcbridge script create --target current --filename controller.js --file ./script.js --folder "AI Agent Bridge/My Task/Scripts"
31
+ pcbridge script set-text --target current --asset-id <id> --file ./script.js
32
+ pcbridge viewport capture --target current --out ./tmp/playcanvas.png
33
+ ```
34
+
35
+ Organize generated assets under `AI Agent Bridge/<task name>/Textures`, `Materials`, and `Scripts`. Use `pcbridge eval` only for custom work:
36
+
37
+ ```bash
38
+ pcbridge eval --target current --code "return { href: location.href, entityCount: editor.api.globals.entities.list().length }"
39
+ ```
40
+
41
+ Eval snippets run in an async function with `editor`, `pc`, `pcui`, `window`, `document`, `command`, and `serialize`. Return compact JSON only. Do not return raw PlayCanvas Editor objects. Use `{ history: true }` for Editor mutations when available, and verify changes with a read-only command.
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: playcanvas-agent-bridge-cli
3
+ description: Control an already-open PlayCanvas Editor scene through the pcbridge CLI and Chrome extension. Use when Codex needs to inspect or modify PlayCanvas Editor targets, entities, assets, scripts, scene data, or viewport captures without DevTools, mouse/keyboard automation, MCP, or browser console scripting.
4
+ ---
5
+
6
+ # PlayCanvas Agent Bridge CLI
7
+
8
+ Use `pcbridge` to automate PlayCanvas Editor through a local daemon and Chrome extension. The CLI is the interface; this skill only tells the agent how to use it safely.
9
+
10
+ ## Quick Start
11
+
12
+ Check local setup:
13
+
14
+ ```bash
15
+ pcbridge doctor
16
+ pcbridge daemon status
17
+ pcbridge targets
18
+ ```
19
+
20
+ If the daemon is offline, tell the user to run this in a separate terminal:
21
+
22
+ ```bash
23
+ pcbridge daemon start
24
+ ```
25
+
26
+ If no target appears, tell the user to run `pcbridge install-extension`, load the printed directory in `chrome://extensions`, then refresh the PlayCanvas Editor tab.
27
+
28
+ ## Workflow
29
+
30
+ 1. Run `pcbridge targets` and choose an explicit target when possible.
31
+ 2. Prefer structured commands for common tasks: `entity`, `asset`, `material`, `script`, and `viewport`.
32
+ 3. Use `pcbridge eval` only for custom Editor API work.
33
+ 4. Return compact JSON from snippets. Never return raw `editor`, `Entity`, `Asset`, `entities.root`, or app objects.
34
+ 5. Use PlayCanvas history options for writes when available.
35
+ 6. Verify writes with a read-only command after mutation.
36
+
37
+ ## Safe Commands
38
+
39
+ Inspect a scene:
40
+
41
+ ```bash
42
+ pcbridge eval --target current --code "return { href: location.href, hasEditor: !!editor, entityCount: editor.api.globals.entities.list().length }"
43
+ ```
44
+
45
+ List entities:
46
+
47
+ ```bash
48
+ pcbridge entity list --target current --limit 50
49
+ pcbridge entity list --target scene:<sceneId> --name Player --component render
50
+ ```
51
+
52
+ Create an entity from JSON:
53
+
54
+ ```bash
55
+ pcbridge entity create --target current --json ./entity.json
56
+ ```
57
+
58
+ Patch an entity:
59
+
60
+ ```bash
61
+ pcbridge entity patch --target current --id <resource_id> --set name=Player --set position='[0,1,0]'
62
+ ```
63
+
64
+ Modify components and materials:
65
+
66
+ ```bash
67
+ pcbridge entity add-component --target current --id <resource_id> --component render --data '{"type":"box"}'
68
+ pcbridge entity set-material --target current --id <resource_id> --material-id <material_asset_id>
69
+ pcbridge entity add-script --target current --id <resource_id> --asset-id <script_asset_id> --attributes '{"speed":2.4}'
70
+ pcbridge entity delete --target current --id <resource_id>
71
+ ```
72
+
73
+ Work with assets and scripts:
74
+
75
+ ```bash
76
+ pcbridge asset list --target current --type script --limit 50
77
+ pcbridge asset folder ensure --target current --path "AI Agent Bridge/My Task/Textures"
78
+ pcbridge asset upload --target current --file ./texture.png --name TaskTexture --folder "AI Agent Bridge/My Task/Textures"
79
+ pcbridge material create --target current --name TaskMaterial --folder "AI Agent Bridge/My Task/Materials" --diffuse-map <texture_asset_id>
80
+ pcbridge script create --target current --filename controller.js --file ./controller.js --folder "AI Agent Bridge/My Task/Scripts"
81
+ pcbridge script set-text --target current --asset-id <id> --file ./controller.js
82
+ pcbridge script parse --target current --asset-id <id>
83
+ ```
84
+
85
+ Capture the viewport:
86
+
87
+ ```bash
88
+ pcbridge viewport capture --target current --out ./tmp/playcanvas-viewport.png
89
+ ```
90
+
91
+ ## Asset Organization
92
+
93
+ Create task-scoped folders before uploading generated assets:
94
+
95
+ ```text
96
+ AI Agent Bridge/<task name>/Textures
97
+ AI Agent Bridge/<task name>/Materials
98
+ AI Agent Bridge/<task name>/Scripts
99
+ ```
100
+
101
+ Use stable names that describe the asset purpose. Avoid dumping generated files at the project root.
102
+
103
+ ## Texture Box Pattern
104
+
105
+ For a textured scripted box, compose structured commands instead of writing one large eval:
106
+
107
+ ```bash
108
+ pcbridge asset folder ensure --target current --path "AI Agent Bridge/Texture Box/Textures"
109
+ pcbridge asset upload --target current --file ./image.png --name TextureBoxImage --folder "AI Agent Bridge/Texture Box/Textures"
110
+ pcbridge material create --target current --name TextureBoxMaterial --folder "AI Agent Bridge/Texture Box/Materials" --diffuse-map <texture_asset_id>
111
+ pcbridge script create --target current --filename jumpingBox.js --file ./jumpingBox.js --folder "AI Agent Bridge/Texture Box/Scripts"
112
+ pcbridge entity create --target current --json ./box.json
113
+ pcbridge entity set-material --target current --id <box_resource_id> --material-id <material_asset_id>
114
+ pcbridge entity add-script --target current --id <box_resource_id> --asset-id <script_asset_id> --attributes '{"height":0.5,"speed":2.4}'
115
+ ```
116
+
117
+ ## Eval Snippet Rules
118
+
119
+ The snippet runs inside an async function with these bindings:
120
+
121
+ ```js
122
+ editor;
123
+ pc;
124
+ pcui;
125
+ window;
126
+ document;
127
+ command;
128
+ serialize;
129
+ ```
130
+
131
+ Prefer:
132
+
133
+ ```js
134
+ const globals = editor.api.globals;
135
+ const entities = globals.entities;
136
+ const assets = globals.assets;
137
+ ```
138
+
139
+ Use compact return values:
140
+
141
+ ```js
142
+ const entities = editor.api.globals.entities.list();
143
+ return entities.slice(0, 20).map((entity) => ({
144
+ resource_id: entity.get("resource_id"),
145
+ name: entity.get("name"),
146
+ components: Object.keys(entity.get("components") || {})
147
+ }));
148
+ ```
149
+
150
+ Avoid destructive operations unless the user clearly asked for them. When deleting or overwriting, require explicit stable IDs and report affected counts.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "PlayCanvas Agent Bridge"
3
+ short_description: "Control open PlayCanvas Editor scenes through pcbridge."
4
+ default_prompt: "Use pcbridge to inspect or edit the open PlayCanvas Editor scene."
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Use pcbridge to control open PlayCanvas Editor tabs from Cursor.
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+
7
+ Use `pcbridge` for PlayCanvas Editor automation. Do not use DevTools, mouse/keyboard browser automation, or raw console typing.
8
+
9
+ Setup checks:
10
+
11
+ ```bash
12
+ pcbridge doctor
13
+ pcbridge daemon status
14
+ pcbridge targets
15
+ ```
16
+
17
+ If needed, ask the user to run `pcbridge daemon start`. If no target appears, ask them to run `pcbridge install-extension`, load the printed extension directory in `chrome://extensions`, and refresh PlayCanvas Editor.
18
+
19
+ Prefer structured commands:
20
+
21
+ ```bash
22
+ pcbridge entity list --target current --limit 50
23
+ pcbridge entity patch --target current --id <resource_id> --set name=Player
24
+ pcbridge entity set-material --target current --id <resource_id> --material-id <material_asset_id>
25
+ pcbridge entity add-script --target current --id <resource_id> --asset-id <script_asset_id> --attributes '{"speed":2.4}'
26
+ pcbridge asset list --target current --type script
27
+ pcbridge asset folder ensure --target current --path "AI Agent Bridge/My Task/Textures"
28
+ pcbridge asset upload --target current --file ./texture.png --name TaskTexture --folder "AI Agent Bridge/My Task/Textures"
29
+ pcbridge material create --target current --name TaskMaterial --folder "AI Agent Bridge/My Task/Materials" --diffuse-map <texture_asset_id>
30
+ pcbridge script create --target current --filename controller.js --file ./script.js --folder "AI Agent Bridge/My Task/Scripts"
31
+ pcbridge script set-text --target current --asset-id <id> --file ./script.js
32
+ pcbridge viewport capture --target current --out ./tmp/playcanvas.png
33
+ ```
34
+
35
+ Put generated assets under `AI Agent Bridge/<task name>/Textures`, `Materials`, and `Scripts`.
36
+
37
+ Use `pcbridge eval` only for custom Editor API work. Snippets run with `editor`, `pc`, `pcui`, `window`, `document`, `command`, and `serialize`. Return compact JSON; never return raw `editor`, `Entity`, `Asset`, or app objects.
@@ -0,0 +1,34 @@
1
+ # PlayCanvas Agent Bridge CLI
2
+
3
+ Use `pcbridge` to automate an already-open PlayCanvas Editor tab through the local daemon and Chrome extension.
4
+
5
+ Start with:
6
+
7
+ ```bash
8
+ pcbridge doctor
9
+ pcbridge daemon status
10
+ pcbridge targets
11
+ ```
12
+
13
+ If the daemon is offline, ask the user to run `pcbridge daemon start`. If no target is connected, ask the user to run `pcbridge install-extension`, load the printed unpacked extension path in `chrome://extensions`, and refresh the Editor tab.
14
+
15
+ Prefer structured commands over eval:
16
+
17
+ ```bash
18
+ pcbridge entity list --target current --limit 50
19
+ pcbridge entity create --target current --json ./entity.json
20
+ pcbridge entity patch --target current --id <resource_id> --set position='[0,1,0]'
21
+ pcbridge entity set-material --target current --id <resource_id> --material-id <material_asset_id>
22
+ pcbridge entity add-script --target current --id <resource_id> --asset-id <script_asset_id> --attributes '{"speed":2.4}'
23
+ pcbridge asset list --target current --type script
24
+ pcbridge asset folder ensure --target current --path "AI Agent Bridge/My Task/Textures"
25
+ pcbridge asset upload --target current --file ./texture.png --name TaskTexture --folder "AI Agent Bridge/My Task/Textures"
26
+ pcbridge material create --target current --name TaskMaterial --folder "AI Agent Bridge/My Task/Materials" --diffuse-map <texture_asset_id>
27
+ pcbridge script create --target current --filename controller.js --file ./script.js --folder "AI Agent Bridge/My Task/Scripts"
28
+ pcbridge script set-text --target current --asset-id <id> --file ./script.js
29
+ pcbridge viewport capture --target current --out ./tmp/playcanvas.png
30
+ ```
31
+
32
+ Put generated assets under `AI Agent Bridge/<task name>/Textures`, `Materials`, and `Scripts`.
33
+
34
+ Use `pcbridge eval` only for custom Editor API snippets. Return compact JSON and never return raw PlayCanvas Editor objects. Use history-enabled mutations when available and verify writes with a read-only command.