Skip to content

rework command framework#59

Draft
timkpaine wants to merge 2 commits into
mainfrom
tkp/commandrework
Draft

rework command framework#59
timkpaine wants to merge 2 commits into
mainfrom
tkp/commandrework

Conversation

@timkpaine

@timkpaine timkpaine commented Apr 21, 2026

Copy link
Copy Markdown
Member

No description provided.

@github-actions

github-actions Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Test Results

227 tests  +130   227 ✅ +130   4s ⏱️ +2s
  1 suites ±  0     0 💤 ±  0 
  1 files   ±  0     0 ❌ ±  0 

Results for commit 5927688. ± Comparison against base commit 62d72c1.

♻️ This comment has been updated with latest results.

@codecov

codecov Bot commented Apr 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.10185% with 257 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.27%. Comparing base (62d72c1) to head (5927688).

Files with missing lines Patch % Lines
csp_bot/bot.py 43.92% 101 Missing and 19 partials ⚠️
csp_bot/commands/agent.py 82.07% 36 Missing and 14 partials ⚠️
csp_bot/persistence.py 89.32% 18 Missing and 4 partials ⚠️
csp_bot/commands/help.py 22.72% 17 Missing ⚠️
csp_bot/commands/executor.py 91.22% 8 Missing and 2 partials ⚠️
csp_bot/commands/context.py 83.33% 7 Missing and 2 partials ⚠️
csp_bot/tests/test_bot_integration.py 92.85% 8 Missing ⚠️
csp_bot/tests/test_command_framework.py 98.63% 7 Missing ⚠️
csp_bot/commands/status.py 14.28% 6 Missing ⚠️
csp_bot/commands/__init__.py 75.00% 2 Missing ⚠️
... and 4 more
Additional details and impacted files
@@             Coverage Diff             @@
##             main      #59       +/-   ##
===========================================
+ Coverage   66.41%   80.27%   +13.86%     
===========================================
  Files          30       40       +10     
  Lines        1694     3756     +2062     
  Branches      171      289      +118     
===========================================
+ Hits         1125     3015     +1890     
- Misses        537      665      +128     
- Partials       32       76       +44     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timkpaine timkpaine force-pushed the tkp/commandrework branch 4 times, most recently from a6e9061 to 4c789bb Compare May 28, 2026 16:54
@timkpaine timkpaine force-pushed the tkp/commandrework branch 3 times, most recently from d7f6b2b to 60b1971 Compare June 22, 2026 02:48
Replace the per-backend, string-formatted command system with a typed,
backend-agnostic command framework built on chatom's FormattedMessage
rendering.

- New command framework: declarative `Command`/`CommandModel`, a
  `CommandContext`, a command executor, and a `LegacyCommandAdapter` so
  existing `BaseCommand` subclasses keep working.
- Load commands via entrypoints and enforce per-backend compatibility.
- Migrate commands to concrete chatom types and render built-in command
  output through `FormattedMessage`/`convert_format` instead of
  hand-crafted per-backend strings.
- Add agent commands, a persistence layer for scheduled/deferred
  commands, and supporting tests.
- Require `chatom>=0.1.3`, which provides the format APIs
  (`convert_format`, `FormattedMessage`, tables) this framework uses.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
@timkpaine timkpaine force-pushed the tkp/commandrework branch from 60b1971 to 5927688 Compare June 22, 2026 03:19
Help command no longer emits a Markdown table on every backend. It now
builds a chatom FormattedMessage from generic nodes and renders per
backend via render_for(): a bulleted list on chat clients (Discord,
Slack, Telegram) and a table on Symphony. All platform markup stays in
chatom; no backend-specific formatting leaks into the command.

DM detection relies on the generic Message.is_dm plus chatom's
ChannelType (direct/group) on the channel object and on
metadata["channel_type"], and resolves channel_id from
metadata["channel_id"] when the channel object is absent. Drops the
Discord-API magic integers and raw-object inspection in favor of the
fields chatom populates.

Adds help-rendering tests per backend and DM-detection tests for the
generic channel-type and metadata paths.
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