Edit a forge's code
apply_part_changesApply an atomic batch of exact edits to a forge's tree, then build it. Every entry in changes names its kind in op — str_replace, create, write, or delete. Prefer str_replace with an old_str that matches exactly once (or set count for more); use create for new files, delete to remove files, write only as a whole-file fallback. expectedTreeHash must be the hash from the latest get_forge or read_part_files call — a stale hash comes back as {conflict:true, manifest} instead of applying. A forge with no code yet (treeHash null) has nothing to be stale against: its first call creates part.js (the entrypoint) and every file the part needs, with an empty expectedTreeHash, and nothing is saved until that build succeeds. On success you get a build screenshot plus measure/verify/lint/match data; on failure, the build error and any lint findings.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| checks | No | How thorough the check after this build should be. Omit it (or "full") for the complete geometric report. "quick" skips the two slowest passes — minimum wall thickness and sub-part gap distances — and is dramatically faster on a large part, so prefer it while iterating toward a shape. A quick check never returns a verdict: `verify.ok` comes back null and `verify.unevaluated` names each gate that went unchecked. Run a full check on the last edit of a turn, and any time you are about to tell the user the part is finished. A check rides an edit — there is no check-only call, so decide on "full" when you make the edit you expect to be the last. A FULL check can also return `verify.ok: null`, for one of two reasons. When the full check lists entries in `verify.unevaluated`, those declared checks could not be measured — a sheet part's 2-D checks ran out of their time budget, or a reading failed — and each entry's `hint` says why and what to do; re-running the same check will not produce a verdict, so act on the hint and tell the user which check could not run. With `verify.evaluated: 0` and a `no expectations declared` warning, the part verified nothing: declare expectations in the part's `verify` block rather than checking again. | |
| changes | Yes | ||
| forgeId | Yes | The forge's id or its slug, exactly as list_forges or get_forge returned it. | |
| message | Yes | One line describing the change | |
| expectedTreeHash | Yes | Tree hash this batch was authored against |