Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-08-10
29 changes: 29 additions & 0 deletions openspec/changes/remove-tui-redundant-reexports/design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Context

The `src/tui` module has two redundancy issues:
1. `hooks.js` exports `nextPanel` and `prevPanel` which are just pass-through re-exports from `panels.js`
2. `components.js` re-exports 7 components that are also re-exported via `index.js`

## Goals / Non-Goals

**Goals:**
- Remove redundant re-exports from hooks.js
- Remove or merge components.js
- Update all consumer import paths

**Non-Goals:**
- Any other TUI restructuring
- Behavioral changes

## Decisions

1. **Remove from hooks.js:** Since `nextPanel` and `prevPanel` add no logic, consumers should import directly from `panels.js`.

2. **Audit components.js:** Before removing, grep the entire codebase for imports of `components.js`. If unused, delete it. If used, merge its exports into `index.js`.

3. **No new barrel file:** Don't create a new intermediate barrel — consumers should import from the source file directly.

## Risks / Trade-offs

- **Consumer breakage:** Any file importing from `hooks.js` or `components.js` needs to update its import path. Mitigation: grep the entire codebase before making changes.
- **components.js might be used externally:** If external packages import from `components.js`, removal would be a breaking change. Mitigation: grep the entire codebase including node_modules references.
29 changes: 29 additions & 0 deletions openspec/changes/remove-tui-redundant-reexports/proposal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Why

The `src/tui` module contains redundant re-exports that add no value: `hooks.js` re-exports `nextPanel` and `prevPanel` from `panels.js` with no added logic, and `components.js` re-exports 7 components that are also re-exported via `index.js`. These dead re-exports increase cognitive load and maintenance burden for no benefit.

## What Changes

- Remove `nextPanel` and `prevPanel` from `src/tui/hooks.js`
- Update consumers to import from `panels.js` directly
- Check if `src/tui/components.js` is imported anywhere; remove or merge into `index.js`

## Capabilities

### New Capabilities
- None

### Modified Capabilities
- None — structural cleanup with no spec-level behavior changes

## Impact

- Affected code: `src/tui/hooks.js`, `src/tui/components.js`, `src/tui/index.js`, any file importing from hooks.js or components.js
- No API changes — function names preserved, just import paths change
- No dependency changes

## Non-goals

- Renaming any TUI modules
- Changing TUI behavior or component logic
- Restructuring other directories
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## ADDED Requirement: hooks.js has no redundant re-exports

The system SHALL remove the `nextPanel` and `prevPanel` functions from `src/tui/hooks.js` since they are pass-through re-exports from `panels.js` with no added logic.

### Requirement: Consumers import from panels.js

The system SHALL update all import paths that reference `nextPanel` or `prevPanel` from `hooks.js` to import from `panels.js` directly.

#### Scenario: No broken imports
- **WHEN** the application loads the TUI module
- **THEN** no import errors occur

#### Scenario: No remaining stale imports
- **WHEN** searching for imports of `nextPanel` or `prevPanel` from `hooks.js`
- **THEN** no such imports exist

### Requirement: components.js removed or merged

The system SHALL either remove `src/tui/components.js` (if unused) or merge its exports into `src/tui/index.js` (if used).

#### Scenario: components.js is removed
- **WHEN** `components.js` is not imported anywhere in the codebase
- **THEN** the file is deleted

#### Scenario: components.js is merged
- **WHEN** `components.js` is imported by other files
- **THEN** its exports are moved to `index.js` and `components.js` is deleted

#### Scenario: No broken imports after cleanup
- **WHEN** the application loads the TUI module
- **THEN** no import errors occur
28 changes: 28 additions & 0 deletions openspec/changes/remove-tui-redundant-reexports/tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## 1. Remove redundant exports from hooks.js

- [ ] 1.1 Remove `nextPanel` and `prevPanel` exports from `src/tui/hooks.js`
- [ ] 1.2 Verify hooks.js still exports all other necessary functions

## 2. Update hooks.js consumers

- [ ] 2.1 Grep the codebase for imports of `nextPanel` or `prevPanel` from `hooks.js`
- [ ] 2.2 Update import paths to use `panels.js` instead
- [ ] 2.3 Verify no remaining imports of these names from `hooks.js`

## 3. Audit components.js

- [ ] 3.1 Grep the entire codebase for imports of `components.js` from the tui module
- [ ] 3.2 If unused: delete `src/tui/components.js`
- [ ] 3.3 If used: merge its exports into `src/tui/index.js` and delete `components.js`
- [ ] 3.4 Update any consumers of components.js to use index.js instead

## 4. Verify no broken imports

- [ ] 4.1 Grep for any remaining imports of `hooks.js` that reference `nextPanel` or `prevPanel`
- [ ] 4.2 Grep for any remaining imports of `components.js`
- [ ] 4.3 Confirm zero stale imports remain

## 5. Test

- [ ] 5.1 Run `npm test` to verify all tests pass
- [ ] 5.2 Run `npm start` with timeout to verify application starts