Skip to content

Conversation

@nighca
Copy link
Collaborator

@nighca nighca commented Feb 11, 2026

close #2579.

@gemini-code-assist
Copy link

Summary of Changes

Hello @nighca, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the application's persistence layer by introducing a dedicated application context (AppCtx) that centralizes helper classes for cloud, local, and XBP file operations. This change decouples the core project model from persistence details, enhancing modularity and maintainability. Additionally, project history management has been moved to the editor's state, and a new spx namespace has been adopted for various models, streamlining import paths and improving code organization across the codebase.

Highlights

  • Centralized Persistence Logic: Introduced AppCtx to centralize persistence concerns, providing CloudHelpers, LocalHelpers, and XbpHelpers for managing project data storage and retrieval. This decouples the SpxProject model from direct persistence implementations.
  • Model Namespace Refactoring: Migrated core project models (e.g., Project, Sprite, Sound, Backdrop, Costume, Animation, Widget, and AIGC generation models) into a new @/models/spx/ namespace. This improves organization and clarifies the domain of these models.
  • History Management Relocation: Moved the History class, responsible for undo/redo functionality, from the Project model to the EditorState. This change aligns history management more closely with the editor's state rather than the project's core data structure.
  • Updated Editor State and Components: Refactored EditorState to integrate the new persistence helpers and the relocated History instance. Numerous components across the application, including asset management, copilot, code editor, and project editor, were updated to use the new SpxProject model and access persistence operations through AppCtx or editorCtx.state.history.
  • Improved Testability and Modularity: Rewrote unit tests for editing.ts and editor-state.ts to reflect the new architecture, utilizing mock helpers for cloud and local cache operations, enhancing testability and modularity of persistence logic.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • spx-gui/TODO.md
    • Added new TODO items in Chinese.
  • spx-gui/src/App.vue
    • Imported and provided the new application context.
  • spx-gui/src/apis/aigc.ts
    • Updated import path for State to the new spx namespace.
  • spx-gui/src/components/agent-copilot/CopilotProvider.vue
    • Integrated useAppCtx to access application context.
    • Replaced Project with SpxProject.
    • Updated project saving logic to use appCtx.cloudHelpers.save.
  • spx-gui/src/components/asset/animation/GroupCostumesModal.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/animation/AnimationGenItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/animation/AnimationGenPreview.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/animation/AnimationSettingsInput.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/animation/AnimationVideoPreview.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/backdrop/BackdropGen.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/backdrop/BackdropGenItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/backdrop/BackdropSettingsInput.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/common/GenStateFailed.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/common/ImageSelector.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/common/ReferenceCostumeInput.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/costume/CostumeGenItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/costume/CostumeGenPreview.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/costume/CostumeSettingsInput.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/sprite/SpriteGen.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/sprite/SpriteGenItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/sprite/SpriteGenModal.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/sprite/SpriteGenPhaseContent.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/sprite/SpriteGenPhaseSettings.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/gen/sprite/SpriteSettingsInput.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/index.ts
    • Updated model import paths to the new spx namespace.
    • Changed Project type to SpxProject in function signatures.
    • Introduced editorCtx to access history for doAction calls.
  • spx-gui/src/components/asset/library/AssetLibraryModal.vue
    • Updated model import paths to the new spx namespace.
    • Changed Project type to SpxProject in props.
    • Integrated useEditorCtx to access history for doAction calls.
  • spx-gui/src/components/asset/library/AssetSaveModal.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/library/BackdropItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/library/BackdropPreview.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/library/SoundItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/library/SoundPreview.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/library/SpriteItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/library/SpritePreview.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/library/management/AssetEditModal.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/library/management/BackdropItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/library/management/SoundItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/library/management/SpriteItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/preprocessing/PreprocessModal.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/preprocessing/remove-background/RemoveBackground.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/asset/scratch/LoadFromScratch.vue
    • Updated model import paths to the new spx namespace.
    • Changed Project type to SpxProject in props.
    • Integrated useEditorCtx to access history for doAction calls.
  • spx-gui/src/components/asset/scratch/LoadFromScratchModal.vue
    • Updated model import paths to the new spx namespace.
    • Changed Project type to SpxProject in props.
  • spx-gui/src/components/asset/scratch/SpriteItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/common/CostumesAutoPlayer.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/common/CostumesPlayer.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/common/app-context.ts
    • Added new file to define AppCtx, provideAppCtx, and useAppCtx for centralized helpers.
  • spx-gui/src/components/copilot/CopilotRoot.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useAppCtx to provide cloudHelpers to the Retriever.
    • Changed Project to SpxProject and updated project loading to use cloudHelpers.load.
  • spx-gui/src/components/copilot/custom-elements/CodeBlock.vue
    • Updated history access from editorCtx.project.history to editorCtx.state.history.
  • spx-gui/src/components/copilot/custom-elements/CodeChange.vue
    • Updated history access from editorCtx.project.history to editorCtx.state.history.
  • spx-gui/src/components/editor/EditorContextProvider.vue
    • Changed Project type to SpxProject in EditorCtx and props.
  • spx-gui/src/components/editor/ProjectEditor.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useAppCtx to access cloudHelpers.
    • Updated project saving to use cloudHelpers.save.
  • spx-gui/src/components/editor/code-editor/FormatButton.vue
    • Updated history access from editorCtx.project.history to editorCtx.state.history.
  • spx-gui/src/components/editor/code-editor/code-editor.ts
    • Updated model import paths to the new spx namespace.
    • Changed Project to SpxProject and added History to constructor arguments.
    • Updated exportGameFiles to exportFiles for project file export.
  • spx-gui/src/components/editor/code-editor/common.ts
    • Updated model import paths to the new spx namespace.
    • Changed Project to SpxProject in function signatures.
  • spx-gui/src/components/editor/code-editor/context.ts
    • Updated model import paths to the new spx namespace.
    • Changed Project to SpxProject in function signatures and CodeEditor instantiation.
  • spx-gui/src/components/editor/code-editor/lsp/index.ts
    • Updated model import paths to the new spx namespace.
    • Changed Project to SpxProject in constructor.
    • Updated exportGameFiles to exportFiles for project file export.
  • spx-gui/src/components/editor/code-editor/text-document.ts
    • Updated model import paths to the new spx namespace.
    • Changed Project to SpxProject and added History to constructor arguments.
    • Updated history access from project.history.doAction to history.doAction.
  • spx-gui/src/components/editor/code-editor/ui/CodeEditorUI.vue
    • Updated model import paths to the new spx namespace.
    • Updated history access from editorCtx.project.history to editorCtx.state.history.
  • spx-gui/src/components/editor/code-editor/ui/code-editor-ui.ts
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/code-editor/ui/diagnostics/index.ts
    • Updated exportGameFiles to exportFiles for project file export.
  • spx-gui/src/components/editor/code-editor/ui/document-tab/DocumentTab.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/code-editor/ui/inlay-hint/index.ts
    • Updated exportGameFiles to exportFiles for project file export.
  • spx-gui/src/components/editor/code-editor/ui/input-helper/InputHelper.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/code-editor/ui/input-helper/index.ts
    • Updated exportGameFiles to exportFiles for project file export.
  • spx-gui/src/components/editor/code-editor/ui/resource-reference/index.ts
    • Updated exportGameFiles to exportFiles for project file export.
  • spx-gui/src/components/editor/code-editor/ui/resource/ResourceItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/code-editor/ui/resource/resource-selector.ts
    • Updated model import paths to the new spx namespace.
    • Changed Project to SpxProject in constructor and function signatures.
    • Updated addCostumeFromLocalFile call to remove project argument.
  • spx-gui/src/components/editor/code-editor/ui/snippet.ts
    • Updated model import paths to the new spx namespace.
    • Changed Project to SpxProject in constructor.
  • spx-gui/src/components/editor/common/EditorList.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/common/config/sprite/SpriteDirection.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useEditorCtx and updated sprite context to use editorCtx.state.history.
  • spx-gui/src/components/editor/common/config/sprite/SpritePhysics.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useEditorCtx and updated physics mode application to use editorCtx.state.history.
  • spx-gui/src/components/editor/common/config/sprite/SpritePositionSize.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useEditorCtx and updated sprite context to use editorCtx.state.history.
  • spx-gui/src/components/editor/common/config/sprite/SpriteVisible.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useEditorCtx and updated sprite context to use editorCtx.state.history.
  • spx-gui/src/components/editor/common/config/utils.ts
    • Updated model import paths to the new spx namespace.
    • Changed Project to History in wrapUpdateHandler context.
  • spx-gui/src/components/editor/common/corner-menu-item/SaveAssetToLibraryMenuItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/common/viewer/DecoratorNode.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/common/viewer/NodeTransformer.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/common/viewer/SpriteNode.vue
    • Updated model import paths to the new spx namespace.
    • Changed Project type to SpxProject in props.
  • spx-gui/src/components/editor/common/viewer/common.ts
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/common/viewer/quick-config/SpriteQuickConfig.vue
    • Updated model import paths to the new spx namespace.
    • Changed Project type to SpxProject in props.
  • spx-gui/src/components/editor/common/viewer/quick-config/WidgetQuickConfig.vue
    • Updated model import paths to the new spx namespace.
    • Changed Project type to SpxProject in props.
  • spx-gui/src/components/editor/common/viewer/quick-config/sprite/DefaultConfigPanel.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useEditorCtx and updated z-order movement to use editorCtx.state.history.
  • spx-gui/src/components/editor/common/viewer/quick-config/sprite/HeadingConfigPanel.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/common/viewer/quick-config/utils.ts
    • Updated model import paths to the new spx namespace.
    • Changed Project to History in LocalConfig constructor and sync method.
    • Updated SpriteLocalConfig and WidgetLocalConfig constructors to use History.
  • spx-gui/src/components/editor/common/viewer/quick-config/widget/DefaultConfigPanel.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useEditorCtx and updated z-order movement to use editorCtx.state.history.
  • spx-gui/src/components/editor/editing.test.ts
    • Refactored test setup to use SimpleProject, makeCloudHelper, makeLocalCache.
    • Updated makeEditing to accept new helper arguments.
    • Adjusted assertions to reflect changes in persistence calls.
  • spx-gui/src/components/editor/editing.ts
    • Removed EditableProject interface.
    • Introduced ILocalCache interface.
    • Refactored Saving class to use CloudHelpers and ILocalCache.
    • Refactored Editing class to manage History internally and use new helper interfaces.
  • spx-gui/src/components/editor/editor-state.test.ts
    • Refactored test setup to use makeEmptyProject, makeProjectWithResources, makeCloudHelpers, makeLocalCache.
    • Updated makeEditorState to accept new helper arguments.
    • Adjusted assertions to reflect changes in history access via editorState.history.
  • spx-gui/src/components/editor/editor-state.ts
    • Refactored EditorState constructor to accept SpxProject, isOnline, signedInUsername, cloudHelpers, localCache.
    • Moved History instance to editing property.
    • Introduced GenManager and ProjectWithGens classes (partially commented out).
    • Renamed genCollapsePosProviderMap to genPosProviderMap and related methods.
  • spx-gui/src/components/editor/history.test.ts
    • Renamed from spx-gui/src/models/project/history.test.ts.
    • Updated to use SpxProject.
  • spx-gui/src/components/editor/history.ts
    • Renamed from spx-gui/src/models/project/history.ts.
    • Changed Project to IProject in constructor.
    • Updated exportGameFiles to exportFiles and loadGameFiles to loadFiles.
    • Changed project.transactionMutex.runExclusive to project.mutex.runExclusive.
  • spx-gui/src/components/editor/map-editor/MapBasicConfig.vue
    • Updated Project type to SpxProject in props.
  • spx-gui/src/components/editor/map-editor/MapEditor.vue
    • Updated model import paths to the new spx namespace.
    • Updated Project type to SpxProject in props.
  • spx-gui/src/components/editor/map-editor/MapLayerSortInput.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useEditorCtx and updated layer sort mode change to use editorCtx.state.history.
  • spx-gui/src/components/editor/map-editor/MapPhysicsInput.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useEditorCtx and updated physics enabled change to use editorCtx.state.history.
  • spx-gui/src/components/editor/map-editor/MapSizeInput.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useEditorCtx and updated map size changes to use editorCtx.state.history.
  • spx-gui/src/components/editor/map-editor/SpriteBasicConfig.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/map-editor/SpritesPanel.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/map-editor/map-viewer/MapViewer.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useEditorCtx and updated sprite local configs to use editorCtx.state.history.
  • spx-gui/src/components/editor/navbar/EditorNavbar.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useAppCtx to access xbpHelpers.
    • Updated project import/export to use xbpHelpers.load and xbpHelpers.save.
    • Updated undo/redo actions to use props.state?.history.
  • spx-gui/src/components/editor/panels/sound/SoundSummaryItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/panels/sound/SoundsPanel.vue
    • Updated model import paths to the new spx namespace.
    • Updated sound order sorting to use editorCtx.state.history.
  • spx-gui/src/components/editor/panels/sprite/SpriteSummaryItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/preview/stage-viewer/StageViewer.vue
    • Updated model import paths to the new spx namespace.
    • Updated camera follow sprite setting to use editorCtx.state.history.
    • Updated sprite and widget local configs to use editorCtx.state.history.
  • spx-gui/src/components/editor/runtime.ts
    • Updated model import paths to the new spx namespace.
    • Changed Project to SpxProject in constructor.
    • Updated exportGameFiles to exportFiles for project file export.
  • spx-gui/src/components/editor/sound/SoundEditor.vue
    • Updated model import paths to the new spx namespace.
    • Updated sound file saving to use editorCtx.state.history.
  • spx-gui/src/components/editor/sound/SoundItem.vue
    • Updated model import paths to the new spx namespace.
    • Updated sound duplication and removal to use editorCtx.state.history.
  • spx-gui/src/components/editor/sound/SoundRecorder.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useEditorCtx and updated recording saving to use editorCtx.state.history.
  • spx-gui/src/components/editor/sound/SoundRecorderModal.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/sprite/AnimationDetail.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/sprite/AnimationEditor.vue
    • Updated model import paths to the new spx namespace.
    • Updated animation order sorting to use editorCtx.state.history.
  • spx-gui/src/components/editor/sprite/AnimationItem.vue
    • Updated model import paths to the new spx namespace.
    • Updated animation duplication to use editorCtx.state.history.
  • spx-gui/src/components/editor/sprite/AnimationRemoveModal.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useEditorCtx and updated animation removal to use editorCtx.state.history.
  • spx-gui/src/components/editor/sprite/CheckableCostumeItem.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/sprite/CostumeDetail.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/sprite/CostumeItem.vue
    • Updated model import paths to the new spx namespace.
    • Updated costume duplication and removal to use editorCtx.state.history.
  • spx-gui/src/components/editor/sprite/CostumesEditor.vue
    • Updated model import paths to the new spx namespace.
    • Updated default costume setting and costume order sorting to use editorCtx.state.history.
  • spx-gui/src/components/editor/sprite/SpriteCollisionEditor.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useEditorCtx and updated collision saving to use editorCtx.state.history.
  • spx-gui/src/components/editor/sprite/SpriteCollisionEditorModal.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/sprite/SpriteEditor.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/sprite/SpriteItem.vue
    • Updated model import paths to the new spx namespace.
    • Updated sprite visibility toggle, duplication, removal, and costume/animation duplication to use editorCtx.state.history.
  • spx-gui/src/components/editor/sprite/SpriteList.vue
    • Updated model import paths to the new spx namespace.
    • Updated sprite order sorting and sprite generation adoption to use editorCtx.state.history.
  • spx-gui/src/components/editor/sprite/animation/AnimationPlayer.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/sprite/animation/AnimationSettings.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/sprite/animation/DurationEditor.vue
    • Updated model import paths to the new spx namespace.
    • Updated animation duration setting to use editorCtx.state.history.
  • spx-gui/src/components/editor/sprite/animation/SoundEditor.vue
    • Updated model import paths to the new spx namespace.
    • Updated animation sound setting to use editorCtx.state.history.
  • spx-gui/src/components/editor/sprite/animation/state/BoundStateEditor.vue
    • Updated model import paths to the new spx namespace.
    • Updated animation bound states setting to use editorCtx.state.history.
  • spx-gui/src/components/editor/stage/StageEditor.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/stage/backdrop/BackdropDetail.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/stage/backdrop/BackdropItem.vue
    • Updated model import paths to the new spx namespace.
    • Updated backdrop duplication and removal to use editorCtx.state.history.
  • spx-gui/src/components/editor/stage/backdrop/BackdropModeSelector.vue
    • Updated model import paths to the new spx namespace.
    • Updated backdrop mode setting to use editorCtx.state.history.
  • spx-gui/src/components/editor/stage/backdrop/BackdropsEditor.vue
    • Updated model import paths to the new spx namespace.
    • Updated default backdrop setting and backdrop order sorting to use editorCtx.state.history.
  • spx-gui/src/components/editor/stage/widget/WidgetItem.vue
    • Updated model import paths to the new spx namespace.
    • Updated widget visibility toggle, duplication, and removal to use editorCtx.state.history.
  • spx-gui/src/components/editor/stage/widget/WidgetsEditor.vue
    • Updated model import paths to the new spx namespace.
    • Updated widget order sorting to use editorCtx.state.history.
  • spx-gui/src/components/editor/stage/widget/detail/MonitorDetail.vue
    • Updated model import paths to the new spx namespace.
    • Updated monitor configuration to use editorCtx.state.history.
  • spx-gui/src/components/editor/stage/widget/detail/WidgetDetail.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/editor/stage/widget/icon.ts
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/project/ProjectCreateModal.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useAppCtx to access cloudHelpers and xbpHelpers.
    • Updated project creation to use xbpHelpers.load and cloudHelpers.save.
  • spx-gui/src/components/project/ProjectPublishModal.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useAppCtx to access cloudHelpers.
    • Updated project publishing to use cloudHelpers.save.
  • spx-gui/src/components/project/ProjectPublishedModal.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/components/project/index.ts
    • Updated model import paths to the new spx namespace.
    • Integrated useAppCtx to access cloudHelpers.
    • Changed Project type to SpxProject in function signatures.
    • Updated unpublish project to use cloudHelpers.save.
  • spx-gui/src/components/project/runner/ProjectRunner.vue
    • Updated model import paths to the new spx namespace.
    • Updated project file export to use project.exportFiles.
  • spx-gui/src/components/project/runner/ProjectRunnerSurface.vue
    • Updated model import paths to the new spx namespace.
  • spx-gui/src/models/common/cloud.ts
    • Introduced CloudHelpers class to encapsulate cloud persistence logic.
    • Made global load and save functions private.
  • spx-gui/src/models/common/local.ts
    • Introduced LocalHelpers class to encapsulate local storage persistence logic.
    • Made global clear, load, and save functions private.
  • spx-gui/src/models/common/test.ts
    • Refactored makeProject into SimpleProject class implementing IProject for better test isolation.
  • spx-gui/src/models/common/xbp.test.ts
    • Updated model import paths to the new spx namespace.
    • Changed Project to SpxProject in test setup.
  • spx-gui/src/models/common/xbp.ts
    • Introduced XbpHelpers class to encapsulate XBP file persistence logic.
    • Made global load and save functions private.
  • spx-gui/src/models/project.ts
    • Added new file defining IProject interface, CloudMetadata, and Metadata types.
  • spx-gui/src/models/spx/animation.test.ts
    • Renamed from spx-gui/src/models/animation.test.ts.
    • Updated to use SpxProject.
  • spx-gui/src/models/spx/animation.ts
    • Renamed from spx-gui/src/models/animation.ts.
    • Updated import paths for common files.
  • spx-gui/src/models/spx/backdrop.test.ts
    • Renamed from spx-gui/src/models/backdrop.test.ts.
    • Updated import paths for common files.
  • spx-gui/src/models/spx/backdrop.ts
    • Renamed from spx-gui/src/models/backdrop.ts.
    • Updated import paths for common files.
  • spx-gui/src/models/spx/common/asset-name.test.ts
    • Renamed from spx-gui/src/models/common/asset-name.test.ts.
    • Updated to use SpxProject and common file imports.
  • spx-gui/src/models/spx/common/asset-name.ts
    • Renamed from spx-gui/src/models/common/asset-name.ts.
  • spx-gui/src/models/spx/common/asset.ts
    • Renamed from spx-gui/src/models/common/asset.ts.
    • Updated import paths for common files and cloud.
  • spx-gui/src/models/spx/common/resource-model.ts
    • Renamed from spx-gui/src/models/common/resource-model.ts.
  • spx-gui/src/models/spx/common/test.ts
    • Added new file makeSpxProject for creating a project with resources.
  • spx-gui/src/models/spx/costume.test.ts
    • Renamed from spx-gui/src/models/costume.test.ts.
    • Updated import paths for common files.
  • spx-gui/src/models/spx/costume.ts
    • Renamed from spx-gui/src/models/costume.ts.
    • Updated import paths for common files.
  • spx-gui/src/models/spx/gen/aigc-mock.ts
    • Renamed from spx-gui/src/models/gen/aigc-mock.ts.
    • Updated to use spx/sprite.
  • spx-gui/src/models/spx/gen/animation-gen.test.ts
    • Renamed from spx-gui/src/models/gen/animation-gen.test.ts.
    • Updated to use makeSpxProject and common file imports.
  • spx-gui/src/models/spx/gen/animation-gen.ts
    • Renamed from spx-gui/src/models/gen/animation-gen.ts.
    • Updated to use SpxProject and common file/cloud imports.
  • spx-gui/src/models/spx/gen/backdrop-gen.test.ts
    • Renamed from spx-gui/src/models/gen/backdrop-gen.test.ts.
    • Updated to use makeSpxProject.
  • spx-gui/src/models/spx/gen/backdrop-gen.ts
    • Renamed from spx-gui/src/models/gen/backdrop-gen.ts.
    • Updated to use SpxProject and common file/cloud imports.
    • Added export and load methods for BackdropGen.
  • spx-gui/src/models/spx/gen/common.test.ts
    • Renamed from spx-gui/src/models/gen/common.test.ts.
  • spx-gui/src/models/spx/gen/common.ts
    • Renamed from spx-gui/src/models/gen/common.ts.
    • Updated to use SpxProject.
    • Added PhaseSerialized and TaskSerialized types for serialization.
    • Added load and export methods to Phase and Task classes.
  • spx-gui/src/models/spx/gen/costume-gen.test.ts
    • Renamed from spx-gui/src/models/gen/costume-gen.test.ts.
    • Updated to use makeSpxProject.
  • spx-gui/src/models/spx/gen/costume-gen.ts
    • Renamed from spx-gui/src/models/gen/costume-gen.ts.
    • Updated to use SpxProject and common file/cloud imports.
  • spx-gui/src/models/spx/gen/sprite-gen.test.ts
    • Renamed from spx-gui/src/models/gen/sprite-gen.test.ts.
    • Updated to use makeSpxProject.
  • spx-gui/src/models/spx/gen/sprite-gen.ts
    • Renamed from spx-gui/src/models/gen/sprite-gen.ts.
    • Updated to use SpxProject and common file/cloud imports.
    • Added spriteGenAssetPath constant.
    • Added loadAll, load, and export methods for SpriteGen.
  • spx-gui/src/models/spx/project.test.ts
    • Renamed from spx-gui/src/models/project/index.test.ts.
    • Updated to use SpxProject.
    • Removed tests for saveToCloud and saveToLocalCache as they are now handled by helpers.
    • Updated exportGameFiles to exportFiles and loadGameFiles to loadFiles.
  • spx-gui/src/models/spx/project.ts
    • Renamed from spx-gui/src/models/project/index.ts.
    • Renamed Project class to SpxProject and implemented IProject interface.
    • Removed direct history and transactionMutex properties, now accessed via EditorState.
    • Removed direct loadXbpFile, exportXbpFile, loadFromCloud, saveToCloud, loadFromLocalCache, saveToLocalCache methods, now handled by helper classes.
    • Updated exportGameFiles to exportFiles and loadGameFiles to loadFiles.
  • spx-gui/src/models/spx/sound.test.ts
    • Renamed from spx-gui/src/models/sound.test.ts.
    • Updated to use SpxProject and common file imports.
  • spx-gui/src/models/spx/sound.ts
    • Renamed from spx-gui/src/models/sound.ts.
    • Updated to use SpxProject and common file imports.
  • spx-gui/src/models/spx/sprite.test.ts
    • Renamed from spx-gui/src/models/sprite.test.ts.
    • Updated import paths for common files.
  • spx-gui/src/models/spx/sprite.ts
    • Renamed from spx-gui/src/models/sprite.ts.
    • Updated to use SpxProject and common file imports.
  • spx-gui/src/models/spx/stage.test.ts
    • Renamed from spx-gui/src/models/stage.test.ts.
    • Updated import paths for common files.
  • spx-gui/src/models/spx/stage.ts
    • Renamed from spx-gui/src/models/stage.ts.
    • Updated import paths for common files.
  • spx-gui/src/models/spx/tilemap.test.ts
    • Renamed from spx-gui/src/models/tilemap.test.ts.
    • Updated import paths for common files.
  • spx-gui/src/models/spx/tilemap.ts
    • Renamed from spx-gui/src/models/tilemap.ts.
    • Updated import paths for common files.
  • spx-gui/src/models/spx/widget/index.ts
    • Renamed from spx-gui/src/models/widget/index.ts.
  • spx-gui/src/models/spx/widget/monitor.ts
    • Renamed from spx-gui/src/models/widget/monitor.ts.
  • spx-gui/src/models/spx/widget/widget.test.ts
    • Renamed from spx-gui/src/models/widget/widget.test.ts.
    • Updated import paths for common files.
  • spx-gui/src/models/spx/widget/widget.ts
    • Renamed from spx-gui/src/models/widget/widget.ts.
  • spx-gui/src/pages/community/project.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useAppCtx to access cloudHelpers.
    • Updated project loading and like/unlike actions to use cloudHelpers.load.
  • spx-gui/src/pages/editor/index.vue
    • Introduced LocalCache class implementing ILocalCache.
    • Integrated useAppCtx to access localHelpers and cloudHelpers.
    • Updated EditorState instantiation to use new helper arguments.
    • Refactored project loading logic to use localCache.load and cloudHelpers.load.
  • spx-gui/src/utils/project.ts
    • Updated Project type to SpxProject in function signatures.
  • spx-gui/src/widgets/spx-runner/SpxRunner.ce.vue
    • Updated model import paths to the new spx namespace.
    • Integrated useAppCtx to access cloudHelpers.
    • Updated project loading to use cloudHelpers.load.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant refactoring aimed at centralizing project persistence logic. Helper classes (CloudHelpers, LocalHelpers, XbpHelpers) are introduced and provided through a Vue context, which is a great improvement over instantiating them everywhere. The Project class is renamed to SpxProject and its persistence-related methods have been moved to these new helpers. Additionally, history management has been moved from the project model to the EditorState. The file structure for models has also been reorganized under models/spx.

While this is a solid architectural improvement, I've found a critical issue where properties related to asset generation state (spriteGens, backdropGens) have been removed from EditorState but are still being accessed by other components, which will lead to runtime errors. There are also some incomplete implementations for the new generation state persistence feature. Please address these points.

}
}

export class EditorState extends Disposable {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The properties spriteGens, backdropGens, and their management methods (addSpriteGen, removeSpriteGen, etc.) have been removed from EditorState. However, other components like SpriteList.vue still access editorCtx.state.spriteGens. This will cause a runtime error. It seems the intention was to move this logic into the new GenManager class, but GenManager is not used within EditorState. These properties should be restored or the dependent components should be updated to use the new GenManager.

Comment on lines +168 to +170
static load(serialized: PhaseSerialized): Phase<unknown> {
const phase = new Phase(serialized.actionName, serialized.state)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The load method creates a phase instance but does not return it. It should return the created instance.

  static load(serialized: PhaseSerialized): Phase<unknown> {
    const phase = new Phase(serialized.actionName, serialized.state)
    return phase
  }

Comment on lines +131 to +138
export(): Files {
// TODO
return {}
}

async load(files: Files) {
// TODO
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The export and load methods are added but not implemented. This seems to be part of the work-in-progress for persisting generation state. Please ensure these are implemented to complete the feature.

Comment on lines +394 to +405
static async loadAll(files: Files) {

}

static async load(files: Files) {
// TODO
}

export(): Files {
// TODO
return {}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The loadAll, load, and export methods are added but not implemented. This seems to be part of the work-in-progress for persisting generation state. Please ensure these are implemented to complete the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persistence for generation state

1 participant