npm package: @krishna117/diary
Description: A polished, professional CLI diary application with rich UX and smart features
Author: Krishna
Latest version: 1.0.1

# 📔 Diary

A polished, professional CLI diary application built with TypeScript and Node.js. Beautiful TUI, rich features, interview-ready code.

![Version](https://img.shields.io/badge/version-1.0.0-blue)
![License](https://img.shields.io/badge/license-MIT-green)
![Node](https://img.shields.io/badge/node-%3E%3D14.0.0-brightgreen)

## ✨ Features

### 🏠 Home Screen
- Clean, intentional interface
- 7 main actions (New, Open, Search, Filter, Stats, Settings, Exit)
- Polished emoji-driven design

### ➕ New Entry
- Rich entry creation with title, content, tags, and mood
- Integrates with system editor (nano, vim, code)
- Auto-saves with timestamp and ID

### 📖 Open Entry
- List all entries sorted by date (newest first)
- Quick preview of each entry
- View full entry details

### 📄 Entry Detail View
- Full entry display with metadata
- Edit content, tags, or mood
- Delete entries with confirmation

### 🔍 Search
- Search by title, content, tag, or date
- Powerful filtering capabilities
- Returns matching entries with full details

### 🏷️ Filter by Tag
- View all available tags
- Filter entries by selected tag
- Queryable diary system

### 📊 Stats
- Total entries count
- Most used tag
- Most common mood
- Longest streak
- Last entry date

### ⚙️ Settings
- Change default editor
- Export diary (JSON/TXT)
- Reset diary (with safety confirmations)

## 📦 Data Model

Each diary entry is a rich object:

```typescript
{
  id: "uuid-string",
  title: "Entry Title",
  content: "Full entry text...",
  tags: ["tag1", "tag2"],
  mood: "happy",
  date: "2026-02-06",
  createdAt: "22:41",
  updatedAt: "22:41"
}
```

All data is persisted in `~/.diary/entries.json`.

## 🚀 Installation

### npm
```bash
npm install -g @yourusername/diary
diary
```

### From Source
```bash
git clone https://github.com/yourusername/diary.git
cd diary
npm install
npm run build
npm start
```

## 💻 Development

### Setup
```bash
npm install
```

### Run in Development
```bash
npm run dev
```

### Build
```bash
npm run build
```

### Run Built App
```bash
npm start
```

## 🎯 Usage

```bash
diary
```

Then follow the interactive menu. All data is automatically saved.

### Quick Examples

**Create a new entry:**
1. Select "➕ New Entry"
2. Enter title
3. Add tags (optional, comma-separated)
4. Select mood
5. Write content in editor
6. Save and exit

**Search entries:**
1. Select "🔍 Search"
2. Choose search type
3. Enter query
4. View results

**View statistics:**
1. Select "📊 Stats"
2. See mood tracking, streaks, and tags

## 🏗️ Architecture

```
src/
├── bin/
│   └── diary.ts          # CLI entry point
├── core/
│   ├── diary.ts          # Main diary logic
│   └── entry.ts          # Entry model
├── screens/
│   ├── homeScreen.ts
│   ├── newEntryScreen.ts
│   ├── openEntryScreen.ts
│   ├── entryDetailScreen.ts
│   ├── searchScreen.ts
│   ├── filterByTagScreen.ts
│   ├── statsScreen.ts
│   └── settingsScreen.ts
├── storage/
│   └── fileManager.ts    # File persistence
├── utils/
│   ├── constants.ts
│   └── helpers.ts
└── index.ts              # Library exports
```

## 🔧 Technologies

- **Runtime:** Node.js (v14+)
- **Language:** TypeScript
- **CLI:** inquirer.js
- **Colors:** chalk
- **Storage:** File system JSON
- **Architecture:** MVC pattern

## 📝 Data Persistence

- Entries stored in `~/.diary/entries.json`
- Automatic saving on every change
- Export to JSON/TXT formats
- Safety confirmations for destructive actions

## 🎨 UI/UX Features

- ✅ Interactive menu navigation
- ✅ Rich emoji indicators
- ✅ Color-coded actions
- ✅ Clean, readable output
- ✅ Confirmation dialogs for critical actions
- ✅ Helpful error messages
- ✅ Sorted and paginated lists

## 📊 Mood Tracking

Supported moods:
- 😊 Happy
- 😐 Neutral
- 😞 Sad
- 😡 Angry
- 🤯 Stressed

## 🔐 Future Features

- Password encryption
- Cloud sync
- Calendar view
- Daily reminders
- AI mood inference
- Theme system
- Plugin architecture

## 🤝 Contributing

Contributions welcome! Please:
1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push and open a pull request

## 📄 License

MIT License - feel free to use this in your projects!

## 👤 Author

Your Name - [@yourhandle](https://twitter.com/yourhandle)

## 🙏 Acknowledgments

Built as a professional-grade CLI application showcasing:
- Clean architecture
- Rich UX/UI design
- TypeScript best practices
- Data persistence
- User-respecting interface

---

**Made with ❤️ as a demonstration of professional CLI application design.**