refactor(canvas): move freeform authoring contract to @posthog/shared#3601
refactor(canvas): move freeform authoring contract to @posthog/shared#3601adboio wants to merge 1 commit into
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
3b038cd to
f73be5a
Compare
There was a problem hiding this comment.
The PR modifies package.json exports and the tsup build config in @posthog/shared, which triggered the deps_toolchain gate. These are build infrastructure changes that require a human reviewer to verify the new package entrypoints are correctly wired before merging.
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
packages/shared/src/canvas-freeform-prompt.ts:26
**Conflicting Canvas Output Contract**
The canvas task is repo-less and publishes complete source through `desktop-file-system-canvas-partial-update`, but this line now tells the agent to maintain a working file with editing tools. It also conflicts with the later instruction not to edit files and to return a fenced block, so the agent can follow the wrong output path and finish without publishing the canvas.
```suggestion
"- Produce the COMPLETE single-file React source using the publishing mechanism specified by the caller. Do not write or edit files on disk.",
```
Reviews (1): Last reviewed commit: "refactor(canvas): move freeform authorin..." | Re-trigger Greptile |
| "", | ||
| "OUTPUT FORMAT — the app is ONE complete file:", | ||
| "- The file MUST `export default` a single React component that takes no props.", | ||
| "- Maintain it as a working file with your file-editing tools: seed it once, then apply changes as TARGETED edits. Do not regenerate the whole file for a small change, and do not paste the source into chat — a short sentence describing the change is enough.", |
There was a problem hiding this comment.
Conflicting Canvas Output Contract
The canvas task is repo-less and publishes complete source through desktop-file-system-canvas-partial-update, but this line now tells the agent to maintain a working file with editing tools. It also conflicts with the later instruction not to edit files and to return a fenced block, so the agent can follow the wrong output path and finish without publishing the canvas.
| "- Maintain it as a working file with your file-editing tools: seed it once, then apply changes as TARGETED edits. Do not regenerate the whole file for a small change, and do not paste the source into chat — a short sentence describing the change is enough.", | |
| "- Produce the COMPLETE single-file React source using the publishing mechanism specified by the caller. Do not write or edit files on disk.", |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/shared/src/canvas-freeform-prompt.ts
Line: 26
Comment:
**Conflicting Canvas Output Contract**
The canvas task is repo-less and publishes complete source through `desktop-file-system-canvas-partial-update`, but this line now tells the agent to maintain a working file with editing tools. It also conflicts with the later instruction not to edit files and to return a fenced block, so the agent can follow the wrong output path and finish without publishing the canvas.
```suggestion
"- Produce the COMPLETE single-file React source using the publishing mechanism specified by the caller. Do not write or edit files on disk.",
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Relocate the freeform canvas authoring contract — the system-prompt builder
(freeformSystemPromptFor), the import whitelist, the starter scaffold, and the
freeform template id — from @posthog/core into @posthog/shared, so @posthog/agent
can consume it (for the canvas_checkout tool) without a core↔agent package cycle.
Pure move: @posthog/core/canvas/{canvasTemplates,freeformSchemas,freeformWhitelist,
freeformStarter} now re-export from @posthog/shared, so existing consumers are
unchanged.
Generated-By: PostHog Code
Task-Id: 2ed89933-091b-446c-af91-5cc72d939b3b
f73be5a to
72f3e5a
Compare

Problem
working on some canvas generation improvements; need to be able to pass canvas instructions to system prompt
Changes
moving some canvas instruction prompting to
@posthog/sharedHow did you test this?
Automatic notifications