Skip to content
AccidentalAntenna
All projects

1 min read

A task log for the terminal

A small command-line tool that records what I worked on and prints the day’s log as Markdown.

Laptop and external monitor displaying code in a dim workspace
A terminal-centered workspace, used to illustrate the environment this tool is built for. Photo by Glen Carrie

Capture the note before I forget it

I wanted to save a line about what I’d finished without opening a task manager. The command accepts a short note and appends it to a JSON Lines file. With one record per line, I can inspect the file with a text editor or pipe it through another script.

import { appendFile } from "node:fs/promises";

async function addNote(path: string, note: string) {
  const text = note.trim();
  if (!text) throw new Error("Enter a note to save.");

  const record = { timestamp: new Date().toISOString(), text };
  await appendFile(path, JSON.stringify(record) + "\n", "utf8");
}

I store timestamps in UTC, then group them by calendar day in my local timezone when rendering the log. That makes a note I enter after dinner land on the same day I remember writing it. A second command prints the result as Markdown for pasting into a project journal.

The first thing I added after trying it for a week was a warning for a malformed record that includes its line number. That made it much easier to recover from a typo after editing the file by hand.

Comments

Share a thought about this project. Comments appear after approval.

    Loading comments…