@ftrdotdev/pi-tui 0.5.0 → 0.5.2
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/package.json +7 -7
- package/src/commands/git-execution.ts +2 -1
- package/src/config.ts +0 -1
- package/src/index.ts +1 -0
- package/src/ui/header.test.ts +17 -1
- package/src/ui/preview.test.ts +7 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ftrdotdev/pi-tui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "House TUI components and the pi interface extension: themed boxes, a pure box-frame model, and the header/footer/editor/settings/preview chrome",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
@@ -50,19 +50,19 @@
|
|
|
50
50
|
"lint": "oxlint && oxlint --type-aware -A all -D typescript/unbound-method",
|
|
51
51
|
"lint:fix": "oxlint --fix",
|
|
52
52
|
"fmt": "oxfmt",
|
|
53
|
-
"prepare": "bun effect-tsgo patch --typescript --oxlint",
|
|
54
53
|
"typecheck": "tsc --noEmit"
|
|
55
54
|
},
|
|
56
55
|
"dependencies": {
|
|
57
|
-
"@effect/platform-node": "4.0.0
|
|
58
|
-
"effect": "4.0.0
|
|
56
|
+
"@effect/platform-node": "4.0.0",
|
|
57
|
+
"@effect/platform-node-shared": "4.0.0",
|
|
58
|
+
"effect": "4.0.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@effect/tsgo": "0.
|
|
62
|
-
"@effect/vitest": "4.0.0
|
|
61
|
+
"@effect/tsgo": "0.47.2",
|
|
62
|
+
"@effect/vitest": "4.0.0",
|
|
63
63
|
"@types/bun": "latest",
|
|
64
64
|
"oxfmt": "^0.63.0",
|
|
65
|
-
"oxlint": "1.
|
|
65
|
+
"oxlint": "1.82.0",
|
|
66
66
|
"oxlint-tsgolint": "7.0.2001",
|
|
67
67
|
"typescript": "7.0.2",
|
|
68
68
|
"vitest": "^4.1.10"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
// @effect-diagnostics unstableApiUsage:off
|
|
1
2
|
import { Context, Duration, Effect, Layer, Schema, Stream, PlatformError } from "effect";
|
|
2
|
-
import * as CP from "effect/
|
|
3
|
+
import * as CP from "effect/process";
|
|
3
4
|
|
|
4
5
|
/** Fixed per-invocation time cap applied to every git command (2 seconds). */
|
|
5
6
|
export const GIT_EXECUTION_CAP: Duration.Duration = Duration.seconds(2);
|
package/src/config.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -390,6 +390,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
390
390
|
);
|
|
391
391
|
const gitExecLayer = GitExecutionService.layer.pipe(Layer.provide(nodeLayer));
|
|
392
392
|
const gitLayer = Layer.provide(GitStatusService.layer, gitExecLayer);
|
|
393
|
+
// TODO: remove Node homedir dep
|
|
393
394
|
const previewLayer = PreviewService.make(homedir).pipe(
|
|
394
395
|
Layer.provide(Layer.merge(NodePath.layer, NodeFileSystem.layer)),
|
|
395
396
|
);
|
package/src/ui/header.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assert, it } from "@effect/vitest";
|
|
2
2
|
import { Effect, Random } from "effect";
|
|
3
|
-
import type
|
|
3
|
+
import { VERSION, type Theme } from "@earendil-works/pi-coding-agent";
|
|
4
4
|
import { HeaderRenderService, installHeader } from "./header.ts";
|
|
5
5
|
|
|
6
6
|
// Pixel parity: the header must render byte-identically through makeBorderedBox
|
|
@@ -134,6 +134,22 @@ const EXPECTED: Record<string, string[]> = {
|
|
|
134
134
|
],
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
+
// The header prints the installed pi version. Rewrite the frozen tables so a pi
|
|
138
|
+
// dependency bump does not break pixel parity. A version of a different length
|
|
139
|
+
// changes the top-border padding, so restore each boxed row to its frozen width
|
|
140
|
+
// by adding or removing trailing dashes before the closing corner.
|
|
141
|
+
const FROZEN_VERSION = "v0.84.4";
|
|
142
|
+
for (const [width, lines] of Object.entries(EXPECTED)) {
|
|
143
|
+
EXPECTED[width] = lines.map((line) => {
|
|
144
|
+
if (!line.includes(FROZEN_VERSION)) return line;
|
|
145
|
+
let next = line.replaceAll(FROZEN_VERSION, `v${VERSION}`);
|
|
146
|
+
if (!next.endsWith("\u256e")) return next;
|
|
147
|
+
while (next.length < line.length) next = `${next.slice(0, -1)}\u2500\u256e`;
|
|
148
|
+
while (next.length > line.length) next = `${next.slice(0, -2)}\u256e`;
|
|
149
|
+
return next;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
137
153
|
// Render one width through the service layer entry under the fixed seed.
|
|
138
154
|
const renderHeader = (width: number) =>
|
|
139
155
|
Effect.runSync(
|
package/src/ui/preview.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assert, it } from "@effect/vitest";
|
|
2
2
|
import type {
|
|
3
3
|
ExtensionAPI,
|
|
4
|
-
|
|
4
|
+
ExtensionToolContext,
|
|
5
5
|
Theme,
|
|
6
6
|
ToolDefinition,
|
|
7
7
|
} from "@earendil-works/pi-coding-agent";
|
|
@@ -548,7 +548,7 @@ it("the preview tool registers with the preview name and a path parameter", () =
|
|
|
548
548
|
|
|
549
549
|
it("tool execute returns the exact confirmation stub and the display record for a readable file", async () => {
|
|
550
550
|
const tool = registerTool(makeMemFs({ "/cwd/src/file.md": "# Title" }));
|
|
551
|
-
const ctx = { cwd: "/cwd" } as
|
|
551
|
+
const ctx = { cwd: "/cwd" } as ExtensionToolContext;
|
|
552
552
|
const result = await tool.execute("call-1", { path: "src/file.md" }, undefined, undefined, ctx);
|
|
553
553
|
assert.strictEqual(
|
|
554
554
|
(result.content[0] as { type: "text"; text: string }).text,
|
|
@@ -565,7 +565,7 @@ it("tool execute returns the exact confirmation stub and the display record for
|
|
|
565
565
|
|
|
566
566
|
it("tool execute keeps the model stub for images and returns an image detail record", async () => {
|
|
567
567
|
const tool = registerTool(makeMemFs({}, { "/cwd/pic.png": PNG_BYTES }));
|
|
568
|
-
const ctx = { cwd: "/cwd" } as
|
|
568
|
+
const ctx = { cwd: "/cwd" } as ExtensionToolContext;
|
|
569
569
|
const result = await tool.execute("call-1", { path: "pic.png" }, undefined, undefined, ctx);
|
|
570
570
|
assert.strictEqual(
|
|
571
571
|
(result.content[0] as { type: "text"; text: string }).text,
|
|
@@ -586,7 +586,7 @@ it("tool execute keeps the model stub for images and returns an image detail rec
|
|
|
586
586
|
|
|
587
587
|
it("tool execute returns only the text stub for text files (no image block)", async () => {
|
|
588
588
|
const tool = registerTool(makeMemFs({ "/cwd/file.md": "# Title" }));
|
|
589
|
-
const ctx = { cwd: "/cwd" } as
|
|
589
|
+
const ctx = { cwd: "/cwd" } as ExtensionToolContext;
|
|
590
590
|
const result = await tool.execute("call-1", { path: "file.md" }, undefined, undefined, ctx);
|
|
591
591
|
assert.strictEqual(result.content.length, 1);
|
|
592
592
|
assert.strictEqual((result.content[0] as { type: string }).type, "text");
|
|
@@ -594,14 +594,14 @@ it("tool execute returns only the text stub for text files (no image block)", as
|
|
|
594
594
|
|
|
595
595
|
it("tool execute resolves relative paths against the tool context cwd", async () => {
|
|
596
596
|
const tool = registerTool(makeMemFs({ "/cwd/src/file.md": "# Title" }));
|
|
597
|
-
const ctx = { cwd: "/cwd" } as
|
|
597
|
+
const ctx = { cwd: "/cwd" } as ExtensionToolContext;
|
|
598
598
|
const result = await tool.execute("call-1", { path: "src/file.md" }, undefined, undefined, ctx);
|
|
599
599
|
assert.strictEqual(result.details.path, "/cwd/src/file.md");
|
|
600
600
|
});
|
|
601
601
|
|
|
602
602
|
it("tool execute returns the exact failure stub and error details when the read fails", async () => {
|
|
603
603
|
const tool = registerTool();
|
|
604
|
-
const ctx = { cwd: "/cwd" } as
|
|
604
|
+
const ctx = { cwd: "/cwd" } as ExtensionToolContext;
|
|
605
605
|
const result = await tool.execute("call-1", { path: "missing.md" }, undefined, undefined, ctx);
|
|
606
606
|
const expectedMessage = PlatformError.systemError({
|
|
607
607
|
_tag: "NotFound",
|
|
@@ -626,7 +626,7 @@ it("tool execute returns the exact failure stub and error details when the read
|
|
|
626
626
|
|
|
627
627
|
it("tool execute reports the failure stub when the reference is unresolvable", async () => {
|
|
628
628
|
const tool = registerTool();
|
|
629
|
-
const ctx = { cwd: "/cwd" } as
|
|
629
|
+
const ctx = { cwd: "/cwd" } as ExtensionToolContext;
|
|
630
630
|
const result = await tool.execute(
|
|
631
631
|
"call-1",
|
|
632
632
|
{ path: "file://host/path" },
|