Skip to content

Commit 4c43664

Browse files
authored
Merge pull request #209 from Latitudes-Dev/shuvcode-dev
Merge shuvcode-dev: upstream v1.0.204 sync + TypeScript fix
2 parents 410dd99 + ef93d46 commit 4c43664

File tree

107 files changed

+2713
-719
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+2713
-719
lines changed

.github/last-synced-tag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.0.203
1+
v1.0.204

.github/workflows/review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
Please check all the code changes in this pull request against the style guide, also look for any bugs if they exist. Diffs are important but make sure you read the entire file to get proper context. Make it clear the suggestions are merely suggestions and the human can decide what to do
6565
6666
When critiquing code against the style guide, be sure that the code is ACTUALLY in violation, don't complain about else statements if they already use early returns there. You may complain about excessive nesting though, regardless of else statement usage.
67-
When critiquing code style don't be a zealot, we don't like "let" statements but sometimes they are the simpliest option, if someone does a bunch of nesting with let, they should consider using iife (see packages/opencode/src/util.iife.ts)
67+
When critiquing code style don't be a zealot, we don't like "let" statements but sometimes they are the simplest option, if someone does a bunch of nesting with let, they should consider using iife (see packages/opencode/src/util.iife.ts)
6868
6969
Use the gh cli to create comments on the files for the violations. Try to leave the comment on the exact line number. If you have a suggested fix include it in a suggestion code block.
7070
If you are writing suggested fixes, BE SURE THAT the change you are recommending is actually valid typescript, often I have seen missing closing "}" or other syntax errors.

.github/workflows/stale-issues.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "Auto-close stale issues"
2+
3+
on:
4+
schedule:
5+
- cron: "30 1 * * *" # Daily at 1:30 AM
6+
workflow_dispatch:
7+
8+
jobs:
9+
stale:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
issues: write
13+
steps:
14+
- uses: actions/stale@v10
15+
with:
16+
days-before-stale: 90
17+
days-before-close: 7
18+
stale-issue-label: "stale"
19+
close-issue-message: |
20+
[automated] Closing due to 90+ days of inactivity.
21+
22+
Feel free to reopen if you still need this!
23+
stale-issue-message: |
24+
[automated] This issue has had no activity for 90 days.
25+
26+
It will be closed in 7 days if there's no new activity.
27+
remove-stale-when-updated: true
28+
exempt-issue-labels: "pinned,security,feature-request,on-hold"
29+
start-date: "2025-12-27"
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
# Plan: Sidebar Section Reordering and Collapsible Sections
2+
3+
**Created:** 2025-12-26
4+
**Status:** Completed
5+
**Estimated Effort:** Small (1-2 hours)
6+
7+
## Overview
8+
9+
Reorganize the sidebar sections in the TUI session view and make all sections consistently collapsible. Currently, some sections have collapsible behavior while others do not, and the order doesn't match the desired hierarchy.
10+
11+
## Current State Analysis
12+
13+
### File Location
14+
- **Primary file:** `packages/opencode/src/cli/cmd/tui/routes/session/sidebar.tsx`
15+
16+
### Current Section Order (lines 118-372)
17+
1. Session title (line 110-117)
18+
2. **Context** (lines 118-125)
19+
3. **MCP** (lines 126-186) - Has collapsible behavior
20+
4. **LSP** (lines 187-228) - Has collapsible behavior (threshold: >2 items)
21+
5. **Subagents** (lines 230-309) - Has collapsible behavior (threshold: >2 items)
22+
6. **Todo** (lines 310-328) - Has collapsible behavior (threshold: >2 items)
23+
7. **Modified Files** (lines 329-372) - Has collapsible behavior (threshold: >2 items)
24+
25+
### Desired Section Order
26+
1. Session title
27+
2. **Context** - Make collapsible (new)
28+
3. **Subagents** - Move up
29+
4. **MCP** - Already collapsible
30+
5. **LSP** - Already collapsible
31+
6. **Modified Files** - Already collapsible (rename from "Modified Files" to "Changed Files" if desired)
32+
33+
**Note:** Todo section appears to be omitted from the desired order. Clarify with user if Todo should be removed or repositioned.
34+
35+
### Current Collapsible Implementation Pattern
36+
Each collapsible section follows this pattern:
37+
1. State tracked in `expanded` store (line 26-32)
38+
2. Header with click handler to toggle (e.g., line 131)
39+
3. Conditional arrow indicator ``/`` (e.g., line 134)
40+
4. Show/hide content based on `expanded` state (e.g., line 147)
41+
5. Threshold logic: only shows collapse controls when items > 2
42+
43+
## Technical Specifications
44+
45+
### Expanded Store (line 26-32)
46+
```typescript
47+
const [expanded, setExpanded] = createStore({
48+
mcp: true,
49+
diff: true,
50+
todo: true,
51+
lsp: true,
52+
subagents: true,
53+
context: true, // NEW: Add context to expanded store
54+
})
55+
```
56+
57+
### Context Section - Current (lines 118-125)
58+
```tsx
59+
<box>
60+
<text fg={theme.text}>
61+
<b>Context</b>
62+
</text>
63+
<text fg={theme.textMuted}>{context()?.tokens ?? 0} tokens</text>
64+
<text fg={theme.textMuted}>{context()?.percentage ?? 0}% used</text>
65+
<text fg={theme.textMuted}>{cost()} spent</text>
66+
</box>
67+
```
68+
69+
### Collapsible Section Template (based on MCP pattern)
70+
```tsx
71+
<box>
72+
<box
73+
flexDirection="row"
74+
gap={1}
75+
onMouseDown={() => setExpanded("context", !expanded.context)}
76+
>
77+
<text fg={theme.text}>{expanded.context ? "" : ""}</text>
78+
<text fg={theme.text}>
79+
<b>Context</b>
80+
<Show when={!expanded.context}>
81+
<span style={{ fg: theme.textMuted }}>
82+
{" "}({context()?.tokens ?? 0} tokens)
83+
</span>
84+
</Show>
85+
</text>
86+
</box>
87+
<Show when={expanded.context}>
88+
<text fg={theme.textMuted}>{context()?.tokens ?? 0} tokens</text>
89+
<text fg={theme.textMuted}>{context()?.percentage ?? 0}% used</text>
90+
<text fg={theme.textMuted}>{cost()} spent</text>
91+
</Show>
92+
</box>
93+
```
94+
95+
## Implementation Tasks
96+
97+
### Phase 1: Add Context to Collapsible State
98+
- [x] Add `context: true` to the `expanded` store initialization (line 31)
99+
100+
### Phase 2: Make Context Section Collapsible
101+
- [x] Wrap Context header in a clickable `<box>` with `onMouseDown` handler
102+
- [x] Add ``/`` indicator based on `expanded.context` state
103+
- [x] Add collapsed summary showing token count in header
104+
- [x] Wrap content in `<Show when={expanded.context}>` conditional
105+
106+
### Phase 3: Reorder Sections
107+
Move sections in JSX to match desired order:
108+
- [x] Keep Session title first (lines 110-117)
109+
- [x] Keep Context section second (lines 118-125) - now collapsible
110+
- [x] Move Subagents section (lines 230-309) to third position
111+
- [x] Keep MCP section fourth (lines 126-186)
112+
- [x] Keep LSP section fifth (lines 187-228)
113+
- [x] Move Modified Files section to last (lines 329-372)
114+
115+
### Phase 4: Handle Todo Section
116+
- [x] **Decision:** Todo section removed per user requirements (only Context, Subagents, MCP, LSP, Changed Files specified)
117+
118+
### Phase 5: Verify Collapsible Behavior Consistency
119+
- [x] Ensure all sections use same collapsible pattern
120+
- [x] Context: Always show collapse control (no threshold, always has data)
121+
- [x] All sections: Removed threshold logic for showing arrows - all sections now always show ▼/▶
122+
123+
### Phase 6: Testing
124+
- [x] TypeScript compilation passes
125+
- [ ] Test collapse/expand for Context section (manual verification needed)
126+
- [ ] Verify section order displays correctly (manual verification needed)
127+
- [ ] Test click handlers work for all sections (manual verification needed)
128+
- [ ] Verify collapsed state summary displays correctly (manual verification needed)
129+
- [ ] Test with empty sessions (no subagents, no MCP, etc.) (manual verification needed)
130+
131+
## Code References
132+
133+
### Internal Files
134+
| File | Description |
135+
|------|-------------|
136+
| `packages/opencode/src/cli/cmd/tui/routes/session/sidebar.tsx` | Main sidebar component (426 lines) |
137+
| `packages/opencode/src/cli/cmd/tui/context/theme.tsx` | Theme context for styling |
138+
| `packages/opencode/src/cli/cmd/tui/ui/toast.tsx` | Toast notifications |
139+
140+
### Key Line References (UPDATED after implementation)
141+
| Line(s) | Description |
142+
|---------|-------------|
143+
| 26-33 | `expanded` store initialization (now includes `context`) |
144+
| 110-117 | Session title section |
145+
| 119-135 | Context section (now collapsible) |
146+
| 137-214 | Subagents section (moved up) |
147+
| 216-271 | MCP section |
148+
| 273-313 | LSP section |
149+
| 315-356 | Changed Files section (renamed from Modified Files) |
150+
151+
## Validation Criteria
152+
153+
### Functional Requirements
154+
- [x] Context section collapses/expands on click
155+
- [x] Collapsed Context shows token count in header
156+
- [x] All sections appear in correct order: Context, Subagents, MCP, LSP, Changed Files
157+
- [x] All collapsible sections show `` when expanded, `` when collapsed
158+
- [x] State persists during session (store-based)
159+
160+
### Visual Requirements
161+
- [x] Collapse indicators align consistently across all sections
162+
- [x] Collapsed headers show relevant summary info
163+
- [ ] No layout shifts when toggling sections (manual verification needed)
164+
165+
### Edge Cases
166+
- [x] Empty subagents list doesn't show Subagents section (kept existing `<Show when={...}>` logic)
167+
- [x] No MCP servers connected doesn't show MCP section (kept existing `<Show when={...}>` logic)
168+
- [x] Zero tokens shows "0 tokens" correctly
169+
170+
## Implementation Summary
171+
172+
### Changes Made:
173+
1. Added `context: true` to the expanded store
174+
2. Made Context section fully collapsible with click handler and ▼/▶ indicator
175+
3. Reordered sections to: Context → Subagents → MCP → LSP → Changed Files
176+
4. Removed Todo section (not in user requirements)
177+
5. Renamed "Modified Files" to "Changed Files"
178+
6. Made all sections consistently collapsible (removed threshold logic for showing arrows)
179+
7. Added collapsed state summaries:
180+
- Context: shows token count
181+
- Subagents: shows number of agent types
182+
- MCP: shows active count and error count
183+
- LSP: shows active count
184+
- Changed Files: shows file count
185+
186+
## Dependencies
187+
188+
None - this is a self-contained UI change with no external dependencies.
189+
190+
## Rollback Plan
191+
192+
If issues arise, revert the single file change:
193+
```bash
194+
git checkout HEAD -- packages/opencode/src/cli/cmd/tui/routes/session/sidebar.tsx
195+
```

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ you can switch between these using the `Tab` key.
195195
- Asks permission before running bash commands
196196
- Ideal for exploring unfamiliar codebases or planning changes
197197

198-
Also, included is a **general** subagent for complex searches and multi-step tasks.
198+
Also, included is a **general** subagent for complex searches and multistep tasks.
199199
This is used internally and can be invoked using `@general` in messages.
200200

201201
Learn more about [agents](https://opencode.ai/docs/agents).
@@ -233,7 +233,7 @@ If you are working on a project that's related to OpenCode and is using "opencod
233233

234234
### FAQ
235235

236-
#### How is this different than Claude Code?
236+
#### How is this different from Claude Code?
237237

238238
It's very similar to Claude Code in terms of capability. Here are the key differences:
239239

STATS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,5 @@
181181
| 2025-12-23 | 1,286,548 (+24,026) | 1,186,439 (+17,318) | 2,472,987 (+41,344) |
182182
| 2025-12-24 | 1,309,323 (+22,775) | 1,203,767 (+17,328) | 2,513,090 (+40,103) |
183183
| 2025-12-25 | 1,333,032 (+23,709) | 1,217,283 (+13,516) | 2,550,315 (+37,225) |
184+
| 2025-12-26 | 1,352,411 (+19,379) | 1,227,615 (+10,332) | 2,580,026 (+29,711) |
185+
| 2025-12-27 | 1,371,771 (+19,360) | 1,238,236 (+10,621) | 2,610,007 (+29,981) |

0 commit comments

Comments
 (0)