Repository navigation
Description
Problem
External tools cannot add or update entries in the material bank (the wood stock catalog with names, dimensions and prices) while BenchUp is running.
An agent that generates a .bup model cannot give the app prices for the stock it uses. The cutting plan and the cost estimate read prices only from the catalog inside the app, so every product has to be typed into the stock settings dialog by hand.
What the source does
- The catalog (name, wood type, thickness, width, length, price per piece, currency) is part of the general settings in the inspector preferences. eframe persists these in
app.ronin the app data directory (seepreferences_pathincrates/benchup-app/src/identity.rs). The catalog is a RON string nested inside that RON file. - The running app keeps the catalog in memory. eframe calls
saveon its autosave interval and on exit, andsavewrites the in-memory preferences again (save_inspector_preferencesincrates/benchup-app/src/sidebar.rs). An external edit made while the app is running is overwritten at the next save. Nothing reloadsapp.ron. - The
.bupfile stores a stock material's name, dimensions and grain (StockMaterialincrates/benchup-core/src/objects.rs). It has no price, so a model cannot carry prices with it. - Prices come from
Settings::wood_priceincrates/benchup-app/src/stock_settings.rs. A catalog entry matches a cut material only when the material id and the dimensions are identical. A price of 0 counts as unpriced.
Today the only working way to change the catalog from outside is to quit the app, edit app.ron by hand (string-patching escaped RON inside RON), and start the app again. That is fragile. A wrong id or a dimension that differs by a tenth of a millimetre makes the price silently not apply.
Use case
An agent generates a .bup model from a script and uses real supplier products as stock. The user wants the cutting plan and the cost estimate to price those products without retyping each one in the stock settings dialog.
Possible directions
Any of these would work. None is a firm proposal.
- Keep the catalog in its own plain JSON file in the app data directory, and reload it when the file changes on disk. External tools could then edit it safely.
- Add an import or merge of a catalog file, from the UI or the command line, with a clear rule for matching existing entries.
- Carry optional price data in the project file and offer to import it into the bank. The model would then travel with its prices.
Whatever the format, the matching rule (material id plus dimensions) should be easy for tools to follow, or be replaced by a rule that is easier to write, such as name plus dimensions.
Related
- Next tools for agents (CLI and MCP) #42 (next tools for agents) and PR Add benchup, a CLI and MCP server for editing .bup projects #41 (CLI and MCP server for
.bupfiles) are about agent access to models. PR Add benchup, a CLI and MCP server for editing .bup projects #41 adds acreate_stock_materialtool for the model. It is not clear from its description whether it touches the catalog or prices. - PR Reload projects changed on disk #46 (reload projects changed on disk) covers external changes to
.bupfiles. A similar reload for a catalog file would fit the same approach.
Activity