Skip to content

feat(MORG-13): add Claude CLI AI provider#41

Closed
developerdavi wants to merge 11 commits intomainfrom
MORG-13
Closed

feat(MORG-13): add Claude CLI AI provider#41
developerdavi wants to merge 11 commits intomainfrom
MORG-13

Conversation

@developerdavi
Copy link
Owner

@developerdavi developerdavi commented Mar 10, 2026

Summary

  • Adds ClaudeCLIProvider that shells out to claude --print --tools "" --no-session-persistence instead of calling the Anthropic API
  • New aiProvider config field (anthropic-api | claude-cli); backwards-compatible — existing API-key users are unaffected
  • Config wizard now prompts for AI provider selection; morg config --show displays it
  • morg standup (and all other AI features) work transparently with either provider
  • 9 new integration tests for ClaudeCLIProvider

Test plan

  • pnpm test — 54 tests passing
  • morg config → choose "Claude CLI" → morg standup generates via local claude binary
  • Existing Anthropic API config (no aiProvider field) → morg standup still works unchanged
  • morg config --show displays aiProvider when set

Adds a `claude-cli` backend that calls the local `claude -p` binary
instead of hitting the Anthropic API, so users with a Claude
subscription but no API key can use AI features (standup, PR descriptions, PR review).

- New `ClaudeCLIProvider` implementing `AIProvider` via `claude --print`
- `aiProvider` field in `GlobalConfigSchema` (`anthropic-api` | `claude-cli`)
- Registry `ai()` returns `ClaudeCLIProvider` when `aiProvider === 'claude-cli'`
- Config wizard gains an AI provider `select` prompt; `--show` displays it
- Standup error message updated to be provider-agnostic
- 9 integration tests for `ClaudeCLIProvider`
clack v1.1 password() can return undefined for empty input; add ?? ''
fallback (matching text()) to prevent "Cannot read properties of undefined
(reading 'trim')" errors in the config wizard.
--tools is not available in all claude CLI versions; drop it since
--print alone is sufficient for text-only completions.
Large prompts (e.g. PR diffs) stall when passed as a CLI argument;
piping via stdin handles arbitrary-length input cleanly.
When morg is invoked from within Claude Code, the CLAUDECODE env var
is set. The claude binary refuses to run nested sessions and exits
with an error. Strip it (and CLAUDE_CODE_ENTRYPOINT) from the child
process environment so morg can call claude --print from any context.
Replace the single-line text() prompt for PR body with an
@inquirer/editor prompt that opens $EDITOR, allowing full
multi-line editing of AI-generated PR descriptions.
These are supported by claude CLI >=2.1.69. The flags were removed
during debugging but work correctly with the current version.
Drop the 700KB+ inquirer dependency. The editor() prompt writes
initial content to a temp file, opens $VISUAL/$EDITOR/vi with
inherited stdio, and reads back the result — same UX, zero new deps.
- Move AI provider select before the API key prompt
- Only show the Anthropic API key prompt when user picks 'anthropic-api'
- Add 'None (disable AI features)' as a first-class option
Single 'Integrations to enable' multiselect (Jira / Notion / Slack)
replaces three separate yes/no prompts. Credentials are only asked
for selected providers. Jira and Notion are grouped with a 'tickets
provider' hint so users know only one can be active per project.
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