Skip to content

fix: honor builtin redirections, propagate exit codes, fix $VAR expansion#2

Merged
ozhangebesoglu merged 1 commit into
mainfrom
fix/tier1-redirect-exitcode
May 21, 2026
Merged

fix: honor builtin redirections, propagate exit codes, fix $VAR expansion#2
ozhangebesoglu merged 1 commit into
mainfrom
fix/tier1-redirect-exitcode

Conversation

@ozhangebesoglu

Copy link
Copy Markdown
Owner

Özet

Scripting'i bozan 6 bug, TDD ile düzeltildi (248 test geçiyor, sıfır regresyon).

Bug Düzeltme
kishi -c exit kodu hep 0 process_command_line artık execute_ast statüsünü döndürür; non-interactive son statüyle çıkar
exit N yok sayılıyordu kishi_exit int(args[1]) kodunu onurlandırır (ValueError→1); mesaj stderr'e
Builtin/function redirect yok sayılıyordu _run_redirected (contextlib, Linux & Windows aynı) — pwd > f dosyaya yazar
Redirect hedefi expand edilmiyordu Expander.expand(globbing=False)> $VAR, > ~/x çözülür
$VAR/suffix boş dönüyordu expander startswith('$')re.fullmatch; $VAR/x, $VAR.txt çalışır
-c/pipe .kishirc komutlarını çalıştırıp stdout kirletiyordu bash -c paritesi: startup komutları sadece interaktif modda; alias/export yine yüklenir

Test

  • 248 passed — 20 yeni test (test_executor.py, test_expander.py, test_main.py) + 228 mevcut
  • Çapraz platform için fd-dup2 yerine contextlib (mevcut tui_dashboard.py deseni); fork yolu dokunulmadı

Plan

Detaylı fazlı plan: docs/superpowers/plans/2026-05-21-tier1-redirect-exitcode-plan.md

🤖 Generated with Claude Code

… fix $VAR expansion

Tier 1 scripting fixes (all TDD, 248 tests pass):

- executor: process_command_line now returns execute_ast status, so
  `kishi -c "false"` exits 1; non-interactive mode exits with last status
- builtins: kishi_exit honors `exit N` code (ValueError -> 1); goodbye to stderr
- executor: single builtin/function path applies stdout/stderr redirection via
  contextlib (_run_redirected) — pure-Python, identical on Linux & Windows
- executor: redirect targets expanded (Expander.expand globbing=False) so
  `> $VAR` and `> ~/x` resolve correctly
- expander: only a bare `$VAR` token takes the drop-if-empty path; `$VAR/suffix`
  and `$VAR.txt` now expand the variable portion and keep the suffix
- main: `-c` and piped/non-interactive modes no longer run .kishirc command
  lines (bash -c parity); aliases/exports still load

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ozhangebesoglu ozhangebesoglu merged commit ce9878d into main May 21, 2026
5 checks passed
@ozhangebesoglu ozhangebesoglu deleted the fix/tier1-redirect-exitcode branch May 21, 2026 14:20
ozhangebesoglu added a commit that referenced this pull request May 21, 2026
Bugfix release: builtin redirections, exit-code propagation,
$VAR/suffix expansion, and -c/pipe rc-pollution fixes (PR #2).
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