|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +This repository contains a template for building embedded applications using |
| 4 | +the Bespoke Simulation framework. For complete template documentation, see |
| 5 | +[BESPOKE-TEMPLATE.md](./BESPOKE-TEMPLATE.md). |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +This template provides: |
| 10 | +- CodeSignal Design System integration |
| 11 | +- Consistent layout components (header, sidebar, main content area) |
| 12 | +- Help modal system |
| 13 | +- Local development server with WebSocket support |
| 14 | +- Standardized file structure and naming conventions |
| 15 | + |
| 16 | +## Quick Start |
| 17 | + |
| 18 | +1. **Customize the HTML template** (`client/index.html`): |
| 19 | + - Replace `<!-- APP_TITLE -->` with your page title |
| 20 | + - Replace `<!-- APP_NAME -->` with your app name |
| 21 | + - Add your main content at `<!-- APP_SPECIFIC_MAIN_CONTENT -->` |
| 22 | + - Add app-specific CSS links at `<!-- APP_SPECIFIC_CSS -->` |
| 23 | + - Add app-specific JavaScript at `<!-- APP_SPECIFIC_SCRIPTS -->` |
| 24 | + |
| 25 | +2. **Create your application files**: |
| 26 | + - App-specific CSS (e.g., `my-app.css`) |
| 27 | + - App-specific JavaScript (e.g., `my-app.js`) |
| 28 | + - Help content (based on `help-content-template.html`) |
| 29 | + |
| 30 | +3. **Start the development server**: |
| 31 | + ```bash |
| 32 | + npm start |
| 33 | + ``` |
| 34 | + Server runs on `http://localhost:3000` |
| 35 | + |
| 36 | +## Key Conventions |
| 37 | + |
| 38 | +### File Naming |
| 39 | + |
| 40 | +- CSS files: kebab-case (e.g., `my-app.css`) |
| 41 | +- JavaScript files: kebab-case (e.g., `my-app.js`) |
| 42 | +- Data files: kebab-case (e.g., `solution.json`) |
| 43 | +- Image files: kebab-case (e.g., `overview.png`) |
| 44 | + |
| 45 | +### Error Handling |
| 46 | + |
| 47 | +- Wrap all async operations in try-catch blocks |
| 48 | +- Provide meaningful error messages to users |
| 49 | +- Log errors to console for debugging |
| 50 | +- Implement retry logic for network operations |
| 51 | +- Handle localStorage quota exceeded errors |
| 52 | +- Validate data before saving operations |
| 53 | + |
| 54 | +## Development Workflow |
| 55 | + |
| 56 | +### Build and Test |
| 57 | + |
| 58 | +```bash |
| 59 | +# Start development server |
| 60 | +npm start |
| 61 | + |
| 62 | +# Development mode (same as start) |
| 63 | +npm run dev |
| 64 | +``` |
| 65 | + |
| 66 | +### WebSocket Messaging |
| 67 | + |
| 68 | +The server provides a `POST /message` endpoint for real-time messaging: |
| 69 | + |
| 70 | +```bash |
| 71 | +curl -X POST http://localhost:3000/message \ |
| 72 | + -H "Content-Type: application/json" \ |
| 73 | + -d '{"message": "Your message here"}' |
| 74 | +``` |
| 75 | + |
| 76 | +This sends alerts to connected clients. Requires `ws` package: |
| 77 | +```bash |
| 78 | +npm install |
| 79 | +``` |
| 80 | + |
| 81 | +## Template Documentation |
| 82 | + |
| 83 | +For detailed information about: |
| 84 | +- Design System usage and components |
| 85 | +- CSS implementation guidelines |
| 86 | +- JavaScript API (HelpModal) |
| 87 | +- Component reference and examples |
| 88 | +- Customization options |
| 89 | + |
| 90 | +See [BESPOKE-TEMPLATE.md](./BESPOKE-TEMPLATE.md). |
| 91 | + |
| 92 | +## Project Structure |
| 93 | + |
| 94 | +``` |
| 95 | +client/ |
| 96 | + ├── index.html # Main HTML template |
| 97 | + ├── app.js # Application logic |
| 98 | + ├── bespoke-template.css # Template-specific styles |
| 99 | + ├── help-modal.js # Help modal system |
| 100 | + ├── help-content-template.html # Help content template |
| 101 | + └── design-system/ # CodeSignal Design System |
| 102 | + ├── colors/ |
| 103 | + ├── spacing/ |
| 104 | + ├── typography/ |
| 105 | + └── components/ |
| 106 | +server.js # Development server |
| 107 | +``` |
| 108 | + |
| 109 | +## Notes for AI Agents |
| 110 | + |
| 111 | +When working on applications built with this template: |
| 112 | + |
| 113 | +1. **Always reference BESPOKE-TEMPLATE.md** for template-specific |
| 114 | + implementation details |
| 115 | +2. **Follow the conventions** listed above for file naming |
| 116 | +3. **Use Design System components** directly - see BESPOKE-TEMPLATE.md for |
| 117 | + component classes and usage |
| 118 | +4. **Maintain consistency** with the template's structure and patterns |
| 119 | +5. **Keep guidelines up to date** by editing this AGENTS.md file as the codebase evolves |
0 commit comments