mirror of
https://github.com/mindfold-ai/Trellis.git
synced 2026-04-26 02:26:00 +03:00
[GH-ISSUE #18] sessionStart 钩子向 stdout 打印非 JSON 时报 JSON 解析错误 #15
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/Trellis#15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @beilo on GitHub (Jan 31, 2026).
Original GitHub issue: https://github.com/mindfold-ai/Trellis/issues/18
环境
2.5.0-pre.31.patch.0sessionStart,命令例如python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/session-start.py"现象
执行 session start 时出现:
钩子收到的 input(stdin)
脚本收到的 JSON 示例:
原因
钩子脚本向 stdout 打印了普通文本(如
<session-context>...)。Cursor 会把 stdout 整体当 JSON 解析,遇到<就报错。建议
{"continue": true, "additional_context": "..."}),避免让人误以为可以直接输出任意上下文文本。补充内容:
tl init 的时候只勾选了 claude code。因为 cursor 是支持了
https://cursor.com/cn/docs/context/subagents
https://cursor.com/cn/docs/agent/hooks
按理说是能跟claude code一样的。
@taosu0216 commented on GitHub (Jan 31, 2026):
编码问题正在hotfix
@taosu0216 commented on GitHub (Jan 31, 2026):
cursor 的 hook 后续我们也会支持一下,感谢建议
@taosu0216 commented on GitHub (Feb 1, 2026):
已经在beta最新版本修复
@beilo commented on GitHub (Feb 1, 2026):
合并到 master 了嘛
@taosu0216 commented on GitHub (Feb 1, 2026):
没有, beta 还没测试完,全部测试完成之后才会合进main, 但可以使用 npm install -g @mindfoldhq/trellis@beta 下载最新beta的版本
@beilo commented on GitHub (Feb 1, 2026):
好嘞 感谢大佬 我是源码部署的。我等合并吧~
@taosu0216 commented on GitHub (Feb 1, 2026):
https://github.com/mindfold-ai/Trellis/tree/feat/opencode 直接从这个分支再重新部署一遍也ok的, beta 版本的改动目前都是在这个分支推进的
@beilo commented on GitHub (Feb 2, 2026):
--- Resolving conflicts ---
? .trellis/.gitignore has changes. (Use arrow keys)
[1] Overwrite - Replace with new version
❯ [2] Skip - Keep your current version
[3] Create copy - Save new version as .new
[a] Apply Overwrite to all
[s] Apply Skip to all
[n] Apply Create copy to all
请问这里的最佳实践是Apply Skip to all 吗?因为我之前写了一些文档了。刚刚Apply Overwrite to all把我的文档全覆盖了
@taosu0216 commented on GitHub (Feb 2, 2026):
如果自己已经做过一些魔改的话, 一般其实都是直接 skip 的, 因为改动通常都是一些更通用化, 泛化的改动 另外每次改动都会在 .trellis/ 目录下面自动生成一份你当前本地的backup 备份的, 另外每次也会自动生成一个task 记录相关changelog, 可以让ai看那个task 帮你看看是否有必要进行相关修改
@beilo commented on GitHub (Feb 2, 2026):
好呢谢谢~。