Building, running, and testing the Node.js implementation of outlook-cli.
- Node.js 20+ (see
enginesinpackage.json) - npm (bundled with Node.js)
cd outlook-cli
npm install# Run directly
node bin/outlook-cli.js <command>
# Or create a global symlink for convenience
npm link
outlook-cli <command>
# Or use npx (from the project directory)
npx outlook-cli <command>npm test # Run all tests (vitest)
npm run test:verbose # Verbose output
npm run test:watch # Watch mode (re-run on change)
npm run test:coverage # With coverage reportSee src-tests.md for test architecture details.
No build step is required. The Node.js implementation uses ESM modules directly — source files are executed as-is by the Node.js runtime.
src/node/
├── accounts/ # Multi-account management (add, remove, list, set-default)
├── auth/ # MSAL authentication (login, logout, status, token cache)
├── cli/ # Commander.js command definitions
├── contacts/ # Contact search and alias management
├── graph/ # Microsoft Graph API HTTP client
├── output/ # Output formatters (text, json, markdown, html)
├── security/ # Permission validation, forbidden scopes, send_to whitelist
├── watch/ # Delta query watch mode, rules engine
├── config.js # Configuration loading (~/.outlook-cli/)
└── input.js # JSON input file parsing (--input flag)
| Package | Purpose |
|---|---|
@azure/msal-node |
Microsoft Authentication Library — OAuth 2.0 flows, token caching |
commander |
CLI framework — commands, options, help generation |
Dev dependencies:
| Package | Purpose |
|---|---|
vitest |
Test runner — describe/it/expect, mocking, coverage |
The project uses ES Modules ("type": "module" in package.json). All imports use the import/export syntax:
import { getAccounts } from '../accounts/store.js';
import { acquireToken } from '../auth/token.js';bin/outlook-cli.js is the main entry point. It imports the Commander.js program from src/node/cli/ and invokes program.parse().
The Node.js implementation reads and writes configuration files in ~/.outlook-cli/. See architecture.md for the shared configuration format used by both implementations.
- architecture.md — Architecture overview, shared config formats
- src-tests.md — Test conventions and how to add tests
- src-dotnet.md — The .NET implementation