Repository navigation
fix: wire TUI process cwd to active project - #1632
Merged
Merged
Conversation
Specs, design, and tasks for wiring the TUI process cwd to the active project on select/clear/new-session. Closes #1629.
Add a guarded safeChdir helper and call it from handleSelectProject, handleClearProject, and handleNewSession so the OS process cwd moves into the selected project and restores to config.cwd on clear/new-session. Failures are logged via the structured logger (no silent catch). Adds regression tests for select, clear, and the invalid-path case. Closes #1629.
Owner
Author
Audit Results — tui-project-cwdGoal Fulfillment
Spec Compliance
Task CompletionAll 10 tasks in Quality
VerdictAll goals fulfilled, spec-compliant, tasks complete, no quality issues. No iteration required. |
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.
Description
Wires the TUI's process working directory to the active project.
handleSelectProject,handleClearProject, andhandleNewSessioninsrc/tui/app.jspreviously updated in-memory project state but never calledprocess.chdir, so consumers readingprocess.cwd()— the cron command builders insrc/scheduler/cron.jsandsrc/tools/cron/index.js(which embedcd ${process.cwd()}) — ran in the wrong directory. This change adds a guarded, exportedsafeChdirhelper and calls it from all three handlers: into the selected project on select, and back toconfig.cwd(fallbackprocess.cwd()) on clear and on new session. Failures are recorded via the structured logger (no silent catch, per AGENTS.md 1.1). The branch also carries the OpenSpec changetui-project-cwd(proposal, design, spec, tasks) and its archive.Type of Change
Testing
Added regression tests to
tests/unit/tui/app.test.jscovering: (1)safeChdirmoves the process cwd into a valid project directory, (2) it restores the cwd to the configured root on clear, and (3) the invalid-path case —process.chdirthrows, the logger records it, and no exception propagates. Full suite: 4482 tests pass.Coverage
safeChdiris directly tested. TheAppcomponent body is not rendered in the suite — pre-existing — so handler lines remain uncovered, not a regression.)Checklist
npm run lintpassesCloses #1629