unreal-engine-mcp-server 0.5.0 → 0.5.1
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/.env.example +1 -1
- package/.github/release-drafter-config.yml +51 -0
- package/.github/workflows/greetings.yml +5 -1
- package/.github/workflows/labeler.yml +2 -1
- package/.github/workflows/publish-mcp.yml +1 -0
- package/.github/workflows/release-drafter.yml +1 -1
- package/.github/workflows/release.yml +3 -3
- package/CHANGELOG.md +71 -0
- package/CONTRIBUTING.md +1 -1
- package/GEMINI.md +115 -0
- package/Public/Plugin_setup_guide.mp4 +0 -0
- package/README.md +166 -200
- package/dist/config.d.ts +0 -1
- package/dist/config.js +0 -1
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +4 -0
- package/dist/graphql/loaders.d.ts +64 -0
- package/dist/graphql/loaders.js +117 -0
- package/dist/graphql/resolvers.d.ts +3 -3
- package/dist/graphql/resolvers.js +33 -30
- package/dist/graphql/server.js +3 -1
- package/dist/graphql/types.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +13 -2
- package/dist/server-setup.d.ts +0 -1
- package/dist/server-setup.js +0 -40
- package/dist/tools/actors.d.ts +40 -24
- package/dist/tools/actors.js +8 -2
- package/dist/tools/assets.d.ts +19 -71
- package/dist/tools/assets.js +28 -22
- package/dist/tools/base-tool.d.ts +4 -4
- package/dist/tools/base-tool.js +1 -1
- package/dist/tools/blueprint.d.ts +33 -61
- package/dist/tools/consolidated-tool-handlers.js +96 -110
- package/dist/tools/dynamic-handler-registry.d.ts +11 -9
- package/dist/tools/dynamic-handler-registry.js +17 -95
- package/dist/tools/editor.d.ts +19 -193
- package/dist/tools/editor.js +8 -0
- package/dist/tools/environment.d.ts +8 -14
- package/dist/tools/foliage.d.ts +18 -143
- package/dist/tools/foliage.js +4 -2
- package/dist/tools/handlers/actor-handlers.js +0 -5
- package/dist/tools/handlers/asset-handlers.js +454 -454
- package/dist/tools/landscape.d.ts +16 -116
- package/dist/tools/landscape.js +7 -3
- package/dist/tools/level.d.ts +22 -103
- package/dist/tools/level.js +24 -16
- package/dist/tools/lighting.js +5 -1
- package/dist/tools/materials.js +5 -1
- package/dist/tools/niagara.js +37 -2
- package/dist/tools/performance.d.ts +0 -1
- package/dist/tools/performance.js +0 -1
- package/dist/tools/physics.js +5 -1
- package/dist/tools/sequence.d.ts +24 -24
- package/dist/tools/sequence.js +13 -0
- package/dist/tools/ui.d.ts +0 -2
- package/dist/types/automation-responses.d.ts +115 -0
- package/dist/types/automation-responses.js +2 -0
- package/dist/types/responses.d.ts +249 -0
- package/dist/types/responses.js +2 -0
- package/dist/types/tool-interfaces.d.ts +135 -135
- package/dist/utils/command-validator.js +3 -2
- package/dist/utils/path-security.d.ts +2 -0
- package/dist/utils/path-security.js +24 -0
- package/dist/utils/response-factory.d.ts +4 -4
- package/dist/utils/response-factory.js +15 -21
- package/docs/Migration-Guide-v0.5.0.md +1 -9
- package/docs/testing-guide.md +2 -2
- package/package.json +12 -6
- package/scripts/run-all-tests.mjs +25 -20
- package/server.json +3 -2
- package/src/config.ts +1 -1
- package/src/constants.ts +7 -0
- package/src/graphql/loaders.ts +244 -0
- package/src/graphql/resolvers.ts +47 -49
- package/src/graphql/server.ts +3 -1
- package/src/graphql/types.ts +3 -0
- package/src/index.ts +15 -2
- package/src/resources/assets.ts +5 -4
- package/src/server-setup.ts +3 -37
- package/src/tools/actors.ts +36 -28
- package/src/tools/animation.ts +1 -0
- package/src/tools/assets.ts +74 -63
- package/src/tools/base-tool.ts +3 -3
- package/src/tools/blueprint.ts +59 -59
- package/src/tools/consolidated-tool-handlers.ts +129 -150
- package/src/tools/dynamic-handler-registry.ts +22 -140
- package/src/tools/editor.ts +39 -26
- package/src/tools/environment.ts +21 -27
- package/src/tools/foliage.ts +28 -25
- package/src/tools/handlers/actor-handlers.ts +2 -8
- package/src/tools/handlers/asset-handlers.ts +484 -484
- package/src/tools/handlers/sequence-handlers.ts +1 -1
- package/src/tools/landscape.ts +34 -28
- package/src/tools/level.ts +96 -76
- package/src/tools/lighting.ts +6 -1
- package/src/tools/materials.ts +8 -2
- package/src/tools/niagara.ts +44 -2
- package/src/tools/performance.ts +1 -2
- package/src/tools/physics.ts +7 -1
- package/src/tools/sequence.ts +41 -25
- package/src/tools/ui.ts +0 -2
- package/src/types/automation-responses.ts +119 -0
- package/src/types/responses.ts +355 -0
- package/src/types/tool-interfaces.ts +135 -135
- package/src/utils/command-validator.ts +3 -2
- package/src/utils/normalize.test.ts +162 -0
- package/src/utils/path-security.ts +43 -0
- package/src/utils/response-factory.ts +29 -24
- package/src/utils/safe-json.test.ts +90 -0
- package/src/utils/validation.test.ts +184 -0
- package/tests/test-animation.mjs +358 -33
- package/tests/test-asset-graph.mjs +311 -0
- package/tests/test-audio.mjs +314 -116
- package/tests/test-behavior-tree.mjs +327 -144
- package/tests/test-blueprint-graph.mjs +343 -12
- package/tests/test-control-editor.mjs +85 -53
- package/tests/test-graphql.mjs +58 -8
- package/tests/test-input.mjs +349 -0
- package/tests/test-inspect.mjs +291 -61
- package/tests/test-landscape.mjs +304 -48
- package/tests/test-lighting.mjs +428 -0
- package/tests/test-manage-level.mjs +70 -51
- package/tests/test-performance.mjs +539 -0
- package/tests/test-sequence.mjs +82 -46
- package/tests/test-system.mjs +72 -33
- package/tests/test-wasm.mjs +98 -8
- package/vitest.config.ts +35 -0
- package/.github/release-drafter.yml +0 -148
- package/dist/prompts/index.d.ts +0 -21
- package/dist/prompts/index.js +0 -217
- package/dist/tools/blueprint/helpers.d.ts +0 -29
- package/dist/tools/blueprint/helpers.js +0 -182
- package/src/prompts/index.ts +0 -249
- package/src/tools/blueprint/helpers.ts +0 -189
- package/tests/test-blueprint-events.mjs +0 -35
- package/tests/test-extra-tools.mjs +0 -38
- package/tests/test-render.mjs +0 -33
- package/tests/test-search-assets.mjs +0 -66
package/tests/test-sequence.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Sequencer Test Suite
|
|
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: '
|
|
16
|
-
{ scenario: 'Get
|
|
17
|
-
{ scenario: 'Set
|
|
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
|
-
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
{ scenario: '
|
|
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: '
|
|
27
|
-
{ scenario: 'Cinematic - Keyframe
|
|
28
|
-
{ scenario: 'Cinematic - Keyframe End', toolName: 'manage_sequence', arguments: { action: 'add_keyframe', path: '/Game/Cinematics/TC_Cinematic', actorName: '
|
|
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
|
-
//
|
|
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: '
|
|
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: '
|
|
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);
|
package/tests/test-system.mjs
CHANGED
|
@@ -1,56 +1,95 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Comprehensive System Control Test Suite
|
|
4
4
|
* Tool: system_control
|
|
5
|
-
*
|
|
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: '
|
|
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: '
|
|
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: '
|
|
26
|
-
{ scenario: '
|
|
27
|
-
|
|
28
|
-
//
|
|
29
|
-
{ scenario: '
|
|
30
|
-
{ scenario: '
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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:
|
|
51
|
-
toolName:
|
|
52
|
-
arguments: { action:
|
|
53
|
-
expected:
|
|
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
|
|
package/tests/test-wasm.mjs
CHANGED
|
@@ -156,16 +156,106 @@ async function testWASMIntegration() {
|
|
|
156
156
|
log.info('\n=== Performance Report ===');
|
|
157
157
|
log.info(wasmIntegration.reportPerformance());
|
|
158
158
|
|
|
159
|
-
// Test
|
|
160
|
-
log.info('\n=== Test
|
|
161
|
-
|
|
162
|
-
|
|
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
|
-
//
|
|
165
|
-
|
|
166
|
-
const newMetrics = wasmIntegration.getMetrics();
|
|
205
|
+
// Test 11: Edge Cases
|
|
206
|
+
log.info('\n=== Test 11: Edge Cases ===');
|
|
167
207
|
|
|
168
|
-
|
|
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 ===');
|
package/vitest.config.ts
ADDED
|
@@ -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');
|
package/dist/prompts/index.d.ts
DELETED
|
@@ -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
|