Skip to content

feat(tui): support external status line command#1493

Open
yearth wants to merge 1 commit into
MoonshotAI:mainfrom
yearth:feat/status-line-command
Open

feat(tui): support external status line command#1493
yearth wants to merge 1 commit into
MoonshotAI:mainfrom
yearth:feat/status-line-command

Conversation

@yearth

@yearth yearth commented Jul 8, 2026

Copy link
Copy Markdown

Summary

  • add [status_line] TUI config for rendering the footer status line with an external command
  • pass session, model, cwd, and context metadata to the command via stdin JSON
  • fall back to the built-in context indicator on empty output, failures, or timeouts
  • document the config and payload in English and Chinese docs

Tests

  • ./node_modules/.bin/tsc -p apps/kimi-code/tsconfig.json --noEmit
  • ./node_modules/.bin/vitest run apps/kimi-code/test/tui/config.test.ts apps/kimi-code/test/tui/components/chrome/footer.test.ts apps/kimi-code/test/tui/utils/status-line-command.test.ts
  • ./node_modules/.bin/vitest run apps/kimi-code/test/tui/commands/reload.test.ts apps/kimi-code/test/tui/kimi-tui-startup.test.ts apps/kimi-code/test/tui/create-tui-state.test.ts apps/kimi-code/test/tui/activity-pane.test.ts apps/kimi-code/test/tui/kimi-tui-message-flow.test.ts apps/kimi-code/test/tui/message-replay.test.ts apps/kimi-code/test/tui/signal-handlers.test.ts apps/kimi-code/test/cli/update/preflight.test.ts
  • ./node_modules/.bin/oxlint --type-aware apps/kimi-code/src/tui/components/chrome/footer.ts apps/kimi-code/src/tui/utils/status-line-command.ts apps/kimi-code/test/tui/components/chrome/footer.test.ts apps/kimi-code/test/tui/utils/status-line-command.test.ts
  • git diff --check

@changeset-bot

changeset-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5191e1a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@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: 5191e1a834

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

}, STATUS_LINE_REFRESH_INTERVAL_MS);
this.statusLineTimer.unref?.();
}
void this.refreshStatusLine();

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 Avoid spawning the status command on every state update

When [status_line].command is configured, every FooterComponent.setState() call reaches this unconditional refresh, so ordinary setAppState updates during streaming, mode changes, context updates, etc. can spawn the external shell command far more often than the 1s interval. If the command is fast, this bypasses STATUS_LINE_REFRESH_INTERVAL_MS and can hammer the shell/process table instead of running "about once per second"; only trigger the immediate refresh when the command changes or the timer is first created.

Useful? React with 👍 / 👎.

this.gitCache = createGitStatusCache(state.workDir, { onChange: this.onRefresh });
this.syncGoalClock(state.goal);
this.syncGoalTimer(state.goal);
this.syncStatusLineTimer(state.statusLine.command);

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 Default statusLine before dereferencing footer fixtures

Several existing footer panel tests still build AppState fixtures via as AppState without the new statusLine field, for example apps/kimi-code/test/tui/components/panels/footer-context.test.ts and footer-bg-agents.test.ts; this new constructor dereference throws before those tests can render. Either update those fixtures or fall back to DEFAULT_TUI_CONFIG.statusLine here so the broader footer test suite does not fail outside the narrowed test list.

Useful? React with 👍 / 👎.

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.

1 participant