npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mutt-config-core

v0.1.0

Published

Pure configuration generator for Neomutt + Gmail + OAuth2.0

Readme

mutt-config-core

Pure configuration generator for Neomutt + Gmail + OAuth2.0

npm version License: MIT

Features

  • Zero dependencies - Pure JavaScript, no external packages
  • Pure functions - No side effects, easy to test
  • Fully tested - 24 test cases, 100% coverage
  • Type-safe - JSDoc type definitions included
  • i18n support - Japanese and English Gmail folders
  • GPG ready - Pre-configured for GPG encryption

Installation

npm install mutt-config-core

Quick Start

const { generateMuttConfigs } = require('mutt-config-core');

const configs = generateMuttConfigs({
  email: '[email protected]',
  realName: 'Your Name',
  editor: 'nvim',
  locale: 'ja'  // or 'en'
});

console.log(configs.accountMuttrc);  // Account-specific config
console.log(configs.mainMuttrc);     // Main muttrc
console.log(configs.setupGuide);     // Next steps guide

API Reference

generateMuttConfigs(input)

Generates all necessary Neomutt configuration files for Gmail with OAuth2.0.

Parameters

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | email | string | Yes | Gmail address (must end with @gmail.com) | | realName | string | Yes | Your real name for email headers | | editor | string | Yes | Editor command (e.g., 'nvim', 'vim', 'emacs') | | locale | 'ja' \| 'en' | Yes | Gmail language setting | | gpgKeyId | string | No | GPG key ID (defaults to email address) |

Returns

{
  accountMuttrc: string,  // Account-specific configuration
  mainMuttrc: string,     // Main muttrc file
  setupGuide: string      // Step-by-step setup instructions
}

Example

const configs = generateMuttConfigs({
  email: '[email protected]',
  realName: 'John Doe',
  editor: 'nvim',
  locale: 'en',
  gpgKeyId: '[email protected]'  // optional
});

getConfigPaths(email)

Returns recommended file paths for configuration files.

Parameters

  • email (string): Gmail address

Returns

{
  accountMuttrc: '.config/mutt/accounts/EMAIL.muttrc',
  mainMuttrc: '.config/mutt/muttrc',
  oauthTokens: '.local/etc/oauth-tokens',
  cacheHeaders: '.cache/mutt/headers',
  cacheBodies: '.cache/mutt/bodies'
}

GMAIL_FOLDERS

Gmail folder names for different locales.

{
  ja: {
    drafts: '下書き',
    sent: '送信済みメール',
    trash: 'ゴミ箱',
    allMail: 'すべてのメール'
  },
  en: {
    drafts: 'Drafts',
    sent: 'Sent Mail',
    trash: 'Trash',
    allMail: 'All Mail'
  }
}

Generated Configuration

The generated configuration includes:

  • OAuth 2.0 authentication - Uses GPG-encrypted tokens
  • IMAP/SMTP settings - Optimized for Gmail
  • Performance settings - Caching and connection keepalive
  • Folder macros - Quick navigation with gi, gt, gs, gd, ga
  • Locale-specific folders - Correct folder names for Japanese/English

Prerequisites

Before using the generated configuration, ensure you have:

  • Neomutt installed
  • mutt-wizard installed
  • Python 3 with mutt_oauth2.py
  • GPG configured
  • Google Cloud OAuth 2.0 credentials

See the generated setupGuide for detailed instructions.

Use Cases

CLI Tool

Perfect for building command-line setup tools:

const inquirer = require('inquirer');
const fs = require('fs').promises;
const { generateMuttConfigs, getConfigPaths } = require('mutt-config-core');

const answers = await inquirer.prompt([...]);
const configs = generateMuttConfigs(answers);
const paths = getConfigPaths(answers.email);

// Write configs to disk
await fs.writeFile(paths.accountMuttrc, configs.accountMuttrc);

Web Service

Generate configurations on-demand:

app.post('/generate-config', (req, res) => {
  const configs = generateMuttConfigs(req.body);
  res.json(configs);
});

Testing

Easy to test due to pure functions:

test('generates valid config', () => {
  const result = generateMuttConfigs({
    email: '[email protected]',
    realName: 'Test User',
    editor: 'vim',
    locale: 'en'
  });
  
  expect(result.accountMuttrc).toContain('[email protected]');
});

Development

# Install dependencies
npm install

# Run tests
npm test

# Watch mode
npm run test:watch

# Coverage report
npm run test:coverage

Related Projects

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT © a-lost-social-misfit

Author

Created by a-lost-social-misfit

Based on practical experience setting up Neomutt with Gmail OAuth2.0 on macOS.

Acknowledgments

Returns:

  • accountMuttrc (string): Account-specific configuration
  • mainMuttrc (string): Main muttrc file
  • setupGuide (string): Next steps guide

getConfigPaths(email)

Returns file paths for configuration files.

GMAIL_FOLDERS

Gmail folder names for different locales.

Development

# Run tests
npm test

# Watch mode
npm run test:watch

# Coverage
npm run test:coverage

License

MIT