unity-agentic-tools 0.5.1 → 0.7.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.
- package/README.md +59 -97
- package/dist/animator-utils.d.ts +46 -0
- package/dist/animator-utils.d.ts.map +1 -0
- package/dist/animator-utils.js +161 -0
- package/dist/animator-utils.js.map +1 -0
- package/dist/bridge-install.d.ts +16 -0
- package/dist/bridge-install.d.ts.map +1 -0
- package/dist/bridge-install.js +94 -0
- package/dist/bridge-install.js.map +1 -0
- package/dist/build-settings.d.ts +43 -0
- package/dist/build-settings.d.ts.map +1 -0
- package/dist/build-settings.js +196 -0
- package/dist/build-settings.js.map +1 -0
- package/dist/build-version.d.ts +40 -0
- package/dist/build-version.d.ts.map +1 -0
- package/dist/build-version.js +114 -0
- package/dist/build-version.js.map +1 -0
- package/dist/class-ids.d.ts +30 -0
- package/dist/class-ids.d.ts.map +1 -0
- package/dist/class-ids.js +322 -0
- package/dist/class-ids.js.map +1 -0
- package/dist/cleanup.d.ts +21 -0
- package/dist/cleanup.d.ts.map +1 -0
- package/dist/cleanup.js +161 -0
- package/dist/cleanup.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1060 -8137
- package/dist/cli.js.map +1 -0
- package/dist/editor-client.d.ts +25 -0
- package/dist/editor-client.d.ts.map +1 -0
- package/dist/editor-client.js +458 -0
- package/dist/editor-client.js.map +1 -0
- package/dist/editor-discovery.d.ts +17 -0
- package/dist/editor-discovery.d.ts.map +1 -0
- package/dist/editor-discovery.js +248 -0
- package/dist/editor-discovery.js.map +1 -0
- package/dist/editor-transport.d.ts +30 -0
- package/dist/editor-transport.d.ts.map +1 -0
- package/dist/editor-transport.js +175 -0
- package/dist/editor-transport.js.map +1 -0
- package/dist/gitignore.d.ts +3 -0
- package/dist/gitignore.d.ts.map +1 -0
- package/dist/gitignore.js +40 -0
- package/dist/gitignore.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +116 -8346
- package/dist/index.js.map +1 -0
- package/dist/loaded-protection.d.ts +6 -0
- package/dist/loaded-protection.d.ts.map +1 -0
- package/dist/loaded-protection.js +95 -0
- package/dist/loaded-protection.js.map +1 -0
- package/dist/packages.d.ts +55 -0
- package/dist/packages.d.ts.map +1 -0
- package/dist/packages.js +102 -0
- package/dist/packages.js.map +1 -0
- package/dist/params.d.ts +54 -0
- package/dist/params.d.ts.map +1 -0
- package/dist/params.js +106 -0
- package/dist/params.js.map +1 -0
- package/dist/types.d.ts +167 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/util.d.ts +2 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +7 -0
- package/dist/util.js.map +1 -0
- package/dist/utils.d.ts +82 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +291 -0
- package/dist/utils.js.map +1 -0
- package/package.json +10 -14
- package/dist/doc-indexer-cli.js +0 -3218
- package/native/index.d.ts +0 -335
- package/native/index.js +0 -330
- package/native/unity-file-tools.darwin-arm64.node +0 -0
- package/native/unity-file-tools.darwin-x64.node +0 -0
- package/native/unity-file-tools.linux-x64-gnu.node +0 -0
- package/native/unity-file-tools.win32-x64-msvc.node +0 -0
package/README.md
CHANGED
|
@@ -1,132 +1,94 @@
|
|
|
1
1
|
# unity-agentic-tools
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
Fast CLI for Unity scene, prefab, and asset files. Extracts GameObject hierarchies, components, properties, materials, animations, and project settings with minimal token output for AI agent consumption. Includes a live editor bridge (WebSocket/JSON-RPC) for play mode control, UI interaction, input simulation, and annotated screenshots.
|
|
3
|
+
Compact Unity Editor command runner for AI agents.
|
|
8
4
|
|
|
9
5
|
## Quick Start
|
|
10
6
|
|
|
11
7
|
```bash
|
|
12
8
|
npm install -g unity-agentic-tools
|
|
13
|
-
unity-agentic-tools
|
|
14
|
-
unity-agentic-tools
|
|
15
|
-
unity-agentic-tools
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Unsafe scene and prefab graph mutations no longer live under top-level `create` / `update`. Use the editor bridge instead:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
unity-agentic-tools editor invoke UnityAgenticTools.Create.Scenes GameObject --args '["Assets/Scenes/Main.unity","EnemyRoot","Gameplay"]'
|
|
24
|
-
unity-agentic-tools editor invoke UnityAgenticTools.Create.Prefabs PrefabInstance --args '["Assets/Scenes/Boot.unity","Assets/Prefabs/AppRoot.prefab"]'
|
|
25
|
-
unity-agentic-tools editor invoke UnityAgenticTools.Update.Objects Component --args '["Assets/Scenes/Main.unity","Player","BoxCollider","0","m_IsTrigger","true"]'
|
|
26
|
-
unity-agentic-tools editor invoke UnityAgenticTools.Update.Serialized BatchComponents --args '["Assets/Scenes/Main.unity","[{\"gameObjectPath\":\"Player\",\"componentType\":\"BoxCollider\",\"componentIndex\":0,\"propertyPath\":\"m_IsTrigger\",\"value\":\"true\"}]"]'
|
|
9
|
+
unity-agentic-tools install -p /path/to/UnityProject
|
|
10
|
+
unity-agentic-tools status -p /path/to/UnityProject
|
|
11
|
+
unity-agentic-tools list create -p /path/to/UnityProject
|
|
12
|
+
unity-agentic-tools run query.scene Assets/Scenes/Main.unity -p /path/to/UnityProject
|
|
13
|
+
unity-agentic-tools stream console -p /path/to/UnityProject
|
|
14
|
+
unity-agentic-tools cleanup -p /path/to/UnityProject
|
|
27
15
|
```
|
|
28
16
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
### Read (20)
|
|
32
|
-
`read scene` | `read gameobject` | `read asset` | `read scriptable-object` | `read material` | `read dependencies` | `read dependents` | `read unused` | `read settings` | `read build` | `read overrides` | `read component` | `read reference` | `read script` | `read scripts` | `read meta` | `read animation` | `read animator` | `read manifest` | `read input-actions`
|
|
17
|
+
By default, `install` writes the GitHub package URL. For local bridge package development, use `unity-agentic-tools install --local [path]`; existing `file:` dependencies are preserved unless `unity-agentic-tools install --remote` is passed.
|
|
33
18
|
|
|
34
|
-
|
|
35
|
-
Creation is editor-only now. Use `unity-agentic-tools editor invoke UnityAgenticTools.Create.* ...`.
|
|
19
|
+
## Command Surface
|
|
36
20
|
|
|
37
|
-
|
|
38
|
-
`update scriptable-object` | `update settings` | `update layer` | `update material` | `update meta` | `update animation` | `update animator`
|
|
21
|
+
The CLI intentionally exposes seven broad commands:
|
|
39
22
|
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
| Command | Purpose |
|
|
24
|
+
|---------|---------|
|
|
25
|
+
| `list [query]` | Discover built-in aliases, attributed project commands, and optional raw static APIs |
|
|
26
|
+
| `run <target> [args...]` | Execute a command alias or raw public static C# method/property through the Unity bridge |
|
|
27
|
+
| `stream [topic]` | Watch real-time bridge events over WebSocket |
|
|
28
|
+
| `install` | Install the Unity bridge package |
|
|
29
|
+
| `uninstall` | Remove the Unity bridge package |
|
|
30
|
+
| `cleanup` | Remove stale bridge state or rebuildable `.unity-agentic` caches |
|
|
31
|
+
| `status` | Check command runner and bridge reachability, and what the Editor is busy with |
|
|
42
32
|
|
|
43
|
-
|
|
44
|
-
`editor status` | `editor invoke` | `editor console-follow` | `editor list` | `editor install` | `editor uninstall`
|
|
33
|
+
There are no hidden local serialized-file mutation commands or editor APIs.
|
|
45
34
|
|
|
46
|
-
|
|
47
|
-
`search` | `grep` | `clone` | `version` | `docs` | `setup` | `cleanup` | `status`
|
|
35
|
+
## Domain Reloads
|
|
48
36
|
|
|
49
|
-
|
|
37
|
+
Script edits and entering play mode reload Unity's domain, which takes the bridge down for seconds at a time. Read commands and `play.enter`/`play.exit` wait that window out automatically — up to 30s, and only while the Unity process is still alive — so expect a slow call rather than a failure. `stream` reconnects on the same budget and reports `Stream lost: ...` if it cannot.
|
|
50
38
|
|
|
51
|
-
|
|
39
|
+
Mutating commands are deliberately not retried across a reload: the request may already be executing on Unity's main thread, and replaying it could apply it twice. Treat `Editor invoke was interrupted by a server transition ...` as "result unknown", check the side effects, then decide whether to re-run.
|
|
52
40
|
|
|
53
|
-
|
|
41
|
+
`play.enter` and `play.exit` report the state at the moment they return, not the requested one — `requested` names the intent, `state` and `isPlaying` are queried live. Gate on `play.state`.
|
|
54
42
|
|
|
55
|
-
|
|
56
|
-
- `clone`
|
|
57
|
-
- `delete gameobject|component|prefab|asset`
|
|
43
|
+
## Examples
|
|
58
44
|
|
|
59
|
-
|
|
45
|
+
```bash
|
|
46
|
+
unity-agentic-tools list scene -p <project>
|
|
47
|
+
unity-agentic-tools run project.refresh -p <project>
|
|
48
|
+
unity-agentic-tools run scene.open Assets/Scenes/Main.unity false -p <project>
|
|
49
|
+
unity-agentic-tools run create.gameobject Assets/Scenes/Main.unity EnemyRoot Gameplay -p <project>
|
|
50
|
+
unity-agentic-tools run update.transform Assets/Scenes/Main.unity Player 1,2,3 0,90,0 1,1,1 -p <project>
|
|
51
|
+
unity-agentic-tools run delete.component Assets/Scenes/Main.unity Player BoxCollider 0 -p <project>
|
|
52
|
+
unity-agentic-tools stream console --type Error -p <project>
|
|
53
|
+
unity-agentic-tools cleanup --cache -p <project>
|
|
54
|
+
```
|
|
60
55
|
|
|
61
|
-
|
|
56
|
+
Structured arguments go positionally in single quotes — the CLI encodes the outer JSON array itself:
|
|
62
57
|
|
|
63
|
-
|
|
58
|
+
```bash
|
|
59
|
+
unity-agentic-tools run update.batch Assets/Scenes/Main.unity '[{"gameObjectPath":"Player","propertyPath":"m_Name","value":"Hero"}]' -p <project>
|
|
60
|
+
```
|
|
64
61
|
|
|
65
|
-
`
|
|
66
|
-
- `Scene(assetPath, includeDefaults = false)`
|
|
67
|
-
- `GameObject(assetPath, name, parentPath = "")`
|
|
68
|
-
- `Component(assetPath, gameObjectPath, componentType)`
|
|
69
|
-
- `ComponentCopy(assetPath, sourceGameObjectPath, sourceComponentType, sourceComponentIndex, targetGameObjectPath)`
|
|
62
|
+
`--args '<json array>'` sends the same payload with the escaping done by hand. Reach for it only when an argument starts with `-`, which the option parser would otherwise claim.
|
|
70
63
|
|
|
71
|
-
|
|
72
|
-
- `Prefab(assetPath, name = "")`
|
|
73
|
-
- `PrefabVariant(sourcePrefabPath, outputPath, variantName = "")`
|
|
74
|
-
- `PrefabInstance(assetPath, prefabPath, parentPath = "", instanceName = "", localPosX = 0, localPosY = 0, localPosZ = 0)`
|
|
64
|
+
## Project Commands
|
|
75
65
|
|
|
76
|
-
`
|
|
77
|
-
- `ScriptableObject(assetPath, script, initialValuesJson = "")`
|
|
78
|
-
- `Meta(scriptPath)`
|
|
79
|
-
- `Material(assetPath, shaderGuid, materialName = "")`
|
|
80
|
-
- `InputActions(assetPath, name)`
|
|
81
|
-
- `Animation(assetPath, clipName = "", sampleRate = 60, loopTime = false)`
|
|
82
|
-
- `Animator(assetPath, controllerName = "", layerName = "Base Layer")`
|
|
66
|
+
Expose project-specific behavior by adding `[AgenticCommand]` to public static editor methods/properties:
|
|
83
67
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
- `Package(name, version)`
|
|
68
|
+
```csharp
|
|
69
|
+
using UnityAgenticTools.Commands;
|
|
87
70
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
71
|
+
public static class BuildCommands
|
|
72
|
+
{
|
|
73
|
+
[AgenticCommand("build.addressables", "Build Addressables content.")]
|
|
74
|
+
public static object BuildAddressables(string profile)
|
|
75
|
+
{
|
|
76
|
+
return new { success = true, profile };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
94
80
|
|
|
95
|
-
|
|
96
|
-
- `Array(assetPath, gameObjectPath, componentType, componentIndex, arrayProperty, action, payloadJson = "")`
|
|
97
|
-
- `Batch(assetPath, editsJson)`
|
|
98
|
-
- `BatchComponents(assetPath, editsJson)`
|
|
99
|
-
- `ManagedReference(assetPath, gameObjectPath, componentType, componentIndex, fieldPath, typeName, initialValuesJson = "", append = false)`
|
|
81
|
+
Then run:
|
|
100
82
|
|
|
101
|
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
|
|
105
|
-
- `PrefabManagedReference(assetPath, gameObjectPath, componentType, componentIndex, fieldPath, typeName, initialValuesJson = "", append = false)`
|
|
106
|
-
- `PrefabRemoveOverride(assetPath, gameObjectPath, componentType, componentIndex, propertyPath)`
|
|
107
|
-
- `PrefabRemoveComponent(assetPath, gameObjectPath, componentType, componentIndex)`
|
|
108
|
-
- `PrefabRestoreComponent(assetPath, gameObjectPath, componentType, componentIndex)`
|
|
109
|
-
- `PrefabRemoveGameObject(assetPath, gameObjectPath)`
|
|
110
|
-
- `PrefabRestoreGameObject(assetPath, gameObjectPath)`
|
|
83
|
+
```bash
|
|
84
|
+
unity-agentic-tools list build -p <project>
|
|
85
|
+
unity-agentic-tools run build.addressables Production -p <project>
|
|
86
|
+
```
|
|
111
87
|
|
|
112
88
|
## Requirements
|
|
113
89
|
|
|
114
90
|
- Bun runtime
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
## Troubleshooting
|
|
118
|
-
|
|
119
|
-
### Slow on large scenes
|
|
120
|
-
|
|
121
|
-
The Rust backend may not be installed. Run `bun install` in the project root to resolve the native module.
|
|
122
|
-
|
|
123
|
-
### Script names show as GUIDs
|
|
124
|
-
|
|
125
|
-
The GUID cache hasn't been built for your project. Run `unity-agentic-tools setup -p <project_path>`.
|
|
126
|
-
|
|
127
|
-
### Parse errors on custom assets
|
|
128
|
-
|
|
129
|
-
Some asset types with non-standard YAML may not parse correctly. Open an issue with a sample file.
|
|
91
|
+
- Unity Editor bridge package installed in the target project
|
|
130
92
|
|
|
131
93
|
## License
|
|
132
94
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for reading and editing Unity AnimatorController files.
|
|
3
|
+
*/
|
|
4
|
+
export interface AnimatorBlock {
|
|
5
|
+
file_id: string;
|
|
6
|
+
class_id: number;
|
|
7
|
+
type_name: string;
|
|
8
|
+
raw: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Split a multi-document Unity YAML file into typed blocks.
|
|
12
|
+
* Supports negative 64-bit fileIDs (e.g. &-8508701068132362129).
|
|
13
|
+
*/
|
|
14
|
+
export declare function split_yaml_blocks(content: string): AnimatorBlock[];
|
|
15
|
+
/**
|
|
16
|
+
* Extract a YAML field value from a block's raw text.
|
|
17
|
+
*/
|
|
18
|
+
export declare function yaml_field(raw: string, field: string): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Extract an inline reference {fileID: X, guid: Y} from a string.
|
|
21
|
+
* Supports negative fileIDs.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parse_inline_ref(str: string): {
|
|
24
|
+
fileID: string;
|
|
25
|
+
guid: string;
|
|
26
|
+
} | null;
|
|
27
|
+
/**
|
|
28
|
+
* Find a state block by its m_Name.
|
|
29
|
+
* Returns the block or null.
|
|
30
|
+
*/
|
|
31
|
+
export declare function find_state_by_name(blocks: AnimatorBlock[], name: string): AnimatorBlock | null;
|
|
32
|
+
/**
|
|
33
|
+
* Find the state machine block for a given layer.
|
|
34
|
+
* If layer_name is not specified, returns the first state machine.
|
|
35
|
+
*/
|
|
36
|
+
export declare function find_state_machine_for_layer(blocks: AnimatorBlock[], controller_block: AnimatorBlock, layer_name?: string): AnimatorBlock | null;
|
|
37
|
+
/**
|
|
38
|
+
* Generate a positive fileID suitable for new Unity YAML blocks.
|
|
39
|
+
* Uses large positive integers to avoid collisions with existing IDs.
|
|
40
|
+
*/
|
|
41
|
+
export declare function generate_file_id(existing_ids: Set<string>): string;
|
|
42
|
+
/**
|
|
43
|
+
* Collect all fileIDs (as strings) from the file content.
|
|
44
|
+
*/
|
|
45
|
+
export declare function collect_file_ids(content: string): Set<string>;
|
|
46
|
+
//# sourceMappingURL=animator-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animator-utils.d.ts","sourceRoot":"","sources":["../src/animator-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACf;AAID;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CAqClE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIpE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAGrF;AAID;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAE9F;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CACxC,MAAM,EAAE,aAAa,EAAE,EACvB,gBAAgB,EAAE,aAAa,EAC/B,UAAU,CAAC,EAAE,MAAM,GACpB,aAAa,GAAG,IAAI,CAqDtB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAQlE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAO7D"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared utilities for reading and editing Unity AnimatorController files.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.split_yaml_blocks = split_yaml_blocks;
|
|
7
|
+
exports.yaml_field = yaml_field;
|
|
8
|
+
exports.parse_inline_ref = parse_inline_ref;
|
|
9
|
+
exports.find_state_by_name = find_state_by_name;
|
|
10
|
+
exports.find_state_machine_for_layer = find_state_machine_for_layer;
|
|
11
|
+
exports.generate_file_id = generate_file_id;
|
|
12
|
+
exports.collect_file_ids = collect_file_ids;
|
|
13
|
+
// ========== Parsing ==========
|
|
14
|
+
/**
|
|
15
|
+
* Split a multi-document Unity YAML file into typed blocks.
|
|
16
|
+
* Supports negative 64-bit fileIDs (e.g. &-8508701068132362129).
|
|
17
|
+
*/
|
|
18
|
+
function split_yaml_blocks(content) {
|
|
19
|
+
const blocks = [];
|
|
20
|
+
const doc_re = /^--- !u!(\d+) &(-?\d+)/;
|
|
21
|
+
const lines = content.split(/\r?\n/);
|
|
22
|
+
let current_lines = [];
|
|
23
|
+
let current_class_id = 0;
|
|
24
|
+
let current_file_id = '';
|
|
25
|
+
for (const line of lines) {
|
|
26
|
+
const m = doc_re.exec(line);
|
|
27
|
+
if (m) {
|
|
28
|
+
if (current_lines.length > 0) {
|
|
29
|
+
const type_line = current_lines.find(l => /^\w+:/.test(l.trimStart()));
|
|
30
|
+
blocks.push({
|
|
31
|
+
file_id: current_file_id,
|
|
32
|
+
class_id: current_class_id,
|
|
33
|
+
type_name: type_line ? type_line.trimStart().replace(/:.*/, '') : 'Unknown',
|
|
34
|
+
raw: current_lines.join('\n'),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
current_class_id = parseInt(m[1], 10);
|
|
38
|
+
current_file_id = m[2];
|
|
39
|
+
current_lines = [];
|
|
40
|
+
}
|
|
41
|
+
else if (!line.startsWith('%')) {
|
|
42
|
+
current_lines.push(line);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (current_lines.length > 0) {
|
|
46
|
+
const type_line = current_lines.find(l => /^\w+:/.test(l.trimStart()));
|
|
47
|
+
blocks.push({
|
|
48
|
+
file_id: current_file_id,
|
|
49
|
+
class_id: current_class_id,
|
|
50
|
+
type_name: type_line ? type_line.trimStart().replace(/:.*/, '') : 'Unknown',
|
|
51
|
+
raw: current_lines.join('\n'),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return blocks;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Extract a YAML field value from a block's raw text.
|
|
58
|
+
*/
|
|
59
|
+
function yaml_field(raw, field) {
|
|
60
|
+
const re = new RegExp(`^\\s*${field}:\\s*(.*)$`, 'm');
|
|
61
|
+
const m = re.exec(raw);
|
|
62
|
+
return m ? m[1].trim() : null;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Extract an inline reference {fileID: X, guid: Y} from a string.
|
|
66
|
+
* Supports negative fileIDs.
|
|
67
|
+
*/
|
|
68
|
+
function parse_inline_ref(str) {
|
|
69
|
+
const m = /\{[^}]*fileID:\s*(-?\d+)(?:[^}]*guid:\s*([a-f0-9]+))?/.exec(str);
|
|
70
|
+
return m ? { fileID: m[1], guid: m[2] || '' } : null;
|
|
71
|
+
}
|
|
72
|
+
// ========== Lookup Helpers ==========
|
|
73
|
+
/**
|
|
74
|
+
* Find a state block by its m_Name.
|
|
75
|
+
* Returns the block or null.
|
|
76
|
+
*/
|
|
77
|
+
function find_state_by_name(blocks, name) {
|
|
78
|
+
return blocks.find(b => b.class_id === 1102 && yaml_field(b.raw, 'm_Name') === name) || null;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Find the state machine block for a given layer.
|
|
82
|
+
* If layer_name is not specified, returns the first state machine.
|
|
83
|
+
*/
|
|
84
|
+
function find_state_machine_for_layer(blocks, controller_block, layer_name) {
|
|
85
|
+
const sm_blocks = blocks.filter(b => b.class_id === 1107);
|
|
86
|
+
if (sm_blocks.length === 0)
|
|
87
|
+
return null;
|
|
88
|
+
if (!layer_name) {
|
|
89
|
+
// Return the first state machine (Base Layer)
|
|
90
|
+
// Parse m_AnimatorLayers to get the first state machine reference
|
|
91
|
+
const lines = controller_block.raw.split(/\r?\n/);
|
|
92
|
+
let in_layers = false;
|
|
93
|
+
for (const line of lines) {
|
|
94
|
+
const t = line.trimStart();
|
|
95
|
+
if (t.startsWith('m_AnimatorLayers:')) {
|
|
96
|
+
in_layers = !t.endsWith('[]');
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (in_layers && t.startsWith('m_StateMachine:')) {
|
|
100
|
+
const ref = parse_inline_ref(t);
|
|
101
|
+
if (ref) {
|
|
102
|
+
return blocks.find(b => b.file_id === ref.fileID && b.class_id === 1107) || null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return sm_blocks[0];
|
|
107
|
+
}
|
|
108
|
+
// Find the layer entry and get its state machine reference
|
|
109
|
+
const lines = controller_block.raw.split(/\r?\n/);
|
|
110
|
+
let in_layers = false;
|
|
111
|
+
let found_layer = false;
|
|
112
|
+
for (const line of lines) {
|
|
113
|
+
const t = line.trimStart();
|
|
114
|
+
if (t.startsWith('m_AnimatorLayers:')) {
|
|
115
|
+
in_layers = !t.endsWith('[]');
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (in_layers) {
|
|
119
|
+
if (t.startsWith('m_Name:') && t.includes(layer_name)) {
|
|
120
|
+
found_layer = true;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (found_layer && t.startsWith('m_StateMachine:')) {
|
|
124
|
+
const ref = parse_inline_ref(t);
|
|
125
|
+
if (ref) {
|
|
126
|
+
return blocks.find(b => b.file_id === ref.fileID && b.class_id === 1107) || null;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Reset if we hit a new layer entry
|
|
130
|
+
if (found_layer && t.startsWith('- serializedVersion:')) {
|
|
131
|
+
found_layer = false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Generate a positive fileID suitable for new Unity YAML blocks.
|
|
139
|
+
* Uses large positive integers to avoid collisions with existing IDs.
|
|
140
|
+
*/
|
|
141
|
+
function generate_file_id(existing_ids) {
|
|
142
|
+
let id;
|
|
143
|
+
do {
|
|
144
|
+
// Generate a 10-digit positive integer
|
|
145
|
+
const num = Math.floor(Math.random() * 9000000000) + 1000000000;
|
|
146
|
+
id = String(num);
|
|
147
|
+
} while (existing_ids.has(id));
|
|
148
|
+
return id;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Collect all fileIDs (as strings) from the file content.
|
|
152
|
+
*/
|
|
153
|
+
function collect_file_ids(content) {
|
|
154
|
+
const ids = new Set();
|
|
155
|
+
const matches = content.matchAll(/--- !u!\d+ &(-?\d+)/g);
|
|
156
|
+
for (const m of matches) {
|
|
157
|
+
ids.add(m[1]);
|
|
158
|
+
}
|
|
159
|
+
return ids;
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=animator-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animator-utils.js","sourceRoot":"","sources":["../src/animator-utils.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAiBH,8CAqCC;AAKD,gCAIC;AAMD,4CAGC;AAQD,gDAEC;AAMD,oEAyDC;AAMD,4CAQC;AAKD,4CAOC;AAhKD,gCAAgC;AAEhC;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,OAAe;IAC7C,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,MAAM,MAAM,GAAG,wBAAwB,CAAC;IACxC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrC,IAAI,aAAa,GAAa,EAAE,CAAC;IACjC,IAAI,gBAAgB,GAAG,CAAC,CAAC;IACzB,IAAI,eAAe,GAAG,EAAE,CAAC;IAEzB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI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B,gBAAgB,CAAC,OAAe;IAC5C,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;IACzD,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACtB,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface BridgeInstallOptions {
|
|
2
|
+
remote?: boolean;
|
|
3
|
+
local_package_path?: string;
|
|
4
|
+
require_local?: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface BridgeInstallResult {
|
|
7
|
+
success: true;
|
|
8
|
+
action: 'added' | 'updated' | 'preserved';
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function install_bridge_package(project_path: string, options?: BridgeInstallOptions): BridgeInstallResult | {
|
|
13
|
+
error: string;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=bridge-install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge-install.d.ts","sourceRoot":"","sources":["../src/bridge-install.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,oBAAoB;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,UAAU,mBAAmB;IACzB,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAMD,wBAAgB,sBAAsB,CAClC,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,oBAAyB,GACnC,mBAAmB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAuBzC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.install_bridge_package = install_bridge_package;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const packages_1 = require("./packages");
|
|
7
|
+
const BRIDGE_PACKAGE_NAME = 'com.unity-agentic-tools.editor-bridge';
|
|
8
|
+
const REMOTE_BRIDGE_PACKAGE_VERSION = 'https://github.com/taconotsandwich/unity-agentic-tools.git?path=unity-package';
|
|
9
|
+
function install_bridge_package(project_path, options = {}) {
|
|
10
|
+
const target = resolve_bridge_package_target(options);
|
|
11
|
+
if ('error' in target) {
|
|
12
|
+
return target;
|
|
13
|
+
}
|
|
14
|
+
const manifest_result = (0, packages_1.load_manifest)(project_path);
|
|
15
|
+
if ('error' in manifest_result) {
|
|
16
|
+
return manifest_result;
|
|
17
|
+
}
|
|
18
|
+
const existing_version = manifest_result.manifest.dependencies[BRIDGE_PACKAGE_NAME];
|
|
19
|
+
const should_preserve_existing_file = !options.remote && !options.local_package_path && !options.require_local;
|
|
20
|
+
if (should_preserve_existing_file && typeof existing_version === 'string' && existing_version.startsWith('file:')) {
|
|
21
|
+
return {
|
|
22
|
+
success: true,
|
|
23
|
+
action: 'preserved',
|
|
24
|
+
name: BRIDGE_PACKAGE_NAME,
|
|
25
|
+
version: existing_version,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return (0, packages_1.add_package)(project_path, BRIDGE_PACKAGE_NAME, target.version);
|
|
29
|
+
}
|
|
30
|
+
function resolve_bridge_package_target(options) {
|
|
31
|
+
if (options.remote && (options.local_package_path || options.require_local)) {
|
|
32
|
+
return { error: 'Use either --local or --remote, not both.' };
|
|
33
|
+
}
|
|
34
|
+
if (options.remote) {
|
|
35
|
+
return { version: REMOTE_BRIDGE_PACKAGE_VERSION };
|
|
36
|
+
}
|
|
37
|
+
if (options.local_package_path) {
|
|
38
|
+
const local_path = (0, path_1.resolve)(options.local_package_path);
|
|
39
|
+
return local_package_target(local_path);
|
|
40
|
+
}
|
|
41
|
+
if (options.require_local) {
|
|
42
|
+
const detected_path = detect_local_bridge_package_path();
|
|
43
|
+
if (detected_path) {
|
|
44
|
+
return local_package_target(detected_path);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
error: 'Local bridge package could not be auto-detected. Pass --local <path-to-unity-package> or run from a source checkout.',
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return { version: REMOTE_BRIDGE_PACKAGE_VERSION };
|
|
51
|
+
}
|
|
52
|
+
function detect_local_bridge_package_path() {
|
|
53
|
+
const candidate = (0, path_1.resolve)(__dirname, '..', '..', 'unity-package');
|
|
54
|
+
return is_bridge_package(candidate) ? candidate : undefined;
|
|
55
|
+
}
|
|
56
|
+
function local_package_target(package_path) {
|
|
57
|
+
const normalized_path = normalize_local_bridge_package_path(package_path);
|
|
58
|
+
if (!normalized_path) {
|
|
59
|
+
return {
|
|
60
|
+
error: `Local bridge package not found at ${package_path}. Expected package.json with name "${BRIDGE_PACKAGE_NAME}".`,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return { version: to_file_dependency(normalized_path) };
|
|
64
|
+
}
|
|
65
|
+
function normalize_local_bridge_package_path(package_path) {
|
|
66
|
+
if (is_bridge_package(package_path)) {
|
|
67
|
+
return package_path;
|
|
68
|
+
}
|
|
69
|
+
const nested_package_path = (0, path_1.join)(package_path, 'unity-package');
|
|
70
|
+
if (is_bridge_package(nested_package_path)) {
|
|
71
|
+
return nested_package_path;
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
function is_bridge_package(package_path) {
|
|
76
|
+
const package_json_path = (0, path_1.join)(package_path, 'package.json');
|
|
77
|
+
if (!(0, fs_1.existsSync)(package_json_path)) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
const parsed = JSON.parse((0, fs_1.readFileSync)(package_json_path, 'utf-8'));
|
|
82
|
+
return is_record(parsed) && parsed.name === BRIDGE_PACKAGE_NAME;
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function is_record(value) {
|
|
89
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
90
|
+
}
|
|
91
|
+
function to_file_dependency(package_path) {
|
|
92
|
+
return `file:${package_path.replace(/\\/g, '/')}`;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=bridge-install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge-install.js","sourceRoot":"","sources":["../src/bridge-install.ts"],"names":[],"mappings":";;AAwBA,wDA0BC;AAlDD,2BAA8C;AAC9C,+BAAqC;AACrC,yCAAwD;AAExD,MAAM,mBAAmB,GAAG,uCAAuC,CAAC;AACpE,MAAM,6BAA6B,GAAG,+EAA+E,CAAC;AAmBtH,SAAgB,sBAAsB,CAClC,YAAoB,EACpB,UAAgC,EAAE;IAElC,MAAM,MAAM,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAAC;IACtD,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,MAAM,eAAe,GAAG,IAAA,wBAAa,EAAC,YAAY,CAAC,CAAC;IACpD,IAAI,OAAO,IAAI,eAAe,EAAE,CAAC;QAC7B,OAAO,eAAe,CAAC;IAC3B,CAAC;IAED,MAAM,gBAAgB,GAAG,eAAe,CAAC,QAAQ,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;IACpF,MAAM,6BAA6B,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,kBAAkB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;IAC/G,IAAI,6B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7B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,kBAAkB,CAAC,YAAoB;IAC5C,OAAO,QAAQ,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { UnityProjectInfo } from './build-version';
|
|
2
|
+
export interface SceneEntry {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
path: string;
|
|
5
|
+
guid?: string;
|
|
6
|
+
buildIndex: number;
|
|
7
|
+
exists?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface EditorBuildSettings {
|
|
10
|
+
scenes: SceneEntry[];
|
|
11
|
+
configObjects?: Record<string, string>;
|
|
12
|
+
}
|
|
13
|
+
export interface BuildProfile {
|
|
14
|
+
name: string;
|
|
15
|
+
path: string;
|
|
16
|
+
platform?: string;
|
|
17
|
+
scenes?: SceneEntry[];
|
|
18
|
+
scriptingDefines?: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface BuildSettingsResult {
|
|
21
|
+
projectInfo: UnityProjectInfo;
|
|
22
|
+
editorBuildSettings: EditorBuildSettings;
|
|
23
|
+
buildProfiles: BuildProfile[];
|
|
24
|
+
activeBuildProfile?: string;
|
|
25
|
+
missingScenes?: string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Parse EditorBuildSettings.asset YAML file
|
|
29
|
+
*/
|
|
30
|
+
export declare function parse_editor_build_settings(filePath: string): EditorBuildSettings;
|
|
31
|
+
/**
|
|
32
|
+
* Parse a Build Profile .asset file (Unity 6+)
|
|
33
|
+
*/
|
|
34
|
+
export declare function parse_build_profile(filePath: string): BuildProfile;
|
|
35
|
+
/**
|
|
36
|
+
* List all build profiles in a Unity 6+ project
|
|
37
|
+
*/
|
|
38
|
+
export declare function list_build_profiles(projectPath: string): BuildProfile[];
|
|
39
|
+
/**
|
|
40
|
+
* Get complete build settings for a Unity project
|
|
41
|
+
*/
|
|
42
|
+
export declare function get_build_settings(projectPath: string): BuildSettingsResult;
|
|
43
|
+
//# sourceMappingURL=build-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-settings.d.ts","sourceRoot":"","sources":["../src/build-settings.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAErE,MAAM,WAAW,UAAU;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,mBAAmB;IAChC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAmCjF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,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