Skip to content

Commit 9387f28

Browse files
Your Nameclaude
andcommitted
Change malformed include directive from error to warning
When a line contains "<!-- include" but doesn't match the JSON format, emit a warning instead of blocking execution. This allows documentation that mentions include syntax (as examples) to pass through without error. Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent a79021c commit 9387f28

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

agent-persona

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,9 @@ def err(msg):
10371037
print(f"include error: {msg}", file=sys.stderr)
10381038
sys.exit(1)
10391039
1040+
def warn(msg):
1041+
print(f"include warning: {msg}", file=sys.stderr)
1042+
10401043
pattern = re.compile(r"<!--\s*include\s+(\{.*?\})\s*-->")
10411044
10421045
root = os.path.abspath(os.environ.get("AP_ROOT") or os.getcwd())
@@ -1113,7 +1116,8 @@ def expand_line(line, base_root, depth, stack, path, line_no):
11131116
if "<!--" not in line:
11141117
return line
11151118
if "<!-- include" in line and not pattern.search(line):
1116-
err(f"{path}:{line_no}: include directive must be JSON on a single line")
1119+
warn(f"{path}:{line_no}: include directive must be JSON on a single line (ignoring)")
1120+
return line
11171121
out = []
11181122
last = 0
11191123
for match in pattern.finditer(line):

0 commit comments

Comments
 (0)