@aefree/pi-unity 0.9.0 → 0.9.2
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.
- package/CHANGELOG.md +190 -173
- package/README.md +234 -197
- package/index.ts +1724 -1724
- package/package.json +75 -75
- package/skills/unity-batchmode-tests/SKILL.md +145 -145
- package/skills/unity-interactive-playmode-authoring/SKILL.md +91 -91
- package/skills/unity-pipeline-workflows/SKILL.md +52 -52
- package/src/unity-artifact-profile.ts +110 -110
- package/src/unity-batchmode.ts +355 -355
- package/src/unity-cli.ts +635 -635
- package/src/unity-file-discovery-filter.ts +89 -89
- package/src/unity-pipeline.ts +487 -487
package/README.md
CHANGED
|
@@ -1,197 +1,234 @@
|
|
|
1
|
-
# Pi Unity
|
|
2
|
-
|
|
3
|
-
Pi
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
- `unity-pipeline-workflows`
|
|
70
|
-
- `
|
|
71
|
-
- `
|
|
72
|
-
- `
|
|
73
|
-
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
##
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
1
|
+
# Pi Unity
|
|
2
|
+
|
|
3
|
+
Pi tools and skills for reliable Unity Editor, Pipeline, batchmode, testing, and project-guidance workflows.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
From npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pi install npm:@aefree/pi-unity
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
From GitHub:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pi install git:git@github.com:aefreedman/pi-unity.git
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
For local development:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pi install <path-to-pi-unity>
|
|
23
|
+
pi install -l <path-to-pi-unity> # project-local
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Pi discovers the extension from `index.ts` and packaged skills from `skills/`.
|
|
27
|
+
|
|
28
|
+
## Included tools
|
|
29
|
+
|
|
30
|
+
### Connected Pipeline
|
|
31
|
+
|
|
32
|
+
Use these tools with an already-open exact Unity project copy that has a reachable `com.unity.pipeline` instance:
|
|
33
|
+
|
|
34
|
+
- `unity_project_status` — inspect lockfiles, matching Unity processes, Pipeline reachability, package version, and advertised commands without launching Unity.
|
|
35
|
+
- `unity_pipeline_recompile` — recompile through Pipeline with exact-copy preflight, bounded polling, and compact compiler evidence.
|
|
36
|
+
- `unity_pipeline_run_tests` — run one focused EditMode or PlayMode selection with bounded polling and aggregate results.
|
|
37
|
+
- `unity_pipeline_eval` — execute bounded project-specific C# through Pipeline's Roslyn REPL.
|
|
38
|
+
- `unity_pipeline_inspect` — dispatch supported package-owned inspection commands and return structured evidence.
|
|
39
|
+
|
|
40
|
+
Connected recompilation follows Unity's Script Changes While Playing policy and never preemptively sends `editor_stop`. Connected tests may exit Play Mode through advertised `editor_stop` when necessary, then verify Edit Mode before dispatch. Play Mode exit is allowed by default; `/unity-playmode-exit allow|disallow|status` controls the current session.
|
|
41
|
+
|
|
42
|
+
A timeout is uncertain: work may still be running. The tools do not silently cancel, retry, launch another Editor, or switch to batchmode.
|
|
43
|
+
|
|
44
|
+
### Editor and batchmode
|
|
45
|
+
|
|
46
|
+
- `unity_open_editor` — open the Unity Editor GUI.
|
|
47
|
+
- `unity_launch_batchmode` — run a bounded batchmode command through Unity CLI or the direct Editor executable.
|
|
48
|
+
- `unity_run_test_batch` — run one isolated or report-producing Unity Test Framework platform with generated XML and log paths.
|
|
49
|
+
- `unity_inspect_artifacts` — summarize existing Unity Test Framework XML and Unity logs without launching Unity.
|
|
50
|
+
|
|
51
|
+
Use connected tests when the exact project is already open and Pipeline testing is reachable. Use `unity_run_test_batch` for closed projects, CI-style isolation, categories or multiple filters, graphics-dependent PlayMode tests, or required NUnit XML/log evidence.
|
|
52
|
+
|
|
53
|
+
Batchmode runs use `-nographics` by default. Set `useGraphics: true` only for screenshots, visual capture, render checks, or graphics-dependent tests. Unity permits only one process per project folder, so all launch routes verify the exact project and use a per-project mutex.
|
|
54
|
+
|
|
55
|
+
### Guidance audit
|
|
56
|
+
|
|
57
|
+
- `unity_guidance_audit` — inspect AGENTS.md, CLAUDE.md, Copilot, and Cursor instructions for outdated or unsafe Unity automation guidance without editing them.
|
|
58
|
+
|
|
59
|
+
### Commands
|
|
60
|
+
|
|
61
|
+
- `/unity-open` — open the current Unity project copy or choose a nearby copy.
|
|
62
|
+
- `/unity-playmode-exit` — allow, disallow, or inspect Play Mode exit behavior for the current session.
|
|
63
|
+
|
|
64
|
+
## Included skills
|
|
65
|
+
|
|
66
|
+
Each skill owns a distinct workflow:
|
|
67
|
+
|
|
68
|
+
- `unity-debugging` — evidence-first diagnosis of Editor, runtime, package, asset, lifecycle, callback, and feature-activation problems.
|
|
69
|
+
- `unity-pipeline-workflows` — connected compilation and focused tests through an already-running exact-copy Pipeline Editor.
|
|
70
|
+
- `unity-batchmode-tests` — isolated or report-producing Unity Test Framework execution.
|
|
71
|
+
- `unity-interactive-playmode-authoring` — temporary live runtime inspection and tuning followed by deliberate persistence when requested.
|
|
72
|
+
- `auditing-unity-agent-guidance` — review and migration of project-local Unity automation instructions.
|
|
73
|
+
|
|
74
|
+
Operation-specific recovery belongs to the operational skill. `unity-debugging` supplies the reusable diagnostic strategy rather than duplicating every workflow's failure handling.
|
|
75
|
+
|
|
76
|
+
## Choosing a workflow
|
|
77
|
+
|
|
78
|
+
| Situation | Preferred route |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| Open exact-copy Editor with reachable Pipeline | Connected Pipeline tools |
|
|
81
|
+
| Closed project or intentional CI isolation | `unity_run_test_batch` or `unity_launch_batchmode` |
|
|
82
|
+
| Required NUnit XML or Unity log evidence | `unity_run_test_batch` |
|
|
83
|
+
| Existing failed-run artifacts | `unity_inspect_artifacts` |
|
|
84
|
+
| Project-specific C# query or operation | `unity_pipeline_eval` |
|
|
85
|
+
| Supported structured project inspection | `unity_pipeline_inspect` |
|
|
86
|
+
| Open the GUI explicitly | `unity_open_editor` or `/unity-open` |
|
|
87
|
+
|
|
88
|
+
Pass an explicit project `path` when multiple copies may be discovered. Pipeline routing compares canonical paths so similarly named copies are not treated as interchangeable.
|
|
89
|
+
|
|
90
|
+
## Pipeline safety and evidence
|
|
91
|
+
|
|
92
|
+
The connected compile and test tools:
|
|
93
|
+
|
|
94
|
+
- require advertised commands before dispatch;
|
|
95
|
+
- verify the exact project copy and Pipeline identity;
|
|
96
|
+
- poll internally with fixed deadlines and bounded backoff;
|
|
97
|
+
- reject malformed or semantically failing nested results;
|
|
98
|
+
- require a known positive test count and zero failures before reporting a pass;
|
|
99
|
+
- discard passing-test records while retaining bounded failure diagnostics;
|
|
100
|
+
- detect pre-existing or clearly displaced test runs when available correlation fields permit it.
|
|
101
|
+
|
|
102
|
+
Another connected client is not a project lock. When Pipeline returns stable correlation fields, conflicting status is reported as displaced and uncertain. If Pipeline omits stable run identity, a competing same-mode, same-filter run may be indistinguishable from the requested run; the tool cannot prove exclusive ownership from shared Editor status alone.
|
|
103
|
+
|
|
104
|
+
### Pipeline eval
|
|
105
|
+
|
|
106
|
+
`unity_pipeline_eval` compiles C# with Roslyn and runs it on the connected Editor main thread. It is a live REPL, not an expression-only or statically read-only evaluator.
|
|
107
|
+
|
|
108
|
+
```text
|
|
109
|
+
{ code: "return UnityEditor.EditorSettings.scriptChangesDuringPlay;" }
|
|
110
|
+
{ code: "var s = UnityEngine.Application.dataPath; return s.Length;" }
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Use `unity_pipeline_inspect` when a purpose-built structured command fits. Use eval for bounded project-specific work that matches the user's intent. Prefer typed tools when they provide stronger lifecycle, polling, validation, or recovery semantics.
|
|
114
|
+
|
|
115
|
+
## Launch and process safeguards
|
|
116
|
+
|
|
117
|
+
`unity_open_editor` and batchmode tools prefer the installed Unity CLI and can fall back to the direct Editor executable. Set `launcher` to `auto`, `unity-cli`, or `editor-executable` when explicit routing is needed.
|
|
118
|
+
|
|
119
|
+
Before launching, pi-unity checks:
|
|
120
|
+
|
|
121
|
+
- running Unity processes targeting the exact project;
|
|
122
|
+
- Unity CLI status and Pipeline instances;
|
|
123
|
+
- native `Temp/UnityLockfile` state;
|
|
124
|
+
- the package-owned per-project launch mutex.
|
|
125
|
+
|
|
126
|
+
Unknown process state blocks launch. Direct Editor execution blocks native lockfiles. Unity CLI may handle a stale lockfile only after pi-unity verifies that no matching Unity process remains.
|
|
127
|
+
|
|
128
|
+
A batchmode call may close a matching Unity process only when all of the following are true:
|
|
129
|
+
|
|
130
|
+
1. isolated execution was deliberately selected;
|
|
131
|
+
2. the call sets `closeBlockingUnityProcess: true`;
|
|
132
|
+
3. `piUnity.allowCloseRunningUnityProcess` is enabled;
|
|
133
|
+
4. any configured test-only restriction permits the operation.
|
|
134
|
+
|
|
135
|
+
The package selects and revalidates the process itself; it never accepts a model-supplied PID. It may remove only the exact project's stale lockfile after a same-call guarded closure and verification that no matching process remains.
|
|
136
|
+
|
|
137
|
+
## Settings
|
|
138
|
+
|
|
139
|
+
Pi-unity reads optional settings from global `~/.pi/agent/settings.json` and, for trusted projects, project `.pi/settings.json`:
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"piUnity": {
|
|
144
|
+
"allowCloseRunningUnityProcess": false,
|
|
145
|
+
"closeRunningUnityProcessOnlyForTests": true,
|
|
146
|
+
"closeRunningUnityProcessTimeoutMs": 30000
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
- `allowCloseRunningUnityProcess` defaults to `false`.
|
|
152
|
+
- `closeRunningUnityProcessOnlyForTests` defaults to `true`.
|
|
153
|
+
- `closeRunningUnityProcessTimeoutMs` defaults to `30000` and is clamped from 1000 to 120000 milliseconds.
|
|
154
|
+
|
|
155
|
+
## Optional integrations
|
|
156
|
+
|
|
157
|
+
`@aefree/pi-project-artifacts` and `@aefree/pi-file-discovery` are optional peer integrations. Core Unity tools work without them.
|
|
158
|
+
|
|
159
|
+
Pi-unity uses a global registry rendezvous so independently installed Git, local, or npm packages can compose without sibling source paths:
|
|
160
|
+
|
|
161
|
+
- The project-artifacts integration contributes an optional Unity profile for solution and memory metadata.
|
|
162
|
+
- The file-discovery integration recommends excluding generated Unity directories from broad searches while preserving exact searches inside those directories.
|
|
163
|
+
|
|
164
|
+
The optional peer integrations are session-scoped, reverse-load-order safe, and transactional. A malformed advertised integration contract fails visibly; an unavailable optional package does not prevent the Unity extension from loading.
|
|
165
|
+
|
|
166
|
+
### Optional artifact metadata
|
|
167
|
+
|
|
168
|
+
When project artifacts are active, solution and memory Markdown may use:
|
|
169
|
+
|
|
170
|
+
```yaml
|
|
171
|
+
---
|
|
172
|
+
engine: unity
|
|
173
|
+
unity_version: "6000.0"
|
|
174
|
+
unity_packages:
|
|
175
|
+
- com.unity.inputsystem
|
|
176
|
+
render_pipeline: urp
|
|
177
|
+
platforms:
|
|
178
|
+
- windows
|
|
179
|
+
- android
|
|
180
|
+
---
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Supported `render_pipeline` values are `builtin`, `urp`, `hdrp`, `custom`, and `agnostic`. All fields are optional, and undeclared project metadata remains open and raw-filterable.
|
|
184
|
+
|
|
185
|
+
### File-discovery filtering
|
|
186
|
+
|
|
187
|
+
Broad Unity project searches may exclude `Library`, `Temp`, `Logs`, `obj`, `Build`, `Builds`, `UserSettings`, and `.vs`. An exact generated root—including `Library/PackageCache/...`—remains searchable. Filter failures degrade filtering rather than blocking inspection.
|
|
188
|
+
|
|
189
|
+
## Package layout
|
|
190
|
+
|
|
191
|
+
```text
|
|
192
|
+
pi-unity/
|
|
193
|
+
index.ts
|
|
194
|
+
src/
|
|
195
|
+
unity-artifact-profile.ts
|
|
196
|
+
unity-batchmode.ts
|
|
197
|
+
unity-cli.ts
|
|
198
|
+
unity-core.ts
|
|
199
|
+
unity-file-discovery-filter.ts
|
|
200
|
+
unity-guidance-audit.ts
|
|
201
|
+
unity-launch.ts
|
|
202
|
+
unity-pipeline.ts
|
|
203
|
+
unity-processes.ts
|
|
204
|
+
unity-project-lock.ts
|
|
205
|
+
unity-projects.ts
|
|
206
|
+
unity-test-batch.ts
|
|
207
|
+
skills/
|
|
208
|
+
auditing-unity-agent-guidance/
|
|
209
|
+
unity-batchmode-tests/
|
|
210
|
+
unity-debugging/
|
|
211
|
+
unity-interactive-playmode-authoring/
|
|
212
|
+
unity-pipeline-workflows/
|
|
213
|
+
tests/
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Development and validation
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
npm ci
|
|
220
|
+
npm test
|
|
221
|
+
npm pack --dry-run --json
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
The auditing skill also has an opt-in provider-backed behavioral eval under `evals/auditing-unity-agent-guidance/`; it is intentionally not part of `npm test`.
|
|
225
|
+
|
|
226
|
+
The registry-clean `package-lock.json` is committed. Optional development packages resolve from the public registry, and the npm archive contains no copied dependency tree, sibling `file:` dependency, or workspace link.
|
|
227
|
+
|
|
228
|
+
## Unity Pipeline project side effect
|
|
229
|
+
|
|
230
|
+
Starting `com.unity.pipeline@0.3.1-exp.1` assigns `Application.runInBackground = true`, which Unity persists as `PlayerSettings.runInBackground` in `ProjectSettings/ProjectSettings.asset`. Review that tracked change alongside `manifest.json` and `packages-lock.json` when installing Pipeline in a Unity project.
|
|
231
|
+
|
|
232
|
+
## License
|
|
233
|
+
|
|
234
|
+
MIT. See `LICENSE`.
|