openpencil/packages
Fini 6b0feb3ba5 fix(mcp): fail fast on invalid parent_id in element tools
Codex stop-hook review: add_bottom_nav_v0 (and siblings) advertised a
parent_id contract that could silently no-op. pen-core's
insertNodeInTree returns the original tree unchanged when parentId
doesn't match any node (tree-utils.ts:200-234), so batch_design's
downstream call produces a success-looking response {results, nodeCount}
with an orphaned node that never lands on disk.

- tools/element-tool-helpers.ts: new ensureParentExists() helper —
  loads the target doc via openDocument + resolveDocPath, checks
  getDocChildren(pageId) with findNodeInTree, throws a descriptive
  Error listing parent_id and pageId if missing
- Apply to all 3 element tools (add_scroll_row_v0 / add_bottom_nav_v0 /
  add_activity_ring_v0) at the top of each handler, before DSL
  construction. Null parent_id short-circuits (root insertion is OK)
- routes/design-routes.ts: fix misleading "Page id" description on
  add_bottom_nav_v0.parent_id → now matches siblings ("Target parent
  node id (must exist...)")
- Tests: 4 new (throws on bogus parent_id for each of 3 tools, +
  positive "inserts under valid parent" for add_scroll_row_v0). 86/86
  pen-mcp suite pass

Bundle rebuilt. format + tsc green.
2026-04-19 16:16:11 +08:00
..
agent-native@e1f90cab96 chore(agent): bump agent-native to v0.4.0 release 2026-04-17 19:04:15 +08:00
pen-acp chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
pen-ai-skills docs(ai): teach overflow.md to prefer add_scroll_row_v0 MCP tool 2026-04-19 15:59:04 +08:00
pen-core chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
pen-engine chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
pen-figma chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
pen-mcp fix(mcp): fail fast on invalid parent_id in element tools 2026-04-19 16:16:11 +08:00
pen-react chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
pen-renderer chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
pen-sdk chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
pen-types chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
CLAUDE.md V0.7.0 (#95) 2026-04-11 23:25:13 +08:00