Hugo-Persson/obsidian-manager

Various cli tools to manage my Obsidian vault

โ˜… 0Forks 0TypeScriptGitHub โ†—Compare

README

Obsidian Manager CLI

A CLI tool for managing Obsidian vault documents and generating flashcards with AI.

Features

  • ๐ŸŽด Interactive Flashcard Generation: Generate flashcards from markdown documents using AI
  • ๐ŸŽฏ Smart Selection: Visual interface to select which flashcards to keep
  • ๐Ÿ“ Live Preview: See exactly what changes will be made before applying them
  • โœ… Document Management: Mark documents as complete after processing
  • โšก Fast: Built with Bun for optimal performance

Installation

Global Installation (Recommended)

# Install dependencies
bun install

# Compile and install globally
bun run install-global

After installation, you can use obsidian-manager from anywhere in your terminal.

Local Usage

# Install dependencies
bun install

# Run directly with bun
bun index.ts [command] [options]

# Or compile first
bun run compile
./dist/index.js [command] [options]

Usage

Generate Flashcards

# Interactive flashcard generation
obsidian-manager generate-flashcard path/to/document.md

# Or use the short alias
obsidian-manager gfc path/to/document.md

This command will:

  1. ๐Ÿ“– Read your markdown document
  2. ๐Ÿค– Generate new flashcards using AI
  3. ๐Ÿ“‹ Show both new and existing flashcards
  4. ๐ŸŽฏ Let you select which ones to keep
  5. ๐Ÿ“ Preview changes before applying
  6. โœ… Optionally mark the document as complete

Placeholder Command

# Placeholder for future functionality
obsidian-manager path/to/document.md

Interactive Controls

When using generate-flashcard, you'll see an interactive interface:

  • โ†‘โ†“: Navigate between flashcards
  • Space: Toggle flashcard selection
  • M: Toggle "mark document as complete"
  • Enter: Proceed to diff preview
  • Y/N: Confirm or cancel actions
  • Q: Quit at any time

Environment Variables

Make sure you have your AWS credentials set up for the AI flashcard generation:

export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key

Scripts

  • bun run build - Build the CLI
  • bun run compile - Build and make executable
  • bun run install-global - Compile and install globally
  • bun run uninstall - Remove global installation
  • bun run dev - Run in development mode with hot reload

Uninstallation

To remove the global installation:

bun run uninstall

Development

# Install dependencies
bun install

# Run in development mode
bun run dev

# Run tests
bun test

File Structure

src/
โ”œโ”€โ”€ cli.ts              # Main CLI command logic
โ”œโ”€โ”€ flashcard-cli.tsx   # Interactive UI components
โ”œโ”€โ”€ document-parser.ts  # Markdown document parsing
โ”œโ”€โ”€ document-updater.ts # Document writing utilities
โ”œโ”€โ”€ flashcard.ts        # AI flashcard generation
โ”œโ”€โ”€ bedrock.ts         # AWS Bedrock configuration
โ””โ”€โ”€ types.ts           # TypeScript type definitions

Contributors

Hugo-Persson

Issues