Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 27, 2025

Implements interactive terminal UI for editing blog posts using the native EDITOR environment variable.

Implementation

  • CLI Tool (bin/edit-posts.tsx)

    • ink-based React interface with arrow-key navigation
    • Visual publish status indicators (✓/○)
    • Spawns user's EDITOR with temporary file containing frontmatter + body
    • Parses edited content and updates database via Kysely
  • Build Pipeline

    • Separate TypeScript config for ESM module output
    • Auto-generates package.json with "type": "module" in dist
    • Build command: npm run build-edit-posts-cli
  • Frontmatter Parsing

    • Regex pattern (.*) handles empty values correctly
    • Type-safe parsing: Record<string, string | number | null>
    • Converts boolean/null fields for SQLite compatibility

Dependencies

Added ink@5 ecosystem (React 18 compatible):

  • ink, ink-select-input, ink-text-input, chalk@4

Usage

npm run edit-posts                    # Uses $EDITOR (default: vim)
EDITOR=nano npm run edit-posts        # Override editor

Post format in editor:

---
title: My Post
description: Post description
slug: my-post
published: true
publish_date: 2024-01-15
---

Post body in markdown...
Original prompt

Use ink to build a CLI that allows editing posts in native terminal EDTIOR (env definig default editor) https://github.com/vadimdemedes/ink


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Oct 27, 2025
Copilot AI and others added 3 commits October 27, 2025 02:48
Co-authored-by: ncrmro <8276365+ncrmro@users.noreply.github.com>
Co-authored-by: ncrmro <8276365+ncrmro@users.noreply.github.com>
Co-authored-by: ncrmro <8276365+ncrmro@users.noreply.github.com>
Copilot AI changed the title [WIP] Add CLI for editing posts in terminal editor Add ink-based CLI for editing posts in terminal editor Oct 27, 2025
Copilot AI requested a review from ncrmro October 27, 2025 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants