From 835435ad393e130008b05fa0281590542af29e9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Volf?= Date: Tue, 26 May 2026 12:27:33 +0200 Subject: [PATCH 1/2] Add "edit" command for manual workfile editing --- index.ts | 4 ++++ lib/edit.ts | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 lib/edit.ts diff --git a/index.ts b/index.ts index 62f9b7a..277c3ed 100644 --- a/index.ts +++ b/index.ts @@ -8,6 +8,7 @@ import { getRunningWork, resolveWorkfilePath, } from "./lib/workfile.ts"; +import { openWorkfileForEdit } from "./lib/edit.ts"; const config = await loadConfig(); const WORKFILE_PATH = await resolveWorkfilePath({ @@ -66,6 +67,9 @@ async function run(command: string) { case "status": await summary(WORKFILE_PATH, config.summary); break; + case "edit": + openWorkfileForEdit(WORKFILE_PATH); + break; default: panic(`Unknown command: ${command}`); } diff --git a/lib/edit.ts b/lib/edit.ts new file mode 100644 index 0000000..95e04b9 --- /dev/null +++ b/lib/edit.ts @@ -0,0 +1,7 @@ +import { execSync } from "node:child_process"; + +export function openWorkfileForEdit(path: string): void { + const editor = process.env["EDITOR"] || "vim"; + const command = `${editor} ${path}`; + execSync(command, { stdio: ["ignore", "inherit", "inherit"] }); +} From 66347a33ddf22e246cb384e5838205402b21953f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Volf?= Date: Thu, 4 Jun 2026 17:29:55 +0200 Subject: [PATCH 2/2] Print config after `work edit` invocation --- index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/index.ts b/index.ts index 277c3ed..a7e8b5d 100644 --- a/index.ts +++ b/index.ts @@ -69,6 +69,7 @@ async function run(command: string) { break; case "edit": openWorkfileForEdit(WORKFILE_PATH); + await summary(WORKFILE_PATH, config.summary); break; default: panic(`Unknown command: ${command}`);