A modern web-based compiler for GGcode to G-code conversion with 3D visualization, real-time editing, and comprehensive tooling support.
- Real-time GGcode Compilation: Convert GGcode to standard G-code with live feedback
- Monaco Editor Integration: Advanced code editing with syntax highlighting and IntelliSense
- 3D G-code Visualization: Interactive 3D preview of toolpaths with simulation controls
- Configurator System: Dynamic form generation for parameterized GGcode files
- Examples Library: Built-in collection of GGcode examples and templates
- Help System: Comprehensive documentation with multi-language support
- File Operations: Import/export GGcode and G-code files with drag-and-drop support
- Annotation System: Real-time G-code analysis with modal state tracking
βββ .githooks/
β βββ commit-msg
β βββ post-commit
β βββ pre-commit
βββ .github/ # GitHub workflows
β βββ workflows/
β β βββ ci.yml
β β βββ documentation.yml
β β βββ release.yml
β βββ markdown-link-check-config.json
βββ docs/ # Documentation
β βββ AI_AGENT_DOCUMENTATION.md
β βββ ARCHITECTURE.md
β βββ BUILD_DOCUMENTATION.md
β βββ COMMANDS.md
β βββ DEPLOYMENT.md
β βββ LOCALSTORAGE_LOGIC.md
β βββ PROJECT_STRUCTURE.md
β βββ SVG_Path_Commands.md
βββ GGCODE/ # Example files
β βββ advanced patterns.ggcode
β βββ advanced_control.ggcode
β βββ Arc Spiral Pattern.ggcode
β βββ array_example.ggcode
β βββ array_literals.ggcode
β βββ Base10_Dice.ggcode
β βββ base10_Digits.ggcode
β βββ Basic Arc Commands.ggcode
β βββ Basic Square Pocket.ggcode
β βββ basic_circle.ggcode
β βββ complete_features.ggcode
β βββ complete_math.ggcode
β βββ configurator_demo.ggcode
β βββ Crop Circle Pattern.ggcode
β βββ Flower of Life.ggcode
β βββ Flower Pattern with Arcs.ggcode
β βββ function_example.ggcode
β βββ Gear Teeth.ggcode
β βββ Inverted Spiral - Downward.ggcode
β βββ math_functions.ggcode
β βββ Mind-Blowing Gear Generator.ggcode
β βββ operators_and_logic.ggcode
β βββ Rose Pattern.ggcode
β βββ simple_spiral.ggcode
β βββ Spiral Function Circle Grid.ggcode
β βββ Spiral Function Grid.ggcode
β βββ Spiral Function Multi-Ring Circular Grid.ggcode
β βββ Spiral.ggcode
β βββ square.ggcode
β βββ Stair Stringer.ggcode
β βββ star.ggcode
β βββ start spiral.ggcode
β βββ SVG.ggcode
β βββ test-arc.ggcode
β βββ test-svg-arcs.ggcode
β βββ True Spiral with Arcs.ggcode
βββ public/ # Static assets (legacy)
β βββ css/
β β βββ components/
β β β βββ buttons.css
β β β βββ controls.css
β β β βββ headers.css
β β β βββ navigation.css
β β β βββ tooltips.css
β β βββ editor/
β β β βββ annotation-content.css
β β β βββ annotation-toolbar.css
β β β βββ annotations.css
β β βββ layout/
β β β βββ global.css
β β β βββ grid.css
β β β βββ panels.css
β β βββ modals/
β β β βββ app-usage.css
β β β βββ base.css
β β β βββ code-blocks.css
β β β βββ collapsible.css
β β β βββ dropdowns.css
β β β βββ examples.css
β β β βββ help-system.css
β β β βββ language-selector.css
β β β βββ rtl-support.css
β β β βββ search.css
β β β βββ settings.css
β β β βββ states.css
β β βββ base.css
β β βββ components.css
β β βββ editor.css
β β βββ main.css
β β βββ modals.css
β β βββ README.md
β βββ data/
β β βββ completions/
β β β βββ ggcode-axes.json
β β β βββ ggcode-brackets.json
β β β βββ ggcode-constants.json
β β β βββ ggcode-functions.json
β β β βββ ggcode-hover-constants.json
β β β βββ ggcode-hover-functions.json
β β β βββ ggcode-hover-gcodes.json
β β β βββ ggcode-hover-keywords.json
β β β βββ ggcode-hover-mcodes.json
β β β βββ ggcode-keywords.json
β β β βββ ggcode-language-config.json
β β β βββ ggcode-operators.json
β β β βββ ggcode-param-mappings.json
β β β βββ ggcode-signatures.json
β β β βββ ggcode-tokenizer.json
β β βββ help-content/
β β β βββ ar.json
β β β βββ de.json
β β β βββ en.json
β β β βββ es.json
β β β βββ fr.json
β β β βββ he.json
β β β βββ it.json
β β β βββ ja.json
β β β βββ ko.json
β β β βββ metadata.json
β β β βββ MULTILANGUAGE_GUIDE.md
β β β βββ nl.json
β β β βββ pl.json
β β β βββ pt.json
β β β βββ README.md
β β β βββ ru.json
β β β βββ tr.json
β β β βββ zh.json
β β βββ themes/
β β β βββ ggcode-dark-colors.json
β β β βββ ggcode-light-colors.json
β β βββ team-themes.json
β βββ js/
β β βββ main.js
β β βββ main.js.LICENSE.txt
β β βββ main.js.map
β β βββ navigation.js
β β βββ navigation.js.map
β β βββ src_client_js_core_applicationManager_js.js
β β βββ src_client_js_core_applicationManager_js.js.map
β β βββ src_client_js_editor_settings_js.js
β β βββ src_client_js_editor_settings_js.js.map
β β βββ src_client_js_editor_theme-loader_js.js
β β βββ src_client_js_editor_theme-loader_js.js.map
β β βββ src_client_js_editor_themes_js.js
β β βββ src_client_js_editor_themes_js.js.map
β β βββ src_client_js_ui_aiCommands_js.js
β β βββ src_client_js_ui_aiCommands_js.js.map
β βββ flags.css
β βββ GGcode.ico
β βββ logo.png
β βββ mill-annotations.json
β βββ mill-dictionary.json
β βββ OrbitControls.js
β βββ style.css
βββ scripts/ # Build and utility scripts
β βββ check-project-health.sh
β βββ generate-docs.sh
β βββ setup-hooks.sh
β βββ smart-commit.sh
β βββ update-changelog.js
β βββ update-dependencies.sh
β βββ update-readme-structure.js
β βββ verify-setup.sh
βββ src/ # Source code
β βββ client/ # Client-side code (ES6 modules)
β β βββ js/
β β βββ api/
β β βββ config/
β β βββ configurator/
β β βββ core/
β β βββ editor/
β β βββ ui/
β β βββ utils/
β β βββ visualizer/
β β βββ main.js
β βββ server/ # Server-side code (CommonJS)
β βββ config/
β β βββ environment.js
β β βββ index.js
β βββ middleware/
β β βββ errorHandler.js
β β βββ index.js
β β βββ security.js
β βββ routes/
β β βββ ai.js
β β βββ compiler.js
β β βββ examples.js
β β βββ help.js
β β βββ index.js
β βββ services/
β β βββ compiler.js
β β βββ fileManager.js
β β βββ helpContent.js
β βββ app.js
β βββ index.js
βββ tests/ # Test suite
β βββ client/
β β βββ api/
β β β βββ client.test.js
β β β βββ compiler.test.js
β β βββ visualizer/
β β βββ adaptive-rendering.test.js
β β βββ chunk-loader.test.js
β β βββ debug.test.js
β β βββ frustum-culling-performance.test.js
β β βββ frustum-culling.test.js
β β βββ geometry-manager.test.js
β β βββ geometry-optimization.test.js
β β βββ lod-system.test.js
β β βββ matrix-calculations.test.js
β β βββ parser-simple.test.js
β β βββ PERFORMANCE_VALIDATION_SUMMARY.md
β β βββ performance-test-report.md
β β βββ progress-bar-benchmark.js
β β βββ progress-bar-integration.test.js
β β βββ progress-bar-validation.js
β β βββ render-queue.test.js
β β βββ renderer-optimization.test.js
β β βββ renderer.test.js
β β βββ tooltipIntegration.test.js
β βββ config/
β β βββ testConfig.js
β βββ fixtures/
β β βββ examples/
β β β βββ simple_square.ggcode
β β β βββ with_variables.ggcode
β β βββ help/
β β βββ test_help.json
β βββ server/
β β βββ config/
β β β βββ config.test.js
β β βββ services/
β β βββ compiler.test.js
β β βββ fileManager.test.js
β βββ utils/
β β βββ mocks.js
β β βββ testHelpers.js
β β βββ testRunner.js
β βββ AI_TESTING_README.md
β βββ ai-commands-test.js
β βββ ai-integration-results.json
β βββ ai-integration-test.js
β βββ ai-test-cases.json
β βββ run-ai-tests.js
β βββ setup.js
β βββ smoke-tests.json
βββ views/ # EJS templates
β βββ layouts/
β β βββ main.ejs
β βββ pages/
β β βββ index.ejs
β βββ partials/
β β βββ head.ejs
β β βββ modals.ejs
β β βββ scripts.ejs
β β βββ viewer.ejs
β βββ help-template.ejs
β βββ helpExamples.ejs
β βββ index.ejs
βββ pm2.json
βββ .eslintrc.js
βββ .gitignore
βββ .jsdoc.json
βββ .prettierrc
βββ CHANGELOG.md
βββ CONTRIBUTING.md
βββ libggcode.so
βββ MAINTENANCE.md
βββ nodemon.json
βββ nohup.out
βββ package-lock.json
βββ package.json
βββ README.md
βββ server.log
βββ setup.sh
βββ USAGE.md
βββ webpack.config.js
- Node.js >= 16.0.0
- npm >= 8.0.0
- GGcode native library (
libggcode.so
)
-
Clone the repository
git clone <repository-url> cd ggcode-compiler
-
Install dependencies
npm install
-
Configure environment
cp .env.example .env # Edit .env with your configuration
-
Build and test
npm run build
# Start development server with hot reload
npm run dev
# Start with debugging
npm run dev:watch
# Start production server
npm start
# Or with PM2
pm2 start ecosystem.config.js
# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode
npm run test:watch
# Lint code
npm run lint
# Fix linting issues
npm run lint:fix
# Format code
npm run format
# Check formatting
npm run format:check
# Update project structure in README.md
npm run update-structure
# Add changelog entry from recent commits
npm run update-changelog # Uses version from package.json
npm run update-changelog 1.0.2 # Uses specific version
These simple scripts automate the mechanical parts of documentation maintenance:
- Project Structure: Scans directories and updates the
## π Project Structure
section - Changelog: Extracts git commits since last tag and adds formatted entries to CHANGELOG.md
Run these manually when preparing releases or updating documentation. The scripts handle the boring stuff while leaving creative content for manual editing.
POST /api/compile
- Compile GGcode to G-codePOST /api/validate
- Validate GGcode syntaxGET /api/compiler/status
- Get compiler status
GET /api/examples
- List available examplesGET /api/examples/:filename
- Get specific example
GET /api/help
- Get help contentGET /api/help/:section
- Get specific help section
The client uses a modular ES6 architecture with the following key components:
- Monaco Editor Manager: Handles code editing with syntax highlighting
- API Manager: Centralized API communication
- Configurator Manager: Dynamic form generation and validation
- Annotation System: Real-time G-code analysis
- Modal Manager: UI modal management
- File Operations: Import/export functionality
The server follows a layered architecture:
- Routes Layer: Express route handlers
- Services Layer: Business logic and data processing
- Middleware Layer: Request processing and security
- Configuration Layer: Environment and application settings
- Client: ES6 modules for modern browser compatibility
- Server: CommonJS modules for Node.js compatibility
- Backward Compatibility: Global function exports for legacy HTML
NODE_ENV=development|production|test
PORT=6990
HOST=localhost
COMPILER_LIB_PATH=/path/to/libggcode.so
Configuration is managed through environment-specific files in src/server/config/
:
environment.js
- Environment-specific settingsindex.js
- Configuration manager
- Unit Tests: Individual component testing
- Integration Tests: API endpoint testing
- Client Tests: Browser-based component testing
- Coverage: Comprehensive code coverage reporting
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # With coverage report
- Lazy Loading: Dynamic module loading
- Code Splitting: Separate bundles for different features
- Caching: Static asset caching in production
- Compression: Gzip compression for responses
- Rate Limiting: API rate limiting for security
- Health Checks:
/api/health
endpoint - Error Tracking: Comprehensive error logging
- Performance Metrics: Request timing and resource usage
- Input Validation: Comprehensive input sanitization
- Rate Limiting: Protection against abuse
- Security Headers: CSRF, XSS, and clickjacking protection
- Content Security Policy: Strict CSP implementation
- Error Handling: Secure error responses
- Fork the repository
- Create a feature branch
git checkout -b feature/your-feature-name
- Make changes and test
npm run build npm test
- Commit with conventional commits
git commit -m "feat: add new feature"
- Push and create PR
- ESLint: Code linting with custom rules
- Prettier: Code formatting
- Conventional Commits: Standardized commit messages
- Test Coverage: Maintain >80% coverage
ISC License - see LICENSE file for details
- API Docs: Available at
/api/docs
when running - Help System: Built-in help at
/help
- Examples: Sample files in
/examples
Common issues and solutions:
- Compilation Errors: Check
libggcode.so
path and permissions - Port Conflicts: Change PORT in environment variables
- Module Errors: Ensure Node.js version >= 16.0.0
- Issues: GitHub Issues for bug reports
- Discussions: GitHub Discussions for questions
- Documentation: In-app help system
- v1.0.0: Initial modular architecture implementation
- v0.9.x: Legacy monolithic structure