Short developer reference for everyday work on SpaghettiChef 0.1.x.
Detailed setup and verification are documented in:
install.mdtest.mddevops.md
SpaghettiChef 0.1.x is a local runtime with:
- embedded HTTP API
- runtime-managed printer registry
- monitoring scheduler and monitoring tasks
- runtime state cache
- SQLite persistence
- embedded dashboard resources
The main verification path is simulation mode.
Real hardware remains optional for manual checks.
Runtime entry point.
Responsibilities:
- read system properties
- create runtime services
- start the local runtime
- keep the process alive
- register shutdown handling
Embedded REST API layer.
Main class:
RemoteApiServer
Responsibilities:
- expose
/health - expose printer administration endpoints
- expose printer status endpoints
- expose dashboard resources
- translate runtime failures into controlled HTTP responses
Runtime backbone.
Main classes:
SpaghettiChefRuntimePrinterRegistryPrinterRuntimeNodePrinterRuntimeNodeFactoryPrinterRuntimeStateCache
Responsibilities:
- load configured printers
- register and remove runtime nodes
- keep current runtime state per printer
- coordinate startup and shutdown
Monitoring layer.
Main classes:
PrinterMonitoringSchedulerPrinterMonitoringTaskMonitoringEventPolicy
Responsibilities:
- schedule per-printer monitoring
- connect and poll printers
- classify responses into runtime state
- persist snapshots and events
- deduplicate repeated failure events
SQLite persistence layer.
Main classes:
DatabaseConfigDatabaseDatabaseInitializerPrinterConfigurationStorePrinterSnapshotStorePrinterEventStoreMonitoringRules
Responsibilities:
- initialize schema
- persist configured printers
- persist snapshots
- persist events
- apply snapshot persistence rules
Serial and simulation implementations.
Main classes:
SerialPortAdapterJSerialCommPortAdapterSimulatedPrinterPort
Real serial communication implementation used for real mode.
Embedded dashboard assets:
index.htmldashboard.cssdashboard.js
Automated tests for:
- runtime
- monitoring
- persistence
- API
- serial communication
- simulation behavior
At the moment, the main runtime flow is:
configured printer
-> runtime node
-> monitoring scheduler
-> monitoring task
-> snapshot/state update
-> API/dashboard exposure
-> persistence of snapshots and events
Main printer states:
DISCONNECTED
CONNECTING
IDLE
HEATING
PRINTING
ERROR
UNKNOWN
mvn clean compilemvn testmvn clean verifymvn exec:java \
-Dexec.mainClass="spaghettichef.local.LocalMain" \
-Dspaghettichef.api.port=8080 \
-Dspaghettichef.monitoring.intervalSeconds=1 \
-Dspaghettichef.databaseFile=spaghettichef.dbcurl http://localhost:8080/healthcurl http://localhost:8080/printerscurl -X POST http://localhost:8080/printers \
-H "Content-Type: application/json" \
-d '{
"id": "printer-1",
"displayName": "Developer Sim Printer",
"portName": "SIM_PORT_1",
"mode": "simulated",
"enabled": true
}'curl http://localhost:8080/printers/printer-1
curl http://localhost:8080/printers/printer-1/statuscurl -X POST http://localhost:8080/printers/printer-1/disable
curl -X POST http://localhost:8080/printers/printer-1/enablehttp://localhost:8080/dashboard
Default database file:
spaghettichef.db
The schema is initialized automatically on runtime startup.
Current tables:
configured_printers
monitoring_rules
print_jobs
printer_events
printer_snapshots
Useful checks:
sqlite3 spaghettichef.db ".tables"sqlite3 spaghettichef.db "select id,name,port_name,mode,enabled from configured_printers order by id;"sqlite3 spaghettichef.db "select printer_id,state,created_at from printer_snapshots order by id desc limit 10;"sqlite3 spaghettichef.db "select printer_id,event_type,message,created_at from printer_events order by id desc limit 10;"Do not commit runtime database files.
Run:
mvn clean verifyDo one local runtime smoke check:
curl http://localhost:8080/health
curl http://localhost:8080/printersIf working on runtime behavior, also verify:
- simulated printer creation
- monitoring state changes
- disable / enable flow
- dashboard load
- database contents when relevant
- use simulation mode for normal development
- use
realmode only when validating actual serial communication - prefer API/runtime verification over old one-shot CLI assumptions
- keep runtime state semantics aligned with the documented state machine
- keep persistence-visible behavior testable and deterministic
- keep Jenkins smoke scenarios aligned with the public runtime/API surface