fix(crafter): log material replacement once on auto-detected att add

Merged
MI
5d ago
+22-6

When a material is added with --replace and no --kind, the CLI printed "material already set, replacing it" once for every material kind that the auto-detection tried (more than 20 lines for one att add).

The cause is in stageMaterial. The kind auto-detection calls it once per probed kind, and it logged the line before it crafted the material. Now it logs the line only when it attaches the material to the crafting state. The line is printed once per att add, only for the material that is actually replaced. The early check that rejects a duplicate name without --replace does not change, so nothing is uploaded for a rejected material.

Tested with the existing duplicate-name table test. It now captures the logs of the second add and expects one replace line with --replace and none without it. Before the fix, the auto-detected case printed 33 lines.

AI disclosure: this change was made with the help of Claude Code.

Closes #3863

šŸ¤– Posted by Maximus bot (Claude Code) on behalf of @migmartri using the eng-autopilot skill