@firstpick/pi-extension-git-footer-status 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +13 -4
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { access } from "node:fs/promises";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
|
-
import { isAbsolute, resolve } from "node:path";
|
|
3
|
+
import { isAbsolute, resolve, sep } from "node:path";
|
|
4
4
|
import type { AssistantMessage } from "@mariozechner/pi-ai";
|
|
5
5
|
import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
6
6
|
import { truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
|
|
@@ -49,7 +49,7 @@ const FOOTER_FLAGS = {
|
|
|
49
49
|
function formatCwd(cwd: string): string {
|
|
50
50
|
const home = homedir();
|
|
51
51
|
if (cwd === home) return "~";
|
|
52
|
-
if (cwd.startsWith(`${home}
|
|
52
|
+
if (cwd.startsWith(`${home}${sep}`)) return `~/${cwd.slice(home.length + 1).split(sep).join("/")}`;
|
|
53
53
|
return cwd;
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -495,8 +495,17 @@ export default function gitFooterStatus(pi: ExtensionAPI) {
|
|
|
495
495
|
const branch = footerData.getGitBranch();
|
|
496
496
|
const cwdWithBranch = `${formatCwd(ctx.cwd)}${branch ? ` (${branch})` : ""}`;
|
|
497
497
|
const cwdText = theme.fg("muted", cwdWithBranch);
|
|
498
|
-
|
|
499
|
-
const
|
|
498
|
+
|
|
499
|
+
const statuses = footerData.getExtensionStatuses();
|
|
500
|
+
const gitStatus = statuses.get("git-footer");
|
|
501
|
+
const otherStatuses = Array.from(statuses.entries())
|
|
502
|
+
.filter(([key, value]) => key !== "git-footer" && Boolean(value))
|
|
503
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
504
|
+
.map(([, value]) => value as string);
|
|
505
|
+
|
|
506
|
+
const combinedStatusParts = [gitStatus, ...otherStatuses].filter(Boolean) as string[];
|
|
507
|
+
const combinedStatus = combinedStatusParts.join(` ${theme.fg("dim", "·")} `);
|
|
508
|
+
const pathGitLine = combinedStatus ? `${cwdText}${theme.fg("dim", " │ ")}${combinedStatus}` : cwdText;
|
|
500
509
|
|
|
501
510
|
// Keep default subtle-grey look even when parts contain their own ANSI colors.
|
|
502
511
|
// Wrapping the whole line once is not enough because inner color resets cancel outer dim.
|
package/package.json
CHANGED