feat: auto-detect completion phrase from CLAUDE.md

- Extract <promise>PHRASE</promise> from CLAUDE.md on session start
- Configure inner loop tracker before first broadcast so UI shows phrase immediately
- More lenient bare phrase detection (triggers when loop is active)
- Auto-detect on session restoration from screens
- Add logging for auto-detection debugging

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-21 19:49:44 +01:00
co-authored by Claude Opus 4.5
parent e469b30ddb
commit 403c7e77fb
4 changed files with 115 additions and 9 deletions
+20 -1
View File
@@ -70,6 +70,7 @@ npx vitest run -t "should create session" # By pattern
# Tests mock PTY - no real Claude CLI spawned
# Test timeout: 30s (configured in vitest.config.ts)
# Global test utilities (describe/it/expect) available without imports (globals: true)
# TypeScript checking
npm run typecheck # Type check without building (or: npx tsc --noEmit)
@@ -107,6 +108,7 @@ pkill -f "SCREEN.*claudeman" # Force kill all claudeman screens
| `src/tui/components/*.tsx` | TUI components: StartScreen, TabBar, TerminalView, StatusBar, RalphPanel, HelpOverlay |
| `src/tui/hooks/useSessionManager.ts` | TUI session state, screen polling, input handling |
| `src/types.ts` | All TypeScript interfaces |
| `src/templates/claude-md.ts` | CLAUDE.md template generation with placeholder support |
### Data Flow
@@ -345,7 +347,17 @@ Writes debounced to `~/.claudeman/state.json`. Batches rapid changes.
### TypeScript Config
Module resolution: NodeNext. Target: ES2022. Strict mode enabled. See `tsconfig.json` for full settings.
Module resolution: NodeNext. Target: ES2022. Strict mode with additional checks:
| Setting | Effect |
|---------|--------|
| `noUnusedLocals` | Error on unused local variables |
| `noUnusedParameters` | Error on unused function parameters |
| `noImplicitReturns` | All code paths must return a value |
| `noFallthroughCasesInSwitch` | Require break/return in switch cases |
| `allowUnreachableCode: false` | Error on unreachable code |
TUI uses React JSX (`jsxImportSource: react`) for Ink components.
## Adding New Features
@@ -471,6 +483,13 @@ Long-running sessions are supported with automatic trimming:
Cases created in `~/claudeman-cases/` by default.
### Custom CLAUDE.md Templates
New cases can use custom CLAUDE.md templates via `generateClaudeMd()` in `src/templates/claude-md.ts`. Placeholders:
- `[PROJECT_NAME]` → Case name
- `[PROJECT_DESCRIPTION]` → Description
- `[DATE]` → Current date (YYYY-MM-DD)
## Screen Session Manager (CLI Tool)
Interactive bash tool for managing claudeman screen sessions directly from the terminal.