Add happy CLI with connect subcommand for Claude integration - #3
Draft
hatcheric950 wants to merge 3 commits into
Draft
Add happy CLI with connect subcommand for Claude integration#3hatcheric950 wants to merge 3 commits into
hatcheric950 wants to merge 3 commits into
Conversation
Introduces the `happy` Python package with a `connect` subcommand that establishes and verifies a connection to an AI provider. `happy connect Claude` reads ANTHROPIC_API_KEY, makes a live round-trip to confirm the key is valid, then persists provider config to ~/.happy/config.json with 0600 permissions. Unknown providers (anything other than "claude") produce a clear error listing all known names, making it easy to extend with new providers. https://claude.ai/code/session_01LpvtaebRr9v7JTpF7tnhDX
happy now loads ~/.happy/.env then ./.env at startup (shell env wins). A minimal stdlib-only parser handles KEY=value, quoted values, and inline comments. The "key not set" error message now also mentions ~/.happy/.env as the recommended place to store the key. .env is added to .gitignore to prevent accidental key commits. https://claude.ai/code/session_01LpvtaebRr9v7JTpF7tnhDX
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.
Summary
happyPython package installable viapip install -e .happy connect <PROVIDER>subcommandhappy connect ClaudereadsANTHROPIC_API_KEY, makes a live round-trip to verify the key, then persists provider config to~/.happy/config.json(mode 0600)Layout
src/happy/__init__.py— versionsrc/happy/cli.py— argparse entrypoint (happy,happy connect)src/happy/connect.py— per-provider connection handlers (_connect_claude)src/happy/config.py— load/save~/.happy/config.jsonpyproject.toml—setuptoolsbuild config;happyconsole script entry pointTest plan
pip install -e .thenhappy --versionprintshappy 0.1.0happy --helplists theconnectsubcommandANTHROPIC_API_KEY=<valid-key> happy connect Claudeprints✓ Connectedand writes~/.happy/config.jsonANTHROPIC_API_KEY=bad happy connect Claudeexits witherror: API key rejectedhappy connect Unknownexits witherror: unknown provider 'Unknown'. Known: claudeANTHROPIC_API_KEYthen runhappy connect Claude— exits with key-not-set messagehttps://claude.ai/code/session_01LpvtaebRr9v7JTpF7tnhDX
Generated by Claude Code