feat(statusline): show review mode
This commit is contained in:
1 parent
3ddf2756c2
commit
83929e856f
5 files changed
+11
-9
No files matched your search
@@ -3,7 +3,7 @@ approvals_reviewer = "auto_review"
|
||||
sandbox_mode = "workspace-write"
|
||||
|
||||
[tui]
|
||||
status_line = ["model", "reasoning", "permissions", "approval-mode", "project-name", "git-branch", "context-window-size", "context-used", "used-tokens"]
|
||||
status_line = ["model", "reasoning", "approval-mode", "project-name", "git-branch", "context-window-size", "context-used", "used-tokens"]
|
||||
|
||||
[agents]
|
||||
enabled = true
|
||||
|
||||
@@ -11,7 +11,7 @@ $buildSummaryOutput = & (Join-Path $root 'scripts/build.ps1') -Summary
|
||||
if (@($buildSummaryOutput | Where-Object { $_ -eq 'Build: PASS | 4 packages' }).Count -ne 1) { throw "build.ps1 -Summary must still print the PASS line: $($buildSummaryOutput -join '; ')" }
|
||||
$statusOutput = ($statusInput | & (Join-Path $root 'shared/statusline/statusline.ps1')) -join "`n"
|
||||
$plainStatusOutput = [regex]::Replace($statusOutput, [char]27 + '\[[0-9;]*m', '')
|
||||
$expectedStatusOutput = "Test Model $([char]0x00B7) Effort high $([char]0x00B7) TestRepo @ $branch`nCtx 200k $([char]0x00B7) Used 9% $([char]0x00B7) Tokens 16.7k"
|
||||
$expectedStatusOutput = "Test Model $([char]0x00B7) Review auto $([char]0x00B7) Effort high $([char]0x00B7) TestRepo @ $branch`nCtx 200k $([char]0x00B7) Used 9% $([char]0x00B7) Tokens 16.7k"
|
||||
if ($buildSummaryOutput.Count -ne 1) { throw 'Build summary must contain only one success line.' }
|
||||
if ($plainStatusOutput -ne $expectedStatusOutput) { throw 'PowerShell status line output is incorrect.' }
|
||||
$sourceAgentCount = @(Get-ChildItem (Join-Path $root 'shared/agents') -Directory).Count
|
||||
@@ -41,7 +41,7 @@ foreach ($shell in @('powershell','bash')) {
|
||||
$events = @([regex]::Matches($content, '(?m)^\[\[hooks\.([^.\]]+)\]\]\s*$') | ForEach-Object { $_.Groups[1].Value })
|
||||
if ($events.Count -ne 1 -or $events[0] -ne 'Stop' -or $content -match 'flashbang-if-input' -or $content -match '(?m)^async\s*=\s*true\s*$') { throw "Codex finish hook is incorrect in $package" }
|
||||
if ($content -notmatch 'approvals_reviewer\s*=\s*"auto_review"') { throw "Codex auto review is missing in $package" }
|
||||
if ($content -notmatch 'status_line\s*=\s*\["model", "reasoning", "permissions", "approval-mode", "project-name", "git-branch", "context-window-size", "context-used", "used-tokens"\]') { throw "Codex status line is incorrect in $package" }
|
||||
if ($content -notmatch 'status_line\s*=\s*\["model", "reasoning", "approval-mode", "project-name", "git-branch", "context-window-size", "context-used", "used-tokens"\]') { throw "Codex status line is incorrect in $package" }
|
||||
} elseif ((($settings.hooks.PSObject.Properties.Name | Sort-Object) -join ',') -ne 'PreCompact,SessionStart,Stop' -or $content -match 'flashbang-if-input' -or $settings.hooks.Stop[0].hooks[0].async) {
|
||||
throw "Claude finish hook is incorrect in $package"
|
||||
} elseif ($content -notmatch '"defaultMode"\s*:\s*"auto"') {
|
||||
|
||||
@@ -20,7 +20,7 @@ fi
|
||||
[ "$build_summary_output" = 'Build: PASS | 4 packages' ]
|
||||
status_output=$(printf '{"model":{"display_name":"Test Model"},"effort":{"level":"high"},"workspace":{"current_dir":"%s","repo":{"name":"TestRepo"}},"context_window":{"context_window_size":200000,"used_percentage":8.5,"total_input_tokens":15500,"total_output_tokens":1200}}' "$root" | bash "$root/shared/statusline/statusline.sh")
|
||||
plain_status_output=$(printf '%s' "$status_output" | sed -E $'s/\x1b\\[[0-9;]*m//g')
|
||||
expected_status_output=$'Test Model \xc2\xb7 Effort high \xc2\xb7 TestRepo @ '"$branch"$'\nCtx 200k \xc2\xb7 Used 9% \xc2\xb7 Tokens 16.7k'
|
||||
expected_status_output=$'Test Model \xc2\xb7 Review auto \xc2\xb7 Effort high \xc2\xb7 TestRepo @ '"$branch"$'\nCtx 200k \xc2\xb7 Used 9% \xc2\xb7 Tokens 16.7k'
|
||||
[ "$plain_status_output" = "$expected_status_output" ]
|
||||
source_agent_count=$(find "$root/shared/agents" -mindepth 1 -maxdepth 1 -type d | wc -l)
|
||||
source_skill_count=$(find "$root/shared/skills" -name SKILL.md | wc -l)
|
||||
@@ -56,7 +56,7 @@ for shell in powershell bash; do
|
||||
! grep -q 'flashbang-if-input' "$package/$file"
|
||||
! grep -Eq '^async[[:space:]]*=[[:space:]]*true[[:space:]]*$' "$package/$file"
|
||||
grep -q 'approvals_reviewer[[:space:]]*=[[:space:]]*"auto_review"' "$package/$file"
|
||||
grep -Fq 'status_line = ["model", "reasoning", "permissions", "approval-mode", "project-name", "git-branch", "context-window-size", "context-used", "used-tokens"]' "$package/$file"
|
||||
grep -Fq 'status_line = ["model", "reasoning", "approval-mode", "project-name", "git-branch", "context-window-size", "context-used", "used-tokens"]' "$package/$file"
|
||||
else
|
||||
python3 -c 'import json,sys; settings=json.load(open(sys.argv[1], encoding="utf-8-sig")); assert set(settings["hooks"]) == {"PreCompact", "SessionStart", "Stop"}' "$package/$file"
|
||||
! grep -q 'flashbang-if-input' "$package/$file"
|
||||
|
||||
@@ -11,6 +11,7 @@ function Format-TokenCount {
|
||||
$data = ($input | Out-String) | ConvertFrom-Json
|
||||
$model = if ($data.model.display_name) { $data.model.display_name } else { '-' }
|
||||
$effort = if ($data.effort.level) { $data.effort.level } else { '-' }
|
||||
$reviewMode = if ($data.permission_mode) { $data.permission_mode } elseif ($data.permissionMode) { $data.permissionMode } else { 'auto' }
|
||||
$directory = if ($data.workspace.current_dir) { $data.workspace.current_dir } else { $data.cwd }
|
||||
$repo = if ($data.workspace.repo.name) { $data.workspace.repo.name } elseif ($directory) { Split-Path $directory -Leaf } else { '-' }
|
||||
if (-not $data.workspace.repo.name -and $directory -and (Get-Command git -ErrorAction SilentlyContinue)) {
|
||||
@@ -36,7 +37,7 @@ $contextColor = if ($null -eq $usedPercentage) { $dim } elseif ($usedPercentage
|
||||
$middot = [char]0x00B7
|
||||
$sep = "$dim$middot$reset"
|
||||
|
||||
$line1 = "$cyan$model$reset $sep Effort $magenta$effort$reset $sep $blue$repo$reset @ $green$branch$reset"
|
||||
$line1 = "$cyan$model$reset $sep Review $magenta$reviewMode$reset $sep Effort $magenta$effort$reset $sep $blue$repo$reset @ $green$branch$reset"
|
||||
$line2 = "Ctx $cyan$contextWindow$reset $sep Used $contextColor$usedContext$reset $sep Tokens $magenta$usedTokensDisplay$reset"
|
||||
$outputText = "$line1`n$line2"
|
||||
if ($env:NO_COLOR) { $outputText = [regex]::Replace($outputText, [char]27 + '\[[0-9;]*m', '') }
|
||||
|
||||
@@ -4,9 +4,10 @@ set -euo pipefail
|
||||
command -v jq >/dev/null 2>&1 || exit 0
|
||||
input=
|
||||
while IFS= read -r line || [ -n "$line" ]; do input+="$line"; done
|
||||
IFS=$'\t' read -r model effort repo directory used_percentage used_tokens context_window < <(
|
||||
IFS=$'\t' read -r model review_mode effort repo directory used_percentage used_tokens context_window < <(
|
||||
printf '%s' "$input" | jq -r '[
|
||||
(.model.display_name // "-"),
|
||||
(.permission_mode // .permissionMode // "auto"),
|
||||
(.effort.level // "-"),
|
||||
(.workspace.repo.name // "-"),
|
||||
(.workspace.current_dir // .cwd // "-"),
|
||||
@@ -66,5 +67,5 @@ if [ -n "${NO_COLOR:-}" ]; then
|
||||
fi
|
||||
sep="${dim}·${reset}"
|
||||
|
||||
printf "${cyan}%s${reset} ${sep} Effort ${magenta}%s${reset} ${sep} ${blue}%s${reset} @ ${green}%s${reset}\nCtx ${cyan}%s${reset} ${sep} Used ${context_color}%s${reset} ${sep} Tokens ${magenta}%s${reset}\n" \
|
||||
"$model" "$effort" "$repo" "$branch" "$context_window_display" "$used_context" "$used_tokens_display"
|
||||
printf "${cyan}%s${reset} ${sep} Review ${magenta}%s${reset} ${sep} Effort ${magenta}%s${reset} ${sep} ${blue}%s${reset} @ ${green}%s${reset}\nCtx ${cyan}%s${reset} ${sep} Used ${context_color}%s${reset} ${sep} Tokens ${magenta}%s${reset}\n" \
|
||||
"$model" "$review_mode" "$effort" "$repo" "$branch" "$context_window_display" "$used_context" "$used_tokens_display"
|
||||
Reference in new issue
Block a user