Skip to content

Commit 38ec2ec

Browse files
craigcarlyleclaude
andauthored
fix(thread): show how many comments a view leaves out (#87)
thread view stops at 50 comments by default, and its header only counted what came back, so a 68-comment thread read as "50 comments". The header now says "50 of 68 comments" and points at --limit. With --since or --until the thread's total doesn't apply, so it says when the limit was reached instead. The search and mentions help now also says that --since and --until filter by when content was posted. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent d6c11c3 commit 38ec2ec

6 files changed

Lines changed: 109 additions & 11 deletions

File tree

‎docs/SPEC.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ Options:
345345
- `--channel <channel-refs>` - Filter by channels (comma-separated IDs)
346346
- `--author <user-refs>` - Filter by author (comma-separated IDs)
347347
- `--mention-me` - Only results mentioning current user
348-
- `--since <date>` - Content from date
349-
- `--until <date>` - Content until date
348+
- `--since <date>` - Content posted since date
349+
- `--until <date>` - Content posted until date
350350
- `--limit <n>` - Max results (default: 50)
351351
- `--cursor <cursor>` - Pagination cursor
352352
- `--json` / `--ndjson` - Machine-readable output

‎skills/comms-cli/SKILL.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ tdc thread view <ref> --comment <id> # View a specific comment
9393
tdc thread view <url-with-/c/id> # Comment ID extracted from URL
9494
tdc thread view <ref> --unread # Show only unread comments
9595
tdc thread view <ref> --context 3 # Include 3 read comments before unread
96-
tdc thread view <ref> --limit 20 # Limit number of comments
96+
tdc thread view <ref> --limit 20 # Max comments to show (default: 50; the header says when it left some out)
9797
tdc thread view <ref> --since <date> # Comments newer than date
9898
tdc thread view <ref> --raw # Show raw markdown
9999
tdc thread create <channel-ref> "Title" "content" # Create a new thread
@@ -235,14 +235,16 @@ tdc search "query" --to <ref> # Messages sent to user
235235
tdc search "query" --title-only # Search thread titles only
236236
tdc search "query" --mention-me # Results mentioning current user
237237
tdc search "query" --conversation <refs> # Limit to conversations (comma-separated refs)
238-
tdc search "query" --since <date> # Content from date
239-
tdc search "query" --until <date> # Content until date
238+
tdc search "query" --since <date> # Content posted since date
239+
tdc search "query" --until <date> # Content posted until date
240240
tdc search "query" --channel <refs> # Filter by channel refs (comma-separated)
241241
tdc search "query" --limit <n> # Max results (default: 50)
242242
tdc search "query" --cursor <cur> # Pagination cursor
243243
tdc search "query" --all # Fetch all result pages
244244
```
245245

246+
`--since` and `--until` filter by when the matching content was posted, not when a thread was last active, so a thread found by its title (`--title-only`) counts from when it was created.
247+
246248
## Users, Channels & Groups
247249

248250
```bash

‎src/commands/thread/thread.test.ts‎

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,74 @@ describe('thread view date filters', () => {
725725
})
726726
})
727727

728+
describe('thread view comment count header', () => {
729+
beforeEach(() => {
730+
clearWorkspaceUserCache()
731+
vi.clearAllMocks()
732+
configMocks.getConfig.mockResolvedValue({})
733+
groupsMock.getWorkspaceGroups.mockResolvedValue([])
734+
groupsMock.getWorkspaceUsers.mockResolvedValue([])
735+
})
736+
737+
const users = { 1: { id: 1, fullName: 'Alice' }, 2: { id: 2, fullName: 'Bob' } }
738+
739+
async function viewOutput(client: ReturnType<typeof createClient>, args: string[]) {
740+
apiMocks.getCommsClient.mockResolvedValue(client)
741+
const program = createProgram()
742+
const consoleSpy = captureConsole('log')
743+
await program.parseAsync(['node', 'tdc', 'thread', 'view', '500', ...args])
744+
return consoleSpy.mock.calls.map((c) => c[0]).join('\n')
745+
}
746+
747+
it('shows the plain count when every comment came back', async () => {
748+
const client = createClient({
749+
comments: [createComment(1, 1), createComment(2, 2), createComment(3, 3)],
750+
users,
751+
})
752+
753+
const output = await viewOutput(client, [])
754+
755+
expect(output).toContain('--- 3 comments ---')
756+
})
757+
758+
it('says how many comments the limit left out', async () => {
759+
const client = createClient({
760+
thread: { ...createThreadFixture(500), commentCount: 68 },
761+
comments: [createComment(1, 1), createComment(2, 2)],
762+
users,
763+
})
764+
765+
const output = await viewOutput(client, ['--limit', '2'])
766+
767+
expect(output).toContain('--- 2 of 68 comments (use --limit for more) ---')
768+
})
769+
770+
it('says when a date-filtered view reached the limit', async () => {
771+
const client = createClient({
772+
thread: { ...createThreadFixture(500), commentCount: 68 },
773+
comments: [createComment(1, 1), createComment(2, 2)],
774+
users,
775+
})
776+
777+
const output = await viewOutput(client, ['--since', '2026-01-01', '--limit', '2'])
778+
779+
expect(output).toContain('--- 2 comments (limit reached, use --limit for more) ---')
780+
expect(output).not.toContain('of 68')
781+
})
782+
783+
it('shows the plain count for a date-filtered view under the limit', async () => {
784+
const client = createClient({
785+
thread: { ...createThreadFixture(500), commentCount: 68 },
786+
comments: [createComment(1, 1), createComment(2, 2)],
787+
users,
788+
})
789+
790+
const output = await viewOutput(client, ['--since', '2026-01-01'])
791+
792+
expect(output).toContain('--- 2 comments ---')
793+
})
794+
})
795+
728796
describe('thread view error propagation', () => {
729797
beforeEach(() => {
730798
clearWorkspaceUserCache()

‎src/commands/thread/view.ts‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,24 @@ type ViewOptions = PaginatedViewOptions & {
1515
context?: string
1616
}
1717

18+
// getComments stops at the limit, so say when that left comments out. A date filter makes the
19+
// thread's own count meaningless, so all that's left to report then is hitting the limit.
20+
function formatCommentsHeader(
21+
shown: number,
22+
total: number,
23+
limit: number,
24+
isDateFiltered: boolean,
25+
): string {
26+
const label = `${shown} ${pluralize(shown, 'comment')}`
27+
if (!isDateFiltered && total > shown) {
28+
return `--- ${shown} of ${total} comments (use --limit for more) ---`
29+
}
30+
if (isDateFiltered && shown >= limit) {
31+
return `--- ${label} (limit reached, use --limit for more) ---`
32+
}
33+
return `--- ${label} ---`
34+
}
35+
1836
async function viewSingleComment(
1937
client: CommsApi,
2038
threadId: string,
@@ -200,8 +218,16 @@ export async function viewThread(ref: string, options: ViewOptions): Promise<voi
200218
console.log('')
201219

202220
if (comments.length > 0) {
221+
const isDateFiltered = options.since !== undefined || options.until !== undefined
203222
console.log(
204-
chalk.dim(`--- ${comments.length} ${pluralize(comments.length, 'comment')} ---`),
223+
chalk.dim(
224+
formatCommentsHeader(
225+
comments.length,
226+
thread.commentCount,
227+
limit,
228+
isDateFiltered,
229+
),
230+
),
205231
)
206232
console.log('')
207233

‎src/lib/search-helpers.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ export function addSharedSearchOptions<T extends Command>(
8888

8989
return command
9090
.option('--conversation <refs>', 'Limit to conversations (comma-separated refs)')
91-
.option('--since <date>', 'Content from date')
92-
.option('--until <date>', 'Content until date')
91+
.option('--since <date>', 'Content posted since date')
92+
.option('--until <date>', 'Content posted until date')
9393
.option('--limit <n>', limitDescription)
9494
.option('--cursor <cursor>', 'Pagination cursor')
9595
.option('--all', 'Fetch all pages of results')

‎src/lib/skills/content.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ tdc thread view <ref> --comment <id> # View a specific comment
9797
tdc thread view <url-with-/c/id> # Comment ID extracted from URL
9898
tdc thread view <ref> --unread # Show only unread comments
9999
tdc thread view <ref> --context 3 # Include 3 read comments before unread
100-
tdc thread view <ref> --limit 20 # Limit number of comments
100+
tdc thread view <ref> --limit 20 # Max comments to show (default: 50; the header says when it left some out)
101101
tdc thread view <ref> --since <date> # Comments newer than date
102102
tdc thread view <ref> --raw # Show raw markdown
103103
tdc thread create <channel-ref> "Title" "content" # Create a new thread
@@ -239,14 +239,16 @@ tdc search "query" --to <ref> # Messages sent to user
239239
tdc search "query" --title-only # Search thread titles only
240240
tdc search "query" --mention-me # Results mentioning current user
241241
tdc search "query" --conversation <refs> # Limit to conversations (comma-separated refs)
242-
tdc search "query" --since <date> # Content from date
243-
tdc search "query" --until <date> # Content until date
242+
tdc search "query" --since <date> # Content posted since date
243+
tdc search "query" --until <date> # Content posted until date
244244
tdc search "query" --channel <refs> # Filter by channel refs (comma-separated)
245245
tdc search "query" --limit <n> # Max results (default: 50)
246246
tdc search "query" --cursor <cur> # Pagination cursor
247247
tdc search "query" --all # Fetch all result pages
248248
\`\`\`
249249
250+
\`--since\` and \`--until\` filter by when the matching content was posted, not when a thread was last active, so a thread found by its title (\`--title-only\`) counts from when it was created.
251+
250252
## Users, Channels & Groups
251253
252254
\`\`\`bash

0 commit comments

Comments
 (0)