Skip to content

feat(inspect): add transcriptStats for structured session summaries - #34

Merged
protosphinx merged 1 commit into
mainfrom
bot/transcript-stats
Aug 11, 2026
Merged

feat(inspect): add transcriptStats for structured session summaries#34
protosphinx merged 1 commit into
mainfrom
bot/transcript-stats

Conversation

@protosphinx

Copy link
Copy Markdown
Member

Why

inspectTranscript already computes frame counts, pair counts, wall-clock
duration, and a per-method call tally internally, but returns all of it as a
formatted string. Any caller that needs those numbers for further processing
(test assertions, CI thresholds, telemetry) has to parse coloured terminal
output. transcriptStats surfaces the same data as a typed object with no
formatting attached.

What

  • src/inspect.ts: new TranscriptStats interface and transcriptStats(frames)
    function. Delegates to the existing private countMethods and pairFrames
    helpers so there is no logic duplication.
  • test/inspect.stats.test.ts: 13 tests covering empty transcripts,
    single-frame edge cases, durationSeconds arithmetic, method counting,
    tools/call grouping by tool name, notification frame counting, and a
    full typical session.

Tests

  • npm test - all 240 tests pass (227 existing + 13 new)
  • npm run lint - clean
  • npm run build - clean

Self-merge gate

  • all CI checks pass
  • LOC delta < 250 (195 lines added)
  • no public-API surface change (src/index.ts not modified)
  • no runtime-dependency additions
  • no workflow file changes
  • tests added or extended (test/inspect.stats.test.ts, 13 tests)

Generated by Claude Code

Extracts the per-method counts, pair count, frame count, and wall-clock
duration already computed by inspectTranscript into a new pure function
transcriptStats that returns a typed TranscriptStats object. Callers
that need the numbers for further processing no longer have to parse
the formatted string output.

Includes 13 tests covering empty transcripts, single-frame edge cases,
method counting, tools/call grouping, and a full typical session.
@protosphinx protosphinx added the automated Opened by the daily bot label Aug 11, 2026 — with Claude
@protosphinx
protosphinx merged commit 6357cde into main Aug 11, 2026
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c3c08fe0e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/inspect.ts
* "tools/call[search_issues]", matching the grouping used by
* `inspectTranscript`.
*/
export function transcriptStats(frames: Frame[]): TranscriptStats {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Export the new stats API from the package entry point

For installed consumers, package.json resolves both JavaScript and declarations through dist/index, but src/index.ts still re-exports only inspectTranscript. Consequently, import { transcriptStats } from "mcprec" fails and TranscriptStats is absent from the public declarations, making the new feature inaccessible through the documented package API; the tests conceal this by importing the internal source module directly.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated Opened by the daily bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant