fix: escape literal BOM characters that trip apm's hidden-Unicode scan
lib-boundary-resolver.sh and the provider-adapter-author BOM fixtures carried literal U+FEFF characters, which apm install reports as "files contain hidden characters". Both sites feed the text to Python, which interprets the '' escape identically, so behaviour is unchanged: the resolver's strip_bom and all five validate-adapter BOM cases pass. No core package bump: the fixture writes the same bytes, so the edit is not substantive under the apm-workflow version policy. Refs #94 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KkT7RSDwDbmrM9T34b6sTi
This commit is contained in:
@@ -298,14 +298,14 @@ EOF
|
|||||||
|
|
||||||
@test "a doubled UTF-8 BOM does not hide the @import line" {
|
@test "a doubled UTF-8 BOM does not hide the @import line" {
|
||||||
ADAPTER="$TMPDIR/CLAUDE.md"
|
ADAPTER="$TMPDIR/CLAUDE.md"
|
||||||
python3 -c "import sys; open(sys.argv[1], 'wb').write(('@AGENTS.md\n').encode('utf-8'))" "$ADAPTER"
|
python3 -c "import sys; open(sys.argv[1], 'wb').write(('\ufeff\ufeff@AGENTS.md\n').encode('utf-8'))" "$ADAPTER"
|
||||||
run bash "$SCRIPT" "$ADAPTER" "$AGENTS_MD"
|
run bash "$SCRIPT" "$ADAPTER" "$AGENTS_MD"
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "a BOM in front of a mid-file @import line does not hide it" {
|
@test "a BOM in front of a mid-file @import line does not hide it" {
|
||||||
ADAPTER="$TMPDIR/CLAUDE.md"
|
ADAPTER="$TMPDIR/CLAUDE.md"
|
||||||
python3 -c "import sys; open(sys.argv[1], 'wb').write(('# Claude notes\n\n@AGENTS.md\n').encode('utf-8'))" "$ADAPTER"
|
python3 -c "import sys; open(sys.argv[1], 'wb').write(('# Claude notes\n\n\ufeff@AGENTS.md\n').encode('utf-8'))" "$ADAPTER"
|
||||||
run bash "$SCRIPT" "$ADAPTER" "$AGENTS_MD"
|
run bash "$SCRIPT" "$ADAPTER" "$AGENTS_MD"
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1016,7 +1016,7 @@ FRONTMATTER_RE = re.compile(
|
|||||||
|
|
||||||
|
|
||||||
def strip_bom(text):
|
def strip_bom(text):
|
||||||
return text[1:] if text.startswith(u'') else text
|
return text[1:] if text.startswith(u'\ufeff') else text
|
||||||
|
|
||||||
|
|
||||||
class FrontmatterError(Exception):
|
class FrontmatterError(Exception):
|
||||||
|
|||||||
Reference in New Issue
Block a user