unreal-engine-mcp-server 0.5.0 → 0.5.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.
Files changed (188) hide show
  1. package/.env.example +1 -1
  2. package/.github/release-drafter-config.yml +51 -0
  3. package/.github/workflows/greetings.yml +5 -1
  4. package/.github/workflows/labeler.yml +2 -1
  5. package/.github/workflows/publish-mcp.yml +2 -4
  6. package/.github/workflows/release-drafter.yml +3 -2
  7. package/.github/workflows/release.yml +3 -3
  8. package/CHANGELOG.md +109 -0
  9. package/CONTRIBUTING.md +1 -1
  10. package/GEMINI.md +115 -0
  11. package/Public/Plugin_setup_guide.mp4 +0 -0
  12. package/README.md +166 -200
  13. package/dist/automation/bridge.d.ts +1 -2
  14. package/dist/automation/bridge.js +24 -23
  15. package/dist/automation/connection-manager.d.ts +1 -0
  16. package/dist/automation/connection-manager.js +10 -0
  17. package/dist/automation/message-handler.js +5 -4
  18. package/dist/automation/request-tracker.d.ts +4 -0
  19. package/dist/automation/request-tracker.js +11 -3
  20. package/dist/config.d.ts +0 -1
  21. package/dist/config.js +0 -1
  22. package/dist/constants.d.ts +4 -0
  23. package/dist/constants.js +4 -0
  24. package/dist/graphql/loaders.d.ts +64 -0
  25. package/dist/graphql/loaders.js +117 -0
  26. package/dist/graphql/resolvers.d.ts +3 -3
  27. package/dist/graphql/resolvers.js +33 -30
  28. package/dist/graphql/server.js +3 -1
  29. package/dist/graphql/types.d.ts +2 -0
  30. package/dist/index.d.ts +2 -0
  31. package/dist/index.js +13 -2
  32. package/dist/server-setup.d.ts +0 -1
  33. package/dist/server-setup.js +0 -40
  34. package/dist/tools/actors.d.ts +58 -24
  35. package/dist/tools/actors.js +22 -6
  36. package/dist/tools/assets.d.ts +19 -71
  37. package/dist/tools/assets.js +28 -22
  38. package/dist/tools/base-tool.d.ts +4 -4
  39. package/dist/tools/base-tool.js +1 -1
  40. package/dist/tools/blueprint.d.ts +45 -61
  41. package/dist/tools/blueprint.js +43 -14
  42. package/dist/tools/consolidated-tool-definitions.js +2 -1
  43. package/dist/tools/consolidated-tool-handlers.js +96 -110
  44. package/dist/tools/dynamic-handler-registry.d.ts +11 -9
  45. package/dist/tools/dynamic-handler-registry.js +17 -95
  46. package/dist/tools/editor.d.ts +19 -193
  47. package/dist/tools/editor.js +11 -2
  48. package/dist/tools/environment.d.ts +8 -14
  49. package/dist/tools/foliage.d.ts +18 -143
  50. package/dist/tools/foliage.js +4 -2
  51. package/dist/tools/handlers/actor-handlers.d.ts +1 -1
  52. package/dist/tools/handlers/actor-handlers.js +14 -13
  53. package/dist/tools/handlers/asset-handlers.js +454 -454
  54. package/dist/tools/handlers/sequence-handlers.d.ts +1 -1
  55. package/dist/tools/handlers/sequence-handlers.js +24 -13
  56. package/dist/tools/introspection.d.ts +1 -1
  57. package/dist/tools/introspection.js +1 -1
  58. package/dist/tools/landscape.d.ts +16 -116
  59. package/dist/tools/landscape.js +7 -3
  60. package/dist/tools/level.d.ts +22 -103
  61. package/dist/tools/level.js +26 -18
  62. package/dist/tools/lighting.d.ts +54 -7
  63. package/dist/tools/lighting.js +9 -5
  64. package/dist/tools/materials.d.ts +1 -1
  65. package/dist/tools/materials.js +5 -1
  66. package/dist/tools/niagara.js +37 -2
  67. package/dist/tools/performance.d.ts +0 -1
  68. package/dist/tools/performance.js +0 -1
  69. package/dist/tools/physics.js +5 -1
  70. package/dist/tools/sequence.d.ts +24 -24
  71. package/dist/tools/sequence.js +13 -0
  72. package/dist/tools/ui.d.ts +0 -2
  73. package/dist/types/automation-responses.d.ts +115 -0
  74. package/dist/types/automation-responses.js +2 -0
  75. package/dist/types/responses.d.ts +249 -0
  76. package/dist/types/responses.js +2 -0
  77. package/dist/types/tool-interfaces.d.ts +135 -135
  78. package/dist/types/tool-types.d.ts +2 -0
  79. package/dist/unreal-bridge.js +4 -4
  80. package/dist/utils/command-validator.js +7 -5
  81. package/dist/utils/error-handler.d.ts +24 -2
  82. package/dist/utils/error-handler.js +58 -23
  83. package/dist/utils/normalize.d.ts +7 -4
  84. package/dist/utils/normalize.js +12 -10
  85. package/dist/utils/path-security.d.ts +2 -0
  86. package/dist/utils/path-security.js +24 -0
  87. package/dist/utils/response-factory.d.ts +4 -4
  88. package/dist/utils/response-factory.js +15 -21
  89. package/dist/utils/response-validator.js +88 -73
  90. package/dist/utils/unreal-command-queue.d.ts +2 -0
  91. package/dist/utils/unreal-command-queue.js +8 -1
  92. package/docs/Migration-Guide-v0.5.0.md +1 -9
  93. package/docs/handler-mapping.md +4 -2
  94. package/docs/testing-guide.md +2 -2
  95. package/package.json +12 -6
  96. package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridgeSubsystem.cpp +298 -33
  97. package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_AnimationHandlers.cpp +7 -8
  98. package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_BlueprintGraphHandlers.cpp +229 -319
  99. package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_BlueprintHandlers.cpp +98 -0
  100. package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_EffectHandlers.cpp +24 -0
  101. package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_EnvironmentHandlers.cpp +96 -0
  102. package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_LightingHandlers.cpp +52 -5
  103. package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_ProcessRequest.cpp +5 -268
  104. package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_SequenceHandlers.cpp +57 -2
  105. package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpConnectionManager.cpp +0 -1
  106. package/scripts/run-all-tests.mjs +25 -20
  107. package/server.json +3 -2
  108. package/src/automation/bridge.ts +27 -25
  109. package/src/automation/connection-manager.ts +18 -0
  110. package/src/automation/message-handler.ts +33 -8
  111. package/src/automation/request-tracker.ts +39 -7
  112. package/src/config.ts +1 -1
  113. package/src/constants.ts +7 -0
  114. package/src/graphql/loaders.ts +244 -0
  115. package/src/graphql/resolvers.ts +47 -49
  116. package/src/graphql/server.ts +3 -1
  117. package/src/graphql/types.ts +3 -0
  118. package/src/index.ts +15 -2
  119. package/src/resources/assets.ts +5 -4
  120. package/src/server/tool-registry.ts +3 -3
  121. package/src/server-setup.ts +3 -37
  122. package/src/tools/actors.ts +77 -44
  123. package/src/tools/animation.ts +1 -0
  124. package/src/tools/assets.ts +76 -65
  125. package/src/tools/base-tool.ts +3 -3
  126. package/src/tools/blueprint.ts +170 -104
  127. package/src/tools/consolidated-tool-definitions.ts +2 -1
  128. package/src/tools/consolidated-tool-handlers.ts +129 -150
  129. package/src/tools/dynamic-handler-registry.ts +22 -140
  130. package/src/tools/editor.ts +43 -29
  131. package/src/tools/environment.ts +21 -27
  132. package/src/tools/foliage.ts +28 -25
  133. package/src/tools/handlers/actor-handlers.ts +16 -17
  134. package/src/tools/handlers/asset-handlers.ts +484 -484
  135. package/src/tools/handlers/sequence-handlers.ts +85 -62
  136. package/src/tools/introspection.ts +7 -7
  137. package/src/tools/landscape.ts +34 -28
  138. package/src/tools/level.ts +100 -80
  139. package/src/tools/lighting.ts +25 -20
  140. package/src/tools/materials.ts +9 -3
  141. package/src/tools/niagara.ts +44 -2
  142. package/src/tools/performance.ts +1 -2
  143. package/src/tools/physics.ts +7 -1
  144. package/src/tools/sequence.ts +42 -26
  145. package/src/tools/ui.ts +1 -3
  146. package/src/types/automation-responses.ts +119 -0
  147. package/src/types/responses.ts +355 -0
  148. package/src/types/tool-interfaces.ts +135 -135
  149. package/src/types/tool-types.ts +4 -0
  150. package/src/unreal-bridge.ts +71 -26
  151. package/src/utils/command-validator.ts +47 -5
  152. package/src/utils/error-handler.ts +128 -45
  153. package/src/utils/normalize.test.ts +162 -0
  154. package/src/utils/normalize.ts +38 -16
  155. package/src/utils/path-security.ts +43 -0
  156. package/src/utils/response-factory.ts +29 -24
  157. package/src/utils/response-validator.ts +103 -87
  158. package/src/utils/safe-json.test.ts +90 -0
  159. package/src/utils/unreal-command-queue.ts +13 -1
  160. package/src/utils/validation.test.ts +184 -0
  161. package/tests/test-animation.mjs +358 -33
  162. package/tests/test-asset-graph.mjs +311 -0
  163. package/tests/test-audio.mjs +314 -116
  164. package/tests/test-behavior-tree.mjs +327 -144
  165. package/tests/test-blueprint-graph.mjs +343 -12
  166. package/tests/test-control-editor.mjs +85 -53
  167. package/tests/test-graphql.mjs +58 -8
  168. package/tests/test-input.mjs +349 -0
  169. package/tests/test-inspect.mjs +291 -61
  170. package/tests/test-landscape.mjs +304 -48
  171. package/tests/test-lighting.mjs +428 -0
  172. package/tests/test-manage-level.mjs +70 -51
  173. package/tests/test-performance.mjs +539 -0
  174. package/tests/test-sequence.mjs +82 -46
  175. package/tests/test-system.mjs +72 -33
  176. package/tests/test-wasm.mjs +98 -8
  177. package/vitest.config.ts +35 -0
  178. package/.github/release-drafter.yml +0 -148
  179. package/dist/prompts/index.d.ts +0 -21
  180. package/dist/prompts/index.js +0 -217
  181. package/dist/tools/blueprint/helpers.d.ts +0 -29
  182. package/dist/tools/blueprint/helpers.js +0 -182
  183. package/src/prompts/index.ts +0 -249
  184. package/src/tools/blueprint/helpers.ts +0 -189
  185. package/tests/test-blueprint-events.mjs +0 -35
  186. package/tests/test-extra-tools.mjs +0 -38
  187. package/tests/test-render.mjs +0 -33
  188. package/tests/test-search-assets.mjs +0 -66
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Sequencer Test Suite (supported actions only)
3
+ * Comprehensive Sequencer Test Suite
4
4
  * Tool: manage_sequence
5
+ * Coverage: All 31 actions with success, error, and edge cases
5
6
  */
6
7
 
7
8
  import { runToolTests } from './test-runner.mjs';
@@ -10,59 +11,94 @@ const seqPath = '/Game/Cinematics/TC_Seq';
10
11
  const copyDir = '/Game/Cinematics/Copies';
11
12
 
12
13
  const testCases = [
14
+ // === PRE-CLEANUP ===
15
+ {
16
+ scenario: 'Pre-cleanup: Delete existing test sequences',
17
+ toolName: 'manage_asset',
18
+ arguments: { action: 'delete', assetPaths: [seqPath, `${copyDir}/TC_Seq_Copy`, `${copyDir}/TC_Seq_Renamed`, '/Game/Cinematics/TC_Cinematic'] },
19
+ expected: 'success|not_found'
20
+ },
21
+
22
+ // === LIFECYCLE (create, open, duplicate, rename, delete, list) ===
13
23
  { scenario: 'Create sequence', toolName: 'manage_sequence', arguments: { action: 'create', name: 'TC_Seq', path: '/Game/Cinematics' }, expected: 'success|Sequence already exists' },
14
24
  { scenario: 'Open sequence', toolName: 'manage_sequence', arguments: { action: 'open', path: seqPath }, expected: 'success' },
15
- { scenario: 'Add camera (spawn-only fallback ok)', toolName: 'manage_sequence', arguments: { action: 'add_camera', spawnable: true }, expected: 'success' },
16
- { scenario: 'Get bindings', toolName: 'manage_sequence', arguments: { action: 'get_bindings', path: seqPath }, expected: 'success - bindings listed' },
17
- { scenario: 'Set playback speed', toolName: 'manage_sequence', arguments: { action: 'set_playback_speed', path: seqPath, speed: 1.2 }, expected: 'success' },
18
- { scenario: 'Get sequence properties', toolName: 'manage_sequence', arguments: { action: 'get_properties', path: seqPath }, expected: 'success|INVALID_SEQUENCE' },
25
+ { scenario: 'List sequences', toolName: 'manage_sequence', arguments: { action: 'list', path: '/Game/Cinematics' }, expected: 'success' },
26
+ { scenario: 'Get sequence properties', toolName: 'manage_sequence', arguments: { action: 'get_properties', path: seqPath }, expected: 'success' },
27
+ { scenario: 'Set sequence properties', toolName: 'manage_sequence', arguments: { action: 'set_properties', path: seqPath, playbackStart: 0, playbackEnd: 120 }, expected: 'success' },
19
28
  { scenario: 'Duplicate sequence', toolName: 'manage_sequence', arguments: { action: 'duplicate', path: seqPath, destinationPath: copyDir, newName: 'TC_Seq_Copy', overwrite: true }, expected: 'success - duplicated' },
20
29
  { scenario: 'Rename sequence copy', toolName: 'manage_sequence', arguments: { action: 'rename', path: `${copyDir}/TC_Seq_Copy`, newName: 'TC_Seq_Renamed' }, expected: 'success|Failed to rename' },
21
- { scenario: 'Delete sequence copy', toolName: 'manage_sequence', arguments: { action: 'delete', path: `${copyDir}/TC_Seq_Renamed` }, expected: 'success|Failed to delete' },
22
- // Real-World Scenario: Cinematic Shot
23
- // Setup: Ensure TC_Cube exists for the cinematic
24
- { scenario: 'Setup - Spawn Cube for Cinematic', toolName: 'control_actor', arguments: { action: 'spawn', classPath: '/Engine/BasicShapes/Cube', actorName: 'TC_Cube', location: { x: 0, y: 0, z: 0 } }, expected: 'success' },
30
+
31
+ // === METADATA ===
32
+ { scenario: 'Get sequence metadata', toolName: 'manage_sequence', arguments: { action: 'get_metadata', path: seqPath }, expected: 'success' },
33
+ { scenario: 'Set sequence metadata', toolName: 'manage_sequence', arguments: { action: 'set_metadata', path: seqPath, metadata: { author: 'Test', version: '1.0' } }, expected: 'success' },
34
+
35
+ // === BINDINGS (add_camera, add_actor, add_actors, remove_actors, get_bindings, add_spawnable_from_class) ===
36
+ { scenario: 'Add camera (spawn-only fallback ok)', toolName: 'manage_sequence', arguments: { action: 'add_camera', path: seqPath, spawnable: true }, expected: 'success' },
37
+ { scenario: 'Get bindings', toolName: 'manage_sequence', arguments: { action: 'get_bindings', path: seqPath }, expected: 'success - bindings listed' },
38
+
39
+ // Setup actor for binding tests
40
+ { scenario: 'Setup - Spawn Cube for Cinematic', toolName: 'control_actor', arguments: { action: 'spawn', classPath: '/Engine/BasicShapes/Cube', actorName: 'TC_SeqCube', location: { x: 0, y: 0, z: 0 } }, expected: 'success' },
41
+ { scenario: 'Add actor binding', toolName: 'manage_sequence', arguments: { action: 'add_actor', path: seqPath, actorName: 'TC_SeqCube' }, expected: 'success' },
42
+ { scenario: 'Add spawnable from class', toolName: 'manage_sequence', arguments: { action: 'add_spawnable_from_class', path: seqPath, className: 'PointLight' }, expected: 'success' },
43
+ { scenario: 'Remove actors', toolName: 'manage_sequence', arguments: { action: 'remove_actors', path: seqPath, actorNames: ['TC_SeqCube'] }, expected: 'success' },
44
+
45
+ // === PLAYBACK (play, pause, stop, set_playback_speed) ===
46
+ { scenario: 'Play sequence', toolName: 'manage_sequence', arguments: { action: 'play', path: seqPath }, expected: 'success' },
47
+ { scenario: 'Pause sequence', toolName: 'manage_sequence', arguments: { action: 'pause', path: seqPath }, expected: 'success' },
48
+ { scenario: 'Stop sequence', toolName: 'manage_sequence', arguments: { action: 'stop', path: seqPath }, expected: 'success' },
49
+ { scenario: 'Set playback speed 1.5x', toolName: 'manage_sequence', arguments: { action: 'set_playback_speed', path: seqPath, speed: 1.5 }, expected: 'success' },
50
+ { scenario: 'Set playback speed 0.5x', toolName: 'manage_sequence', arguments: { action: 'set_playback_speed', path: seqPath, speed: 0.5 }, expected: 'success' },
51
+
52
+ // === KEYFRAMES (add_keyframe) ===
53
+ { scenario: 'Re-add actor for keyframes', toolName: 'manage_sequence', arguments: { action: 'add_actor', path: seqPath, actorName: 'TC_SeqCube' }, expected: 'success' },
54
+ { scenario: 'Add keyframe at frame 0', toolName: 'manage_sequence', arguments: { action: 'add_keyframe', path: seqPath, actorName: 'TC_SeqCube', property: 'Transform', frame: 0, value: { location: { x: 0, y: 0, z: 0 } } }, expected: 'success' },
55
+ { scenario: 'Add keyframe at frame 60', toolName: 'manage_sequence', arguments: { action: 'add_keyframe', path: seqPath, actorName: 'TC_SeqCube', property: 'Transform', frame: 60, value: { location: { x: 200, y: 0, z: 0 } } }, expected: 'success' },
56
+ { scenario: 'Add keyframe at frame 120', toolName: 'manage_sequence', arguments: { action: 'add_keyframe', path: seqPath, actorName: 'TC_SeqCube', property: 'Transform', frame: 120, value: { location: { x: 0, y: 200, z: 0 } } }, expected: 'success' },
57
+
58
+ // === TRACKS (add_track, add_section, list_tracks, remove_track, set_track_muted, set_track_solo, set_track_locked) ===
59
+ { scenario: 'Add Transform track', toolName: 'manage_sequence', arguments: { action: 'add_track', path: seqPath, actorName: 'TC_SeqCube', trackType: 'Transform' }, expected: 'success' },
60
+ { scenario: 'Add Event track', toolName: 'manage_sequence', arguments: { action: 'add_track', path: seqPath, actorName: 'TC_SeqCube', trackType: 'Event' }, expected: 'success' },
61
+ { scenario: 'List tracks', toolName: 'manage_sequence', arguments: { action: 'list_tracks', path: seqPath }, expected: 'success' },
62
+ { scenario: 'Add section to track', toolName: 'manage_sequence', arguments: { action: 'add_section', path: seqPath, trackName: 'Transform', startFrame: 0, endFrame: 120 }, expected: 'success' },
63
+ { scenario: 'Set track muted', toolName: 'manage_sequence', arguments: { action: 'set_track_muted', path: seqPath, trackName: 'Transform', muted: true }, expected: 'success' },
64
+ { scenario: 'Set track unmuted', toolName: 'manage_sequence', arguments: { action: 'set_track_muted', path: seqPath, trackName: 'Transform', muted: false }, expected: 'success' },
65
+ { scenario: 'Set track solo', toolName: 'manage_sequence', arguments: { action: 'set_track_solo', path: seqPath, trackName: 'Transform', solo: true }, expected: 'success' },
66
+ { scenario: 'Set track locked', toolName: 'manage_sequence', arguments: { action: 'set_track_locked', path: seqPath, trackName: 'Transform', locked: true }, expected: 'success' },
67
+ { scenario: 'Set track unlocked', toolName: 'manage_sequence', arguments: { action: 'set_track_locked', path: seqPath, trackName: 'Transform', locked: false }, expected: 'success' },
68
+
69
+ // === DISPLAY/TIMING SETTINGS ===
70
+ { scenario: 'Set display rate 30fps', toolName: 'manage_sequence', arguments: { action: 'set_display_rate', path: seqPath, frameRate: '30fps' }, expected: 'success' },
71
+ { scenario: 'Set display rate 60fps', toolName: 'manage_sequence', arguments: { action: 'set_display_rate', path: seqPath, frameRate: '60fps' }, expected: 'success' },
72
+ { scenario: 'Set tick resolution', toolName: 'manage_sequence', arguments: { action: 'set_tick_resolution', path: seqPath, resolution: '24000fps' }, expected: 'success' },
73
+ { scenario: 'Set work range', toolName: 'manage_sequence', arguments: { action: 'set_work_range', path: seqPath, start: 0, end: 150 }, expected: 'success' },
74
+ { scenario: 'Set view range', toolName: 'manage_sequence', arguments: { action: 'set_view_range', path: seqPath, start: 0, end: 120 }, expected: 'success' },
75
+
76
+ // === REAL-WORLD SCENARIO ===
25
77
  { scenario: 'Cinematic - Create Sequence', toolName: 'manage_sequence', arguments: { action: 'create', name: 'TC_Cinematic', path: '/Game/Cinematics' }, expected: 'success|Sequence already exists' },
26
- { scenario: 'Cinematic - Add Actor', toolName: 'manage_sequence', arguments: { action: 'add_actor', path: '/Game/Cinematics/TC_Cinematic', actorName: 'TC_Cube' }, expected: 'success' },
27
- { scenario: 'Cinematic - Keyframe Transform', toolName: 'manage_sequence', arguments: { action: 'add_keyframe', path: '/Game/Cinematics/TC_Cinematic', actorName: 'TC_Cube', property: 'Transform', frame: 0, value: { location: { x: 0, y: 0, z: 0 } } }, expected: 'success' },
28
- { scenario: 'Cinematic - Keyframe End', toolName: 'manage_sequence', arguments: { action: 'add_keyframe', path: '/Game/Cinematics/TC_Cinematic', actorName: 'TC_Cube', property: 'Transform', frame: 60, value: { location: { x: 200, y: 0, z: 0 } } }, expected: 'success' },
78
+ { scenario: 'Cinematic - Add Actor', toolName: 'manage_sequence', arguments: { action: 'add_actor', path: '/Game/Cinematics/TC_Cinematic', actorName: 'TC_SeqCube' }, expected: 'success' },
79
+ { scenario: 'Cinematic - Keyframe Start', toolName: 'manage_sequence', arguments: { action: 'add_keyframe', path: '/Game/Cinematics/TC_Cinematic', actorName: 'TC_SeqCube', property: 'Transform', frame: 0, value: { location: { x: 0, y: 0, z: 0 } } }, expected: 'success' },
80
+ { scenario: 'Cinematic - Keyframe End', toolName: 'manage_sequence', arguments: { action: 'add_keyframe', path: '/Game/Cinematics/TC_Cinematic', actorName: 'TC_SeqCube', property: 'Transform', frame: 60, value: { location: { x: 200, y: 0, z: 0 } } }, expected: 'success' },
29
81
 
30
- // Cleanup
82
+ // === ERROR CASES ===
83
+ { scenario: 'Error: Invalid actor name', toolName: 'manage_sequence', arguments: { action: 'add_actor', path: seqPath, actorName: 'NonExistentActor' }, expected: 'not_found|error|ASSET_NOT_FOUND|LOAD_FAILED' },
84
+ { scenario: 'Error: Invalid class spawnable', toolName: 'manage_sequence', arguments: { action: 'add_spawnable_from_class', path: seqPath, className: 'InvalidClass' }, expected: 'error' },
85
+ { scenario: 'Error: Invalid sequence path', toolName: 'manage_sequence', arguments: { action: 'open', path: '/Game/NonExistent/Sequence' }, expected: 'error|not_found' },
86
+ { scenario: 'Error: Remove track non-existent', toolName: 'manage_sequence', arguments: { action: 'remove_track', path: seqPath, trackName: 'NonExistentTrack' }, expected: 'error|not_found' },
87
+
88
+ // === EDGE CASES ===
89
+ { scenario: 'Edge: Playback speed 0', toolName: 'manage_sequence', arguments: { action: 'set_playback_speed', speed: 0 }, expected: 'error' },
90
+ { scenario: 'Edge: Negative frame keyframe', toolName: 'manage_sequence', arguments: { action: 'add_keyframe', path: seqPath, actorName: 'TC_SeqCube', property: 'Transform', frame: -10, value: {} }, expected: 'success|error' },
91
+ { scenario: 'Edge: Empty actors array', toolName: 'manage_sequence', arguments: { action: 'add_actors', path: seqPath, actorNames: [] }, expected: 'actorNames required|INVALID_ARGUMENT' },
92
+ { scenario: 'Edge: Very high work range', toolName: 'manage_sequence', arguments: { action: 'set_work_range', path: seqPath, start: 0, end: 100000 }, expected: 'success' },
93
+
94
+ // === CLEANUP ===
31
95
  { scenario: 'Cleanup - Delete Cinematic', toolName: 'manage_sequence', arguments: { action: 'delete', path: '/Game/Cinematics/TC_Cinematic' }, expected: 'success|Failed to delete' },
32
- { scenario: 'Cleanup - Delete Cube', toolName: 'control_actor', arguments: { action: 'delete', actorName: 'TC_Cube' }, expected: 'success' },
96
+ { scenario: 'Cleanup - Delete Cube', toolName: 'control_actor', arguments: { action: 'delete', actorName: 'TC_SeqCube' }, expected: 'success' },
97
+ { scenario: 'Cleanup - Remove track', toolName: 'manage_sequence', arguments: { action: 'remove_track', path: seqPath, trackName: 'Event' }, expected: 'success|not_found' },
33
98
  { scenario: 'Delete original sequence', toolName: 'manage_sequence', arguments: { action: 'delete', path: seqPath }, expected: 'success|Failed to delete' },
34
- { scenario: 'Verify sequence removed', toolName: 'manage_sequence', arguments: { action: 'get_bindings', path: seqPath }, expected: 'success|not found|error|ASSET_NOT_FOUND|LOAD_FAILED' },
35
-
36
- {
37
- scenario: "Error: Invalid actor name",
38
- toolName: "manage_sequence",
39
- arguments: { action: "add_actor", path: seqPath, actorName: "NonExistentActor" },
40
- expected: "not_found|error|ASSET_NOT_FOUND|LOAD_FAILED"
41
- },
42
- {
43
- scenario: "Edge: Playback speed 0",
44
- toolName: "manage_sequence",
45
- arguments: { action: "set_playback_speed", speed: 0 },
46
- expected: "error"
47
- },
48
- {
49
- scenario: "Border: Empty actors array",
50
- toolName: "manage_sequence",
51
- arguments: { action: "add_actors", path: seqPath, actorNames: [] },
52
- expected: "actorNames required|INVALID_ARGUMENT"
53
- },
54
- {
55
- scenario: "Error: Invalid class spawnable",
56
- toolName: "manage_sequence",
57
- arguments: { action: "add_spawnable_from_class", path: seqPath, className: "InvalidClass" },
58
- expected: "error"
59
- },
60
- {
61
- scenario: "Cleanup Sequence Tests",
62
- toolName: "manage_asset",
63
- arguments: { action: "delete", assetPaths: [seqPath] },
64
- expected: "success|ASSET_NOT_FOUND|LOAD_FAILED"
65
- }
99
+ { scenario: 'Delete renamed copy', toolName: 'manage_sequence', arguments: { action: 'delete', path: `${copyDir}/TC_Seq_Renamed` }, expected: 'success|Failed to delete' },
100
+ { scenario: 'Verify sequences removed', toolName: 'manage_sequence', arguments: { action: 'get_bindings', path: seqPath }, expected: 'success|not found|error|ASSET_NOT_FOUND|LOAD_FAILED' },
101
+ { scenario: 'Final cleanup via manage_asset', toolName: 'manage_asset', arguments: { action: 'delete', assetPaths: [seqPath, copyDir] }, expected: 'success|ASSET_NOT_FOUND|LOAD_FAILED' }
66
102
  ];
67
103
 
68
104
  await runToolTests('Sequences', testCases);
@@ -1,56 +1,95 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Condensed System Control Test Suite (15 safe cases)
3
+ * Comprehensive System Control Test Suite
4
4
  * Tool: system_control
5
- * This file avoids destructive operations (engine quit/start) and focuses on
6
- * safe diagnostics, screenshots, widget operations, CVARs, and profiling toggles.
5
+ * Coverage: All 22 actions with success, error, and edge cases
7
6
  */
8
7
 
9
8
  import { runToolTests } from './test-runner.mjs';
10
9
 
11
10
  const testCases = [
11
+ // === PROFILING (profile, show_fps, show_stats) ===
12
12
  { scenario: 'Enable FPS display', toolName: 'system_control', arguments: { action: 'show_fps', enabled: true }, expected: 'success - FPS shown' },
13
13
  { scenario: 'Disable FPS display', toolName: 'system_control', arguments: { action: 'show_fps', enabled: false }, expected: 'success - FPS hidden' },
14
- { scenario: 'Enable CPU profiling (brief)', toolName: 'system_control', arguments: { action: 'profile', profileType: 'CPU', enabled: true }, expected: 'success - profiling enabled' },
14
+ { scenario: 'Show stats', toolName: 'system_control', arguments: { action: 'show_stats', category: 'Engine' }, expected: 'success' },
15
+ { scenario: 'Enable CPU profiling', toolName: 'system_control', arguments: { action: 'profile', profileType: 'CPU', enabled: true }, expected: 'success - profiling enabled' },
15
16
  { scenario: 'Disable CPU profiling', toolName: 'system_control', arguments: { action: 'profile', profileType: 'CPU', enabled: false }, expected: 'success - profiling disabled' },
17
+ { scenario: 'Enable GPU profiling', toolName: 'system_control', arguments: { action: 'profile', profileType: 'GPU', enabled: true }, expected: 'success' },
18
+ { scenario: 'Disable GPU profiling', toolName: 'system_control', arguments: { action: 'profile', profileType: 'GPU', enabled: false }, expected: 'success' },
19
+ { scenario: 'Enable RenderThread profiling', toolName: 'system_control', arguments: { action: 'profile', profileType: 'RenderThread', enabled: true }, expected: 'success' },
20
+ { scenario: 'Disable RenderThread profiling', toolName: 'system_control', arguments: { action: 'profile', profileType: 'RenderThread', enabled: false }, expected: 'success' },
21
+ { scenario: 'Enable Memory profiling', toolName: 'system_control', arguments: { action: 'profile', profileType: 'Memory', enabled: true }, expected: 'success' },
22
+ { scenario: 'Disable Memory profiling', toolName: 'system_control', arguments: { action: 'profile', profileType: 'Memory', enabled: false }, expected: 'success' },
23
+ { scenario: 'Profile All', toolName: 'system_control', arguments: { action: 'profile', profileType: 'All', enabled: true }, expected: 'success' },
24
+ { scenario: 'Generate memory report', toolName: 'system_control', arguments: { action: 'profile', profileType: 'Memory', detailed: true, outputPath: './tests/reports' }, expected: 'success' },
25
+
26
+ // === QUALITY SETTINGS (set_quality, set_resolution_scale, set_vsync, set_frame_rate_limit) ===
16
27
  { scenario: 'Set shadow quality to medium', toolName: 'system_control', arguments: { action: 'set_quality', category: 'Shadow', level: 1 }, expected: 'success - quality set' },
17
28
  { scenario: 'Set texture quality to high', toolName: 'system_control', arguments: { action: 'set_quality', category: 'Texture', level: 2 }, expected: 'success - quality set' },
29
+ { scenario: 'Set quality level 0 (low)', toolName: 'system_control', arguments: { action: 'set_quality', category: 'ViewDistance', level: 0 }, expected: 'success' },
30
+ { scenario: 'Set quality level 3 (epic)', toolName: 'system_control', arguments: { action: 'set_quality', category: 'Effects', level: 3 }, expected: 'success' },
31
+
32
+ // === CONSOLE COMMANDS (execute_command, console_command) ===
18
33
  { scenario: 'Execute console command (stat fps)', toolName: 'system_control', arguments: { action: 'execute_command', command: 'stat fps' }, expected: 'success - console command executed' },
34
+ { scenario: 'Console command (alias)', toolName: 'system_control', arguments: { action: 'console_command', command: 'stat unit' }, expected: 'success' },
35
+ { scenario: 'Console command - stat none', toolName: 'system_control', arguments: { action: 'console_command', command: 'stat none' }, expected: 'success' },
36
+ { scenario: 'Console command - gc', toolName: 'system_control', arguments: { action: 'console_command', command: 'obj gc' }, expected: 'success' },
37
+
38
+ // === SCREENSHOTS ===
19
39
  { scenario: 'Take a screenshot', toolName: 'system_control', arguments: { action: 'screenshot', filename: 'tc_sys_screenshot' }, expected: 'success - screenshot taken' },
20
40
  { scenario: 'Take screenshot with metadata', toolName: 'system_control', arguments: { action: 'screenshot', includeMetadata: true, metadata: { test: 'system_tc' } }, expected: 'success - metadata screenshot taken' },
41
+
42
+ // === RESOLUTION / DISPLAY ===
43
+ { scenario: 'Set resolution 1920x1080', toolName: 'system_control', arguments: { action: 'set_resolution', resolution: '1920x1080' }, expected: 'success' },
44
+ { scenario: 'Set fullscreen on', toolName: 'system_control', arguments: { action: 'set_fullscreen', enabled: true }, expected: 'success' },
45
+ { scenario: 'Set fullscreen off', toolName: 'system_control', arguments: { action: 'set_fullscreen', enabled: false }, expected: 'success' },
46
+
47
+ // === WIDGETS ===
21
48
  { scenario: 'Create debug widget asset', toolName: 'system_control', arguments: { action: 'create_widget', name: 'TestWidget_Safe', savePath: '/Game/Tests' }, expected: 'success - widget created or handled' },
22
- { scenario: 'Show short notification', toolName: 'system_control', arguments: { action: 'show_widget', widgetId: 'Notification', visible: true, message: 'TC: Notification', duration: 1.5 }, expected: 'success - notification shown' },
49
+ { scenario: 'Create console widget asset', toolName: 'system_control', arguments: { action: 'create_widget', name: 'TestWidget_Console', savePath: '/Game/Tests' }, expected: 'success - widget created or handled' },
50
+ { scenario: 'Show notification widget', toolName: 'system_control', arguments: { action: 'show_widget', widgetId: 'Notification', visible: true, message: 'TC: Notification', duration: 1.5 }, expected: 'success - notification shown' },
51
+ { scenario: 'Add child to widget', toolName: 'system_control', arguments: { action: 'add_widget_child', parentName: 'TestWidget_Safe', childClass: 'Button' }, expected: 'success|handled' },
52
+
53
+ // === CVARS ===
23
54
  { scenario: 'Set VSync CVAR', toolName: 'system_control', arguments: { action: 'set_cvar', name: 'r.VSync', value: '0' }, expected: 'success - CVAR set' },
24
55
  { scenario: 'Set max FPS CVAR', toolName: 'system_control', arguments: { action: 'set_cvar', name: 't.MaxFPS', value: '60' }, expected: 'success - CVAR set' },
25
- { scenario: 'Play short UI sound (best-effort)', toolName: 'system_control', arguments: { action: 'play_sound', soundPath: '/Engine/EditorSounds/Notifications/CompileSuccess.CompileSuccess', volume: 0.5 }, expected: 'success - sound played or handled' },
26
- { scenario: 'Create console widget asset', toolName: 'system_control', arguments: { action: 'create_widget', name: 'TestWidget_Console', savePath: '/Game/Tests' }, expected: 'success - widget created or handled' },
27
- // Additional
28
- // Real-World Scenario: Project Validation
29
- { scenario: 'Validation - Check Settings', toolName: 'system_control', arguments: { action: 'get_project_settings', category: 'Project' }, expected: 'success' },
30
- { scenario: 'Validation - Validate Assets', toolName: 'system_control', arguments: { action: 'validate_assets', paths: ['/Game'] }, expected: 'success' },
31
- {
32
- scenario: "Error: Invalid profile type",
33
- toolName: "system_control",
34
- arguments: { action: "profile", profileType: "InvalidProfile" },
35
- expected: "error"
36
- },
37
- {
38
- scenario: "Edge: Quality level 0 (low)",
39
- toolName: "system_control",
40
- arguments: { action: "set_quality", category: "ViewDistance", level: 0 },
41
- expected: "success"
42
- },
43
- {
44
- scenario: "Border: Volume 0 (silent)",
45
- toolName: "system_control",
46
- arguments: { action: "play_sound", soundPath: "/Engine/EditorSounds/Notifications/CompileSuccess.CompileSuccess", volume: 0 },
47
- expected: "success"
48
- },
56
+ { scenario: 'Set anti-aliasing CVAR', toolName: 'system_control', arguments: { action: 'set_cvar', name: 'r.PostProcessAAQuality', value: '4' }, expected: 'success' },
57
+ { scenario: 'Set LOD bias CVAR', toolName: 'system_control', arguments: { action: 'set_cvar', name: 'foliage.LODDistanceScale', value: '1.0' }, expected: 'success' },
58
+
59
+ // === SOUND ===
60
+ { scenario: 'Play UI sound', toolName: 'system_control', arguments: { action: 'play_sound', soundPath: '/Engine/EditorSounds/Notifications/CompileSuccess.CompileSuccess', volume: 0.5 }, expected: 'success - sound played or handled' },
61
+ { scenario: 'Play sound silent', toolName: 'system_control', arguments: { action: 'play_sound', soundPath: '/Engine/EditorSounds/Notifications/CompileSuccess.CompileSuccess', volume: 0 }, expected: 'success' },
62
+
63
+ // === PROJECT SETTINGS ===
64
+ { scenario: 'Get project settings', toolName: 'system_control', arguments: { action: 'get_project_settings', category: 'Project' }, expected: 'success' },
65
+ { scenario: 'Get project settings - Engine', toolName: 'system_control', arguments: { action: 'get_project_settings', section: '/Script/EngineSettings.GeneralProjectSettings' }, expected: 'success' },
66
+ { scenario: 'Set project setting', toolName: 'system_control', arguments: { action: 'set_project_setting', section: '/Script/Engine.Engine', key: 'bSmoothFrameRate', value: 'true', configName: 'Engine' }, expected: 'success|handled' },
67
+
68
+ // === VALIDATION ===
69
+ { scenario: 'Validate assets', toolName: 'system_control', arguments: { action: 'validate_assets', paths: ['/Game'] }, expected: 'success' },
70
+
71
+ // === LUMEN ===
72
+ { scenario: 'Lumen update scene', toolName: 'system_control', arguments: { action: 'lumen_update_scene' }, expected: 'success|handled' },
73
+
74
+ // === SUBSCRIPTIONS (subscribe, unsubscribe, spawn_category, start_session) ===
75
+ { scenario: 'Subscribe to events', toolName: 'system_control', arguments: { action: 'subscribe', channels: 'Assets' }, expected: 'success|handled' },
76
+ { scenario: 'Unsubscribe from events', toolName: 'system_control', arguments: { action: 'unsubscribe', channels: 'Assets' }, expected: 'success|handled' },
77
+ { scenario: 'Spawn category', toolName: 'system_control', arguments: { action: 'spawn_category', category: 'TestCategory' }, expected: 'success|handled' },
78
+ { scenario: 'Start session', toolName: 'system_control', arguments: { action: 'start_session' }, expected: 'success|handled' },
79
+
80
+ // === ERROR CASES ===
81
+ { scenario: 'Error: Invalid profile type', toolName: 'system_control', arguments: { action: 'profile', profileType: 'InvalidProfile' }, expected: 'error' },
82
+ { scenario: 'Error: Empty command', toolName: 'system_control', arguments: { action: 'console_command', command: '' }, expected: 'error|handled' },
83
+ { scenario: 'Error: Invalid resolution', toolName: 'system_control', arguments: { action: 'set_resolution', width: -1, height: -1 }, expected: 'error|validation' },
84
+ { scenario: 'Error: Invalid quality level', toolName: 'system_control', arguments: { action: 'set_quality', category: 'Shadow', level: 999 }, expected: 'error|clamped' },
85
+ { scenario: 'Error: Invalid sound path', toolName: 'system_control', arguments: { action: 'play_sound', soundPath: '/Game/Invalid/Sound' }, expected: 'error|not_found' },
86
+
87
+ // === CLEANUP ===
49
88
  {
50
- scenario: "Error: Invalid resolution",
51
- toolName: "system_control",
52
- arguments: { action: "set_resolution", width: -1, height: -1 },
53
- expected: "error|validation"
89
+ scenario: 'Cleanup widgets',
90
+ toolName: 'manage_asset',
91
+ arguments: { action: 'delete', assetPaths: ['/Game/Tests/TestWidget_Safe', '/Game/Tests/TestWidget_Console'] },
92
+ expected: 'success|handled'
54
93
  }
55
94
  ];
56
95
 
@@ -156,16 +156,106 @@ async function testWASMIntegration() {
156
156
  log.info('\n=== Performance Report ===');
157
157
  log.info(wasmIntegration.reportPerformance());
158
158
 
159
- // Test 8: Fallback Mechanism
160
- log.info('\n=== Test 8: Fallback Mechanism ===');
161
- log.info('Testing TypeScript fallback by clearing metrics...');
162
- wasmIntegration.clearMetrics();
159
+ // Test 9: Circular Dependency Detection
160
+ log.info('\n=== Test 9: Circular Dependency Detection ===');
161
+ const circularDeps = {
162
+ 'AssetA': ['AssetB'],
163
+ 'AssetB': ['AssetC'],
164
+ 'AssetC': ['AssetA'] // Creates a cycle
165
+ };
166
+
167
+ try {
168
+ const circular = await wasmIntegration.findCircularDependencies(circularDeps);
169
+ log.info(`✅ Circular dependency detection completed`);
170
+ log.info(`Found ${circular.length} circular dependency chains`);
171
+ if (circular.length > 0) {
172
+ log.info(`Cycle: ${circular[0].join(' -> ')}`);
173
+ }
174
+ } catch (error) {
175
+ log.error('❌ Circular dependency detection failed:', error.message);
176
+ }
177
+
178
+ // Test 10: Topological Sort
179
+ log.info('\n=== Test 10: Topological Sort ===');
180
+ const sortDeps = {
181
+ 'D': [],
182
+ 'C': ['D'],
183
+ 'B': ['C', 'D'],
184
+ 'A': ['B', 'C']
185
+ };
186
+
187
+ try {
188
+ const sorted = await wasmIntegration.topologicalSort(sortDeps);
189
+ log.info(`✅ Topological sort completed`);
190
+ log.info(`Order: ${sorted.join(' -> ')}`);
191
+ // D should come before C, C before B, B before A
192
+ const dIdx = sorted.indexOf('D');
193
+ const cIdx = sorted.indexOf('C');
194
+ const bIdx = sorted.indexOf('B');
195
+ const aIdx = sorted.indexOf('A');
196
+ if (dIdx < cIdx && cIdx < bIdx && bIdx < aIdx) {
197
+ log.info('✅ Sort order is correct');
198
+ } else {
199
+ log.warn('⚠️ Sort order may be incorrect');
200
+ }
201
+ } catch (error) {
202
+ log.error('❌ Topological sort failed:', error.message);
203
+ }
163
204
 
164
- // Force a few operations to test metrics
165
- await wasmIntegration.parseProperties(testJson);
166
- const newMetrics = wasmIntegration.getMetrics();
205
+ // Test 11: Edge Cases
206
+ log.info('\n=== Test 11: Edge Cases ===');
167
207
 
168
- log.info(`✅ Metrics reset successful (${newMetrics.totalOperations} operations)`);
208
+ // Empty JSON
209
+ try {
210
+ const emptyResult = await wasmIntegration.parseProperties('{}');
211
+ log.info(`✅ Empty JSON parsing: ${Object.keys(emptyResult).length === 0 ? 'passed' : 'result has keys'}`);
212
+ } catch (error) {
213
+ log.error('❌ Empty JSON parsing failed:', error.message);
214
+ }
215
+
216
+ // Invalid JSON (should fallback gracefully)
217
+ try {
218
+ await wasmIntegration.parseProperties('not valid json');
219
+ log.warn('⚠️ Invalid JSON did not throw - fallback handled');
220
+ } catch (error) {
221
+ log.info(`✅ Invalid JSON correctly rejected: ${error.message.substring(0, 50)}...`);
222
+ }
223
+
224
+ // Zero vectors
225
+ try {
226
+ const zeroAdd = wasmIntegration.vectorAdd([0, 0, 0], [0, 0, 0]);
227
+ const isZero = zeroAdd.every(v => v === 0);
228
+ log.info(`✅ Zero vector addition: ${isZero ? 'passed' : 'unexpected result'}`);
229
+ } catch (error) {
230
+ log.error('❌ Zero vector test failed:', error.message);
231
+ }
232
+
233
+ // Test 12: Performance Benchmark
234
+ log.info('\n=== Test 12: Performance Benchmark ===');
235
+ const iterations = 100;
236
+ const largeJson = JSON.stringify({
237
+ assets: Array.from({ length: 50 }, (_, i) => ({
238
+ name: `Asset${i}`,
239
+ path: `/Game/Assets/Asset${i}`,
240
+ properties: { value: i * 100, enabled: i % 2 === 0 }
241
+ }))
242
+ });
243
+
244
+ const benchStart = performance.now();
245
+ for (let i = 0; i < iterations; i++) {
246
+ await wasmIntegration.parseProperties(largeJson);
247
+ }
248
+ const benchDuration = performance.now() - benchStart;
249
+ log.info(`✅ Parsed ${iterations} large JSON objects in ${benchDuration.toFixed(2)}ms`);
250
+ log.info(`Average: ${(benchDuration / iterations).toFixed(3)}ms per parse`);
251
+
252
+ // Vector math benchmark
253
+ const vecStart = performance.now();
254
+ for (let i = 0; i < 1000; i++) {
255
+ wasmIntegration.vectorAdd([i, i + 1, i + 2], [i * 2, i * 3, i * 4]);
256
+ }
257
+ const vecDuration = performance.now() - vecStart;
258
+ log.info(`✅ 1000 vector additions in ${vecDuration.toFixed(2)}ms`);
169
259
 
170
260
  // Final Summary
171
261
  log.info('\n=== Test Summary ===');
@@ -0,0 +1,35 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ environment: 'node',
7
+ include: [
8
+ 'src/**/*.test.ts',
9
+ 'tests/unit/**/*.test.ts'
10
+ ],
11
+ exclude: [
12
+ '**/node_modules/**',
13
+ '**/dist/**'
14
+ ],
15
+ coverage: {
16
+ provider: 'v8',
17
+ reporter: ['text', 'text-summary', 'html'],
18
+ include: ['src/**/*.ts'],
19
+ exclude: [
20
+ 'src/**/*.test.ts',
21
+ 'src/types/**',
22
+ 'src/**/*.d.ts'
23
+ ],
24
+ thresholds: {
25
+ // Start with low thresholds, increase as coverage improves
26
+ lines: 20,
27
+ functions: 20,
28
+ branches: 20,
29
+ statements: 20
30
+ }
31
+ },
32
+ testTimeout: 10000,
33
+ hookTimeout: 10000
34
+ }
35
+ });
@@ -1,148 +0,0 @@
1
- name: Release Drafter
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- workflow_dispatch:
8
-
9
- permissions:
10
- contents: read
11
-
12
- jobs:
13
- update_release_draft:
14
- permissions:
15
- contents: write
16
- pull-requests: write
17
- runs-on: ubuntu-latest
18
- steps:
19
- - name: Checkout
20
- uses: actions/checkout@v4
21
- with:
22
- fetch-depth: 0
23
-
24
- - name: Run Release Drafter
25
- id: release_drafter
26
- uses: release-drafter/release-drafter@v6
27
- with:
28
- config-name: release-drafter.yml
29
- env:
30
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31
-
32
- - name: Get commits not in PRs
33
- id: orphan_commits
34
- uses: actions/github-script@v7
35
- with:
36
- github-token: ${{ secrets.GITHUB_TOKEN }}
37
- script: |
38
- const { execSync } = require('child_process');
39
-
40
- // Get the last release tag
41
- let lastTag;
42
- try {
43
- const { data: releases } = await github.rest.repos.listReleases({
44
- owner: context.repo.owner,
45
- repo: context.repo.repo,
46
- per_page: 1
47
- });
48
- lastTag = releases[0]?.tag_name;
49
- } catch (e) {
50
- lastTag = null;
51
- }
52
-
53
- // Get all commits since last release
54
- const range = lastTag ? `${lastTag}..HEAD` : 'HEAD~50..HEAD';
55
- let commits;
56
- try {
57
- commits = execSync(`git log ${range} --pretty=format:"%H|%s|%an" --no-merges`, { encoding: 'utf-8' })
58
- .split('\n')
59
- .filter(Boolean)
60
- .map(line => {
61
- const [sha, message, author] = line.split('|');
62
- return { sha, message, author };
63
- });
64
- } catch (e) {
65
- commits = [];
66
- }
67
-
68
- if (commits.length === 0) {
69
- core.setOutput('orphan_commits', '');
70
- return;
71
- }
72
-
73
- // Get all PRs merged since last release to filter out PR commits
74
- const { data: prs } = await github.rest.pulls.list({
75
- owner: context.repo.owner,
76
- repo: context.repo.repo,
77
- state: 'closed',
78
- sort: 'updated',
79
- direction: 'desc',
80
- per_page: 100
81
- });
82
-
83
- // Get commit SHAs that are part of PRs
84
- const prCommitShas = new Set();
85
- for (const pr of prs.filter(p => p.merged_at)) {
86
- try {
87
- const { data: prCommits } = await github.rest.pulls.listCommits({
88
- owner: context.repo.owner,
89
- repo: context.repo.repo,
90
- pull_number: pr.number
91
- });
92
- prCommits.forEach(c => prCommitShas.add(c.sha));
93
- } catch (e) {
94
- // Skip if error
95
- }
96
- }
97
-
98
- // Filter to only orphan commits (not in any PR)
99
- const orphanCommits = commits.filter(c => !prCommitShas.has(c.sha));
100
-
101
- if (orphanCommits.length === 0) {
102
- core.setOutput('orphan_commits', '');
103
- return;
104
- }
105
-
106
- // Format orphan commits
107
- const formatted = orphanCommits
108
- .map(c => `- ${c.message} (${c.sha.substring(0, 7)}) @${c.author}`)
109
- .join('\n');
110
-
111
- core.setOutput('orphan_commits', formatted);
112
- core.info(`Found ${orphanCommits.length} commits not in PRs`);
113
-
114
- - name: Update release body with commits
115
- if: steps.orphan_commits.outputs.orphan_commits != ''
116
- uses: actions/github-script@v7
117
- with:
118
- github-token: ${{ secrets.GITHUB_TOKEN }}
119
- script: |
120
- const releaseId = '${{ steps.release_drafter.outputs.id }}';
121
- const orphanCommits = `${{ steps.orphan_commits.outputs.orphan_commits }}`;
122
-
123
- if (!releaseId || !orphanCommits) return;
124
-
125
- // Get current release body
126
- const { data: release } = await github.rest.repos.getRelease({
127
- owner: context.repo.owner,
128
- repo: context.repo.repo,
129
- release_id: parseInt(releaseId)
130
- });
131
-
132
- // Check if commits section already exists
133
- if (release.body && release.body.includes('## Direct Commits')) {
134
- core.info('Commits section already exists, skipping');
135
- return;
136
- }
137
-
138
- // Append commits section
139
- const newBody = `${release.body || ''}\n\n## Direct Commits\n\n${orphanCommits}`;
140
-
141
- await github.rest.repos.updateRelease({
142
- owner: context.repo.owner,
143
- repo: context.repo.repo,
144
- release_id: parseInt(releaseId),
145
- body: newBody
146
- });
147
-
148
- core.info('Added orphan commits to release draft');
@@ -1,21 +0,0 @@
1
- export interface PromptArgument {
2
- type: string;
3
- description?: string;
4
- enum?: string[];
5
- default?: unknown;
6
- required?: boolean;
7
- }
8
- export interface PromptTemplate {
9
- name: string;
10
- description: string;
11
- arguments?: Record<string, PromptArgument>;
12
- build: (args: Record<string, unknown>) => Array<{
13
- role: 'user' | 'assistant';
14
- content: {
15
- type: 'text';
16
- text: string;
17
- };
18
- }>;
19
- }
20
- export declare const prompts: PromptTemplate[];
21
- //# sourceMappingURL=index.d.ts.map