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