Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
name: CI

on:
pull_request:
push:
branches: [master]

permissions:
contents: read
pull_request:
merge_group:
types: [checks_requested]

jobs:
build:
typecheck:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v5

- uses: actions/setup-node@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
node-version: 20
path: |
~/.bun/install/cache
node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock', 'package.json') }}
restore-keys: |
${{ runner.os }}-bun-

- name: Install dependencies
run: bun install --frozen-lockfile

- run: npm ci
- run: npm run lint --if-present
- run: npm test --if-present
- run: npm run build --if-present
- name: Typecheck
run: bun run typecheck
75 changes: 75 additions & 0 deletions .github/workflows/pr-autofix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: PR Autofix

on:
issue_comment:
types: [created]

permissions:
contents: write
pull-requests: write
issues: read

jobs:
autofix:
if: >
github.event.issue.pull_request &&
(
contains(github.event.comment.body, '/prettier') ||
contains(github.event.comment.body, '/autofix') ||
contains(github.event.comment.body, '@github-actions prettier')
)
runs-on: ubuntu-latest

steps:
- name: Get PR branch info
id: pr
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr view ${{ github.event.issue.number }} --json headRefName,headRepositoryOwner,headRepository,isCrossRepository \
--jq '{headRefName, headRepositoryOwner: .headRepositoryOwner.login, headRepository: .headRepository.name, isCrossRepository}' > pr.json
echo "ref=$(jq -r '.headRefName' pr.json)" >> $GITHUB_OUTPUT
echo "owner=$(jq -r '.headRepositoryOwner' pr.json)" >> $GITHUB_OUTPUT
echo "repo=$(jq -r '.headRepository' pr.json)" >> $GITHUB_OUTPUT
echo "cross=$(jq -r '.isCrossRepository' pr.json)" >> $GITHUB_OUTPUT

- name: Stop if PR comes from fork
if: steps.pr.outputs.cross == 'true'
run: |
echo "This autofix workflow is disabled for PRs from forks."
exit 1

- name: Checkout PR branch
uses: actions/checkout@v5
with:
repository: ${{ steps.pr.outputs.owner }}/${{ steps.pr.outputs.repo }}
ref: ${{ steps.pr.outputs.ref }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Run Prettier
run: bun run format

- name: Run ESLint autofix
run: bun run lint:fix

- name: Commit and push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git diff --cached --quiet && exit 0
git commit -m "chore: apply prettier and eslint fixes"
git push

- name: Comment back on PR
if: success()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue comment ${{ github.event.issue.number }} --body "✅ Applied Prettier/ESLint fixes to the PR branch."
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist
node_modules
coverage
bun.lock
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": false,
"trailingComma": "all",
"printWidth": 100,
"tabWidth": 2
}
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,30 @@ npm start
```

This starts:

- Dashboard: `http://localhost:3000`
- Interactive CLI in the same terminal

## CLI commands

| Command | Description |
|---|---|
| `/add [authorizationCode]` | Add and start a new bot |
| Command | Description |
| -------------------------------------------------- | ---------------------------- |
| `/add [authorizationCode]` | Add and start a new bot |
| `/add:device_auth <accountId> <deviceId> <secret>` | Add and start a bot manually |
| `/remove <accountId>` | Stop and remove a bot |
| `/reload <accountId>` | Reconnect one bot |
| `/reload all` | Reconnect all bots |
| `/list` | List bots and current states |
| `/stats` | Show bot statistics |
| `/help` | Show help |
| `/exit` | Stop everything and exit |
| `/remove <accountId>` | Stop and remove a bot |
| `/reload <accountId>` | Reconnect one bot |
| `/reload all` | Reconnect all bots |
| `/list` | List bots and current states |
| `/stats` | Show bot statistics |
| `/help` | Show help |
| `/exit` | Stop everything and exit |

You can use just the first 8 characters of an `accountId` in CLI commands.

## Configuration

`config.json` is organized into clear sections:

- `bot.status`
- `bot.party`
- `bot.features`
Expand All @@ -62,4 +64,4 @@ You can use just the first 8 characters of an `accountId` in CLI commands.
- EpicResearch repository: https://github.com/MixV2/EpicResearch
- EpicResearch auth clients: https://github.com/MixV2/EpicResearch/blob/master/docs/auth/auth_clients.md
- EpicResearch authorization code flow: https://github.com/MixV2/EpicResearch/blob/master/docs/auth/grant_types/authorization_code.md
- EpicResearch exchange code flow: https://github.com/MixV2/EpicResearch/blob/master/docs/auth/grant_types/exchange_code.md
- EpicResearch exchange code flow: https://github.com/MixV2/EpicResearch/blob/master/docs/auth/grant_types/exchange_code.md
Loading
Loading