From 1f59cbca7b250a32a6c5839b62b2e9cc9b90381a Mon Sep 17 00:00:00 2001 From: mitchell Date: Wed, 15 Apr 2026 16:14:11 -0400 Subject: [PATCH] feat: write to the same files in homedir everytime --- index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/index.ts b/index.ts index bff4871..f7068c9 100644 --- a/index.ts +++ b/index.ts @@ -1,3 +1,4 @@ +import os from "node:os"; import { createOpenAICompatible } from "@ai-sdk/openai-compatible"; import { streamText } from "ai"; @@ -17,14 +18,18 @@ const { fullStream, reasoningText, text } = streamText({ renderStream(fullStream); +const home = os.homedir(); +const reasoningPath = `${home}/.aicl_reasoning.md`; +const responsePath = `${home}/.aicl_response.md`; + const reasoning = await reasoningText; -Bun.file("reasoning.md").write(reasoning ?? ""); +await Bun.file(reasoningPath).write(reasoning ?? ""); const response = await text; -Bun.file("response.md").write(response); +await Bun.file(responsePath).write(response); const [numColumns] = process.stdout.getWindowSize(); Bun.spawnSync({ - cmd: ["glow", "-w", `${numColumns}`, "response.md"], + cmd: ["glow", "-w", `${numColumns}`, responsePath], stdio: ["inherit", "inherit", "inherit"], });