Skip to content

feat: add /summary command to summarize the current conversation (v0.1.15)#20

Merged
t2tx merged 2 commits into
mainfrom
feature/summary-command
Jun 21, 2026
Merged

feat: add /summary command to summarize the current conversation (v0.1.15)#20
t2tx merged 2 commits into
mainfrom
feature/summary-command

Conversation

@t2tx

@t2tx t2tx commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a /summary slash command that summarizes the current conversation (this DM or thread) — intended for handing work over to another person or a fresh session.

Behaviour

  • /summary — forwards a handover-oriented default prompt (目的 / やったこと / 現状 / 未解決 / 次の一手)
  • /summary <request> — forwards your own text verbatim as the prompt
  • Either way the result is wrapped in a ``` code block so it can be copied straight into a handover note
  • Targets the session keyed by thread_ts ?? channel, so it summarizes whatever conversation you run it in

Implementation

  • CommandResult.forwardToClaude: when set, tryCommand (index.ts) forwards the prompt to the session's Claude process via manager.send and lets the reply stream back like a normal turn — instead of the command answering by itself. handleCommand stays synchronous.
  • /help updated; README (en/ja) updated; version bumped to 0.1.15.

Ported from the upstream (GitLab) v0.1.15. The OS-independent basename test for /switch is preserved (not overwritten by the upstream endsWith('/mile') variant).

Checks

  • pnpm verify — 99 tests pass
  • Verified live on the dev Slack app (DM): default summary, custom request, and code-block wrapping all work.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a /summary command to generate conversation summaries, supporting an optional custom request to guide the output and formatting.
  • Documentation
    • Updated the English and Japanese command reference lists, adding /summary and expanding related command descriptions.
  • Tests
    • Added coverage for /summary, including default behavior, custom requests, and help listing.
  • Chores
    • Bumped the package version to 0.1.15.

…1.15)

/summary forwards a prompt to the session's Claude process and lets the reply
stream back like a normal turn, so it summarizes the current session (this DM
or thread; sessionKey = thread_ts ?? channel).

- No arg: a handover-oriented default prompt (目的/やったこと/現状/未解決/次の一手)
- /summary <request>: forwards the user's own text verbatim
- The result is wrapped in a fenced code block for easy copy into a handover note

Adds CommandResult.forwardToClaude; tryCommand forwards it via manager.send.
Ported from the upstream (GitLab) v0.1.15. Tests + README (en/ja) updated.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fbb9b44e-de44-4a24-91ea-8fb316d9ec23

📥 Commits

Reviewing files that changed from the base of the PR and between df0f2ed and 7d910d3.

📒 Files selected for processing (1)
  • src/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/index.ts

Walkthrough

Adds a /summary slash command to the Slack bot. CommandResult gains a forwardToClaude optional field; cmdSummary builds a default or custom handover prompt with a fenced-code-block wrap instruction and returns it via that field. tryCommand routes results carrying forwardToClaude to Claude via manager.send, skipping the normal text reply. READMEs (EN + JA) and the version are updated accordingly.

Changes

/summary Command Implementation

Layer / File(s) Summary
CommandResult contract, /summary implementation, and tests
src/commands.ts, src/commands.test.ts
CommandResult adds optional forwardToClaude?: string; DEFAULT_SUMMARY_PROMPT and SUMMARY_WRAP_INSTRUCTION constants are defined; cmdSummary composes and returns the forwarding prompt; /help text is extended with /summary entries; tests assert default forwarding, custom argument forwarding with wrap instruction, and /help presence.
tryCommand forwarding branch
src/index.ts
New early-return branch detects result.forwardToClaude, calls manager.send with handlersFor(project, channel, threadTs), and returns true to skip the standard result.text reply path.
README updates and version bump
README.md, README.ja.md, package.json
Both READMEs add /summary to the slash-command feature list with output description and optional argument; version bumped from 0.1.14 to 0.1.15.

Sequence Diagram(s)

sequenceDiagram
  participant Slack
  participant tryCommand
  participant cmdSummary
  participant manager as ClaudeManager

  Slack->>tryCommand: /summary [arg]
  tryCommand->>cmdSummary: dispatch(arg)
  cmdSummary-->>tryCommand: { text: '', forwardToClaude: prompt }
  tryCommand->>manager: send(prompt, handlersFor(project, channel, threadTs))
  manager-->>Slack: streamed Claude summary in fenced code block
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • t2tx/iris#19: Both PRs modify README slash-command documentation; this PR extends the list with /summary and updates /resume documentation alongside it.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a /summary command. It is concise, clear, and directly reflects the primary functionality introduced in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/summary-command

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/index.ts`:
- Line 222: The log statement in the forwarding path logs the full user-provided
prompt via prompt.trim(), which can expose sensitive user input in logs. Modify
the log.debug call to log only command metadata (such as command name or type)
instead of the raw prompt content, while still maintaining visibility into the
forwarding action to Claude. Ensure no user-provided text or sensitive input is
included in the debug log message.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e58dce62-00f8-41d6-889d-8c4b8e963f2c

📥 Commits

Reviewing files that changed from the base of the PR and between 0f24e28 and df0f2ed.

📒 Files selected for processing (6)
  • README.ja.md
  • README.md
  • package.json
  • src/commands.test.ts
  • src/commands.ts
  • src/index.ts

Comment thread src/index.ts Outdated
A command argument (e.g. /summary <free text>) may contain sensitive user
content; logging prompt.trim() verbatim could leak it. Log the command name
only — applied to both the forwarding and responding debug lines.

Addresses CodeRabbit review on PR #20.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@t2tx

t2tx commented Jun 21, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Addressed: the forwarding-path log no longer logs the raw prompt. It now logs only the command name (prompt.trim().split(/\s+/, 1)[0]), so a /summary <free text> argument can't leak into logs. Applied the same fix to the existing responding debug line for consistency.

@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@t2tx: That's a solid fix — extracting only the first token ensures no free-text argument content ever reaches the log output, regardless of what the user passes after the command name. Applying the same treatment to the responding line keeps logging behaviour consistent across both paths. Thanks for taking care of both spots!

@t2tx t2tx merged commit 354ae1e into main Jun 21, 2026
5 checks passed
@t2tx t2tx deleted the feature/summary-command branch June 21, 2026 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant