Skip to content

Latest commit

 

History

History
96 lines (67 loc) · 2.95 KB

File metadata and controls

96 lines (67 loc) · 2.95 KB

Node.js Implementation

Building, running, and testing the Node.js implementation of outlook-cli.

Prerequisites

  • Node.js 20+ (see engines in package.json)
  • npm (bundled with Node.js)

Install Dependencies

cd outlook-cli
npm install

Run

# 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>

Test

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 report

See src-tests.md for test architecture details.

Build

No build step is required. The Node.js implementation uses ESM modules directly — source files are executed as-is by the Node.js runtime.

Project Structure

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)

Key Dependencies

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

Module System

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';

Entry Point

bin/outlook-cli.js is the main entry point. It imports the Commander.js program from src/node/cli/ and invokes program.parse().

Configuration

The Node.js implementation reads and writes configuration files in ~/.outlook-cli/. See architecture.md for the shared configuration format used by both implementations.

Related Documentation