Repository navigation
fix(clipboard): detect a script folder as XMSC, not XMSS - #94
Open
anwespanda wants to merge 1 commit into
Open
anwespanda wants to merge 1 commit into
anwespanda wants to merge 1 commit into
Conversation
`clipboard.py write filemaker/agentic-fm.xml` loads the companion scripts
onto the clipboard as XMSS (Script Steps). Pasting that into the Script
Workspace does not work — nothing is installed.
That is the documented install path for a host solution: QUICKSTART's
"Option B — Install via clipboard" is exactly this command.
Cause: a script folder exported from the Script Workspace wraps its
<Script> elements in a <Group>:
<fmxmlsnippet type="FMObjectList">
<Group groupCollapsed="False" includeInMenu="False" id="1" name="agentic-fm">
<Script ... name="Get agentic-fm path">
<Step .../>
`Group` is not in XML_ELEMENT_TO_CLASS, so the XML-parse branch of
detect_class_from_xml() returns None and execution falls through to the
regex scan. That loop iterates the mapping in insertion order, where
'Step' comes first, and filemaker/agentic-fm.xml contains 344 nested
<Step> elements — so it matches XMSS. The file holds 15 <Script>
elements, and the module's own table already declares 'Script': 'XMSC'.
Fix: map 'Group' to XMSC, and give it priority over 'Step' in the regex
fallback so a truncated script-folder snippet is still classified
correctly. This mirrors the existing CustomMenu/CustomMenuSet precedence,
which exists for the same reason — menu XML also nests <Step>.
'Script' is deliberately NOT given the same regex precedence: a
steps-only snippet containing a Perform Script step holds
<Script id="0" name="..."/>, and promoting it would misclassify that as
XMSC. Only <Group> is unambiguous.
Verified against every snippet shape in the repo:
script folder -> XMSC (was XMSS)
custom function -> XMFN unchanged
steps only -> XMSS unchanged
steps incl. Perform Script -> XMSS unchanged
bare <Script>, no Group -> XMSC unchanged
malformed script folder -> XMSC (was XMSS)
malformed steps only -> XMSS unchanged
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The documented way to install the companion scripts into a host solution does not work.
QUICKSTART.md→ "Option B — Install via clipboard":It should be XMSC (Script). Pasting the XMSS clipboard into the Script Workspace does not install the scripts — confirmed by testing both classes into a scratch file:
XMSSdoes nothing,--class XMSCproduces the agentic-fm folder with all 15 scripts as documented.Cause
A script folder exported from the Script Workspace wraps its
<Script>elements in a<Group>:Groupis not inXML_ELEMENT_TO_CLASS, so the XML-parse branch ofdetect_class_from_xml()returnsNone:Execution then falls through to the regex scan, which iterates the mapping in insertion order —
'Step'first.filemaker/agentic-fm.xmlcontains 344 nested<Step>elements, so it matchesXMSSand returns.The file holds 15
<Script>elements, and the module's own table already declares'Script': 'XMSC'.Fix
Map
'Group'toXMSC, and give it priority over'Step'in the regex fallback so a truncated script-folder snippet is still classified correctly.This mirrors the precedence already in place for
CustomMenu/CustomMenuSet, which exists for exactly the same reason — menu XML also nests<Step>inside action blocks.'Script'is deliberately not given the same regex precedence. A steps-only snippet containing aPerform Scriptstep holds<Script id="0" name="..."/>, and promotingScriptaboveStepwould misclassify that asXMSC. Only<Group>is unambiguous — it never appears inside a step.Verification
Every snippet shape in the repo, before and after:
filemaker/agentic-fm.xml)XMSS❌XMSC✅filemaker/context.xml)XMFNXMFNXMSSXMSSPerform ScriptXMSSXMSS<Script>, no<Group>XMSCXMSCXMSS❌XMSC✅XMSSXMSSI also checked that
<Group>does not appear as the root child of any other snippet type inagent/snippet_examples/,agent/library/orfilemaker/— only the script-folder file.Notes
Related to #52, which touches the same install path — that report notes the CLI route working, which I'd guess means the bundled
.fmp12(Option A) was used rather than Option B.🤖 Generated with Claude Code