feat(coding-agent): address PR comments and improve reftable support

This commit is contained in:
Matt Anger
2026-06-10 08:26:00 +02:00
committed by can1357
parent 65c56db2f5
commit 2e31abcc16
4 changed files with 170 additions and 55 deletions
@@ -1,4 +1,5 @@
import * as fs from "node:fs";
import * as path from "node:path";
import { stripVTControlCharacters } from "node:util";
import { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
import { type Component, padding, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui";
@@ -65,7 +66,8 @@ export class FooterComponent implements Component {
}
try {
this.#gitWatcher = fs.watch(head.headPath, () => {
const watchPath = head.isReftable ? path.join(head.commonDir, "reftable", "tables.list") : head.headPath;
this.#gitWatcher = fs.watch(watchPath, () => {
this.#cachedBranch = undefined; // Invalidate cache
if (this.#onBranchChange) {
this.#onBranchChange();
@@ -1,4 +1,5 @@
import * as fs from "node:fs";
import * as path from "node:path";
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
import { estimateTokens } from "@oh-my-pi/pi-agent-core/compaction";
import { type Component, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui";
@@ -238,11 +239,15 @@ export class StatusLineComponent implements Component {
this.#gitWatcher = null;
}
const gitHeadPath = git.repo.resolveSync(getProjectDir())?.headPath ?? null;
if (!gitHeadPath) return;
const repository = git.repo.resolveSync(getProjectDir());
if (!repository) return;
const watchPath = git.repo.isReftableSync(repository)
? path.join(repository.commonDir, "reftable", "tables.list")
: repository.headPath;
try {
this.#gitWatcher = fs.watch(gitHeadPath, () => {
this.#gitWatcher = fs.watch(watchPath, () => {
this.#invalidateGitCaches();
if (this.#onBranchChange) {
this.#onBranchChange();