Skip to content

MORG-13: Add option to use Claude CLI for AI prompts instead of Anthropic API#42

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

MORG-13: Add option to use Claude CLI for AI prompts instead of Anthropic API#42
developerdavi wants to merge 12 commits intomainfrom
MORG-13

Conversation

@developerdavi
Copy link
Owner

No description provided.

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.
… support

- SYSTEM_PR_DESCRIPTION: enforce ## Ticket / ## Summary / ## Test plan
  structure with explicit "no title/preamble" instruction
- SYSTEM_PR_REVIEW: explicit **What it does** / **Potential concerns** /
  **Overall assessment** sections
- SYSTEM_STANDUP: **Yesterday** / **Today** / **Blockers** structure
- prDescriptionPrompt: add ticketId + ticketUrl params; builds linked
  ticket reference ([ID](url): title) when URL is available
- BranchSchema: add ticketUrl field (nullable, default null)
- start.ts: store ticket.url as ticketUrl when creating branch entry
- track.ts: include ticketUrl: null in new branch entries
- pr.ts: pass ticketId + ticketUrl to prDescriptionPrompt
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