feat: chat shell + handoff archiving + forced color - #35
Merged
Conversation
- ansi.c honors NO_COLOR / FORCE_COLOR (and CLAUDART_FORCE_COLOR) so surfaces that read ANSI but aren't a TTY can show colour; otherwise follows the terminal. - status: colour the Status value by its HandoffStatus hue; branch-mismatch warning in yellow. - StatusBadge.warn uses the⚠️ emoji glyph for a more visible warning.
New `archiveCurrentHandoff` snapshots the existing handoff to archive/ and appends an index entry (so `claudart archives` can list/resume it). Wired into setup "Start fresh" and suggest's overwrite path so starting fresh never silently loses the prior session. Filename is computed once so the written file and the index entry always agree.
`claudart chat` greets, resolves the current workspace, then converses: plain text is a turn answered by `claude` with the session's handoff + skills as context; slash commands (/flow, /suggest) invoke structured work; /quit exits. The read->parse->dispatch loop is split out for hermetic testing. Exposes defaultClaudeRunner so the chat reuses the existing claude call.
There was a problem hiding this comment.
⚠️ Not ready to approve
New archiving logic can create noisy/invalid archive index entries (placeholder-only handoffs and multi-line descriptions) and the chat shell currently exits with success on an error path.
Pull request overview
Adds a new conversation-first interactive chat command (claudart chat), improves session safety by archiving the current handoff before overwrites, and refines terminal color/output behavior (forced color env vars + consistent warning glyph/coloring).
Changes:
- Introduce an interactive chat shell with a “plain text = message, slash = command” parser and hermetic read→parse→dispatch loop.
- Archive the current handoff (snapshot + index entry) before destructive overwrites (setup start-fresh and suggest overwrite path), with accompanying tests.
- Add forced-color support via
NO_COLOR/FORCE_COLORand colorize status output + standardize the⚠️ badge glyph.
File summaries
| File | Description |
|---|---|
| test/session/handoff_archive_test.dart | New unit tests for handoff snapshot + archive index append behavior. |
| test/commands/chat_shell_test.dart | New tests for chat command parsing and loop dispatch behavior. |
| lib/ui/render.dart | Standardizes warn badge icon to |
| lib/ui/ansi.dart | Adds env-driven color enablement (NO_COLOR/FORCE_COLOR). |
| lib/session/session_ops.dart | Adds archiveCurrentHandoff to snapshot + index the active handoff before overwrites. |
| lib/pipeline/pipeline_executor.dart | Makes the default Claude runner accessible (defaultClaudeRunner) for reuse (e.g. chat shell). |
| lib/commands/suggest.dart | Archives the current handoff before overwriting on re-run suggest confirmation. |
| lib/commands/status.dart | Adds colored status rendering and a colored branch-mismatch warning. |
| lib/commands/setup.dart | Archives the current handoff when choosing “start fresh” and prints the archived filename. |
| lib/commands/chat_shell.dart | New interactive chat shell implementation and command parser. |
| bin/claudart.dart | Registers claudart chat command and documents it in CLI usage text. |
Copilot's findings
- Files reviewed: 10/11 changed files
- Comments generated: 3
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+100
to
+104
| print(render.header('CLAUDART')); | ||
| if (entry == null) { | ||
| print('\n Not in a registered project — run `claudart link` here first.\n'); | ||
| exit_(0); | ||
| } |
| } | ||
| } | ||
|
|
||
| const String _commandHint = 'talk to me, or invoke /flow · /suggest · /quit'; |
Comment on lines
+37
to
+59
| final state = SessionState.parse(content); | ||
| final branch = state.branch; | ||
| final fileName = archiveName(branch); | ||
| final dir = archiveDirFor(workspace); | ||
| fileIO.createDir(dir); | ||
| fileIO.write(p.join(dir, fileName), content); | ||
|
|
||
| appendToIndex( | ||
| workspace, | ||
| ArchiveEntry( | ||
| id: '${branch}_${DateTime.now().millisecondsSinceEpoch}', | ||
| kind: kind, | ||
| description: state.bug.trim().isEmpty | ||
| ? (description ?? 'session snapshot') | ||
| : state.bug, | ||
| branch: branch, | ||
| createdAt: DateTime.now(), | ||
| handoffFile: fileName, | ||
| ), | ||
| io: fileIO, | ||
| ); | ||
| return fileName; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three commits:
FORCE_COLOR/NO_COLOR) + status coloring +claudart chat): plain text talks to claude w/ context; /flow /suggest invoke860 tests green, build clean.