git clone https://github.com/wavyx/hscli.git
cd hscli
npm installRun the CLI in development mode:
./bin/dev.js --help
./bin/dev.js version# Run all tests
npm test
# Watch mode
npm run test:watch
# With coverage
npm run test:coverageTests use vitest with nock for HTTP mocking.
# Check
npm run lint
# Fix
npm run lint:fixUses ESLint 9 (flat config) and Prettier.
src/
base-command.js # Shared command base (auth, output, profile)
commands/ # oclif commands (directory = topic)
auth/ # hs auth login/logout/status/refresh
conv/ # hs conv list/get
mailbox/ # hs mailbox list/get
...
lib/ # Core modules
auth.js # OAuth flows
client.js # Help Scout API client
config.js # Config management
keychain.js # Credential storage
output/ # Formatters (table, json)
hooks/ # oclif lifecycle hooks
test/
commands/ # Command integration tests
lib/ # Unit tests
fixtures/ # API response fixtures
- Create
src/commands/<topic>/<name>.js - Extend
BaseCommand - Define
static description,flags,args - Implement
async run() - Add tests in
test/commands/<topic>/<name>.test.js - Run
npx oclif manifestto update the command index
Follow Conventional Commits:
feat: add webhook list command
fix: handle expired token refresh
docs: update auth flow documentation
test: add mailbox get edge cases
chore: update dependencies
- One feature/fix per PR
- Tests required for new commands
- Run
npm test && npm run lintbefore submitting - CI must pass (Node 20/22 x ubuntu/macos/windows)