agentleFS
reaatechreaatech/mcp-changelog/skills/cli-development/SKILL.md

cli-development

Skill0 starsChanged 3 months agoMITView on GitHub

The CLI development skill provides capabilities for building a user-friendly command-line interface using Commander.js. The CLI is the primary user-facing interface for mcp-changelog.

  • Reads credentials

6 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use incident-response.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AnthropicSkill

    incident-response

    Run an incident response workflow — triage, communicate, and write postmortem. Trigger with "we have an incident", "production is down", an alert that needs severity assessment, a status update mid-incident, or when writing a blameless postmortem after resolution.

    Also in 3 projects that use this

The file

Files
SKILL.md

CLI Development Skill

Purpose

The CLI development skill provides capabilities for building a user-friendly command-line interface using Commander.js. The CLI is the primary user-facing interface for mcp-changelog.

Capabilities

1. Command Parsing

  • Parse git range notation (v1.0.0..v2.0.0)
  • Support multiple output formats
  • Handle configuration file loading
  • Provide helpful error messages and usage hints

2. Subcommands

  • generate — Generate changelog for a git range
  • diff — Show raw diff without generating output
  • inspect — Parse and display a schema file
  • list-tags — List all version tags

3. Options and Flags

  • --schema-path — Override auto-detected schema path
  • --output-dir — Output directory for generated files
  • --format — Output format (markdown, json, all)
  • --config — Path to configuration file
  • --verbose — Enable verbose logging

Usage Examples

Generate Changelog

# Basic usage
mcp-changelog generate v1.0.0..v2.0.0

# With custom schema path
mcp-changelog generate v1.0.0..v2.0.0 --schema-path api/schema.json

# With custom output directory
mcp-changelog generate v1.0.0..v2.0.0 --output-dir ./docs

# JSON only
mcp-changelog generate v1.0.0..v2.0.0 --format json

# Verbose mode
mcp-changelog generate v1.0.0..v2.0.0 --verbose

Show Raw Diff

# Show diff without generating files
mcp-changelog diff v1.0.0..v2.0.0

# Output as JSON
mcp-changelog diff v1.0.0..v2.0.0 --format json

Validate Schema

# Parse and display a schema file
mcp-changelog inspect ./schema.json

# Validate at a specific git ref
mcp-changelog inspect ./schema.json --ref v1.0.0

List Tags

# List all tags
mcp-changelog list-tags

# Filter by semver pattern
mcp-changelog list-tags --pattern '^v\\d+\\.\\d+\\.\\d+$'

Implementation

#!/usr/bin/env node
import { Command } from 'commander';
import { generate } from './commands/generate';
import { diff } from './commands/diff';
import { inspect } from './commands/inspect';
import { listTags } from './commands/list-tags';
import { version } from '../package.json';

const program = new Command();

program
  .name('mcp-changelog')
  .description('Automated changelog generator for MCP servers')
  .version(version);

program
  .command('generate <range>')
  .description('Generate changelog for git range (e.g. v1.0.0..v2.0.0)')
  .option('-s, --schema-path <path>', 'Path to schema file (default: auto-detect)')
  .option('-o, --output-dir <dir>', 'Output directory', './')
  .option('-f, --format <format>', 'Output format (markdown, json, all)', 'all')
  .option('-c, --config <path>', 'Path to config file')
  .option('-v, --verbose', 'Enable verbose logging', false)
  .action(generate);

program
  .command('diff <range>')
  .description('Show raw diff without generating output')
  .option('-s, --schema-path <path>', 'Path to schema file (default: auto-detect)')
  .option('-f, --format <format>', 'Output format (text, json)', 'text')
  .action(diff);

program
  .command('inspect <schema>')
  .description('Parse and display a schema file')
  .option('-r, --ref <ref>', 'Git ref to inspect')
  .action(inspect);

program
  .command('list-tags')
  .description('List all version tags')
  .option('-p, --pattern <pattern>', 'Filter by regex pattern')
  .action(listTags);

program.parse(process.argv);

Error Handling

// User-friendly error messages
function handleError(error: Error, context: string) {
  switch (error.name) {
    case 'GitRefNotFoundError':
      console.error(`Error: Git reference not found: ${error.message}`);
      console.error('Hint: Run "mcp-changelog list-tags" to see available tags.');
      break;
    case 'SchemaNotFoundError':
      console.error(`Error: No schema file found. ${error.message}`);
      console.error('Hint: Use --schema-path to specify the schema location.');
      break;
    case 'SchemaParseError':
      console.error(`Error: Failed to parse schema: ${error.message}`);
      console.error('Hint: Check that the file is valid JSON.');
      break;
    case 'InvalidRangeError':
      console.error(`Error: Invalid git range: ${error.message}`);
      console.error('Hint: Use format "from..to", e.g. "v1.0.0..v2.0.0"');
      break;
    default:
      console.error(`Error: ${error.message}`);
      if (process.env.DEBUG) {
        console.error(error.stack);
      }
  }
  process.exit(1);
}

Configuration File Support

// mcp-changelog.config.ts
export default {
  schema: {
    paths: ['schema.json'],
  },
  output: {
    dir: './changelog',
    formats: ['markdown', 'json'],
  },
  changelog: {
    template: 'default',
    includeMigrationLinks: true,
  },
};
// Config loading
import { loadConfig } from './config';

async function generate(range: string, options: any) {
  const config = await loadConfig(options.config);

  // CLI options override config file
  const finalConfig = {
    ...config,
    output: {
      ...config.output,
      dir: options.outputDir || config.output.dir,
    },
  };

  // ... generate changelog
}

Best Practices

1. Provide Helpful Error Messages

// Good: Actionable error
Error: Git reference "v3.0.0" not found
Hint: Run "mcp-changelog list-tags" to see available tags.

// Bad: Cryptic error
Error: fatal: ambiguous argument 'v3.0.0': unknown revision

2. Support Common Conventions

// Good: Support common patterns
mcp-changelog generate v1.0.0..v2.0.0    // Tag range
mcp-changelog generate HEAD~5..HEAD       // Commit range
mcp-changelog generate main..feature      // Branch comparison

// Bad: Only one format
mcp-changelog generate --from v1.0.0 --to v2.0.0

3. sensible defaults

// Good: Sensible defaults
--output-dir ./          // Current directory
--format all             // Both markdown and JSON
--schema-path (auto)     // Auto-detect

// Bad: Required options
--output-dir (required)
--format (required)
--schema-path (required)

Testing Strategies

describe('CLI', () => {
  it('should generate changelog for valid range', async () => {
    const { stdout } = await runCLI('generate v1.0.0..v2.0.0 --output-dir /tmp/test');
    expect(stdout).toContain('CHANGELOG.md');
    expect(stdout).toContain('MIGRATION.md');
    expect(stdout).toContain('diff.json');
  });

  it('should fail for invalid range', async () => {
    const { stderr, exitCode } = await runCLI('generate invalid..range');
    expect(exitCode).toBe(1);
    expect(stderr).toContain('Git reference not found');
  });

  it('should list tags', async () => {
    const { stdout } = await runCLI('list-tags');
    expect(stdout).toContain('v1.0.0');
    expect(stdout).toContain('v2.0.0');
  });

  it('should show help', async () => {
    const { stdout } = await runCLI('--help');
    expect(stdout).toContain('generate');
    expect(stdout).toContain('diff');
    expect(stdout).toContain('inspect');
    expect(stdout).toContain('list-tags');
  });
});

Resources

  • ARCHITECTURE.md - System architecture
  • CLI section - Detailed module spec
  • Commander.js docs - CLI framework reference

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.