Skip to content

Add cross-platform lightweight CLI for ad-hoc and cron usage - #10

Merged
stevensouza merged 1 commit into
mainfrom
stevensouza/cli-lite
May 6, 2026
Merged

stevensouza merged 1 commit into
mainfrom
stevensouza/cli-lite

Conversation

@stevensouza

Copy link
Copy Markdown
Owner

Summary

  • New cli/ directory with a Python script (pingclaude.py) that performs one ping to the claude.ai web API and exits — for ad-hoc terminal use or cron/Task Scheduler on macOS, Linux, and Windows. Hardcoded haiku, prints success/failure plus 5-hour and 7-day window utilization and reset times to stdout (human or --json).
  • Credentials resolve in priority order: env vars → ~/.config/pingclaude/config.json → the existing GUI app's macOS plist (read-only auto-detect, zero-config on Macs); no credential CLI flags so secrets never appear in ps.
  • Requires curl_cffi (Safari TLS impersonation) because claude.ai is fronted by Cloudflare and stdlib urllib/system curl get 403'd at the edge regardless of cookies — verified empirically; Safari impersonation succeeds with the same credentials.
  • Includes cli/README.md with venv install (PEP 668), cron examples (use venv's Python directly), --json >> history-log pattern, exit codes (incl. 5 = missing dep), and a VPN-troubleshooting note.
  • Verified end-to-end against the live account: ping succeeds, reset times match the GUI app's display exactly; no Swift code touched.

Test plan

  • python3 -m venv ~/.pingclaude/venv && ~/.pingclaude/venv/bin/pip install curl_cffi
  • ~/.pingclaude/venv/bin/python3 cli/pingclaude.py → prints help, exits 0
  • python3 cli/pingclaude.py ping → exits 5 with install instructions (system Python lacks curl_cffi)
  • ~/.pingclaude/venv/bin/python3 cli/pingclaude.py ping → success with 5h/7d windows + reset times
  • ~/.pingclaude/venv/bin/python3 cli/pingclaude.py ping --json | python3 -m json.tool → well-formed JSON
  • ~/.pingclaude/venv/bin/python3 cli/pingclaude.py ping --quiet → silent on success, exit 0

🤖 Generated with Claude Code

Introduces a single-file Python 3 script (cli/pingclaude.py) that performs
one ping to claude.ai and exits, suitable for Linux, cron, and ad-hoc use
without the macOS GUI. Includes CLI-specific docs, config template, and
.gitignore. Updates main README with pointer to CLI docs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@stevensouza
stevensouza merged commit 711b878 into main May 6, 2026
2 checks passed
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