Skip to content

Conversation

@entropyy0
Copy link

Closes #65

Summary

Add authToken and ct0 fields to BirdConfig so credentials can be stored persistently in ~/.config/bird/config.json5:
json5
{
authToken: "0a57edf...",
ct0: "88de293..."
}

Priority order

CLI flags → config.json5 → env vars → browser cookies

Why

  • Persistent auth without environment variable pollution
  • Avoids generic AUTH_TOKEN env var name conflicting with other tools
  • Essential for automation/agents where browser cookie extraction isn't available
  • Follows existing config pattern (chromeProfile, timeoutMs, etc.)

Changes

  • Added authToken and ct0 to BirdConfig type
  • resolveCredentialsFromOptions falls back to config values
  • Documented in README config example

All 423 tests pass. AI-assisted (Claude), fully tested.

When BIRD_READ_ONLY=1 (or 'true'), all write commands (tweet, reply,
follow, unfollow, unbookmark) are blocked with a clear error message
before execution. Read commands continue to work normally.

This is useful when running bird for AI agents where you want to
allow reading/searching but prevent accidental posts — as the README
already recommends against tweeting.

Implementation:
- Export WRITE_COMMANDS set from program.ts
- Check env var in preAction hook (zero overhead for read commands)
- Add test for write/read command classification
- Document in README under environment shortcuts

Closes steipete#69
Add authToken and ct0 fields to BirdConfig so credentials can be
stored persistently in ~/.config/bird/config.json5 instead of
requiring environment variables or browser cookie extraction.

Priority order: CLI flags > config.json5 > env vars > browser cookies

This is especially useful for automation/agents where browser cookie
extraction isn't available, and avoids the generic AUTH_TOKEN env var
name that can conflict with other tools.

Closes steipete#65
Copy link

@BjoernSchotte BjoernSchotte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally on Linux - works as expected. Config fallback for authToken/ct0 functions correctly. Minor note: credential source shows 'CLI argument' instead of 'config'.

…json5

When authToken/ct0 are loaded from config.json5 rather than CLI flags,
the credential source now correctly displays 'config' instead of
'CLI argument'.

Addresses review feedback from @BjoernSchotte.
@Kuberwastaken
Copy link

tested on RPi OS ; LGTM

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.

Support authToken and ct0 in config.json5

3 participants