filesystem: read_text_file head/tail mishandle line endings (tail drops a line after a final newline; head keeps \r on CRLF)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- backend
调研方向
Start with tailFile in src/filesystem/lib.ts and the trailing newline test in src/filesystem/__tests__/server-tools.test.ts; trace how the decoded tail is split, including LF, CRLF, and the chunk boundary. Update the test to capture the expected behavior, then verify tail: 1 and tail: 2 return the final lines without counting a trailing newline as an extra line.
由索引模型根据 Issue 内容生成。
描述
Problem
tailFile in src/filesystem/lib.ts splits the decoded tail on \n and keeps the last N segments. For a file that ends with a newline, the empty segment after the final \n counts as one of the N lines: tail: 1 on "a\nb\nc\n" returns an empty string, and tail: 2 returns only c. The test in src/filesystem/__tests__/server-tools.test.ts that counts the trailing newline as a line pins this today. head does not have the problem.
Expected
A final newline ends the last line and is not counted as an extra empty line, for LF and CRLF files and across the chunk boundary tailFile reads in. The pinning test changes with the fix.
Prior work
- #4674 by @jstar0
- #4643 by @teddiesloco
The PR(s) above targeted the pre-refactor code and are closed as part of the backlog triage in #4875; this issue is where the work continues, with the PR(s) as a prototype. Thank you to their authors.
- 主要语言
- TypeScript
- 星标
- 91.6k
- 派生
- 11.9k
- 平均合并
- 4 小时 31 分钟
- 30 天内合并 PR
- 236
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/servers 的其他 Issue
-
enhancement server-everything v2
难度 2/5 1-3 小时 新手友好度 72/100
modelcontextprotocol/servers#5371 · 1 条评论 ·
维护者通常 1 天内回复
-
chore server-filesystem server-memory server-sequentialthinking v2
难度 2/5 1-3 小时 新手友好度 78/100
modelcontextprotocol/servers#5345 ·
维护者通常 1 天内回复
-
docs(git): clarify unconfined default scope and repository confinement options in README and CLI未关闭documentation server-git v2
难度 1/5 1 小时以内 新手友好度 74/100
modelcontextprotocol/servers#5230 · 1 条评论 ·
维护者通常 1 天内回复
-
bug server-filesystem v2
难度 2/5 1-3 小时 新手友好度 72/100
modelcontextprotocol/servers#5216 · 3 条评论 ·
维护者通常 1 天内回复
-
documentation server-git server-time v2
难度 2/5 1-3 小时 新手友好度 72/100
modelcontextprotocol/servers#5213 · 2 条评论 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/servers 的全部 Issue
相似的 Issue
-
bug triage
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
hemi-earn
难度 2/5 1-3 小时 新手友好度 82/100
vetro-protocol/vetro-monorepo#1043 ·
维护者通常 1 天内回复
-
stage 2: bare names resolve against PATH differently from the shell (empty and relative entries)未关闭
难度 2/5 1-3 小时 新手友好度 82/100
STRML/omp-classifier#206 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
atlassian-labs/mermaid-diagrams-viewer#188 ·
维护者通常 1 天内回复
-
dashboard enhancement
难度 2/5 1-3 小时 新手友好度 76/100
Olanetsoft/agent-lookout#225 ·
维护者通常 1 天内回复