How sabakihq/sabaki works
Main Components
• UI Layer: Show the primary “App” component at the entry point (from src/components/App.js) as the container for the SPA.
• UI Subcomponents: List out the individual UI components – for example, MainMenu, MainView, Goban (the main board), MiniGoban, DrawerManager, ToolBar, the various bars (e.g., AutoplayBar, EditBar) and sidebars (e.g., CommentBox, GtpConsole). These represent different regions of the user interface.
• Modules/Logic: Represent the modules housed in src/modules. Key modules include:
• File Formats: Including submodules for SGF, GIB, NGF, and UGf (found under src/modules/fileformats).
• Game Logic & Transformation: Modules such as gamesort, gametree, gobantransformer.
• Engine Support: The enginesyncer and GTP logger to support external GTP engine integration.
• Helpers/Shims: Utility modules like helper.js and shims for compatibility.
• Supporting Layers:
• Internationalization (i18n.js in src),
• Updater (src/updater.js),
• Settings (src/setting.js).
• Configuration and Build: Represent build configuration files (webpack.config.js, package.json) as the foundation that compiles and bundles these components.
• Data Assets: Include the data folder containing audio files and assets for the application (like themes and textures suggested by user-customizable board appearances).
Relationships and Interactions
• User Interaction flows: A user starts at the “App” and interacts with the UI components (e.g., through drawer menus, toolbars, or direct board manipulation); actions and events flow from these UI components to the underlying modules.
• Data handling: When a user opens or edits a game file, the UI sends requests to the appropriate file format parser modules (sgf.js, gib.js, etc.). Similarly, integrations with GTP engines pass moves and analysis results between the UI and the engine support modules.
• Module Interconnection:
• The game tree and game sorting utilities work together to update the board state.
• The settings or theme modules update the UI’s styling dynamically (reflected through the style/ directory).
Architectural Patterns and Design Principles
• Component-Based Architecture: The project splits its UI into numerous reusable components (React-based, judging by the .js components and modular organization).
• Separation of Concerns: Notice how UI components are separated from the game logic and file handling modules.
• Extensibility: Clearly highlight integration points (e.g., plugin-like modules for GTP engines and various file formats) which allow Sabaki to be extensible and to integrate with external services.
Highlighting Relevant Technologies and Frameworks
• JavaScript Framework: The use of components in the src directory suggests a modern JavaScript framework (possibly React or Preact – especially given related projects like Shudan mentioned in the README).
• Bundling Tools: Webpack is used as evident from webpack.config.js.
• CI/CD: GitHub workflows and CI scripts, indicating automated testing and deployment.
• Testing: A separate test directory emphasizes the importance of automated tests for game logic and file format handling.