Skip to content

feat: status line segment (bin/ytstack-status) with STATE progress block - #32

Merged
lx-0 merged 10 commits into
mainfrom
feat/status-segment
Nov 11, 2026
Merged

lx-0 merged 10 commits into
mainfrom
feat/status-segment

Conversation

@lx-0

@lx-0 lx-0 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Closes #31.

What

A status line script can now append one compact ytstack segment for the directory it runs in.

V2 76% 138/180 · M021/S01/T02 · waiting: review of PR 12   (progress block)
M021/S01/T02 3/7                                           (no block: slice checkboxes)
  • bin/ytstack-status: reads cwd from the status line JSON on stdin (else $PWD), prints the segment and exits 0, or prints nothing and exits 1 (no .ytstack/, nothing to show, malformed block). NO_COLOR / --no-color for plain text. Local refs only, no network, no gh.
  • Optional progress block in the STATE.md frontmatter (label, done, total, waiting_on). Without it the segment falls back to the task checkboxes of the active slice plan.
  • Two levels: plan progress is read from the newer of origin/<default> and <default> when the checkout is on another branch (a linked worktree carries a stale copy); the task pointer always comes from the checkout.
  • yt_progress_parse in hooks/lib/git-ctx.sh is the only parser; yt_state_lint reports a malformed block as W7, so the segment and the lint cannot disagree.
  • summarize-task and quick-task update the block when they advance STATE.
  • docs/statusline.md: block reference, output forms, integration snippet, limits. Pointers in README, docs/concept.md, docs/codex.md, CHANGELOG [Unreleased].

Decisions

  • The issue's open questions: exactly one track with done / total. Several named tracks and a done / open pair are not built (DECISIONS 2026-11-11).
  • Locating the script: Claude Code documents no stable path to plugin files for a statusLine command, so the documented snippet globs the plugin cache and picks the highest installed version. A SessionStart-maintained link was dropped because that hook is read-only by contract.
  • Planned as M021: M020 is taken by the Kimi adapter planning (feat: Kimi Code CLI host support — skills + lifecycle hooks via extra_skill_dirs and hook wrappers (working setup attached) #30), which is not committed yet. That planning also edits STATE.md and appends to DECISIONS.md, so expect a textual conflict there when both lines meet.

Verification

  • bash tests/run-all.sh: 13 suites pass on macOS (bash 3.2), including the new tests/ytstack-status.test.sh (31 cases: outside a project, slice fallback, block, malformed block, input fallbacks, colour switch, linked worktree, detached HEAD, clone with a newer origin/main) and 16 new parser/lint cases in tests/git-ctx.test.sh.
  • bin/ytstack-check: no failures, 27 warnings, the same count as main.
  • python3 -m unittest discover -s tests -p 'codex*_test.py': 13 tests OK. claude plugin validate .: passed.
  • The integration snippet was run against a fake plugin cache with versions 0.4.2 (no script), 0.9.0 and 0.10.0 and picked 0.10.0.
  • Not run locally: tests/run-all.sh --linux (no Docker daemon). The ubuntu CI job on this PR is the Linux evidence.

Known limits

  • waiting_on is cut by characters of the current locale; under LC_ALL=C a multi-byte character at the cut can be split (marked shortcut: in the script).
  • One run takes about 90 ms on the development machine.
  • The skill instructions for keeping the block current are prose; no eval case covers them yet.

🤖 Generated with Claude Code


Note

Low Risk
Additive CLI and frontmatter parsing with broad shell tests; shared git-ctx.sh change is limited to optional progress linting and does not alter hook write paths.

Overview
Adds a status line segment so any host can append one line of ytstack context: optional release-style progress frontmatter in STATE.md (label, done, total, waiting_on), or fallback to the active slice’s task checkbox counts plus the local M###/S##/T## pointer.

bin/ytstack-status reads cwd from status-line JSON (else $PWD), resolves the project via the existing git-ctx helpers, and prints a single formatted line (colour optional). On non-default branches and linked worktrees, plan progress comes from the newer of local/origin default-branch STATE.md via git show; the task pointer always comes from the checkout. Malformed blocks produce no output; yt_progress_parse in hooks/lib/git-ctx.sh is the sole parser, with yt_state_lint W7 so lint and the segment cannot disagree.

summarize-task and quick-task (0.1.1) document keeping the block in sync when STATE advances. docs/statusline.md covers the block, behaviour, and a plugin-cache glob snippet for Claude Code; README, CHANGELOG, concept.md, and codex.md point at it. Milestone M021 closes in .ytstack/ artifacts and DECISIONS.

Reviewed by Cursor Bugbot for commit 8dd603e. Bugbot is set up for automated code reviews on this repo. Configure here.

lx-0 and others added 7 commits November 11, 2026 11:29
…slices, S01-T01 plan

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… progress block

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…tstack project

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…02-T01

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…lock current

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…EADME, concept, codex, CHANGELOG)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ate)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 11, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 9464a800-b9df-4eca-8e37-7e8661e4c81a)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T10:51:02.451790Z 8dd603e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e6264b4f92

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/ytstack-status Resolved
lx-0 and others added 2 commits November 11, 2026 11:44
… pointer (PR #32 review)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 11, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 41ef3fc4-b042-4855-872b-52c8619db906)

…t branch (PR #32 review)

The slice checkbox count now follows the same source rule as the progress
block; the checkout's copy is counted only when the slice plan does not
exist on the default branch yet. Replaces the local-only reading pinned in
the previous fix commit.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 11, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 661de598-dbce-4c89-b126-5346a7af1f74)

@lx-0

lx-0 commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

@codex review

@lx-0
lx-0 merged commit b9daa42 into main Nov 11, 2026
5 checks passed
@lx-0
lx-0 deleted the feat/status-segment branch November 11, 2026 10:48

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8dd603e504

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/ytstack-status
Comment on lines +60 to +61
REF=$(git -C "$YT_TOPLEVEL" for-each-ref --sort=-committerdate --count=1 --format='%(refname)' \
"refs/heads/$DEF" "refs/remotes/origin/$DEF" 2>/dev/null)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve equal-timestamp default refs explicitly

When the fetched origin/<default> has advanced beyond the local default branch but both tip commits have the same second-level committer timestamp, this sort ties and selects refs/heads/<default> first; I reproduced that ordering locally, causing feature branches and worktrees to display stale progress. Git documents that committerdate is a numeric sort key and that --count=1 stops after the first ref (git-for-each-ref documentation), so use ancestry or an explicit tie-break that favors the unequal remote ref rather than treating the timestamp as a total ordering.

Useful? React with 👍 / 👎.

Comment thread docs/statusline.md
```bash
input=$(cat)
yt=$(ls -d ~/.claude/plugins/cache/*/ytstack/*/bin/ytstack-status 2>/dev/null | sort -V | tail -1)
seg=$([ -n "$yt" ] && printf '%s' "$input" | "$yt")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard the optional segment in set -e scripts

When a user's status-line script enables set -e, running this documented snippet outside a ytstack project, with a malformed progress block, or before the plugin is installed terminates the entire status-line script at this assignment because the substitution returns 1. Bash gives an assignment-only command the status of its command substitution (Bash reference), so handle the expected nonzero status here (for example with || true) before printing the rest of the status line.

Useful? React with 👍 / 👎.

lx-0 added a commit that referenced this pull request Nov 11, 2026
…#33)

* fix: pick the default ref by ancestry and guard the status line snippet under set -e (PR #32 review follow-up)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* chore: STATE reflects the merge of PR #32

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* chore: release 0.5.0 (status line segment); manifests, README badge, CHANGELOG, STATE

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Status line segment: project progress and current task from .ytstack/STATE.md

1 participant