feat(claude): add opt-in trellis init --with-statusline flag#333
Open
wang199001 wants to merge 2 commits into
Open
feat(claude): add opt-in trellis init --with-statusline flag#333wang199001 wants to merge 2 commits into
wang199001 wants to merge 2 commits into
Conversation
Re-introduce the Claude Code statusLine as an explicit opt-in, the shape recommended when the default install was removed in 0.5.0-beta.15 (9ea89f2). Default init output stays byte-identical: no statusLine key, no statusline.py. - New template src/templates/claude/hooks/statusline.py (claude-specific, not a shared hook): session-scoped task resolution via the shared resolver, [session] source tag, Windows reconfigure fix, rate-limit display with reset countdown (5h 17% (reset 4h31m)), and width adaptation via the COLUMNS env var (rate limits move to their own line on narrow terminals; explicit \n to avoid the wrap-height bug). - --with-statusline wired through both init paths (fresh init and re-init add-platform); statusLine settings injection mirrors update's preservation serialization byte-for-byte to avoid phantom updates. - Interactive (non -y) init additionally asks "Install Trellis statusLine for Claude Code?" (default No) when Claude Code is selected and the flag was not passed; -y and flag-passed runs never prompt. - Update safety both directions: statusline.py stays out of the unconditional template walk (never force-installed on opted-out projects); opted-in installs survive update (existing preserveExistingClaudeStatusLine + no manifest entry). - Tests: default-off regression, flag-on file matrix, other platforms unaffected, update safety both ways, ISO-8601/epoch resets_at tolerance, COLUMNS split/single-line, interactive confirm matrix (Yes/No/-y/flag/already-configured); resurrected the session-scoped statusline tests removed in 9ea89f2. - Specs: restored statusline statements adapted to the new placement; documented the settings-injection serialization contract and the statusline COLUMNS/no-TTY runtime constraints.
Resolve conflict in init.ts InitOptions: keep both withStatusline (statusline opt-in) and workflow/workflowSource (from main).
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.
概述
实现当初移除默认 statusLine 时(0.5.0-beta.15, 9ea89f2)官方推荐但未实现的 opt-in 方案:
trellis init --with-statusline为 Claude Code 安装 Trellis 状态栏(hook 脚本 +settings.json 的 statusLine 配置项)。交互式(非 -y)init 在选择了 Claude Code 且未传
flag 时会额外询问"是否安装 Trellis statusLine",默认否。
默认完全关闭:不选择安装时,init 产物与当前版本逐字节一致,当初"项目级 statusLine
静默覆盖用户全局配置"的问题不可能回归。
脚本基于移除前的仓库最终版(会话级任务解析、[session] 来源标记、Windows UTF-8 修复),
新增两项能力:
5h 17% (reset 4h31m) · 7d 19% (reset 2d11h)限额段自动换到独立一行,避免状态栏折行错位
Closes #332
行为矩阵
trellis init --claude(默认 /-y)trellis init --claude --with-statusline-y模式从不询问trellis updatetrellis update测试
{{PYTHON_CMD}}已解析)-y不询问 / 传 flag 不询问 / 已配置不重复询问 / re-init 加平台路径生效resets_at格式容错(epoch 秒 + ISO-8601,未知格式省略倒计时而非崩溃)pnpm lint/pnpm lint:py/pnpm typecheck/pnpm test全部通过截图