diff --git a/.gitignore b/.gitignore index fe8a10e..71e4303 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ dist/ *.log .DS_Store twitter-cli.bin +bird diff --git a/README.md b/README.md index 8f11830..40554ea 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,13 @@ -# twitter-cli +# bird -A command-line tool for posting tweets and replies via Twitter's GraphQL API. +A command-line tool for posting tweets and replies via Twitter/X's GraphQL API. ## Installation ```bash -cd ~/Projects/twitter-cli +cd ~/Projects/bird pnpm install +pnpm run binary # Creates the 'bird' executable ``` ## Usage @@ -14,23 +15,31 @@ pnpm install ### Post a tweet ```bash -./twitter-cli tweet "Hello from twitter-cli!" +bird tweet "Hello from bird!" ``` ### Reply to a tweet ```bash # Using tweet URL -./twitter-cli reply "https://x.com/user/status/1234567890" "This is my reply" +bird reply "https://x.com/user/status/1234567890" "This is my reply" # Using tweet ID directly -./twitter-cli reply 1234567890 "This is my reply" +bird reply 1234567890 "This is my reply" +``` + +### Read a tweet + +```bash +# Get tweet content by URL or ID +bird read "https://x.com/user/status/1234567890" +bird read 1234567890 --json ``` ### Check credentials ```bash -./twitter-cli check +bird check ``` ## Authentication @@ -39,14 +48,14 @@ The tool resolves credentials in the following order of priority: 1. **CLI arguments** (highest priority) ```bash - ./twitter-cli --auth-token "xxx" --ct0 "yyy" tweet "Hello" + bird --auth-token "xxx" --ct0 "yyy" tweet "Hello" ``` 2. **Environment variables** ```bash export AUTH_TOKEN="xxx" export CT0="yyy" - ./twitter-cli tweet "Hello" + bird tweet "Hello" ``` Alternative env var names: `TWITTER_AUTH_TOKEN`, `TWITTER_CT0` diff --git a/package.json b/package.json index 69b72a6..6d741e6 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { - "name": "twitter-cli", + "name": "bird", "version": "0.1.0", - "description": "CLI tool for tweeting and replying via Twitter GraphQL API", + "description": "CLI tool for tweeting and replying via Twitter/X GraphQL API", "type": "module", "main": "dist/index.js", "bin": { - "twitter-cli": "dist/index.js" + "bird": "dist/index.js" }, "scripts": { "build": "tsc", @@ -15,7 +15,7 @@ "lint": "biome check .", "lint:fix": "biome check --write .", "format": "biome format --write .", - "binary": "bun build --compile --minify src/index.ts --outfile twitter-cli" + "binary": "bun build --compile --minify src/index.ts --outfile bird" }, "dependencies": { "commander": "^12.1.0" diff --git a/src/index.ts b/src/index.ts index 054e3bb..47c499b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,11 +1,12 @@ #!/usr/bin/env node /** - * twitter-cli - CLI tool for posting tweets and replies + * bird - CLI tool for posting tweets and replies * * Usage: - * twitter-cli tweet "Hello world!" - * twitter-cli reply "This is a reply" - * twitter-cli reply "This is a reply" + * bird tweet "Hello world!" + * bird reply "This is a reply" + * bird reply "This is a reply" + * bird read */ import { Command } from 'commander'; @@ -14,7 +15,7 @@ import { TwitterClient } from './lib/twitter-client.js'; const program = new Command(); -program.name('twitter-cli').description('Post tweets and replies via Twitter GraphQL API').version('0.1.0'); +program.name('bird').description('Post tweets and replies via Twitter/X GraphQL API').version('0.1.0'); // Global options for authentication program diff --git a/twitter-cli b/twitter-cli deleted file mode 100755 index 130832f..0000000 --- a/twitter-cli +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -# twitter-cli - CLI tool for posting tweets and replies -# Requires Node.js 20+ and pnpm - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -cd "$SCRIPT_DIR" && exec pnpm exec tsx src/index.ts "$@"