repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

remove unused pi extensions

91a8424e9c8b92379c19f41b38c49ca24d57278c

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (23)

pi/agent/extensions/diff-render/__tests__/render.test.ts

Deleted
deleted file mode 100644
1 -import { describe, expect, test } from "bun:test";
2 -import { initTheme, type Theme } from "@mariozechner/pi-coding-agent";
3 -import { visibleWidth } from "@mariozechner/pi-tui";
4 -import type { DiffRenderPayload } from "../model";
5 -import { normalizeToolPath, scrubLine } from "../model";
6 -import { DiffRenderComponent } from "../render";
8 -const theme = {
9 - fg: (_name: string, text: string) => text,
10 - bg: (_name: string, text: string) => text,
11 - bold: (text: string) => text,
12 -} as Theme;
14 -initTheme("dark");
16 -const payload: DiffRenderPayload = {
17 - diff: [
18 - "@@ -1,3 +1,3 @@",
19 - " 1 # TODO",
20 - "-2 bad",
21 - "+2 good",
22 - " 3 done",
23 - "@@ -9,2 +9,2 @@",
24 - "-9 expandaple",
25 - "+9 expandable",
26 - ].join("\n"),
27 - stats: { files: 1, additions: 2, deletions: 2, hunks: 2 },
28 -};
30 -describe("diff-render model", () => {
31 - test("normalizes @ paths", () => {
32 - expect(normalizeToolPath("@agent/extensions/TODO.md")).toBe("agent/extensions/TODO.md");
33 - expect(normalizeToolPath("agent/extensions/TODO.md")).toBe("agent/extensions/TODO.md");
34 - });
36 - test("scrubs physical newlines", () => {
37 - expect(scrubLine("hello\n")).toBe("hello");
38 - expect(scrubLine("a\nb")).toBe("a↵b");
39 - });
40 -});
42 -describe("DiffRenderComponent", () => {
43 - test("collapsed summary is one padded line", () => {
44 - const lines = new DiffRenderComponent(payload, theme, false).render(60);
45 - expect(lines).toHaveLength(1);
46 - expect(visibleWidth(lines[0]!)).toBe(60);
47 - expect(lines[0]).toContain("1 file +2 -2 2 hunks");
48 - });
50 - test("expanded layout fits width and contains no physical newlines", () => {
51 - const lines = new DiffRenderComponent(payload, theme, true).render(80);
52 - for (const line of lines) {
53 - expect(line).not.toMatch(/[\r\n]/);
54 - expect(visibleWidth(line)).toBeLessThanOrEqual(80);
55 - }
56 - });
58 - test("expanded layout does not duplicate file header", () => {
59 - const lines = new DiffRenderComponent(payload, theme, true).render(80);
60 - expect(lines.some((line) => line.includes("TODO.md"))).toBe(false);
61 - });
62 -});

pi/agent/extensions/diff-render/bun.lock

Deleted
deleted file mode 100644
1 -{
2 - "lockfileVersion": 1,
3 - "configVersion": 1,
4 - "workspaces": {
5 - "": {
6 - "name": "@bugabinga/pi-ext-diff-render",
7 - "dependencies": {
8 - "@pierre/diffs": "^1.1.22",
9 - },
10 - "peerDependencies": {
11 - "@mariozechner/pi-coding-agent": "*",
12 - "@mariozechner/pi-tui": "*",
13 - },
14 - },
15 - },
16 - "packages": {
17 - "@anthropic-ai/sdk": ["@anthropic-ai/sdk@0.91.1", "", { "dependencies": { "json-schema-to-ts": "^3.1.1" }, "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" }, "optionalPeers": ["zod"], "bin": { "anthropic-ai-sdk": "bin/cli" } }, "sha512-LAmu761tSN9r66ixvmciswUj/ZC+1Q4iAfpedTfSVLeswRwnY3n2Nb6Tsk+cLPP28aLOPWeMgIuTuCcMC6W/iw=="],
19 - "@aws-crypto/crc32": ["@aws-crypto/crc32@5.2.0", "", { "dependencies": { "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "tslib": "^2.6.2" } }, "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg=="],
21 - "@aws-crypto/sha256-browser": ["@aws-crypto/sha256-browser@5.2.0", "", { "dependencies": { "@aws-crypto/sha256-js": "^5.2.0", "@aws-crypto/supports-web-crypto": "^5.2.0", "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "@aws-sdk/util-locate-window": "^3.0.0", "@smithy/util-utf8": "^2.0.0", "tslib": "^2.6.2" } }, "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw=="],
23 - "@aws-crypto/sha256-js": ["@aws-crypto/sha256-js@5.2.0", "", { "dependencies": { "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "tslib": "^2.6.2" } }, "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA=="],
25 - "@aws-crypto/supports-web-crypto": ["@aws-crypto/supports-web-crypto@5.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg=="],
27 - "@aws-crypto/util": ["@aws-crypto/util@5.2.0", "", { "dependencies": { "@aws-sdk/types": "^3.222.0", "@smithy/util-utf8": "^2.0.0", "tslib": "^2.6.2" } }, "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ=="],
29 - "@aws-sdk/client-bedrock-runtime": ["@aws-sdk/client-bedrock-runtime@3.1048.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "^3.974.11", "@aws-sdk/credential-provider-node": "^3.972.42", "@aws-sdk/eventstream-handler-node": "^3.972.16", "@aws-sdk/middleware-eventstream": "^3.972.12", "@aws-sdk/middleware-websocket": "^3.972.19", "@aws-sdk/token-providers": "3.1048.0", "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/fetch-http-handler": "^5.4.2", "@smithy/node-http-handler": "^4.7.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-u+NT61JZEkRFtpL0CAw1N1dwxnaLgwVXQl/zjJxTGgLyS/jTIdg2SdoEoCTHxgDyCnqa1HEi9QOoE9/pYRNpOQ=="],
31 - "@aws-sdk/core": ["@aws-sdk/core@3.974.11", "", { "dependencies": { "@aws-sdk/types": "^3.973.8", "@aws-sdk/xml-builder": "^3.972.24", "@aws/lambda-invoke-store": "^0.2.2", "@smithy/core": "^3.24.2", "@smithy/signature-v4": "^5.4.2", "@smithy/types": "^4.14.1", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-QpnINq5FZH6EOaDEkmHdT7eUunbvD27pDNQypaWjFyYz7Zl1q3UCMQErBZxpmfGfI7MvI2TlK8KTkgNpv8b1ug=="],
33 - "@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.37", "", { "dependencies": { "@aws-sdk/core": "^3.974.11", "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-/jpPvEh6f7ntmIzf7dNxoNX6Q8vt8UpesCjbW6mFfk4V1NW6bIy9qxcQ6WbA8As5yQhsZOe+xeNd4xHX8kdY2Q=="],
35 - "@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.39", "", { "dependencies": { "@aws-sdk/core": "^3.974.11", "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/fetch-http-handler": "^5.4.2", "@smithy/node-http-handler": "^4.7.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-pIgTpisWyWg7X1bUbzSjuUYosYTD0Ghz2M0hkSTmb3a6i3qV3uU+NYJPI/E2XSC0HcsZh5rsLPzeXrkb2DS0Cg=="],
37 - "@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.972.41", "", { "dependencies": { "@aws-sdk/core": "^3.974.11", "@aws-sdk/credential-provider-env": "^3.972.37", "@aws-sdk/credential-provider-http": "^3.972.39", "@aws-sdk/credential-provider-login": "^3.972.41", "@aws-sdk/credential-provider-process": "^3.972.37", "@aws-sdk/credential-provider-sso": "^3.972.41", "@aws-sdk/credential-provider-web-identity": "^3.972.41", "@aws-sdk/nested-clients": "^3.997.9", "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/credential-provider-imds": "^4.3.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-u2tyjaxJJzW8UtW4SM1ZcPMDwO6y+kV+llvou+Adts0FAKyzes5jG4izQN+KX3yE8ZROpS5y1LJ//xL2iSf76w=="],
39 - "@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.41", "", { "dependencies": { "@aws-sdk/core": "^3.974.11", "@aws-sdk/nested-clients": "^3.997.9", "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-0LBitxXiAiaE5nlFPfpNIww/8FRY/I7WIndWsc9GmNFOM7cE1wNpVNQEGEk9Outg5l8xl+3vybxFyUy4l9q/LQ=="],
41 - "@aws-sdk/credential-provider-node": ["@aws-sdk/credential-provider-node@3.972.42", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.37", "@aws-sdk/credential-provider-http": "^3.972.39", "@aws-sdk/credential-provider-ini": "^3.972.41", "@aws-sdk/credential-provider-process": "^3.972.37", "@aws-sdk/credential-provider-sso": "^3.972.41", "@aws-sdk/credential-provider-web-identity": "^3.972.41", "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/credential-provider-imds": "^4.3.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-D4oon2zbqqsWOJUM99Gm3/ZyJ0IJvTXVN3PyloGb3kQEyI36fjCZheZj422lAgTWWd6TSHgiImLt3RIaLdv3dQ=="],
43 - "@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.37", "", { "dependencies": { "@aws-sdk/core": "^3.974.11", "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-7nVaHBUaWIddASYfVaA9O4D5ZVjewU3sCol9WqZPGfW0nR+0WqE0xHZnD/U2L33PlOB8KNXGKZ6wOES/QijKzg=="],
45 - "@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.972.41", "", { "dependencies": { "@aws-sdk/core": "^3.974.11", "@aws-sdk/nested-clients": "^3.997.9", "@aws-sdk/token-providers": "3.1048.0", "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-IOWAWEHe5LkjSKkkUUX9ciV6Y1scHTsnfEkdt5yyC4Slrc7AGbkLPrpntjqh18ksJAMOaVhoBsO8p2WyTcY2wQ=="],
47 - "@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.41", "", { "dependencies": { "@aws-sdk/core": "^3.974.11", "@aws-sdk/nested-clients": "^3.997.9", "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-mbACk9Yypa8nm4iGZLs0PofOXEcTDOUw6wDnsPXNDNSd2WNXs1tSo+6nc/fh0jLYdfVZThhBL98PHW4aXFsG5A=="],
49 - "@aws-sdk/eventstream-handler-node": ["@aws-sdk/eventstream-handler-node@3.972.16", "", { "dependencies": { "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-yedpPgKftqjU5SlPFHfqWpOw6xSCRieWRG1euWOlXn4WJxt2VX92VprCa2PpSOXjVCAeK6dTjW9eJRXVig9yGA=="],
51 - "@aws-sdk/middleware-eventstream": ["@aws-sdk/middleware-eventstream@3.972.12", "", { "dependencies": { "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-tHTHHCHNrq6XklQvlzHBDJG4Iuhh7NVPRdtmvP+nHFA+5sxPlIDzlAHHgfoYHGvT3NXP1yVP/L5c3opUn6T3Qg=="],
53 - "@aws-sdk/middleware-websocket": ["@aws-sdk/middleware-websocket@3.972.19", "", { "dependencies": { "@aws-sdk/core": "^3.974.11", "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/fetch-http-handler": "^5.4.2", "@smithy/signature-v4": "^5.4.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-mkEhOGYozqKQkbFaVrjwr0faiwwZza1v5/jSY6Tucm3bD+uKTazIUH/4Yo6aMnQD2ua2W9cMP6s8mvwTcjtqHw=="],
55 - "@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.9", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "^3.974.11", "@aws-sdk/signature-v4-multi-region": "^3.996.27", "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/fetch-http-handler": "^5.4.2", "@smithy/node-http-handler": "^4.7.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-jPR3rnmRI4hWYyzfmTGBr7NblMp8QYYeflHXba1H6+7CGrWVqWKQzaXFQ4qbExqPRsXN3T3L3JxFhr6aouXUGQ=="],
57 - "@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.27", "", { "dependencies": { "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/signature-v4": "^5.4.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-0Phbz4t6HI3D3skxvG2uI+VWU034/nSIw1T8d+FPzzQG9EQTrw94o9mOKO2Gv3n3Oc8P7JD7RAUxkoneLWv5Eg=="],
59 - "@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1048.0", "", { "dependencies": { "@aws-sdk/core": "^3.974.11", "@aws-sdk/nested-clients": "^3.997.9", "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-k0y/GcuesuSfWyUM0WamrGyeZmltRYaPbHO82UDA6mZ/doB+FOHKutikPAtSXMn/hDz970cF+iRuuiYO9VEbAA=="],
61 - "@aws-sdk/types": ["@aws-sdk/types@3.973.8", "", { "dependencies": { "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-gjlAdtHMbtR9X5iIhVUvbVcy55KnznpC6bkDUWW9z915bi0ckdUr5cjf16Kp6xq0bP5HBD2xzgbL9F9Quv5vUw=="],
63 - "@aws-sdk/util-locate-window": ["@aws-sdk/util-locate-window@3.965.5", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-WhlJNNINQB+9qtLtZJcpQdgZw3SCDCpXdUJP7cToGwHbCWCnRckGlc6Bx/OhWwIYFNAn+FIydY8SZ0QmVu3xTQ=="],
65 - "@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.24", "", { "dependencies": { "@nodable/entities": "2.1.0", "@smithy/types": "^4.14.1", "fast-xml-parser": "5.7.3", "tslib": "^2.6.2" } }, "sha512-V8z5YcDPfsvzrBlj0xR1vhRtocblhYbqdreCJB/voGd4Sr5zjNAeWxexbnqVtskTJe0vFb5KMqbSL++ePl+zRw=="],
67 - "@aws/lambda-invoke-store": ["@aws/lambda-invoke-store@0.2.4", "", {}, "sha512-iY8yvjE0y651BixKNPgmv1WrQc+GZ142sb0z4gYnChDDY2YqI4P/jsSopBWrKfAt7LOJAkOXt7rC/hms+WclQQ=="],
69 - "@babel/runtime": ["@babel/runtime@7.29.2", "", {}, "sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g=="],
71 - "@borewit/text-codec": ["@borewit/text-codec@0.2.2", "", {}, "sha512-DDaRehssg1aNrH4+2hnj1B7vnUGEjU6OIlyRdkMd0aUdIUvKXrJfXsy8LVtXAy7DRvYVluWbMspsRhz2lcW0mQ=="],
73 - "@google/genai": ["@google/genai@1.52.0", "", { "dependencies": { "google-auth-library": "^10.3.0", "p-retry": "^4.6.2", "protobufjs": "^7.5.4", "ws": "^8.18.0" }, "peerDependencies": { "@modelcontextprotocol/sdk": "^1.25.2" }, "optionalPeers": ["@modelcontextprotocol/sdk"] }, "sha512-gwSvbpiN/17O9TbsqSsE/OzZcpv5Fo4RQjdngGgogtuB9RsyJ8ZHhX5KjHj1bp5N9snN2eK8LDGXSaWW2hof8Q=="],
75 - "@mariozechner/clipboard": ["@mariozechner/clipboard@0.3.6", "", { "optionalDependencies": { "@mariozechner/clipboard-darwin-arm64": "0.3.6", "@mariozechner/clipboard-darwin-universal": "0.3.6", "@mariozechner/clipboard-darwin-x64": "0.3.6", "@mariozechner/clipboard-linux-arm64-gnu": "0.3.6", "@mariozechner/clipboard-linux-arm64-musl": "0.3.6", "@mariozechner/clipboard-linux-riscv64-gnu": "0.3.6", "@mariozechner/clipboard-linux-x64-gnu": "0.3.6", "@mariozechner/clipboard-linux-x64-musl": "0.3.6", "@mariozechner/clipboard-win32-arm64-msvc": "0.3.6", "@mariozechner/clipboard-win32-x64-msvc": "0.3.6" } }, "sha512-MXdtr+6+ntlIVHdrZYuZNQydu6o8yZswFJ2Ln81j2O/Y9B/LDHvEaIm95xWNPkjGTWriSOeLnQJRFs6dYb60bg=="],
77 - "@mariozechner/clipboard-darwin-arm64": ["@mariozechner/clipboard-darwin-arm64@0.3.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-HjaisYCAbHi/1+N1yDAQHc8ZXGffufIUT5NSOSVR3f3AuMDusxTtnbK8tZ7JFDkShua1oNGZoNwQHsc8MPtE0Q=="],
79 - "@mariozechner/clipboard-darwin-universal": ["@mariozechner/clipboard-darwin-universal@0.3.6", "", { "os": "darwin" }, "sha512-8BWtPjOtJOJoykml3w0fx0zRrfWP31mXrJwfoA7xzNprkZw1uolCNfgmjDiVBseoKjp16EGITz7bN+61qn8dWA=="],
81 - "@mariozechner/clipboard-darwin-x64": ["@mariozechner/clipboard-darwin-x64@0.3.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-p9syiZD1kU4I+1ya7f7g+zD1GiUvR8fdlRlNmgsZNWlyjtc8rlV2EjTLd/35x1LsdBq020GVvtzp0ZmPgBI09Q=="],
83 - "@mariozechner/clipboard-linux-arm64-gnu": ["@mariozechner/clipboard-linux-arm64-gnu@0.3.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-5JFf5rGofrm+V29HNF+wLthXphHdQpMbKDUYJ5tML6/Z5DLlLOV/9Ak4kDPtYyZ+Dzf+kAusE0VsFg4+tfP1IA=="],
85 - "@mariozechner/clipboard-linux-arm64-musl": ["@mariozechner/clipboard-linux-arm64-musl@0.3.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-JlVjxxw0GbGC0djXYWRIqyteO3J1KZ/QG3udlEFaOD5TLOM1FnmXXAPDQBqr+aBVr720ef9K00dirYnJ0LDCtw=="],
87 - "@mariozechner/clipboard-linux-riscv64-gnu": ["@mariozechner/clipboard-linux-riscv64-gnu@0.3.6", "", { "os": "linux", "cpu": "none" }, "sha512-4t8BUi5zZ+L77otFQVnVSlaTyAX4TVk9EqQm4syMrEQp96trFEHEwwNHcNEBGzYv5+K7mxay50TthYkz47OWzQ=="],
89 - "@mariozechner/clipboard-linux-x64-gnu": ["@mariozechner/clipboard-linux-x64-gnu@0.3.6", "", { "os": "linux", "cpu": "x64" }, "sha512-trtPwcNLW37irwQCJLtCxLw757jjJZk3TSnY/MU9bhtWtA3K9b/eLW0e4RGhUXDoFRds9opNWWaUDuFLa8dm0w=="],
91 - "@mariozechner/clipboard-linux-x64-musl": ["@mariozechner/clipboard-linux-x64-musl@0.3.6", "", { "os": "linux", "cpu": "x64" }, "sha512-WfnzIvOCCWQiN0MmltCEo6cLceUDbYe+I7xyFZjaps5A+2Op/M2CY7Rey+C4ucQhrvmpoHmTSFgY9ODWk7snoA=="],
93 - "@mariozechner/clipboard-win32-arm64-msvc": ["@mariozechner/clipboard-win32-arm64-msvc@0.3.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-+8+1aHYsBPUjmW3otmWlg+Hijt0iJvoBBs5e0mxFeUd4gDaKMB8Bn6x7c6KVtscg7E5j5NFXnwQqNSIAO4p8zQ=="],
95 - "@mariozechner/clipboard-win32-x64-msvc": ["@mariozechner/clipboard-win32-x64-msvc@0.3.6", "", { "os": "win32", "cpu": "x64" }, "sha512-S4xfPmERC8ZkiLHe3vekZCjdDwNEETCuvCgQK2kP6/TnvmUkq1y2Pk+DjM4t8uh9KMX9bH4zs5ePcKa8GTXmfg=="],
97 - "@mariozechner/pi-agent-core": ["@mariozechner/pi-agent-core@0.73.1", "", { "dependencies": { "@mariozechner/pi-ai": "^0.73.1", "typebox": "^1.1.24" } }, "sha512-Y/KVOhuKSgRQgYBlwmRtO2gPkUcoavOSqGF9bpQIINvNZvc19k6Z1H3bFDTce3Vp5ApMmTsfLH3+tNvOg75fAQ=="],
99 - "@mariozechner/pi-ai": ["@mariozechner/pi-ai@0.73.1", "", { "dependencies": { "@anthropic-ai/sdk": "^0.91.1", "@aws-sdk/client-bedrock-runtime": "^3.1030.0", "@google/genai": "^1.40.0", "@mistralai/mistralai": "^2.2.0", "chalk": "^5.6.2", "openai": "6.26.0", "partial-json": "^0.1.7", "proxy-agent": "^6.5.0", "typebox": "^1.1.24", "undici": "^7.19.1", "zod-to-json-schema": "^3.24.6" }, "bin": { "pi-ai": "dist/cli.js" } }, "sha512-Jh4lXawZYuC83HzSIYuVum9NBqJD49i4JOt3H96cGW/924cwJMOyUs1Mv/e4QPzTXnzrqMoGviNQnvGgSu1LSg=="],
101 - "@mariozechner/pi-coding-agent": ["@mariozechner/pi-coding-agent@0.73.1", "", { "dependencies": { "@mariozechner/pi-agent-core": "^0.73.1", "@mariozechner/pi-ai": "^0.73.1", "@mariozechner/pi-tui": "^0.73.1", "@silvia-odwyer/photon-node": "^0.3.4", "chalk": "^5.5.0", "cli-highlight": "^2.1.11", "diff": "^8.0.2", "extract-zip": "^2.0.1", "file-type": "^21.1.1", "glob": "^13.0.1", "hosted-git-info": "^9.0.2", "ignore": "^7.0.5", "jiti": "^2.7.0", "marked": "^15.0.12", "minimatch": "^10.2.3", "proper-lockfile": "^4.1.2", "strip-ansi": "^7.1.0", "typebox": "^1.1.24", "undici": "^7.19.1", "uuid": "^14.0.0", "yaml": "^2.8.2" }, "optionalDependencies": { "@mariozechner/clipboard": "^0.3.5" }, "bin": { "pi": "dist/cli.js" } }, "sha512-gXQh3SaZmWTfVMc4Ao5+LGbVeKvzyO7tolok0nLsZgq9nGjZx/EEU3NM8C+qUnB4Nvs2rswG5qOVgLzQkq0fHQ=="],
103 - "@mariozechner/pi-tui": ["@mariozechner/pi-tui@0.73.1", "", { "dependencies": { "@types/mime-types": "^2.1.4", "chalk": "^5.5.0", "get-east-asian-width": "^1.3.0", "marked": "^15.0.12", "mime-types": "^3.0.1" }, "optionalDependencies": { "koffi": "^2.9.0" } }, "sha512-ybVsRnUbzQRtbocltJ2OXb2QogrO67N2BlUyKjZz9BHcZYiDJtNkcKQockxDjsVvDc0uBCLDX6iZJoBElBd8fw=="],
105 - "@mistralai/mistralai": ["@mistralai/mistralai@2.2.1", "", { "dependencies": { "ws": "^8.18.0", "zod": "^3.25.0 || ^4.0.0", "zod-to-json-schema": "^3.25.0" } }, "sha512-uKU8CZmL2RzYKmplsU01hii4p3pe4HqJefpWNRWXm1Tcm0Sm4xXfwSLIy4k7ZCPlbETCGcp69E7hZs+WOJ5itQ=="],
107 - "@nodable/entities": ["@nodable/entities@2.1.0", "", {}, "sha512-nyT7T3nbMyBI/lvr6L5TyWbFJAI9FTgVRakNoBqCD+PmID8DzFrrNdLLtHMwMszOtqZa8PAOV24ZqDnQrhQINA=="],
109 - "@pierre/diffs": ["@pierre/diffs@1.1.22", "", { "dependencies": { "@pierre/theme": "0.0.28", "@shikijs/transformers": "^3.0.0", "diff": "8.0.3", "hast-util-to-html": "9.0.5", "lru_map": "0.4.1", "shiki": "^3.0.0" }, "peerDependencies": { "react": "^18.3.1 || ^19.0.0", "react-dom": "^18.3.1 || ^19.0.0" } }, "sha512-1Iv7kdl6OABFCd1n2HQbGUiRHouXPaHoIjcb7Lwg8zeJKY5ph+cESFcGEyIiwW0NCbKGtYS2bTnXmI+Eze5dwg=="],
111 - "@pierre/theme": ["@pierre/theme@0.0.28", "", {}, "sha512-1j/H/fECBuc9dEvntdWI+l435HZapw+RCJTlqCA6BboQ5TjlnE005j/ROWutXIs8aq5OAc82JI2Kwk4A1WWBgw=="],
113 - "@protobufjs/aspromise": ["@protobufjs/aspromise@1.1.2", "", {}, "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ=="],
115 - "@protobufjs/base64": ["@protobufjs/base64@1.1.2", "", {}, "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="],
117 - "@protobufjs/codegen": ["@protobufjs/codegen@2.0.5", "", {}, "sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g=="],
119 - "@protobufjs/eventemitter": ["@protobufjs/eventemitter@1.1.0", "", {}, "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q=="],
121 - "@protobufjs/fetch": ["@protobufjs/fetch@1.1.0", "", { "dependencies": { "@protobufjs/aspromise": "^1.1.1", "@protobufjs/inquire": "^1.1.0" } }, "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ=="],
123 - "@protobufjs/float": ["@protobufjs/float@1.0.2", "", {}, "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ=="],
125 - "@protobufjs/inquire": ["@protobufjs/inquire@1.1.1", "", {}, "sha512-mnzgDV26ueAvk7rsbt9L7bE0SuAoqyuys/sMMrmVcN5x9VsxpcG3rqAUSgDyLp0UZlmNfIbQ4fHfCtreVBk8Ew=="],
127 - "@protobufjs/path": ["@protobufjs/path@1.1.2", "", {}, "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA=="],
129 - "@protobufjs/pool": ["@protobufjs/pool@1.1.0", "", {}, "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw=="],
131 - "@protobufjs/utf8": ["@protobufjs/utf8@1.1.1", "", {}, "sha512-oOAWABowe8EAbMyWKM0tYDKi8Yaox52D+HWZhAIJqQXbqe0xI/GV7FhLWqlEKreMkfDjshR5FKgi3mnle0h6Eg=="],
133 - "@shikijs/core": ["@shikijs/core@3.23.0", "", { "dependencies": { "@shikijs/types": "3.23.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.5" } }, "sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA=="],
135 - "@shikijs/engine-javascript": ["@shikijs/engine-javascript@3.23.0", "", { "dependencies": { "@shikijs/types": "3.23.0", "@shikijs/vscode-textmate": "^10.0.2", "oniguruma-to-es": "^4.3.4" } }, "sha512-aHt9eiGFobmWR5uqJUViySI1bHMqrAgamWE1TYSUoftkAeCCAiGawPMwM+VCadylQtF4V3VNOZ5LmfItH5f3yA=="],
137 - "@shikijs/engine-oniguruma": ["@shikijs/engine-oniguruma@3.23.0", "", { "dependencies": { "@shikijs/types": "3.23.0", "@shikijs/vscode-textmate": "^10.0.2" } }, "sha512-1nWINwKXxKKLqPibT5f4pAFLej9oZzQTsby8942OTlsJzOBZ0MWKiwzMsd+jhzu8YPCHAswGnnN1YtQfirL35g=="],
139 - "@shikijs/langs": ["@shikijs/langs@3.23.0", "", { "dependencies": { "@shikijs/types": "3.23.0" } }, "sha512-2Ep4W3Re5aB1/62RSYQInK9mM3HsLeB91cHqznAJMuylqjzNVAVCMnNWRHFtcNHXsoNRayP9z1qj4Sq3nMqYXg=="],
141 - "@shikijs/themes": ["@shikijs/themes@3.23.0", "", { "dependencies": { "@shikijs/types": "3.23.0" } }, "sha512-5qySYa1ZgAT18HR/ypENL9cUSGOeI2x+4IvYJu4JgVJdizn6kG4ia5Q1jDEOi7gTbN4RbuYtmHh0W3eccOrjMA=="],
143 - "@shikijs/transformers": ["@shikijs/transformers@3.23.0", "", { "dependencies": { "@shikijs/core": "3.23.0", "@shikijs/types": "3.23.0" } }, "sha512-F9msZVxdF+krQNSdQ4V+Ja5QemeAoTQ2jxt7nJCwhDsdF1JWS3KxIQXA3lQbyKwS3J61oHRUSv4jYWv3CkaKTQ=="],
145 - "@shikijs/types": ["@shikijs/types@3.23.0", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ=="],
147 - "@shikijs/vscode-textmate": ["@shikijs/vscode-textmate@10.0.2", "", {}, "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg=="],
149 - "@silvia-odwyer/photon-node": ["@silvia-odwyer/photon-node@0.3.4", "", {}, "sha512-bnly4BKB3KDTFxrUIcgCLbaeVVS8lrAkri1pEzskpmxu9MdfGQTy8b8EgcD83ywD3RPMsIulY8xJH5Awa+t9fA=="],
151 - "@smithy/core": ["@smithy/core@3.24.3", "", { "dependencies": { "@aws-crypto/crc32": "5.2.0", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-Ep/7tPamGY8mgESE3LyLKtxJyy6U52WWAqr/3wial47Sj4u3PiIF73AOGI27UyLy9duTkhZbgzodOfLV4TduZg=="],
153 - "@smithy/credential-provider-imds": ["@smithy/credential-provider-imds@4.3.3", "", { "dependencies": { "@smithy/core": "^3.24.3", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-I2Bti0DKFo2IJyN28ijCsx51BAumEYR4/1yZ1FXyBygy9MqbnMqCev4JPth/MbpRfBSRAX35hITSnAdJRo1u5w=="],
155 - "@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.4.3", "", { "dependencies": { "@smithy/core": "^3.24.3", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-F+DRf8IJazRJgYog2A/yJK7eYVc0rqTlRzO+5ZxjJd4WkZoKz0IJRncf7G6t1pdVT3kryJcwuTFhN1c5m6N47A=="],
157 - "@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="],
159 - "@smithy/node-http-handler": ["@smithy/node-http-handler@4.7.3", "", { "dependencies": { "@smithy/core": "^3.24.3", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-/jPhevcTFPMVl6KNjbaI47iOg1zxC7IsnX4PQDGVZKMFceOXtB8IEYaB7a9VvkP/3oC60WzTeKocvSI7vLT0vA=="],
161 - "@smithy/signature-v4": ["@smithy/signature-v4@5.4.3", "", { "dependencies": { "@smithy/core": "^3.24.3", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-53+75QuPl6DL+ct6vVEB51FDO5oulXr20TPV46VvJZg76lIlXNWfxi8j+G2V/t0I2qxCBOa3vX/8bmjrpFVo9g=="],
163 - "@smithy/types": ["@smithy/types@4.14.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-P+otAxbV4CqBybp7EkcJCrig63yE2E7PuNVOmilVMRcx/O+QDzGULTrKsq4DV13gSfak9ObPrWaHl/9bL5YcWw=="],
165 - "@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="],
167 - "@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="],
169 - "@tokenizer/inflate": ["@tokenizer/inflate@0.4.1", "", { "dependencies": { "debug": "^4.4.3", "token-types": "^6.1.1" } }, "sha512-2mAv+8pkG6GIZiF1kNg1jAjh27IDxEPKwdGul3snfztFerfPGI1LjDezZp3i7BElXompqEtPmoPx6c2wgtWsOA=="],
171 - "@tokenizer/token": ["@tokenizer/token@0.3.0", "", {}, "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A=="],
173 - "@tootallnate/quickjs-emscripten": ["@tootallnate/quickjs-emscripten@0.23.0", "", {}, "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA=="],
175 - "@types/hast": ["@types/hast@3.0.4", "", { "dependencies": { "@types/unist": "*" } }, "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ=="],
177 - "@types/mdast": ["@types/mdast@4.0.4", "", { "dependencies": { "@types/unist": "*" } }, "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA=="],
179 - "@types/mime-types": ["@types/mime-types@2.1.4", "", {}, "sha512-lfU4b34HOri+kAY5UheuFMWPDOI+OPceBSHZKp69gEyTL/mmJ4cnU6Y/rlme3UL3GyOn6Y42hyIEw0/q8sWx5w=="],
181 - "@types/node": ["@types/node@25.8.0", "", { "dependencies": { "undici-types": ">=7.24.0 <7.24.7" } }, "sha512-TCFSk8IZh+iLX1xtksoBVtdmgL+1IX0fC9BeU4QqFSuNdN/K+HUlhqOzEmSYYpZUVsLYcPqc9KX+60iDuninSQ=="],
183 - "@types/retry": ["@types/retry@0.12.0", "", {}, "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA=="],
185 - "@types/unist": ["@types/unist@3.0.3", "", {}, "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="],
187 - "@types/yauzl": ["@types/yauzl@2.10.3", "", { "dependencies": { "@types/node": "*" } }, "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q=="],
189 - "@ungap/structured-clone": ["@ungap/structured-clone@1.3.1", "", {}, "sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ=="],
191 - "agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="],
193 - "ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
195 - "ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
197 - "any-promise": ["any-promise@1.3.0", "", {}, "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A=="],
199 - "ast-types": ["ast-types@0.13.4", "", { "dependencies": { "tslib": "^2.0.1" } }, "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w=="],
201 - "balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="],
203 - "base64-js": ["base64-js@1.5.1", "", {}, "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="],
205 - "basic-ftp": ["basic-ftp@5.3.1", "", {}, "sha512-bopVNp6ugyA150DDuZfPFdt1KZ5a94ZDiwX4hMgZDzF+GttD80lEy8kj98kbyhLXnPvhtIo93mdnLIjpCAeeOw=="],
207 - "bignumber.js": ["bignumber.js@9.3.1", "", {}, "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ=="],
209 - "bowser": ["bowser@2.14.1", "", {}, "sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg=="],
211 - "brace-expansion": ["brace-expansion@5.0.6", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g=="],
213 - "buffer-crc32": ["buffer-crc32@0.2.13", "", {}, "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ=="],
215 - "buffer-equal-constant-time": ["buffer-equal-constant-time@1.0.1", "", {}, "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="],
217 - "ccount": ["ccount@2.0.1", "", {}, "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg=="],
219 - "chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="],
221 - "character-entities-html4": ["character-entities-html4@2.1.0", "", {}, "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA=="],
223 - "character-entities-legacy": ["character-entities-legacy@3.0.0", "", {}, "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ=="],
225 - "cli-highlight": ["cli-highlight@2.1.11", "", { "dependencies": { "chalk": "^4.0.0", "highlight.js": "^10.7.1", "mz": "^2.4.0", "parse5": "^5.1.1", "parse5-htmlparser2-tree-adapter": "^6.0.0", "yargs": "^16.0.0" }, "bin": { "highlight": "bin/highlight" } }, "sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg=="],
227 - "cliui": ["cliui@7.0.4", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^7.0.0" } }, "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ=="],
229 - "color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="],
231 - "color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
233 - "comma-separated-tokens": ["comma-separated-tokens@2.0.3", "", {}, "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg=="],
235 - "data-uri-to-buffer": ["data-uri-to-buffer@6.0.2", "", {}, "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw=="],
237 - "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
239 - "degenerator": ["degenerator@5.0.1", "", { "dependencies": { "ast-types": "^0.13.4", "escodegen": "^2.1.0", "esprima": "^4.0.1" } }, "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ=="],
241 - "dequal": ["dequal@2.0.3", "", {}, "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA=="],
243 - "devlop": ["devlop@1.1.0", "", { "dependencies": { "dequal": "^2.0.0" } }, "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA=="],
245 - "diff": ["diff@8.0.3", "", {}, "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ=="],
247 - "ecdsa-sig-formatter": ["ecdsa-sig-formatter@1.0.11", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ=="],
249 - "emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
251 - "end-of-stream": ["end-of-stream@1.4.5", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg=="],
253 - "escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],
255 - "escodegen": ["escodegen@2.1.0", "", { "dependencies": { "esprima": "^4.0.1", "estraverse": "^5.2.0", "esutils": "^2.0.2" }, "optionalDependencies": { "source-map": "~0.6.1" }, "bin": { "esgenerate": "bin/esgenerate.js", "escodegen": "bin/escodegen.js" } }, "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w=="],
257 - "esprima": ["esprima@4.0.1", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="],
259 - "estraverse": ["estraverse@5.3.0", "", {}, "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA=="],
261 - "esutils": ["esutils@2.0.3", "", {}, "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="],
263 - "extend": ["extend@3.0.2", "", {}, "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="],
265 - "extract-zip": ["extract-zip@2.0.1", "", { "dependencies": { "debug": "^4.1.1", "get-stream": "^5.1.0", "yauzl": "^2.10.0" }, "optionalDependencies": { "@types/yauzl": "^2.9.1" }, "bin": { "extract-zip": "cli.js" } }, "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg=="],
267 - "fast-xml-builder": ["fast-xml-builder@1.2.0", "", { "dependencies": { "path-expression-matcher": "^1.5.0", "xml-naming": "^0.1.0" } }, "sha512-00aAWieqff+ZJhsXA4g1g7M8k+7AYoMUUHF+/zFb5U6Uv/P0Vl4QZo84/IcufzYalLuEj9928bXN9PbbFzMF0Q=="],
269 - "fast-xml-parser": ["fast-xml-parser@5.7.3", "", { "dependencies": { "@nodable/entities": "^2.1.0", "fast-xml-builder": "^1.1.7", "path-expression-matcher": "^1.5.0", "strnum": "^2.2.3" }, "bin": { "fxparser": "src/cli/cli.js" } }, "sha512-C0AaNuC+mscy6vrAQKAc/rMq+zAPHodfHGZu4sGVehvAQt/JLG1O5zEcYcXSY5zSqr4YVgxsB+pHXTq0i7eDlg=="],
271 - "fd-slicer": ["fd-slicer@1.1.0", "", { "dependencies": { "pend": "~1.2.0" } }, "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g=="],
273 - "fetch-blob": ["fetch-blob@3.2.0", "", { "dependencies": { "node-domexception": "^1.0.0", "web-streams-polyfill": "^3.0.3" } }, "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ=="],
275 - "file-type": ["file-type@21.3.4", "", { "dependencies": { "@tokenizer/inflate": "^0.4.1", "strtok3": "^10.3.4", "token-types": "^6.1.1", "uint8array-extras": "^1.4.0" } }, "sha512-Ievi/yy8DS3ygGvT47PjSfdFoX+2isQueoYP1cntFW1JLYAuS4GD7NUPGg4zv2iZfV52uDyk5w5Z0TdpRS6Q1g=="],
277 - "formdata-polyfill": ["formdata-polyfill@4.0.10", "", { "dependencies": { "fetch-blob": "^3.1.2" } }, "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g=="],
279 - "gaxios": ["gaxios@7.1.4", "", { "dependencies": { "extend": "^3.0.2", "https-proxy-agent": "^7.0.1", "node-fetch": "^3.3.2" } }, "sha512-bTIgTsM2bWn3XklZISBTQX7ZSddGW+IO3bMdGaemHZ3tbqExMENHLx6kKZ/KlejgrMtj8q7wBItt51yegqalrA=="],
281 - "gcp-metadata": ["gcp-metadata@8.1.2", "", { "dependencies": { "gaxios": "^7.0.0", "google-logging-utils": "^1.0.0", "json-bigint": "^1.0.0" } }, "sha512-zV/5HKTfCeKWnxG0Dmrw51hEWFGfcF2xiXqcA3+J90WDuP0SvoiSO5ORvcBsifmx/FoIjgQN3oNOGaQ5PhLFkg=="],
283 - "get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="],
285 - "get-east-asian-width": ["get-east-asian-width@1.6.0", "", {}, "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA=="],
287 - "get-stream": ["get-stream@5.2.0", "", { "dependencies": { "pump": "^3.0.0" } }, "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA=="],
289 - "get-uri": ["get-uri@6.0.5", "", { "dependencies": { "basic-ftp": "^5.0.2", "data-uri-to-buffer": "^6.0.2", "debug": "^4.3.4" } }, "sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg=="],
291 - "glob": ["glob@13.0.6", "", { "dependencies": { "minimatch": "^10.2.2", "minipass": "^7.1.3", "path-scurry": "^2.0.2" } }, "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw=="],
293 - "google-auth-library": ["google-auth-library@10.6.2", "", { "dependencies": { "base64-js": "^1.3.0", "ecdsa-sig-formatter": "^1.0.11", "gaxios": "^7.1.4", "gcp-metadata": "8.1.2", "google-logging-utils": "1.1.3", "jws": "^4.0.0" } }, "sha512-e27Z6EThmVNNvtYASwQxose/G57rkRuaRbQyxM2bvYLLX/GqWZ5chWq2EBoUchJbCc57eC9ArzO5wMsEmWftCw=="],
295 - "google-logging-utils": ["google-logging-utils@1.1.3", "", {}, "sha512-eAmLkjDjAFCVXg7A1unxHsLf961m6y17QFqXqAXGj/gVkKFrEICfStRfwUlGNfeCEjNRa32JEWOUTlYXPyyKvA=="],
297 - "graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="],
299 - "has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
301 - "hast-util-to-html": ["hast-util-to-html@9.0.5", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "ccount": "^2.0.0", "comma-separated-tokens": "^2.0.0", "hast-util-whitespace": "^3.0.0", "html-void-elements": "^3.0.0", "mdast-util-to-hast": "^13.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "stringify-entities": "^4.0.0", "zwitch": "^2.0.4" } }, "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw=="],
303 - "hast-util-whitespace": ["hast-util-whitespace@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw=="],
305 - "highlight.js": ["highlight.js@10.7.3", "", {}, "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A=="],
307 - "hosted-git-info": ["hosted-git-info@9.0.3", "", { "dependencies": { "lru-cache": "^11.1.0" } }, "sha512-Hc+ghLoSt6QaYZUv0WBiIvmMDZuZZ7oaDvdH8MbfOO4lOsxdXLEvuC6ePoGs9H1X9oCLyq6+NVN0MKqD+ydxyg=="],
309 - "html-void-elements": ["html-void-elements@3.0.0", "", {}, "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg=="],
311 - "http-proxy-agent": ["http-proxy-agent@7.0.2", "", { "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" } }, "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig=="],
313 - "https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="],
315 - "ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
317 - "ignore": ["ignore@7.0.5", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="],
319 - "ip-address": ["ip-address@10.2.0", "", {}, "sha512-/+S6j4E9AHvW9SWMSEY9Xfy66O5PWvVEJ08O0y5JGyEKQpojb0K0GKpz/v5HJ/G0vi3D2sjGK78119oXZeE0qA=="],
321 - "is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="],
323 - "jiti": ["jiti@2.7.0", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ=="],
325 - "json-bigint": ["json-bigint@1.0.0", "", { "dependencies": { "bignumber.js": "^9.0.0" } }, "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ=="],
327 - "json-schema-to-ts": ["json-schema-to-ts@3.1.1", "", { "dependencies": { "@babel/runtime": "^7.18.3", "ts-algebra": "^2.0.0" } }, "sha512-+DWg8jCJG2TEnpy7kOm/7/AxaYoaRbjVB4LFZLySZlWn8exGs3A4OLJR966cVvU26N7X9TWxl+Jsw7dzAqKT6g=="],
329 - "jwa": ["jwa@2.0.1", "", { "dependencies": { "buffer-equal-constant-time": "^1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg=="],
331 - "jws": ["jws@4.0.1", "", { "dependencies": { "jwa": "^2.0.1", "safe-buffer": "^5.0.1" } }, "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA=="],
333 - "koffi": ["koffi@2.16.2", "", {}, "sha512-owU0MRwv6xkrVqCd+33uw6BaYppkTRXbO/rVdJNI2dvZG0gzyRhYwW25eWtc5pauwK8TGh3AbkFONSezdykfSA=="],
335 - "long": ["long@5.3.2", "", {}, "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA=="],
337 - "lru-cache": ["lru-cache@11.3.6", "", {}, "sha512-Gf/KoL3C/MlI7Bt0PGI9I+TeTC/I6r/csU58N4BSNc4lppLBeKsOdFYkK+dX0ABDUMJNfCHTyPpzwwO21Awd3A=="],
339 - "lru_map": ["lru_map@0.4.1", "", {}, "sha512-I+lBvqMMFfqaV8CJCISjI3wbjmwVu/VyOoU7+qtu9d7ioW5klMgsTTiUOUp+DJvfTTzKXoPbyC6YfgkNcyPSOg=="],
341 - "marked": ["marked@15.0.12", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA=="],
343 - "mdast-util-to-hast": ["mdast-util-to-hast@13.2.1", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "@ungap/structured-clone": "^1.0.0", "devlop": "^1.0.0", "micromark-util-sanitize-uri": "^2.0.0", "trim-lines": "^3.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA=="],
345 - "micromark-util-character": ["micromark-util-character@2.1.1", "", { "dependencies": { "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q=="],
347 - "micromark-util-encode": ["micromark-util-encode@2.0.1", "", {}, "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw=="],
349 - "micromark-util-sanitize-uri": ["micromark-util-sanitize-uri@2.0.1", "", { "dependencies": { "micromark-util-character": "^2.0.0", "micromark-util-encode": "^2.0.0", "micromark-util-symbol": "^2.0.0" } }, "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ=="],
351 - "micromark-util-symbol": ["micromark-util-symbol@2.0.1", "", {}, "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q=="],
353 - "micromark-util-types": ["micromark-util-types@2.0.2", "", {}, "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA=="],
355 - "mime-db": ["mime-db@1.54.0", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="],
357 - "mime-types": ["mime-types@3.0.2", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A=="],
359 - "minimatch": ["minimatch@10.2.5", "", { "dependencies": { "brace-expansion": "^5.0.5" } }, "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg=="],
361 - "minipass": ["minipass@7.1.3", "", {}, "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A=="],
363 - "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
365 - "mz": ["mz@2.7.0", "", { "dependencies": { "any-promise": "^1.0.0", "object-assign": "^4.0.1", "thenify-all": "^1.0.0" } }, "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q=="],
367 - "netmask": ["netmask@2.1.1", "", {}, "sha512-eonl3sLUha+S1GzTPxychyhnUzKyeQkZ7jLjKrBagJgPla13F+uQ71HgpFefyHgqrjEbCPkDArxYsjY8/+gLKA=="],
369 - "node-domexception": ["node-domexception@1.0.0", "", {}, "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ=="],
371 - "node-fetch": ["node-fetch@3.3.2", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="],
373 - "object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="],
375 - "once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
377 - "oniguruma-parser": ["oniguruma-parser@0.12.2", "", {}, "sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw=="],
379 - "oniguruma-to-es": ["oniguruma-to-es@4.3.6", "", { "dependencies": { "oniguruma-parser": "^0.12.2", "regex": "^6.1.0", "regex-recursion": "^6.0.2" } }, "sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA=="],
381 - "openai": ["openai@6.26.0", "", { "peerDependencies": { "ws": "^8.18.0", "zod": "^3.25 || ^4.0" }, "optionalPeers": ["ws", "zod"], "bin": { "openai": "bin/cli" } }, "sha512-zd23dbWTjiJ6sSAX6s0HrCZi41JwTA1bQVs0wLQPZ2/5o2gxOJA5wh7yOAUgwYybfhDXyhwlpeQf7Mlgx8EOCA=="],
383 - "p-retry": ["p-retry@4.6.2", "", { "dependencies": { "@types/retry": "0.12.0", "retry": "^0.13.1" } }, "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ=="],
385 - "pac-proxy-agent": ["pac-proxy-agent@7.2.0", "", { "dependencies": { "@tootallnate/quickjs-emscripten": "^0.23.0", "agent-base": "^7.1.2", "debug": "^4.3.4", "get-uri": "^6.0.1", "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.6", "pac-resolver": "^7.0.1", "socks-proxy-agent": "^8.0.5" } }, "sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA=="],
387 - "pac-resolver": ["pac-resolver@7.0.1", "", { "dependencies": { "degenerator": "^5.0.0", "netmask": "^2.0.2" } }, "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg=="],
389 - "parse5": ["parse5@5.1.1", "", {}, "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug=="],
391 - "parse5-htmlparser2-tree-adapter": ["parse5-htmlparser2-tree-adapter@6.0.1", "", { "dependencies": { "parse5": "^6.0.1" } }, "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA=="],
393 - "partial-json": ["partial-json@0.1.7", "", {}, "sha512-Njv/59hHaokb/hRUjce3Hdv12wd60MtM9Z5Olmn+nehe0QDAsRtRbJPvJ0Z91TusF0SuZRIvnM+S4l6EIP8leA=="],
395 - "path-expression-matcher": ["path-expression-matcher@1.5.0", "", {}, "sha512-cbrerZV+6rvdQrrD+iGMcZFEiiSrbv9Tfdkvnusy6y0x0GKBXREFg/Y65GhIfm0tnLntThhzCnfKwp1WRjeCyQ=="],
397 - "path-scurry": ["path-scurry@2.0.2", "", { "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" } }, "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg=="],
399 - "pend": ["pend@1.2.0", "", {}, "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg=="],
401 - "proper-lockfile": ["proper-lockfile@4.1.2", "", { "dependencies": { "graceful-fs": "^4.2.4", "retry": "^0.12.0", "signal-exit": "^3.0.2" } }, "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA=="],
403 - "property-information": ["property-information@7.1.0", "", {}, "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ=="],
405 - "protobufjs": ["protobufjs@7.5.8", "", { "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", "@protobufjs/codegen": "^2.0.5", "@protobufjs/eventemitter": "^1.1.0", "@protobufjs/fetch": "^1.1.0", "@protobufjs/float": "^1.0.2", "@protobufjs/inquire": "^1.1.1", "@protobufjs/path": "^1.1.2", "@protobufjs/pool": "^1.1.0", "@protobufjs/utf8": "^1.1.1", "@types/node": ">=13.7.0", "long": "^5.0.0" } }, "sha512-dvpCIeLPbXZS/Ete7yLaO7RenOdken2NHKykBXbsaGxZT0UTltcarBciw+A78SRQs9iMAAVpsYA+l8b1hTePIA=="],
407 - "proxy-agent": ["proxy-agent@6.5.0", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "^4.3.4", "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.6", "lru-cache": "^7.14.1", "pac-proxy-agent": "^7.1.0", "proxy-from-env": "^1.1.0", "socks-proxy-agent": "^8.0.5" } }, "sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A=="],
409 - "proxy-from-env": ["proxy-from-env@1.1.0", "", {}, "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="],
411 - "pump": ["pump@3.0.4", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA=="],
413 - "react": ["react@19.2.6", "", {}, "sha512-sfWGGfavi0xr8Pg0sVsyHMAOziVYKgPLNrS7ig+ivMNb3wbCBw3KxtflsGBAwD3gYQlE/AEZsTLgToRrSCjb0Q=="],
415 - "react-dom": ["react-dom@19.2.6", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.6" } }, "sha512-0prMI+hvBbPjsWnxDLxlCGyM8PN6UuWjEUCYmZhO67xIV9Xasa/r/vDnq+Xyq4Lo27g8QSbO5YzARu0D1Sps3g=="],
417 - "regex": ["regex@6.1.0", "", { "dependencies": { "regex-utilities": "^2.3.0" } }, "sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg=="],
419 - "regex-recursion": ["regex-recursion@6.0.2", "", { "dependencies": { "regex-utilities": "^2.3.0" } }, "sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg=="],
421 - "regex-utilities": ["regex-utilities@2.3.0", "", {}, "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng=="],
423 - "require-directory": ["require-directory@2.1.1", "", {}, "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="],
425 - "retry": ["retry@0.12.0", "", {}, "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow=="],
427 - "safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],
429 - "scheduler": ["scheduler@0.27.0", "", {}, "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q=="],
431 - "shiki": ["shiki@3.23.0", "", { "dependencies": { "@shikijs/core": "3.23.0", "@shikijs/engine-javascript": "3.23.0", "@shikijs/engine-oniguruma": "3.23.0", "@shikijs/langs": "3.23.0", "@shikijs/themes": "3.23.0", "@shikijs/types": "3.23.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-55Dj73uq9ZXL5zyeRPzHQsK7Nbyt6Y10k5s7OjuFZGMhpp4r/rsLBH0o/0fstIzX1Lep9VxefWljK/SKCzygIA=="],
433 - "signal-exit": ["signal-exit@3.0.7", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="],
435 - "smart-buffer": ["smart-buffer@4.2.0", "", {}, "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="],
437 - "socks": ["socks@2.8.9", "", { "dependencies": { "ip-address": "^10.1.1", "smart-buffer": "^4.2.0" } }, "sha512-LJhUYUvItdQ0LkJTmPeaEObWXAqFyfmP85x0tch/ez9cahmhlBBLbIqDFnvBnUJGagb0JbIQrkBs1wJ+yRYpEw=="],
439 - "socks-proxy-agent": ["socks-proxy-agent@8.0.5", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "^4.3.4", "socks": "^2.8.3" } }, "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw=="],
441 - "source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="],
443 - "space-separated-tokens": ["space-separated-tokens@2.0.2", "", {}, "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q=="],
445 - "string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
447 - "stringify-entities": ["stringify-entities@4.0.4", "", { "dependencies": { "character-entities-html4": "^2.0.0", "character-entities-legacy": "^3.0.0" } }, "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg=="],
449 - "strip-ansi": ["strip-ansi@7.2.0", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="],
451 - "strnum": ["strnum@2.3.0", "", {}, "sha512-ums3KNd42PGyx5xaoVTO1mjU1bH3NpY4vsrVlnv9PNGqQj8wd7rJ6nEypLrJ7z5vxK5RP0yMLo6J/Gsm62DI5Q=="],
453 - "strtok3": ["strtok3@10.3.5", "", { "dependencies": { "@tokenizer/token": "^0.3.0" } }, "sha512-ki4hZQfh5rX0QDLLkOCj+h+CVNkqmp/CMf8v8kZpkNVK6jGQooMytqzLZYUVYIZcFZ6yDB70EfD8POcFXiF5oA=="],
455 - "supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
457 - "thenify": ["thenify@3.3.1", "", { "dependencies": { "any-promise": "^1.0.0" } }, "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw=="],
459 - "thenify-all": ["thenify-all@1.6.0", "", { "dependencies": { "thenify": ">= 3.1.0 < 4" } }, "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA=="],
461 - "token-types": ["token-types@6.1.2", "", { "dependencies": { "@borewit/text-codec": "^0.2.1", "@tokenizer/token": "^0.3.0", "ieee754": "^1.2.1" } }, "sha512-dRXchy+C0IgK8WPC6xvCHFRIWYUbqqdEIKPaKo/AcTUNzwLTK6AH7RjdLWsEZcAN/TBdtfUw3PYEgPr5VPr6ww=="],
463 - "trim-lines": ["trim-lines@3.0.1", "", {}, "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg=="],
465 - "ts-algebra": ["ts-algebra@2.0.0", "", {}, "sha512-FPAhNPFMrkwz76P7cdjdmiShwMynZYN6SgOujD1urY4oNm80Ou9oMdmbR45LotcKOXoy7wSmHkRFE6Mxbrhefw=="],
467 - "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
469 - "typebox": ["typebox@1.1.38", "", {}, "sha512-pZ0aQPmMmXoUvSbeuWf/Hzsc+avNw/Zd6VeE8CFgkVGWyuHPJvqeJJDeJqLve+K70LvjYIoleGcoJHPT17cWoA=="],
471 - "uint8array-extras": ["uint8array-extras@1.5.0", "", {}, "sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A=="],
473 - "undici": ["undici@7.25.0", "", {}, "sha512-xXnp4kTyor2Zq+J1FfPI6Eq3ew5h6Vl0F/8d9XU5zZQf1tX9s2Su1/3PiMmUANFULpmksxkClamIZcaUqryHsQ=="],
475 - "undici-types": ["undici-types@7.24.6", "", {}, "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg=="],
477 - "unist-util-is": ["unist-util-is@6.0.1", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g=="],
479 - "unist-util-position": ["unist-util-position@5.0.0", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA=="],
481 - "unist-util-stringify-position": ["unist-util-stringify-position@4.0.0", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ=="],
483 - "unist-util-visit": ["unist-util-visit@5.1.0", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg=="],
485 - "unist-util-visit-parents": ["unist-util-visit-parents@6.0.2", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0" } }, "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ=="],
487 - "uuid": ["uuid@14.0.0", "", { "bin": { "uuid": "dist-node/bin/uuid" } }, "sha512-Qo+uWgilfSmAhXCMav1uYFynlQO7fMFiMVZsQqZRMIXp0O7rR7qjkj+cPvBHLgBqi960QCoo/PH2/6ZtVqKvrg=="],
489 - "vfile": ["vfile@6.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile-message": "^4.0.0" } }, "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q=="],
491 - "vfile-message": ["vfile-message@4.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw=="],
493 - "web-streams-polyfill": ["web-streams-polyfill@3.3.3", "", {}, "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw=="],
495 - "wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="],
497 - "wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
499 - "ws": ["ws@8.20.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w=="],
501 - "xml-naming": ["xml-naming@0.1.0", "", {}, "sha512-k8KO9hrMyNk6tUWqUfkTEZbezRRpONVOzUTnc97VnCvyj6Tf9lyUR9EDAIeiVLv56jsMcoXEwjW8Kv5yPY52lw=="],
503 - "y18n": ["y18n@5.0.8", "", {}, "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="],
505 - "yaml": ["yaml@2.9.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA=="],
507 - "yargs": ["yargs@16.2.0", "", { "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.0", "y18n": "^5.0.5", "yargs-parser": "^20.2.2" } }, "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw=="],
509 - "yargs-parser": ["yargs-parser@20.2.9", "", {}, "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w=="],
511 - "yauzl": ["yauzl@2.10.0", "", { "dependencies": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" } }, "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g=="],
513 - "zod": ["zod@4.4.3", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="],
515 - "zod-to-json-schema": ["zod-to-json-schema@3.25.2", "", { "peerDependencies": { "zod": "^3.25.28 || ^4" } }, "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA=="],
517 - "zwitch": ["zwitch@2.0.4", "", {}, "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A=="],
519 - "cli-highlight/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
521 - "cliui/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
523 - "node-fetch/data-uri-to-buffer": ["data-uri-to-buffer@4.0.1", "", {}, "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A=="],
525 - "p-retry/retry": ["retry@0.13.1", "", {}, "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg=="],
527 - "parse5-htmlparser2-tree-adapter/parse5": ["parse5@6.0.1", "", {}, "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="],
529 - "proxy-agent/lru-cache": ["lru-cache@7.18.3", "", {}, "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA=="],
531 - "string-width/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
533 - "wrap-ansi/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
535 - "cliui/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
537 - "string-width/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
539 - "wrap-ansi/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
540 - }

pi/agent/extensions/diff-render/index.ts

Deleted
deleted file mode 100644
1 -import type { EditToolDetails, ExtensionAPI, Theme } from "@mariozechner/pi-coding-agent";
2 -import { createEditToolDefinition } from "@mariozechner/pi-coding-agent";
3 -import { Box, Container, Spacer, Text } from "@mariozechner/pi-tui";
4 -import { parseDiffFromFile } from "@pierre/diffs";
5 -import { readFile } from "node:fs/promises";
6 -import { resolve } from "node:path";
7 -import type { DiffRenderPayload } from "./model";
8 -import { normalizeToolPath, toRenderPayload } from "./model";
9 -import { DiffRenderComponent } from "./render";
11 -type DiffRenderDetails = EditToolDetails & {
12 - diffRender?: DiffRenderPayload;
13 -};
15 -type ReadResult =
16 - | { ok: true; text: string }
17 - | { ok: false; error: string };
19 -async function readText(path: string): Promise<ReadResult> {
20 - try {
21 - return { ok: true, text: await readFile(path, "utf8") };
22 - } catch (error) {
23 - return { ok: false, error: error instanceof Error ? error.message : String(error) };
24 - }
27 -function buildPayload(path: string, before: string, after: string): DiffRenderPayload {
28 - const file = parseDiffFromFile(
29 - { name: path, contents: before },
30 - { name: path, contents: after },
31 - undefined,
32 - true,
33 - );
34 - return toRenderPayload([file]);
37 -function isDiffRenderPayload(value: unknown): value is DiffRenderPayload {
38 - if (!value || typeof value !== "object") return false;
39 - const payload = value as Partial<DiffRenderPayload>;
40 - const stats = payload.stats as Partial<DiffRenderPayload["stats"]> | undefined;
41 - return typeof payload.diff === "string"
42 - && !!stats
43 - && typeof stats.files === "number"
44 - && typeof stats.additions === "number"
45 - && typeof stats.deletions === "number"
46 - && typeof stats.hunks === "number";
49 -function renderDiffResult(payload: DiffRenderPayload, theme: Theme, expanded: boolean): Container {
50 - const container = new Container();
51 - const body = new Box(1, 0);
52 - body.addChild(new DiffRenderComponent(payload, theme, expanded));
53 - container.addChild(new Spacer(1));
54 - container.addChild(body);
55 - return container;
58 -export default function diffRenderExtension(pi: ExtensionAPI): void {
59 - const cwd = process.cwd();
60 - const originalEdit = createEditToolDefinition(cwd);
62 - pi.registerTool({
63 - name: "edit",
64 - label: "edit",
65 - description: originalEdit.description,
66 - promptSnippet: originalEdit.promptSnippet,
67 - promptGuidelines: originalEdit.promptGuidelines,
68 - parameters: originalEdit.parameters,
69 - renderShell: originalEdit.renderShell,
70 - prepareArguments: originalEdit.prepareArguments,
72 - async execute(toolCallId, params, signal, onUpdate, ctx) {
73 - const path = normalizeToolPath(params.path);
74 - const absolutePath = resolve(cwd, path);
75 - const before = await readText(absolutePath);
76 - const result = await originalEdit.execute(toolCallId, { ...params, path }, signal, onUpdate, ctx);
77 - const details = result.details as DiffRenderDetails | undefined;
79 - if (!details || !before.ok) return result;
81 - const after = await readText(absolutePath);
82 - if (!after.ok || before.text === after.text) return result;
84 - try {
85 - return { ...result, details: { ...details, diffRender: buildPayload(path, before.text, after.text) } };
86 - } catch {
87 - return result;
88 - }
89 - },
91 - renderCall(args, theme, context) {
92 - if (typeof args.path === "string") args.path = normalizeToolPath(args.path);
93 - return originalEdit.renderCall?.(args, theme, context) ?? new Text(theme.fg("toolTitle", theme.bold("edit")), 0, 0);
94 - },
96 - renderResult(result, options, theme, context) {
97 - const details = result.details as DiffRenderDetails | undefined;
98 - if (isDiffRenderPayload(details?.diffRender)) return renderDiffResult(details.diffRender, theme, options.expanded);
99 - return originalEdit.renderResult?.(result as never, options, theme, context) ?? new Text(theme.fg("success", "Applied"), 0, 0);
100 - },
101 - });

pi/agent/extensions/diff-render/model.ts

Deleted
deleted file mode 100644
1 -import type { FileDiffMetadata, Hunk } from "@pierre/diffs";
3 -export type DiffStats = {
4 - files: number;
5 - additions: number;
6 - deletions: number;
7 - hunks: number;
8 -};
10 -export type DiffRenderPayload = {
11 - diff: string;
12 - stats: DiffStats;
13 -};
15 -export function normalizeToolPath(path: string): string {
16 - return path.startsWith("@") ? path.slice(1) : path;
17 -}
19 -export function scrubLine(text: string): string {
20 - return text.replace(/[\r\n]+$/g, "").replace(/[\r\n]/g, "↵");
21 -}
23 -export function toRenderPayload(files: readonly FileDiffMetadata[]): DiffRenderPayload {
24 - return {
25 - diff: files.flatMap(fileDiffLines).join("\n"),
26 - stats: diffStats(files),
27 - };
28 -}
30 -function diffStats(files: readonly FileDiffMetadata[]): DiffStats {
31 - let additions = 0;
32 - let deletions = 0;
33 - let hunks = 0;
35 - for (const file of files) {
36 - hunks += file.hunks.length;
37 - for (const hunk of file.hunks) {
38 - additions += hunk.additionLines;
39 - deletions += hunk.deletionLines;
40 - }
41 - }
43 - return { files: files.length, additions, deletions, hunks };
44 -}
46 -function fileDiffLines(file: FileDiffMetadata): string[] {
47 - return file.hunks.flatMap((hunk) => hunkLines(file, hunk));
48 -}
50 -function hunkLines(file: FileDiffMetadata, hunk: Hunk): string[] {
51 - const lines = [hunkHeader(hunk)];
52 - let oldNo = hunk.deletionStart;
53 - let newNo = hunk.additionStart;
55 - for (const part of hunk.hunkContent) {
56 - if (part.type === "context") {
57 - for (let i = 0; i < part.lines; i++) {
58 - lines.push(` ${oldNo} ${sourceLine(file, part.deletionLineIndex + i, part.additionLineIndex + i)}`);
59 - oldNo++;
60 - newNo++;
61 - }
62 - continue;
63 - }
65 - for (let i = 0; i < part.deletions; i++) {
66 - lines.push(`-${oldNo++} ${scrubLine(file.deletionLines[part.deletionLineIndex + i] ?? "")}`);
67 - }
69 - for (let i = 0; i < part.additions; i++) {
70 - lines.push(`+${newNo++} ${scrubLine(file.additionLines[part.additionLineIndex + i] ?? "")}`);
71 - }
72 - }
74 - return lines;
75 -}
77 -function sourceLine(file: FileDiffMetadata, oldIndex: number, newIndex: number): string {
78 - return scrubLine(file.additionLines[newIndex] ?? file.deletionLines[oldIndex] ?? "");
79 -}
81 -function hunkHeader(hunk: Hunk): string {
82 - if (hunk.hunkSpecs) return scrubLine(hunk.hunkSpecs);
83 - const suffix = hunk.hunkContext ? ` ${hunk.hunkContext}` : "";
84 - return `@@ -${hunk.deletionStart},${hunk.deletionCount} +${hunk.additionStart},${hunk.additionCount} @@${suffix}`;
85 -}

pi/agent/extensions/diff-render/package.json

Deleted
deleted file mode 100644
1 -{
2 - "name": "@bugabinga/pi-ext-diff-render",
3 - "version": "0.0.0",
4 - "private": true,
5 - "type": "module",
6 - "main": "index.ts",
7 - "scripts": {
8 - "test": "bun test ./__tests__/*.test.ts"
9 - },
10 - "dependencies": {
11 - "@pierre/diffs": "^1.1.22"
12 - },
13 - "peerDependencies": {
14 - "@mariozechner/pi-coding-agent": "*",
15 - "@mariozechner/pi-tui": "*"
16 - }
17 -}

pi/agent/extensions/diff-render/render.ts

Deleted
deleted file mode 100644
1 -import type { Theme } from "@mariozechner/pi-coding-agent";
2 -import { renderDiff } from "@mariozechner/pi-coding-agent";
3 -import type { Component } from "@mariozechner/pi-tui";
4 -import { truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
5 -import type { DiffRenderPayload } from "./model";
7 -const MAX_RENDER_LINES = 240;
9 -export class DiffRenderComponent implements Component {
10 - constructor(
11 - private readonly payload: DiffRenderPayload,
12 - private readonly theme: Theme,
13 - private readonly expanded: boolean,
14 - ) {}
16 - render(width: number): string[] {
17 - if (!this.expanded || this.payload.diff.length === 0) return [fitLine(this.summary(), width)];
18 - return capLines(renderDiff(this.payload.diff).split("\n")).map((line) => fitLine(line, width));
19 - }
21 - invalidate(): void {}
23 - private summary(): string {
24 - const s = this.payload.stats;
25 - const text = `${s.files} file${s.files === 1 ? "" : "s"} +${s.additions} -${s.deletions} ${s.hunks} hunk${s.hunks === 1 ? "" : "s"}`;
26 - return `${this.theme.fg("success", "Applied")} ${this.theme.fg("muted", text)}`;
27 - }
28 -}
30 -function capLines(lines: string[]): string[] {
31 - if (lines.length <= MAX_RENDER_LINES) return lines;
32 - return [...lines.slice(0, MAX_RENDER_LINES), `… ${lines.length - MAX_RENDER_LINES} more diff lines`];
33 -}
35 -function fitLine(line: string, width: number): string {
36 - const clipped = truncateToWidth(line, width, "…");
37 - return clipped + " ".repeat(Math.max(0, width - visibleWidth(clipped)));
38 -}

pi/agent/extensions/diff-review/PLAN.md

Modified
129 129 ## Non-goals for v1
131 131 - applying fixes directly from browser
132 -- replacing normal `edit` rendering (`diff-render` owns that)
132 +- replacing normal `edit` rendering
133 133 - full Pi session tree browser

pi/agent/extensions/files-widget/__tests__/file-viewer.test.ts

Deleted
deleted file mode 100644
1 -import { describe, expect, it } from "bun:test";
2 -import type { Stats } from "node:fs";
3 -import { loadFileContent, type CommandRunner, type FileViewerDeps } from "../file-viewer.ts";
5 -type Call = { command: string; args: string[]; input?: string; cwd?: string };
7 -const FILE_WITH_SHELL_CHARS = `/tmp/weird "file"; rm -rf nope.md`;
9 -function fileStat(): Stats {
10 - return { isDirectory: () => false } as Stats;
13 -function dirStat(): Stats {
14 - return { isDirectory: () => true } as Stats;
17 -function deps(overrides: Partial<FileViewerDeps> = {}): FileViewerDeps {
18 - return {
19 - hasCommand: () => false,
20 - isGitRepo: () => false,
21 - runCommand: () => { throw new Error("unexpected command"); },
22 - readFile: () => "hello\nworld",
23 - stat: fileStat,
24 - columns: 80,
25 - ...overrides,
26 - };
29 -function recordingRunner(calls: Call[], responses: Record<string, string | Error>): CommandRunner {
30 - return (command, args, options = {}) => {
31 - calls.push({ command, args, input: options.input, cwd: options.cwd });
32 - const key = `${command} ${args.join(" ")}`;
33 - const response = responses[key] ?? responses[command];
34 - if (response instanceof Error) throw response;
35 - if (response !== undefined) return response;
36 - throw new Error(`unexpected command: ${key}`);
37 - };
40 -describe("loadFileContent", () => {
41 - it("returns a typed directory message", () => {
42 - const result = loadFileContent("/tmp/dir", "/tmp", false, false, 80, true, deps({ stat: dirStat }));
43 - expect(result.renderedMarkdown).toBe(false);
44 - expect(result.lines[0]).toContain("Directory selected");
45 - });
47 - it("uses execFile-style command + args for git diff and delta", () => {
48 - const calls: Call[] = [];
49 - const diff = "diff --git a/file b/file\n+new line";
50 - const result = loadFileContent(FILE_WITH_SHELL_CHARS, "/repo", true, true, 100, true, deps({
51 - hasCommand: (cmd) => cmd === "delta",
52 - isGitRepo: () => true,
53 - runCommand: recordingRunner(calls, {
54 - "git diff --no-color -- /tmp/weird \"file\"; rm -rf nope.md": diff,
55 - delta: "1 │ +new line",
56 - }),
57 - }));
59 - expect(result.renderedMarkdown).toBe(false);
60 - expect(result.lines.join("\n")).toContain("new line");
61 - expect(calls[0]).toEqual({
62 - command: "git",
63 - args: ["diff", "--no-color", "--", FILE_WITH_SHELL_CHARS],
64 - cwd: "/repo",
65 - input: undefined,
66 - });
67 - expect(calls[1]?.command).toBe("delta");
68 - expect(calls[1]?.input).toBe(diff);
69 - });
71 - it("falls back from wrapped bat to plain bat", () => {
72 - const calls: Call[] = [];
73 - const result = loadFileContent("/tmp/a.ts", "/tmp", false, false, 80, true, deps({
74 - hasCommand: (cmd) => cmd === "bat",
75 - runCommand: recordingRunner(calls, {
76 - "bat --style=numbers --color=always --paging=never --wrap=auto --terminal-width=80 /tmp/a.ts": new Error("wrap unsupported"),
77 - "bat --style=numbers --color=always --paging=never --terminal-width=80 /tmp/a.ts": "1 │ const x = 1;",
78 - }),
79 - }));
81 - expect(result.lines).toEqual(["1 │ const x = 1;"]);
82 - expect(calls).toHaveLength(2);
83 - expect(calls[1]?.args).not.toContain("--wrap=auto");
84 - });
86 - it("renders markdown with glow when available", () => {
87 - const calls: Call[] = [];
88 - const result = loadFileContent(FILE_WITH_SHELL_CHARS, "/tmp", false, false, 72, true, deps({
89 - hasCommand: (cmd) => cmd === "glow",
90 - runCommand: recordingRunner(calls, { glow: "# Rendered" }),
91 - }));
93 - expect(result.renderedMarkdown).toBe(true);
94 - expect(result.lines).toEqual(["# Rendered"]);
95 - expect(calls[0]?.args).toEqual(["-s", "dark", "-w", "72", FILE_WITH_SHELL_CHARS]);
96 - });
98 - it("falls back to raw file read with line numbers", () => {
99 - const result = loadFileContent("/tmp/a.txt", "/tmp", false, false, 80, true, deps({
100 - readFile: () => "a\nb",
101 - }));
103 - expect(result).toEqual({
104 - renderedMarkdown: false,
105 - lines: [" 1 │ a", " 2 │ b"],
106 - });
107 - });
108 -});

pi/agent/extensions/files-widget/browser.ts

Deleted
deleted file mode 100644
1 -/**
2 - * Based on tmustier/pi-extensions (files-widget). MIT License.
3 - */
4 -import type { Theme } from "@mariozechner/pi-coding-agent";
5 -import { Key, matchesKey, truncateToWidth } from "@mariozechner/pi-tui";
6 -import { homedir } from "node:os";
7 -import { basename, join, relative, resolve, sep } from "node:path";
9 -import {
10 - DEFAULT_BROWSER_HEIGHT,
11 - MAX_BROWSER_HEIGHT,
12 - MAX_TREE_DEPTH,
13 - MIN_PANEL_HEIGHT,
14 - POLL_INTERVAL_MS,
15 -} from "./constants";
16 -import { getGitBranch, getGitDiffStats, getGitFileList, getGitStatus, isGitRepo } from "./git";
17 -import { buildFileTreeFromPaths, flattenTree, getIgnoredNames, sortChildren, updateTreeStats } from "./file-tree";
18 -import type { DiffStats, FileNode, FlatNode } from "./types";
19 -import { isIgnoredStatus, isUntrackedStatus } from "./utils";
20 -import { createViewer, type CommentPayload, type ViewerAction } from "./viewer";
21 -import { createTextInputBuffer } from "./input-utils";
22 -import { FileScanner, safeRealPathSync } from "./scanner";
24 -export interface BrowserController {
25 - render(width: number): string[];
26 - handleInput(data: string): void;
27 - invalidate(): void;
30 -interface BrowserStats {
31 - totalLines?: number;
32 - additions: number;
33 - deletions: number;
36 -type ScanMode = "full" | "safe" | "none";
38 -interface ScanState {
39 - mode: ScanMode;
40 - isScanning: boolean;
41 - isPartial: boolean;
42 - pending: number;
43 - spinnerIndex: number;
46 -interface BrowserState {
47 - root: FileNode | null;
48 - flatList: FlatNode[];
49 - fullList: FlatNode[];
50 - stats: BrowserStats;
51 - nodeByPath: Map<string, FileNode>;
52 - scanState: ScanState;
53 - selectedIndex: number;
54 - searchQuery: string;
55 - searchMode: boolean;
56 - showOnlyChanged: boolean;
57 - browserHeight: number;
58 - lastPollTime: number;
61 -interface ChangedFile {
62 - file: FileNode;
63 - ancestors: FileNode[];
66 -const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
68 -function findNodeByPath(root: FileNode | null, path: string): FileNode | null {
69 - if (!root) return null;
70 - if (root.path === path) return root;
71 - if (!root.children) return null;
73 - for (const child of root.children) {
74 - const found = findNodeByPath(child, path);
75 - if (found) return found;
76 - }
78 - return null;
81 -function indexNodes(root: FileNode | null, map: Map<string, FileNode>): void {
82 - map.clear();
83 - if (!root) return;
84 - const stack: FileNode[] = [root];
85 - while (stack.length > 0) {
86 - const node = stack.pop();
87 - if (!node) continue;
88 - map.set(node.path, node);
89 - if (node.children) {
90 - for (const child of node.children) {
91 - stack.push(child);
92 - }
93 - }
94 - }
97 -function getNodeDepth(node: FileNode, cwd: string): number {
98 - if (node.path === cwd) return 0;
99 - const rel = relative(cwd, node.path);
100 - if (!rel) return 0;
101 - return rel.split(sep).length;
104 -// safeRealPathSync, getPathInfoSync, getPathInfo, hasAncestorRealPath → scanner.ts
106 -function shouldSafeMode(cwd: string): boolean {
107 - const resolved = resolve(cwd);
108 - const home = resolve(homedir());
109 - const root = resolve(sep);
110 - return resolved === home || resolved === root;
113 -function collectChangedFiles(node: FileNode, ancestors: FileNode[] = []): ChangedFile[] {
114 - const results: ChangedFile[] = [];
116 - if (!node.isDirectory && (node.gitStatus || node.agentModified)) {
117 - results.push({ file: node, ancestors: [...ancestors] });
118 - }
120 - if (node.children) {
121 - for (const child of node.children) {
122 - results.push(...collectChangedFiles(child, [...ancestors, node]));
123 - }
124 - }
126 - return results;
129 -function getTreeStats(root: FileNode | null): BrowserStats {
130 - if (!root) {
131 - return { totalLines: undefined, additions: 0, deletions: 0 };
132 - }
134 - return {
135 - totalLines: root.lineCountComplete ? root.totalLines ?? 0 : undefined,
136 - additions: root.totalAdditions ?? 0,
137 - deletions: root.totalDeletions ?? 0,
138 - };
141 -function formatNodeStatus(node: FileNode, theme: Theme): string {
142 - if (isIgnoredStatus(node.gitStatus)) return "";
143 - if (node.agentModified) return theme.fg("accent", " 🤖");
144 - if (node.gitStatus === "M" || node.gitStatus === "MM") return theme.fg("warning", " M");
145 - if (isUntrackedStatus(node.gitStatus)) return theme.fg("dim", " ?");
146 - if (node.gitStatus === "A") return theme.fg("success", " A");
147 - if (node.gitStatus === "D") return theme.fg("error", " D");
148 - return "";
151 -function formatNodeMeta(node: FileNode, theme: Theme): string {
152 - if (isIgnoredStatus(node.gitStatus)) return "";
154 - const parts: string[] = [];
156 - if (node.isDirectory && !node.expanded) {
157 - if (node.totalAdditions && node.totalAdditions > 0) {
158 - parts.push(theme.fg("success", `+${node.totalAdditions}`));
159 - }
160 - if (node.totalDeletions && node.totalDeletions > 0) {
161 - parts.push(theme.fg("error", `-${node.totalDeletions}`));
162 - }
163 - if (node.totalLines && node.lineCountComplete !== false) {
164 - parts.push(theme.fg("dim", `${node.totalLines}L`));
165 - }
166 - } else if (!node.isDirectory) {
167 - if (node.diffStats) {
168 - if (node.diffStats.additions > 0) {
169 - parts.push(theme.fg("success", `+${node.diffStats.additions}`));
170 - }
171 - if (node.diffStats.deletions > 0) {
172 - parts.push(theme.fg("error", `-${node.diffStats.deletions}`));
173 - }
174 - } else if (isUntrackedStatus(node.gitStatus) && node.lineCount !== undefined) {
175 - parts.push(theme.fg("success", `+${node.lineCount}`));
176 - }
177 - if (node.lineCount !== undefined) {
178 - parts.push(theme.fg("dim", `${node.lineCount}L`));
179 - }
180 - }
182 - return parts.length > 0 ? ` ${parts.join(" ")}` : "";
185 -function withSymlinkMarker(label: string, node: FileNode, theme: Theme): string {
186 - return node.isSymlink ? `${label}${theme.fg("dim", " ↗")}` : label;
189 -function formatNodeName(node: FileNode, theme: Theme): string {
190 - if (isIgnoredStatus(node.gitStatus)) return withSymlinkMarker(theme.fg("dim", node.name), node, theme);
191 - if (node.isDirectory) {
192 - const label = node.hasChangedChildren ? theme.fg("warning", node.name) : theme.fg("accent", node.name);
193 - const rendered = withSymlinkMarker(label, node, theme);
194 - return node.loading ? `${rendered}${theme.fg("dim", " ⏳")}` : rendered;
195 - }
196 - if (node.gitStatus) return withSymlinkMarker(theme.fg("warning", node.name), node, theme);
197 - return withSymlinkMarker(node.name, node, theme);
200 -function collapseAllExcept(node: FileNode, keep: Set<FileNode>): void {
201 - if (node.isDirectory) {
202 - node.expanded = keep.has(node);
203 - if (node.children) {
204 - for (const child of node.children) {
205 - collapseAllExcept(child, keep);
206 - }
207 - }
208 - }
211 -export function createFileBrowser(
212 - cwd: string,
213 - agentModifiedFiles: Set<string>,
214 - theme: Theme,
215 - onClose: () => void,
216 - requestComment: (payload: CommentPayload, comment: string) => void,
217 - requestRender: () => void
218 -): BrowserController {
219 - const ignored = getIgnoredNames();
220 - const repo = isGitRepo(cwd);
221 - let gitStatus = repo ? getGitStatus(cwd) : new Map<string, string>();
222 - let diffStats = repo ? getGitDiffStats(cwd) : new Map<string, DiffStats>();
223 - const gitBranch = repo ? getGitBranch(cwd) : "";
225 - const viewer = createViewer(cwd, theme, requestComment);
226 - const textInput = createTextInputBuffer();
228 - const root = repo
229 - ? buildFileTreeFromPaths(cwd, getGitFileList(cwd), gitStatus, diffStats, ignored, agentModifiedFiles)
230 - : {
231 - name: ".",
232 - path: cwd,
233 - isDirectory: true,
234 - realPath: safeRealPathSync(cwd),
235 - children: undefined,
236 - expanded: true,
237 - hasChangedChildren: false,
238 - };
240 - const safeMode = !repo && shouldSafeMode(cwd);
241 - const scanState: ScanState = {
242 - mode: repo ? "none" : safeMode ? "safe" : "full",
243 - isScanning: false,
244 - isPartial: safeMode,
245 - pending: 0,
246 - spinnerIndex: 0,
247 - };
249 - const browser: BrowserState = {
250 - root,
251 - flatList: [],
252 - fullList: [],
253 - stats: getTreeStats(root),
254 - nodeByPath: new Map<string, FileNode>(),
255 - scanState,
256 - selectedIndex: 0,
257 - searchQuery: "",
258 - searchMode: false,
259 - showOnlyChanged: false,
260 - browserHeight: DEFAULT_BROWSER_HEIGHT,
261 - lastPollTime: Date.now(),
262 - };
264 - indexNodes(browser.root, browser.nodeByPath);
265 - browser.flatList = browser.root ? flattenTree(browser.root) : [];
266 - browser.fullList = browser.root ? flattenTree(browser.root, 0, true, true) : [];
268 - const scanner = new FileScanner(cwd, repo, scanState, agentModifiedFiles, browser.nodeByPath, requestRender);
269 - scanner.onUpdate = () => {
270 - updateTreeStats(browser.root);
271 - browser.stats = getTreeStats(browser.root);
272 - refreshLists();
273 - };
275 - function applyAgentModified(): void {
276 - for (const node of browser.nodeByPath.values()) {
277 - if (!node.isDirectory) {
278 - node.agentModified = agentModifiedFiles.has(node.path);
279 - }
280 - }
281 - }
283 - function applyGitUpdates(): void {
284 - for (const node of browser.nodeByPath.values()) {
285 - const relPath = normalizeGitPath(relative(cwd, node.path));
286 - node.gitStatus = gitStatus.get(relPath);
287 - node.diffStats = diffStats.get(relPath);
288 - }
289 - }
291 - function ensureNode(relPath: string): FileNode | null {
292 - if (!browser.root) return null;
293 - let normalized = relPath.trim();
294 - if (!normalized) return null;
295 - if (normalized.startsWith("./")) {
296 - normalized = normalized.slice(2);
297 - }
298 - normalized = normalizeGitPath(normalized);
299 - const parts = normalized.split("/").filter(Boolean);
300 - if (parts.length === 0) return null;
301 - if (parts.length - 1 > MAX_TREE_DEPTH) return null;
303 - let current = browser.root;
304 - let currentRel = "";
306 - for (let i = 0; i < parts.length - 1; i++) {
307 - const part = parts[i];
308 - if (ignored.has(part) || part.startsWith(".")) return null;
309 - currentRel = currentRel ? `${currentRel}/${part}` : part;
310 - const dirPath = join(cwd, currentRel);
311 - let dirNode = browser.nodeByPath.get(dirPath);
312 - if (!dirNode) {
313 - const depth = i + 1;
314 - dirNode = {
315 - name: part,
316 - path: dirPath,
317 - isDirectory: true,
318 - realPath: safeRealPathSync(dirPath),
319 - parent: current,
320 - children: [],
321 - expanded: depth < 1,
322 - hasChangedChildren: false,
323 - };
324 - current.children ??= [];
325 - current.children.push(dirNode);
326 - sortChildren(current);
327 - browser.nodeByPath.set(dirPath, dirNode);
328 - }
329 - current = dirNode;
330 - }
332 - const fileName = parts[parts.length - 1];
333 - if (ignored.has(fileName) || fileName.startsWith(".")) return null;
335 - const filePath = join(cwd, normalized);
336 - const existing = browser.nodeByPath.get(filePath);
337 - if (existing) return existing;
339 - const pathInfo = getPathInfoSync(filePath);
340 - if (pathInfo.isDirectory) {
341 - const isCycle = pathInfo.realPath ? hasAncestorRealPath(current, pathInfo.realPath) : false;
342 - const dirNode: FileNode = {
343 - name: fileName,
344 - path: filePath,
345 - isDirectory: true,
346 - isSymlink: pathInfo.isSymlink,
347 - realPath: pathInfo.realPath ?? safeRealPathSync(filePath),
348 - parent: current,
349 - children: pathInfo.isSymlink && !isCycle ? undefined : [],
350 - expanded: false,
351 - hasChangedChildren: false,
352 - gitStatus: gitStatus.get(normalized),
353 - diffStats: diffStats.get(normalized),
354 - };
356 - current.children ??= [];
357 - current.children.push(dirNode);
358 - sortChildren(current);
359 - browser.nodeByPath.set(filePath, dirNode);
360 - return dirNode;
361 - }
363 - const fileNode: FileNode = {
364 - name: fileName,
365 - path: filePath,
366 - isDirectory: false,
367 - isSymlink: pathInfo.isSymlink,
368 - parent: current,
369 - gitStatus: gitStatus.get(normalized),
370 - agentModified: agentModifiedFiles.has(filePath),
371 - diffStats: diffStats.get(normalized),
372 - };
374 - current.children ??= [];
375 - current.children.push(fileNode);
376 - sortChildren(current);
377 - browser.nodeByPath.set(filePath, fileNode);
378 - return fileNode;
379 - }
381 - function addUntrackedNodes(): void {
382 - for (const [relPath, status] of gitStatus.entries()) {
383 - if (!isUntrackedStatus(status)) continue;
384 - const node = ensureNode(relPath);
385 - if (node) {
386 - node.gitStatus = status;
387 - node.diffStats = diffStats.get(relPath);
388 - if (!node.isDirectory) {
389 - queueLineCount(node, true);
390 - }
391 - }
392 - }
393 - }
395 - function refreshMetadata(): void {
396 - if (!browser.root) return;
397 - const previousDisplayList = getDisplayList();
398 - const currentPath = previousDisplayList[browser.selectedIndex]?.node.path;
399 - const viewingFile = viewer.getFile();
400 - const viewingFilePath = viewingFile?.path;
402 - if (repo) {
403 - gitStatus = getGitStatus(cwd);
404 - diffStats = getGitDiffStats(cwd);
405 - applyGitUpdates();
406 - addUntrackedNodes();
407 - }
409 - applyAgentModified();
410 - updateTreeStats(browser.root);
411 - browser.stats = getTreeStats(browser.root);
412 - refreshLists();
414 - const updatedDisplayList = getDisplayList();
415 - if (currentPath) {
416 - const newIdx = updatedDisplayList.findIndex(f => f.node.path === currentPath);
417 - if (newIdx !== -1) {
418 - browser.selectedIndex = newIdx;
419 - }
420 - }
422 - browser.selectedIndex = Math.min(browser.selectedIndex, Math.max(0, updatedDisplayList.length - 1));
424 - if (viewingFilePath && browser.root) {
425 - const newNode = browser.nodeByPath.get(viewingFilePath) ?? findNodeByPath(browser.root, viewingFilePath);
426 - if (newNode) {
427 - if (newNode.lineCount === undefined && viewingFile?.lineCount !== undefined) {
428 - newNode.lineCount = viewingFile.lineCount;
429 - }
430 - viewer.updateFileRef(newNode);
431 - }
432 - }
433 - }
435 - if (repo) {
436 - queueLineCountsForTree(browser.root);
437 - } else if (browser.root) {
438 - enqueueScan(browser.root, 0, true);
439 - }
441 - function getDisplayList(): FlatNode[] {
442 - let list = browser.searchQuery ? browser.fullList : browser.flatList;
444 - if (browser.showOnlyChanged) {
445 - list = list.filter(f =>
446 - f.node.gitStatus ||
447 - f.node.agentModified ||
448 - (f.node.isDirectory && f.node.hasChangedChildren)
449 - );
450 - }
452 - if (browser.searchQuery) {
453 - const q = browser.searchQuery.toLowerCase();
454 - list = list.filter(f => f.node.name.toLowerCase().includes(q));
455 - }
457 - return list;
458 - }
460 - function navigateToChange(direction: 1 | -1): void {
461 - if (!browser.root) return;
463 - const changedFiles = collectChangedFiles(browser.root);
464 - if (changedFiles.length === 0) return;
466 - const displayList = getDisplayList();
467 - const currentNode = displayList[browser.selectedIndex]?.node;
469 - let currentIdx = -1;
470 - if (currentNode && !currentNode.isDirectory) {
471 - currentIdx = changedFiles.findIndex(c => c.file.path === currentNode.path);
472 - }
474 - let nextIdx: number;
475 - if (currentIdx === -1) {
476 - nextIdx = direction === 1 ? 0 : changedFiles.length - 1;
477 - } else {
478 - nextIdx = currentIdx + direction;
479 - if (nextIdx < 0) nextIdx = changedFiles.length - 1;
480 - if (nextIdx >= changedFiles.length) nextIdx = 0;
481 - }
483 - const target = changedFiles[nextIdx];
485 - const ancestorSet = new Set(target.ancestors);
486 - collapseAllExcept(browser.root, ancestorSet);
488 - for (const ancestor of target.ancestors) {
489 - ancestor.expanded = true;
490 - }
492 - browser.flatList = flattenTree(browser.root);
494 - const newDisplayList = getDisplayList();
495 - const targetIdx = newDisplayList.findIndex(f => f.node.path === target.file.path);
496 - if (targetIdx !== -1) {
497 - browser.selectedIndex = targetIdx;
498 - }
499 - }
501 - function toggleDir(node: FileNode): void {
502 - if (node.isDirectory) {
503 - node.expanded = !node.expanded;
504 - if (node.expanded && node.children === undefined) {
505 - enqueueScan(node, getNodeDepth(node, cwd), true);
506 - }
507 - refreshLists();
508 - }
509 - }
511 - function openFile(node: FileNode): void {
512 - viewer.setFile(node);
513 - }
515 - function renderBrowser(width: number): string[] {
516 - const lines: string[] = [];
517 - const pathDisplay = basename(cwd);
518 - const branchDisplay = gitBranch ? theme.fg("accent", ` (${gitBranch})`) : "";
519 - const stats = browser.stats;
521 - let statsDisplay = "";
522 - if (stats.totalLines !== undefined) {
523 - statsDisplay += theme.fg("dim", ` ${stats.totalLines}L`);
524 - }
525 - if (stats.additions > 0) statsDisplay += theme.fg("success", ` +${stats.additions}`);
526 - if (stats.deletions > 0) statsDisplay += theme.fg("error", ` -${stats.deletions}`);
528 - const hasActivity = browser.scanState.isScanning || scanner.isLineCounting;
529 - if (hasActivity) {
530 - browser.scanState.spinnerIndex = (browser.scanState.spinnerIndex + 1) % SPINNER_FRAMES.length;
531 - }
532 - const spinner = SPINNER_FRAMES[browser.scanState.spinnerIndex];
533 - const activityParts: string[] = [];
534 - if (browser.scanState.isScanning) activityParts.push(`${spinner} scanning`);
535 - if (scanner.isLineCounting) activityParts.push(`${spinner} counts`);
536 - const activityIndicator = activityParts.length > 0 ? theme.fg("dim", ` ${activityParts.join(" ")}`) : "";
537 - const partialIndicator = browser.scanState.isPartial ? theme.fg("warning", " [partial]") : "";
539 - const searchIndicator = browser.searchMode
540 - ? theme.fg("accent", ` /${browser.searchQuery}█`)
541 - : "";
543 - lines.push(
544 - truncateToWidth(theme.bold(pathDisplay) + branchDisplay + statsDisplay + activityIndicator + partialIndicator + searchIndicator, width)
545 - );
546 - lines.push(theme.fg("borderMuted", "─".repeat(width)));
548 - const displayList = getDisplayList();
549 - if (displayList.length === 0) {
550 - const emptyLabel = browser.scanState.isScanning
551 - ? " (loading...)"
552 - : " (no files" + (browser.searchQuery ? " matching '" + browser.searchQuery + "'" : "") + ")";
553 - lines.push(theme.fg("dim", emptyLabel));
554 - for (let i = 1; i < browser.browserHeight; i++) {
555 - lines.push("");
556 - }
557 - } else {
558 - const start = Math.max(
559 - 0,
560 - Math.min(browser.selectedIndex - Math.floor(browser.browserHeight / 2), displayList.length - browser.browserHeight)
561 - );
562 - const end = Math.min(displayList.length, start + browser.browserHeight);
564 - for (let i = start; i < end; i++) {
565 - const { node, depth } = displayList[i];
566 - const isSelected = i === browser.selectedIndex;
567 - const indent = " ".repeat(depth);
568 - const icon = node.isDirectory
569 - ? (node.expanded ? "▼ " : "▶ ")
570 - : " ";
572 - const status = formatNodeStatus(node, theme);
573 - const meta = formatNodeMeta(node, theme);
574 - const name = formatNodeName(node, theme);
576 - let line = `${indent}${icon}${name}${status}${meta}`;
577 - line = truncateToWidth(line, width);
579 - if (isSelected) {
580 - line = theme.bg("selectedBg", line);
581 - }
583 - lines.push(line);
584 - }
586 - const renderedCount = end - start;
587 - for (let i = renderedCount; i < browser.browserHeight; i++) {
588 - lines.push("");
589 - }
591 - const pct = displayList.length > 1
592 - ? Math.round((browser.selectedIndex / (displayList.length - 1)) * 100)
593 - : 100;
594 - lines.push(theme.fg("dim", ` ${browser.selectedIndex + 1}/${displayList.length} (${pct}%)`));
595 - }
597 - lines.push(theme.fg("borderMuted", "─".repeat(width)));
598 - const changedIndicator = browser.showOnlyChanged ? theme.fg("warning", " [changed only]") : "";
599 - const help = browser.searchMode
600 - ? theme.fg("dim", "Type to search ↑↓: nav Enter: confirm Esc: cancel")
601 - : theme.fg("dim", "j/k: nav []: next/prev change c: toggle changed /: search q: close") + changedIndicator;
602 - lines.push(truncateToWidth(help, width));
604 - return lines;
605 - }
607 - function handleViewerInput(data: string): void {
608 - const action: ViewerAction = viewer.handleInput(data);
609 - if (action.type === "close") {
610 - viewer.close();
611 - return;
612 - }
613 - if (action.type === "navigate") {
614 - viewer.close();
615 - navigateToChange(action.direction);
616 - const displayList = getDisplayList();
617 - const item = displayList[browser.selectedIndex];
618 - if (item && !item.node.isDirectory) {
619 - openFile(item.node);
620 - }
621 - }
622 - }
624 - function handleBrowserInput(data: string): void {
625 - const displayList = getDisplayList();
626 - const maxIndex = Math.max(0, displayList.length - 1);
628 - if (matchesKey(data, "q") && !browser.searchMode) {
629 - textInput.reset();
630 - scanner.stop();
631 - onClose();
632 - return;
633 - }
634 - if (matchesKey(data, Key.escape)) {
635 - if (browser.searchMode) {
636 - browser.searchMode = false;
637 - browser.searchQuery = "";
638 - textInput.reset();
639 - } else {
640 - textInput.reset();
641 - scanner.stop();
642 - onClose();
643 - }
644 - return;
645 - }
646 - if (matchesKey(data, "/") && !browser.searchMode) {
647 - browser.searchMode = true;
648 - browser.searchQuery = "";
649 - textInput.reset();
650 - return;
651 - }
652 - if (browser.searchMode) {
653 - if (matchesKey(data, Key.enter)) {
654 - browser.searchMode = false;
655 - browser.selectedIndex = 0;
656 - textInput.reset();
657 - } else if (matchesKey(data, Key.backspace)) {
658 - browser.searchQuery = browser.searchQuery.slice(0, -1);
659 - browser.selectedIndex = 0;
660 - } else if (matchesKey(data, Key.down)) {
661 - browser.selectedIndex = Math.min(maxIndex, browser.selectedIndex + 1);
662 - } else if (matchesKey(data, Key.up)) {
663 - browser.selectedIndex = Math.max(0, browser.selectedIndex - 1);
664 - } else {
665 - const text = textInput.push(data);
666 - if (text) {
667 - browser.searchQuery += text;
668 - browser.selectedIndex = 0;
669 - }
670 - }
671 - return;
672 - }
673 - if (matchesKey(data, "j") || matchesKey(data, Key.down)) {
674 - browser.selectedIndex = Math.min(maxIndex, browser.selectedIndex + 1);
675 - return;
676 - }
677 - if (matchesKey(data, "k") || matchesKey(data, Key.up)) {
678 - browser.selectedIndex = Math.max(0, browser.selectedIndex - 1);
679 - return;
680 - }
681 - if (matchesKey(data, Key.enter)) {
682 - const item = displayList[browser.selectedIndex];
683 - if (item) {
684 - if (item.node.isDirectory) {
685 - toggleDir(item.node);
686 - } else {
687 - openFile(item.node);
688 - }
689 - }
690 - return;
691 - }
692 - if (matchesKey(data, "l") || matchesKey(data, Key.right)) {
693 - const item = displayList[browser.selectedIndex];
694 - if (item?.node.isDirectory && !item.node.expanded) {
695 - toggleDir(item.node);
696 - } else if (item && !item.node.isDirectory) {
697 - openFile(item.node);
698 - }
699 - return;
700 - }
701 - if (matchesKey(data, "h") || matchesKey(data, Key.left)) {
702 - const item = displayList[browser.selectedIndex];
703 - if (item?.node.isDirectory && item.node.expanded) {
704 - toggleDir(item.node);
705 - }
706 - return;
707 - }
708 - if (matchesKey(data, Key.pageDown)) {
709 - browser.selectedIndex = Math.min(maxIndex, browser.selectedIndex + browser.browserHeight);
710 - return;
711 - }
712 - if (matchesKey(data, Key.pageUp)) {
713 - browser.selectedIndex = Math.max(0, browser.selectedIndex - browser.browserHeight);
714 - return;
715 - }
716 - if (matchesKey(data, "+") || matchesKey(data, "=")) {
717 - browser.browserHeight = Math.min(MAX_BROWSER_HEIGHT, browser.browserHeight + 5);
718 - return;
719 - }
720 - if (matchesKey(data, "-") || matchesKey(data, "_")) {
721 - browser.browserHeight = Math.max(MIN_PANEL_HEIGHT, browser.browserHeight - 5);
722 - return;
723 - }
724 - if (matchesKey(data, "c")) {
725 - browser.showOnlyChanged = !browser.showOnlyChanged;
726 - browser.selectedIndex = 0;
727 - return;
728 - }
729 - if (matchesKey(data, "]")) {
730 - navigateToChange(1);
731 - return;
732 - }
733 - if (matchesKey(data, "[")) {
734 - navigateToChange(-1);
735 - return;
736 - }
737 - }
739 - return {
740 - render(width: number): string[] {
741 - const now = Date.now();
742 - if (repo && now - browser.lastPollTime > POLL_INTERVAL_MS) {
743 - browser.lastPollTime = now;
744 - refreshMetadata();
745 - }
747 - if (viewer.isOpen()) {
748 - return viewer.render(width);
749 - }
751 - return renderBrowser(width);
752 - },
754 - handleInput(data: string): void {
755 - if (viewer.isOpen()) {
756 - handleViewerInput(data);
757 - } else {
758 - handleBrowserInput(data);
759 - }
760 - },
762 - invalidate(): void {},
763 - };

pi/agent/extensions/files-widget/comment.ts

Deleted
deleted file mode 100644
1 -import type { CommentPayload } from "./viewer";
3 -export function formatCommentMessage(payload: CommentPayload, comment: string): string {
4 - return `In \`${payload.relPath}\` (${payload.lineRange}):\n\`\`\`${payload.ext}\n${payload.selectedText}\n\`\`\`\n\nComment: ${comment}\n`;
5 -}

pi/agent/extensions/files-widget/constants.ts

Deleted
deleted file mode 100644
1 -export const MAX_TREE_DEPTH = 6;
2 -export const POLL_INTERVAL_MS = 3000;
3 -export const MAX_LINE_COUNT_BYTES = 256 * 1024;
4 -export const LINE_COUNT_BATCH_SIZE = 8;
5 -export const LINE_COUNT_BATCH_DELAY_MS = 30;
6 -export const SCAN_BATCH_SIZE = 4;
7 -export const SCAN_BATCH_DELAY_MS = 25;
8 -export const SAFE_MODE_ENTRY_THRESHOLD = 200;
10 -export const DEFAULT_VIEWER_HEIGHT = 18;
11 -export const DEFAULT_BROWSER_HEIGHT = 15;
13 -export const MIN_PANEL_HEIGHT = 5;
14 -export const MAX_VIEWER_HEIGHT = 50;
15 -export const MAX_BROWSER_HEIGHT = 40;
17 -export const SEARCH_SCROLL_OFFSET = 3;

pi/agent/extensions/files-widget/file-tree.ts

Deleted
deleted file mode 100644
1 -/**
2 - * Based on tmustier/pi-extensions (files-widget). MIT License.
3 - */
4 -import { lstatSync, realpathSync, statSync } from "node:fs";
5 -import { join } from "node:path";
7 -import { MAX_TREE_DEPTH } from "./constants";
8 -import type { DiffStats, FileNode, FlatNode } from "./types";
10 -const collator = new Intl.Collator(undefined, { sensitivity: "base" });
12 -function safeRealPathSync(path: string): string {
13 - try {
14 - return realpathSync(path);
15 - } catch {
16 - return path;
17 - }
20 -function getPathInfo(path: string): { isDirectory: boolean; isSymlink: boolean; realPath?: string } {
21 - try {
22 - const linkStat = lstatSync(path);
23 - const isSymlink = linkStat.isSymbolicLink();
24 - const targetStat = isSymlink ? statSync(path) : linkStat;
25 - return {
26 - isDirectory: targetStat.isDirectory(),
27 - isSymlink,
28 - realPath: targetStat.isDirectory() ? safeRealPathSync(path) : undefined,
29 - };
30 - } catch {
31 - return { isDirectory: false, isSymlink: false };
32 - }
35 -function compareNodes(a: FileNode, b: FileNode): number {
36 - if (a.isDirectory !== b.isDirectory) {
37 - return a.isDirectory ? -1 : 1;
38 - }
39 - return collator.compare(a.name, b.name);
42 -function shouldIgnoreSegment(segment: string, ignored: Set<string>): boolean {
43 - return ignored.has(segment) || segment.startsWith(".");
46 -export function sortChildren(node: FileNode): void {
47 - if (!node.children || node.children.length === 0) return;
48 - node.children.sort(compareNodes);
51 -function sortTree(node: FileNode): void {
52 - sortChildren(node);
53 - if (node.children) {
54 - for (const child of node.children) {
55 - if (child.isDirectory) {
56 - sortTree(child);
57 - }
58 - }
59 - }
62 -export function updateTreeStats(root: FileNode | null): void {
63 - if (!root) return;
65 - function traverse(node: FileNode): {
66 - totalLines: number;
67 - totalAdditions: number;
68 - totalDeletions: number;
69 - lineCountComplete: boolean;
70 - hasChanges: boolean;
71 - } {
72 - if (!node.isDirectory) {
73 - const totalLines = node.lineCount ?? 0;
74 - const totalAdditions = node.diffStats?.additions ?? 0;
75 - const totalDeletions = node.diffStats?.deletions ?? 0;
76 - const lineCountComplete = node.lineCount !== undefined;
77 - const hasChanges = Boolean(node.gitStatus || node.agentModified);
78 - return { totalLines, totalAdditions, totalDeletions, lineCountComplete, hasChanges };
79 - }
81 - let totalLines = 0;
82 - let totalAdditions = 0;
83 - let totalDeletions = 0;
84 - let lineCountComplete = true;
85 - let hasChanges = false;
87 - if (node.children) {
88 - for (const child of node.children) {
89 - const stats = traverse(child);
90 - totalLines += stats.totalLines;
91 - totalAdditions += stats.totalAdditions;
92 - totalDeletions += stats.totalDeletions;
93 - if (!stats.lineCountComplete) {
94 - lineCountComplete = false;
95 - }
96 - if (stats.hasChanges) {
97 - hasChanges = true;
98 - }
99 - }
100 - }
102 - node.totalLines = totalLines;
103 - node.totalAdditions = totalAdditions;
104 - node.totalDeletions = totalDeletions;
105 - node.lineCountComplete = lineCountComplete;
106 - node.hasChangedChildren = hasChanges;
108 - return { totalLines, totalAdditions, totalDeletions, lineCountComplete, hasChanges };
109 - }
111 - traverse(root);
114 -export function buildFileTreeFromPaths(
115 - cwd: string,
116 - filePaths: string[],
117 - gitStatus: Map<string, string>,
118 - diffStats: Map<string, DiffStats>,
119 - ignored: Set<string>,
120 - agentModified: Set<string>
121 -): FileNode {
122 - const root: FileNode = {
123 - name: ".",
124 - path: cwd,
125 - isDirectory: true,
126 - realPath: safeRealPathSync(cwd),
127 - children: [],
128 - expanded: true,
129 - hasChangedChildren: false,
130 - };
132 - const directoryMap = new Map<string, FileNode>();
133 - directoryMap.set("", root);
134 - const seenFiles = new Set<string>();
136 - for (const rawPath of filePaths) {
137 - let normalized = rawPath.trim();
138 - if (!normalized) continue;
139 - if (normalized.startsWith("./")) {
140 - normalized = normalized.slice(2);
141 - }
142 - normalized = normalized.replace(/\\/g, "/");
144 - const parts = normalized.split("/").filter(Boolean);
145 - if (parts.length === 0) continue;
146 - const dirDepth = parts.length - 1;
147 - if (dirDepth > MAX_TREE_DEPTH) continue;
149 - let current = root;
150 - let relPath = "";
151 - let skip = false;
153 - for (let i = 0; i < parts.length - 1; i++) {
154 - const part = parts[i];
155 - if (shouldIgnoreSegment(part, ignored)) {
156 - skip = true;
157 - break;
158 - }
159 - relPath = relPath ? `${relPath}/${part}` : part;
160 - let dirNode = directoryMap.get(relPath);
161 - if (!dirNode) {
162 - const depth = i + 1;
163 - dirNode = {
164 - name: part,
165 - path: join(cwd, relPath),
166 - isDirectory: true,
167 - realPath: safeRealPathSync(join(cwd, relPath)),
168 - parent: current,
169 - children: [],
170 - expanded: depth < 1,
171 - hasChangedChildren: false,
172 - };
173 - directoryMap.set(relPath, dirNode);
174 - current.children?.push(dirNode);
175 - }
176 - current = dirNode;
177 - }
179 - if (skip) continue;
181 - const fileName = parts[parts.length - 1];
182 - if (shouldIgnoreSegment(fileName, ignored)) continue;
184 - const fileRelPath = parts.join("/");
185 - if (seenFiles.has(fileRelPath)) continue;
187 - const filePath = join(cwd, fileRelPath);
188 - const fileGitStatus = gitStatus.get(fileRelPath) ?? gitStatus.get(`${fileRelPath}/`);
189 - const fileDiffStats = diffStats.get(fileRelPath);
190 - const existingDir = directoryMap.get(fileRelPath);
192 - if (existingDir) {
193 - if (fileGitStatus) {
194 - existingDir.gitStatus = fileGitStatus;
195 - }
196 - if (fileDiffStats) {
197 - existingDir.diffStats = fileDiffStats;
198 - }
199 - continue;
200 - }
202 - const pathInfo = getPathInfo(filePath);
203 - const isDirEntry = normalized.endsWith("/") || pathInfo.isDirectory;
204 - if (isDirEntry) {
205 - const depth = parts.length;
206 - const dirNode: FileNode = {
207 - name: fileName,
208 - path: filePath,
209 - isDirectory: true,
210 - isSymlink: pathInfo.isSymlink,
211 - realPath: pathInfo.realPath ?? safeRealPathSync(filePath),
212 - parent: current,
213 - children: pathInfo.isSymlink ? undefined : [],
214 - expanded: depth < 1,
215 - hasChangedChildren: false,
216 - gitStatus: fileGitStatus,
217 - diffStats: fileDiffStats,
218 - };
219 - directoryMap.set(fileRelPath, dirNode);
220 - current.children?.push(dirNode);
221 - continue;
222 - }
224 - seenFiles.add(fileRelPath);
226 - current.children?.push({
227 - name: fileName,
228 - path: filePath,
229 - isDirectory: false,
230 - isSymlink: pathInfo.isSymlink,
231 - parent: current,
232 - gitStatus: fileGitStatus,
233 - agentModified: agentModified.has(filePath),
234 - diffStats: fileDiffStats,
235 - });
236 - }
238 - sortTree(root);
239 - updateTreeStats(root);
240 - return root;
243 -export function getIgnoredNames(): Set<string> {
244 - return new Set([
245 - "node_modules",
246 - ".git",
247 - ".DS_Store",
248 - "__pycache__",
249 - ".pytest_cache",
250 - ".mypy_cache",
251 - ".next",
252 - ".nuxt",
253 - "dist",
254 - "build",
255 - ".venv",
256 - "venv",
257 - ".env",
258 - "coverage",
259 - ".nyc_output",
260 - ".turbo",
261 - ".cache",
262 - ]);
265 -export function flattenTree(
266 - node: FileNode,
267 - depth = 0,
268 - isRoot = true,
269 - includeCollapsed = false
270 -): FlatNode[] {
271 - const result: FlatNode[] = [];
273 - // Skip the root "." node itself, just process its children
274 - if (isRoot && node.name === ".") {
275 - for (const child of node.children || []) {
276 - result.push(...flattenTree(child, 0, false, includeCollapsed));
277 - }
278 - return result;
279 - }
281 - result.push({ node, depth });
283 - if (node.isDirectory && node.children && (includeCollapsed || node.expanded)) {
284 - for (const child of node.children) {
285 - result.push(...flattenTree(child, depth + 1, false, includeCollapsed));
286 - }
287 - }
289 - return result;

pi/agent/extensions/files-widget/file-viewer.ts

Deleted
deleted file mode 100644
1 -/**
2 - * Based on tmustier/pi-extensions (files-widget). MIT License.
3 - */
4 -import { visibleWidth, wrapTextWithAnsi } from "@mariozechner/pi-tui";
5 -import { execFileSync } from "node:child_process";
6 -import { readFileSync, statSync } from "node:fs";
8 -import { isGitRepo as defaultIsGitRepo } from "./git";
9 -import { hasCommand as defaultHasCommand, isMarkdownPath, stripLeadingEmptyLines } from "./utils";
11 -const DEFAULT_TERM_WIDTH = 80;
12 -const COMMAND_TIMEOUT_MS = 10_000;
13 -const RAW_LINE_NUMBER_WIDTH = 4;
14 -const DIFF_CONTENT_PREFIXES = new Set(["+", "-", " "]);
16 -type CommandOptions = {
17 - cwd?: string;
18 - input?: string;
19 -};
21 -export type CommandRunner = (command: string, args: string[], options?: CommandOptions) => string;
23 -export type FileViewerDeps = {
24 - hasCommand?: (cmd: string) => boolean;
25 - isGitRepo?: (cwd: string) => boolean;
26 - runCommand?: CommandRunner;
27 - readFile?: (path: string, encoding: "utf-8") => string;
28 - stat?: typeof statSync;
29 - columns?: number;
30 -};
32 -export interface LoadedFileContent {
33 - lines: string[];
34 - renderedMarkdown: boolean;
37 -function runCommand(command: string, args: string[], options: CommandOptions = {}): string {
38 - return execFileSync(command, args, {
39 - cwd: options.cwd,
40 - encoding: "utf-8",
41 - timeout: COMMAND_TIMEOUT_MS,
42 - input: options.input,
43 - stdio: options.input === undefined ? "pipe" : ["pipe", "pipe", "pipe"],
44 - });
47 -function termWidth(width: number | undefined, deps: FileViewerDeps): number {
48 - return width || deps.columns || process.stdout.columns || DEFAULT_TERM_WIDTH;
51 -function isDiffContentLine(line: string): boolean {
52 - if (!line) return false;
53 - if (!DIFF_CONTENT_PREFIXES.has(line[0])) return false;
54 - if (line.startsWith("+++ ") || line.startsWith("--- ")) return false;
55 - return true;
58 -function wrapLine(line: string, width: number): string[] {
59 - if (width <= 0 || line.length <= width) return [line];
61 - const wrapped: string[] = [];
62 - for (let i = 0; i < line.length; i += width) {
63 - wrapped.push(line.slice(i, i + width));
64 - }
65 - return wrapped;
68 -function wrapDiffLines(lines: string[], width: number): string[] {
69 - if (width <= 0) return lines;
71 - const wrapped: string[] = [];
72 - for (const line of lines) {
73 - if (line.length <= width) {
74 - wrapped.push(line);
75 - continue;
76 - }
78 - if (!isDiffContentLine(line)) {
79 - wrapped.push(...wrapLine(line, width));
80 - continue;
81 - }
83 - const prefix = line[0];
84 - const contentWidth = Math.max(width - 1, 1);
85 - for (const chunk of wrapLine(line.slice(1), contentWidth)) {
86 - wrapped.push(prefix + chunk);
87 - }
88 - }
89 - return wrapped;
92 -function extractAnsiCode(str: string, pos: number): { length: number } | null {
93 - if (pos >= str.length || str[pos] !== "\x1b") return null;
94 - const next = str[pos + 1];
96 - if (next === "[") {
97 - let j = pos + 2;
98 - while (j < str.length && !/[mGKHJ]/.test(str[j])) j++;
99 - return j < str.length ? { length: j + 1 - pos } : null;
100 - }
102 - if (next === "]" || next === "_") {
103 - let j = pos + 2;
104 - while (j < str.length) {
105 - if (str[j] === "\x07") return { length: j + 1 - pos };
106 - if (str[j] === "\x1b" && str[j + 1] === "\\") return { length: j + 2 - pos };
107 - j++;
108 - }
109 - }
111 - return null;
114 -function stripAnsiCodes(line: string): string {
115 - let result = "";
116 - for (let i = 0; i < line.length;) {
117 - const ansi = extractAnsiCode(line, i);
118 - if (ansi) {
119 - i += ansi.length;
120 - continue;
121 - }
122 - result += line[i];
123 - i += 1;
124 - }
125 - return result;
128 -function splitByVisibleWidth(line: string, width: number): { prefix: string; rest: string } {
129 - if (width <= 0) return { prefix: "", rest: line };
131 - let visible = 0;
132 - let i = 0;
133 - while (i < line.length) {
134 - const ansi = extractAnsiCode(line, i);
135 - if (ansi) {
136 - i += ansi.length;
137 - continue;
138 - }
140 - const charWidth = visibleWidth(line[i]);
141 - if (visible + charWidth > width) break;
142 - visible += charWidth;
143 - i += 1;
144 - }
145 - return { prefix: line.slice(0, i), rest: line.slice(i) };
148 -function maskDigits(line: string): string {
149 - let result = "";
150 - for (let i = 0; i < line.length;) {
151 - const ansi = extractAnsiCode(line, i);
152 - if (ansi) {
153 - result += line.slice(i, i + ansi.length);
154 - i += ansi.length;
155 - continue;
156 - }
158 - const char = line[i];
159 - result += char >= "0" && char <= "9" ? " " : char;
160 - i += 1;
161 - }
162 - return result;
165 -function wrapDeltaLine(line: string, width: number): string[] {
166 - const clean = stripAnsiCodes(line);
167 - let separatorIndex = clean.indexOf("│");
168 - if (separatorIndex === -1) separatorIndex = clean.indexOf("|");
169 - if (separatorIndex === -1) return wrapTextWithAnsi(line, width);
171 - let prefixWidth = visibleWidth(clean.slice(0, separatorIndex + 1));
172 - if (clean[separatorIndex + 1] === " ") prefixWidth += 1;
173 - if (prefixWidth >= width) return wrapTextWithAnsi(line, width);
175 - const { prefix, rest } = splitByVisibleWidth(line, prefixWidth);
176 - const contentWidth = Math.max(width - visibleWidth(prefix), 1);
177 - const continuationPrefix = maskDigits(prefix);
178 - const wrappedContent = wrapTextWithAnsi(rest, contentWidth);
180 - return wrappedContent.map((chunk, index) => (index === 0 ? prefix : continuationPrefix) + chunk);
183 -function wrapDeltaLines(lines: string[], width: number): string[] {
184 - if (width <= 0) return lines;
186 - const wrapped: string[] = [];
187 - for (const line of lines) wrapped.push(...wrapDeltaLine(line, width));
188 - return wrapped;
191 -function commandErrorMessage(error: unknown): string {
192 - return error instanceof Error ? error.message : String(error);
195 -function readGitDiff(filePath: string, cwd: string, run: CommandRunner): string {
196 - const attempts: string[][] = [
197 - ["diff", "--no-color", "--", filePath],
198 - ["diff", "--no-color", "--cached", "--", filePath],
199 - ["diff", "--no-color", "HEAD", "--", filePath],
200 - ];
202 - for (const args of attempts) {
203 - const output = run("git", args, { cwd });
204 - if (output.trim()) return output;
205 - }
206 - return "";
209 -function renderDelta(diffOutput: string, cwd: string, width: number, run: CommandRunner): LoadedFileContent | undefined {
210 - try {
211 - const output = run("delta", [
212 - "--no-gitconfig",
213 - `--width=${width}`,
214 - "--line-numbers",
215 - "--wrap-max-lines=unlimited",
216 - "--max-line-length=0",
217 - ], { cwd, input: diffOutput });
219 - return { lines: wrapDeltaLines(stripLeadingEmptyLines(output.split("\n")), width), renderedMarkdown: false };
220 - } catch {
221 - return undefined;
222 - }
225 -function loadDiffContent(filePath: string, cwd: string, width: number, deps: Required<FileViewerDeps>): LoadedFileContent {
226 - try {
227 - const diffOutput = readGitDiff(filePath, cwd, deps.runCommand);
228 - if (!diffOutput.trim()) {
229 - return { lines: ["No diff available - file may be untracked or unchanged"], renderedMarkdown: false };
230 - }
232 - if (deps.hasCommand("delta")) {
233 - const delta = renderDelta(diffOutput, cwd, width, deps.runCommand);
234 - if (delta) return delta;
235 - }
237 - return { lines: wrapDiffLines(stripLeadingEmptyLines(diffOutput.split("\n")), width), renderedMarkdown: false };
238 - } catch (error) {
239 - return { lines: [`Diff error: ${commandErrorMessage(error)}`], renderedMarkdown: false };
240 - }
243 -function renderMarkdownWithGlow(filePath: string, width: number, deps: Required<FileViewerDeps>): LoadedFileContent | undefined {
244 - if (!deps.hasCommand("glow")) return undefined;
246 - try {
247 - const output = deps.runCommand("glow", ["-s", "dark", "-w", String(width), filePath]);
248 - return output.trim()
249 - ? { lines: stripLeadingEmptyLines(output.split("\n")), renderedMarkdown: true }
250 - : undefined;
251 - } catch {
252 - return undefined;
253 - }
256 -function renderWithBat(filePath: string, width: number, deps: Required<FileViewerDeps>): LoadedFileContent | undefined {
257 - if (!deps.hasCommand("bat")) return undefined;
259 - const common = ["--style=numbers", "--color=always", "--paging=never"];
260 - const attempts = [
261 - [...common, "--wrap=auto", `--terminal-width=${width}`, filePath],
262 - [...common, `--terminal-width=${width}`, filePath],
263 - ];
265 - for (const args of attempts) {
266 - try {
267 - return { lines: deps.runCommand("bat", args).split("\n"), renderedMarkdown: false };
268 - } catch {
269 - // Try next bat invocation, then fall back to raw file.
270 - }
271 - }
273 - return undefined;
276 -function loadRawFile(filePath: string, deps: Required<FileViewerDeps>): LoadedFileContent {
277 - const raw = deps.readFile(filePath, "utf-8");
278 - return {
279 - lines: raw.split("\n").map((line, i) => `${String(i + 1).padStart(RAW_LINE_NUMBER_WIDTH)} │ ${line}`),
280 - renderedMarkdown: false,
281 - };
284 -function withDefaults(deps: FileViewerDeps): Required<FileViewerDeps> {
285 - return {
286 - hasCommand: deps.hasCommand ?? defaultHasCommand,
287 - isGitRepo: deps.isGitRepo ?? defaultIsGitRepo,
288 - runCommand: deps.runCommand ?? runCommand,
289 - readFile: deps.readFile ?? readFileSync,
290 - stat: deps.stat ?? statSync,
291 - columns: deps.columns ?? process.stdout.columns ?? DEFAULT_TERM_WIDTH,
292 - };
295 -export function loadFileContent(
296 - filePath: string,
297 - cwd: string,
298 - diffMode: boolean,
299 - hasChanges: boolean,
300 - width?: number,
301 - renderMarkdown = true,
302 - deps: FileViewerDeps = {},
303 -): LoadedFileContent {
304 - const resolvedDeps = withDefaults(deps);
305 - const resolvedWidth = termWidth(width, resolvedDeps);
307 - try {
308 - if (resolvedDeps.stat(filePath).isDirectory()) {
309 - return { lines: ["Directory selected - expand it in the file tree instead of opening it."], renderedMarkdown: false };
310 - }
311 - } catch {
312 - // Fall through to normal file handling; read/bat/glow will surface useful errors.
313 - }
315 - try {
316 - if (diffMode && hasChanges && resolvedDeps.isGitRepo(cwd)) {
317 - return loadDiffContent(filePath, cwd, resolvedWidth, resolvedDeps);
318 - }
320 - if (isMarkdownPath(filePath) && renderMarkdown) {
321 - const markdown = renderMarkdownWithGlow(filePath, resolvedWidth, resolvedDeps);
322 - if (markdown) return markdown;
323 - }
325 - const bat = renderWithBat(filePath, resolvedWidth, resolvedDeps);
326 - if (bat) return bat;
328 - return loadRawFile(filePath, resolvedDeps);
329 - } catch (error) {
330 - return { lines: [`Error loading file: ${commandErrorMessage(error)}`], renderedMarkdown: false };
331 - }

pi/agent/extensions/files-widget/git.ts

Deleted
deleted file mode 100644
1 -/**
2 - * Based on tmustier/pi-extensions (files-widget). MIT License.
3 - */
4 -import { execSync } from "node:child_process";
6 -import type { DiffStats } from "./types";
8 -export function isGitRepo(cwd: string): boolean {
9 - try {
10 - execSync("git rev-parse --is-inside-work-tree", { cwd, encoding: "utf-8", timeout: 2000, stdio: "pipe" });
11 - return true;
12 - } catch {
13 - return false;
14 - }
17 -export function getGitStatus(cwd: string, options: { includeIgnored?: boolean } = {}): Map<string, string> {
18 - const status = new Map<string, string>();
19 - try {
20 - const flags = ["--porcelain"];
21 - if (options.includeIgnored !== false) {
22 - flags.push("--ignored");
23 - }
24 - const output = execSync(`git status ${flags.join(" ")}`, { cwd, encoding: "utf-8", timeout: 5000, stdio: "pipe" });
25 - for (const line of output.split("\n")) {
26 - if (line.length < 3) continue;
27 - const statusCode = line.slice(0, 2).trim() || "?";
28 - const filePath = line.slice(3);
29 - status.set(filePath, statusCode);
30 - }
31 - } catch {}
32 - return status;
35 -export function getGitFileList(cwd: string): string[] {
36 - const files = new Set<string>();
37 - try {
38 - const tracked = execSync("git ls-files -z", { cwd, encoding: "utf-8", timeout: 5000, stdio: "pipe" });
39 - for (const entry of tracked.split("\0")) {
40 - if (entry) files.add(entry);
41 - }
42 - } catch {}
44 - try {
45 - const statusOutput = execSync("git status --porcelain -uall -z", { cwd, encoding: "utf-8", timeout: 5000, stdio: "pipe" });
46 - const entries = statusOutput.split("\0");
47 - for (let i = 0; i < entries.length; i++) {
48 - const entry = entries[i];
49 - if (!entry) continue;
50 - const statusCode = entry.slice(0, 2).trim();
51 - let filePath = entry.slice(3);
52 - if ((statusCode.startsWith("R") || statusCode.startsWith("C")) && entries[i + 1]) {
53 - i += 1;
54 - filePath = entries[i];
55 - } else if (filePath.includes(" -> ")) {
56 - filePath = filePath.split(" -> ").pop() || filePath;
57 - }
58 - if (filePath) {
59 - files.add(filePath);
60 - }
61 - }
62 - } catch {}
64 - return Array.from(files);
67 -export function getGitBranch(cwd: string): string {
68 - try {
69 - return execSync("git branch --show-current", { cwd, encoding: "utf-8", timeout: 2000, stdio: "pipe" }).trim();
70 - } catch {
71 - return "";
72 - }
75 -export function getGitDiffStats(cwd: string): Map<string, DiffStats> {
76 - const stats = new Map<string, DiffStats>();
77 - try {
78 - // Get diff stats for modified files
79 - const output = execSync("git diff --numstat HEAD", { cwd, encoding: "utf-8", timeout: 5000, stdio: "pipe" });
80 - for (const line of output.split("\n")) {
81 - const parts = line.split("\t");
82 - if (parts.length >= 3) {
83 - const additions = parseInt(parts[0], 10) || 0;
84 - const deletions = parseInt(parts[1], 10) || 0;
85 - const filePath = parts[2];
86 - stats.set(filePath, { additions, deletions });
87 - }
88 - }
89 - // Also get stats for staged files
90 - const stagedOutput = execSync("git diff --numstat --cached", { cwd, encoding: "utf-8", timeout: 5000, stdio: "pipe" });
91 - for (const line of stagedOutput.split("\n")) {
92 - const parts = line.split("\t");
93 - if (parts.length >= 3) {
94 - const additions = parseInt(parts[0], 10) || 0;
95 - const deletions = parseInt(parts[1], 10) || 0;
96 - const filePath = parts[2];
97 - const existing = stats.get(filePath);
98 - if (existing) {
99 - stats.set(filePath, {
100 - additions: existing.additions + additions,
101 - deletions: existing.deletions + deletions,
102 - });
103 - } else {
104 - stats.set(filePath, { additions, deletions });
105 - }
106 - }
107 - }
108 - } catch {}
109 - return stats;

pi/agent/extensions/files-widget/index.ts

Deleted
deleted file mode 100644
1 -/**
2 - * files-widget — in-terminal file browser and diff viewer
3 - *
4 - * /readfiles opens a file browser with syntax highlighting (bat),
5 - * formatted diffs (delta), and markdown rendering (glow).
6 - * Navigate files, view diffs, select code, and send comments to the agent.
7 - *
8 - * Based on tmustier/pi-extensions (files-widget).
9 - * MIT License — https://github.com/tmustier/pi-extensions
10 - */
12 -import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
13 -import { join } from "node:path";
15 -import { createFileBrowser } from "./browser";
16 -import { POLL_INTERVAL_MS } from "./constants";
17 -import { formatCommentMessage } from "./comment";
18 -import { hasCommand } from "./utils";
20 -export default function editorExtension(pi: ExtensionAPI): void {
21 - const cwd = process.cwd();
22 - const agentModifiedFiles = new Set<string>();
23 - const requiredDeps = ["bat", "delta", "glow"] as const;
24 - const getMissingDeps = () => requiredDeps.filter((dep) => !hasCommand(dep));
26 - pi.registerCommand("readfiles", {
27 - description: "Open file browser",
28 - handler: async (_args, ctx) => {
29 - const missing = getMissingDeps();
30 - if (missing.length > 0) {
31 - ctx.ui.notify(`files-widget requires ${missing.join(", ")}. Install: brew install bat git-delta glow`, "error");
32 - return;
33 - }
35 - await ctx.ui.custom<void>((tui, theme, _kb, done) => {
36 - let pollInterval: ReturnType<typeof setInterval> | null = null;
38 - const cleanup = () => {
39 - if (pollInterval) { clearInterval(pollInterval); pollInterval = null; }
40 - done();
41 - };
43 - const requestComment = (payload: { relPath: string; lineRange: string; ext: string; selectedText: string }, comment: string) => {
44 - const message = formatCommentMessage(payload, comment);
45 - if (ctx.isIdle()) {
46 - pi.sendUserMessage(message);
47 - ctx.ui.notify(`Comment sent for ${payload.relPath} (${payload.lineRange})`, "success");
48 - } else {
49 - pi.sendUserMessage(message, { deliverAs: "followUp" });
50 - ctx.ui.notify(`Comment queued for ${payload.relPath} (${payload.lineRange})`, "info");
51 - }
52 - };
54 - const requestRender = () => tui.requestRender();
55 - const browser = createFileBrowser(cwd, agentModifiedFiles, theme, cleanup, requestComment, requestRender);
57 - pollInterval = setInterval(() => requestRender(), POLL_INTERVAL_MS);
59 - return {
60 - render: (w) => browser.render(w),
61 - handleInput: (data) => { browser.handleInput(data); requestRender(); },
62 - invalidate: () => browser.invalidate(),
63 - };
64 - });
65 - },
66 - });
68 - pi.on("tool_result", async (event) => {
69 - if (event.toolName === "write" || event.toolName === "edit") {
70 - const filePath = event.input?.path as string | undefined;
71 - if (filePath) agentModifiedFiles.add(join(cwd, filePath));
72 - }
73 - });
75 - pi.on("session_start", async (_event, ctx) => {
76 - const missing = getMissingDeps();
77 - if (missing.length > 0) {
78 - ctx.ui.notify(`files-widget requires ${missing.join(", ")}. Install: brew install bat git-delta glow`, "error");
79 - }
80 - agentModifiedFiles.clear();
81 - });
83 - pi.on("session_switch", async () => {
84 - agentModifiedFiles.clear();
85 - });
86 -}

pi/agent/extensions/files-widget/input-utils.ts

Deleted
deleted file mode 100644
1 -/**
2 - * Based on tmustier/pi-extensions (files-widget). MIT License.
3 - */
4 -import { decodeKittyPrintable } from "@mariozechner/pi-tui";
6 -const CONTROL_CHARS = /[\u0000-\u0008\u000B-\u001F\u007F]/g;
7 -const BRACKETED_PASTE_START = "\u001b[200~";
8 -const BRACKETED_PASTE_END = "\u001b[201~";
10 -interface SanitizeTextInputOptions {
11 - preserveNewlines?: boolean;
12 -}
14 -function sanitizeTextInput(data: string, options: SanitizeTextInputOptions = {}): string {
15 - const normalized = decodeKittyPrintable(data) ?? data;
16 - if (!normalized || normalized.includes("\u001b")) {
17 - return "";
18 - }
20 - const withNewlines = normalized.replace(/\r\n?/g, "\n");
21 - const withoutTabs = options.preserveNewlines
22 - ? withNewlines.replace(/\t/g, " ")
23 - : withNewlines.replace(/\n/g, " ").replace(/\t/g, " ");
25 - return withoutTabs.replace(CONTROL_CHARS, "");
26 -}
28 -function getPendingStartSuffix(data: string): string {
29 - const maxLength = BRACKETED_PASTE_START.length - 1;
30 - for (let length = Math.min(data.length, maxLength); length > 0; length--) {
31 - const suffix = data.slice(-length);
32 - if (BRACKETED_PASTE_START.startsWith(suffix)) {
33 - return suffix;
34 - }
35 - }
36 - return "";
37 -}
39 -export interface TextInputBuffer {
40 - push(data: string): string;
41 - reset(): void;
42 -}
44 -interface TextInputBufferOptions {
45 - preserveNewlines?: boolean;
46 -}
48 -export function createTextInputBuffer(options: TextInputBufferOptions = {}): TextInputBuffer {
49 - let isInPaste = false;
50 - let pasteBuffer = "";
51 - let pendingStart = "";
53 - const push = (data: string): string => {
54 - if (!data) {
55 - return "";
56 - }
58 - const combined = pendingStart + data;
59 - pendingStart = "";
61 - if (!isInPaste) {
62 - const startIndex = combined.indexOf(BRACKETED_PASTE_START);
63 - if (startIndex === -1) {
64 - const pendingSuffix = getPendingStartSuffix(combined);
65 - const completeText = pendingSuffix ? combined.slice(0, combined.length - pendingSuffix.length) : combined;
66 - pendingStart = pendingSuffix;
67 - return sanitizeTextInput(completeText, options);
68 - }
70 - const beforePaste = combined.slice(0, startIndex);
71 - const afterStart = combined.slice(startIndex + BRACKETED_PASTE_START.length);
72 - isInPaste = true;
73 - pasteBuffer = "";
74 - return sanitizeTextInput(beforePaste, options) + push(afterStart);
75 - }
77 - pasteBuffer += combined;
78 - const endIndex = pasteBuffer.indexOf(BRACKETED_PASTE_END);
79 - if (endIndex === -1) {
80 - return "";
81 - }
83 - const pastedText = pasteBuffer.slice(0, endIndex);
84 - const remaining = pasteBuffer.slice(endIndex + BRACKETED_PASTE_END.length);
85 - isInPaste = false;
86 - pasteBuffer = "";
88 - return sanitizeTextInput(pastedText, options) + push(remaining);
89 - };
91 - return {
92 - push,
93 - reset(): void {
94 - isInPaste = false;
95 - pasteBuffer = "";
96 - pendingStart = "";
97 - },
98 - };
99 -}

pi/agent/extensions/files-widget/package.json

Deleted
deleted file mode 100644
1 -{
2 - "name": "@bugabinga/pi-ext-files-widget",
3 - "version": "0.1.0",
4 - "private": true,
5 - "type": "module",
6 - "main": "index.ts",
7 - "scripts": {
8 - "test": "bun test ./__tests__/*.test.ts",
9 - "test:watch": "bun test ./__tests__/*.test.ts --watch"
10 - },
11 - "peerDependencies": {
12 - "@mariozechner/pi-coding-agent": "*",
13 - "@mariozechner/pi-tui": "*"
14 - }
15 -}

pi/agent/extensions/files-widget/scanner.ts

Deleted
deleted file mode 100644
1 -/**
2 - * Background scanner for file-widget — handles line counting and directory scanning.
3 - * Extracted from browser.ts for testability and clarity.
4 - */
6 -import { readdir, readFile, realpath, stat } from "node:fs/promises";
7 -import { realpathSync, lstatSync, statSync } from "node:fs";
8 -import { join, resolve, sep } from "node:path";
10 -import {
11 - LINE_COUNT_BATCH_DELAY_MS,
12 - LINE_COUNT_BATCH_SIZE,
13 - MAX_LINE_COUNT_BYTES,
14 - MAX_TREE_DEPTH,
15 - SCAN_BATCH_DELAY_MS,
16 - SCAN_BATCH_SIZE,
17 - SAFE_MODE_ENTRY_THRESHOLD,
18 -} from "./constants";
19 -import { getIgnoredNames, sortChildren } from "./file-tree";
20 -import type { FileNode } from "./types";
22 -// ── Scan state ──────────────────────────────────────────────────────────
24 -export interface ScanState {
25 - mode: "full" | "safe" | "none";
26 - isScanning: boolean;
27 - isPartial: boolean;
28 - pending: number;
29 - spinnerIndex: number;
32 -// ── Helpers ─────────────────────────────────────────────────────────────
34 -export function safeRealPathSync(path: string): string {
35 - try {
36 - return realpathSync(path);
37 - } catch {
38 - return resolve(path);
39 - }
42 -function hasAncestorRealPath(node: FileNode | undefined, realPath: string): boolean {
43 - let current = node;
44 - while (current) {
45 - if (current.realPath === realPath) return true;
46 - current = current.parent;
47 - }
48 - return false;
51 -async function getPathInfo(path: string, isSymlink: boolean): Promise<{ isDirectory: boolean; isSymlink: boolean; realPath?: string }> {
52 - try {
53 - const targetStat = await stat(path);
54 - return {
55 - isDirectory: targetStat.isDirectory(),
56 - isSymlink,
57 - realPath: targetStat.isDirectory() ? await realpath(path).catch(() => resolve(path)) : undefined,
58 - };
59 - } catch {
60 - return { isDirectory: false, isSymlink };
61 - }
64 -// ── Scanner class ───────────────────────────────────────────────────────
66 -export class FileScanner {
67 - private lineCountCache = new Map<string, { size: number; mtimeMs: number; count: number }>();
68 - private lineCountQueue: FileNode[] = [];
69 - private lineCountPending = new Set<string>();
70 - private lineCountTimer: ReturnType<typeof setTimeout> | null = null;
72 - private scanQueue: Array<{ node: FileNode; depth: number }> = [];
73 - private scanQueued = new Set<string>();
74 - private scanTimer: ReturnType<typeof setTimeout> | null = null;
76 - private ignored: Set<string>;
77 - private scanState: ScanState;
78 - private repo: boolean;
79 - private cwd: string;
80 - private agentModifiedFiles: Set<string>;
81 - private nodeByPath: Map<string, FileNode>;
82 - private requestRender: () => void;
84 - /** Called after any batch completes with updated stats */
85 - onUpdate?: () => void;
87 - constructor(
88 - cwd: string,
89 - repo: boolean,
90 - scanState: ScanState,
91 - agentModifiedFiles: Set<string>,
92 - nodeByPath: Map<string, FileNode>,
93 - requestRender: () => void,
94 - ) {
95 - this.cwd = cwd;
96 - this.repo = repo;
97 - this.scanState = scanState;
98 - this.agentModifiedFiles = agentModifiedFiles;
99 - this.nodeByPath = nodeByPath;
100 - this.requestRender = requestRender;
101 - this.ignored = getIgnoredNames();
102 - }
104 - // ── Public API ────────────────────────────────────────────────────
106 - get isLineCounting(): boolean {
107 - return this.lineCountPending.size > 0;
108 - }
110 - queueLineCount(node: FileNode, force = false): void {
111 - if (node.isDirectory) return;
112 - if (!force && node.lineCount !== undefined) return;
113 - if (this.lineCountPending.has(node.path)) return;
114 - this.lineCountPending.add(node.path);
115 - this.lineCountQueue.push(node);
116 - if (!this.lineCountTimer) {
117 - this.lineCountTimer = setTimeout(() => this.processLineCountBatch(), LINE_COUNT_BATCH_DELAY_MS);
118 - }
119 - }
121 - queueLineCountsForTree(rootNode: FileNode | null): void {
122 - if (!rootNode) return;
123 - const stack: FileNode[] = [rootNode];
124 - while (stack.length > 0) {
125 - const node = stack.pop();
126 - if (!node) continue;
127 - if (node.isDirectory) {
128 - if (node.children) {
129 - for (const child of node.children) stack.push(child);
130 - }
131 - } else {
132 - this.queueLineCount(node);
133 - }
134 - }
135 - }
137 - enqueueScan(node: FileNode, depth: number, force = false): void {
138 - if (depth > MAX_TREE_DEPTH) return;
139 - if (!force && this.scanState.mode === "safe" && depth > 0) return;
140 - if (node.children !== undefined || node.loading) return;
141 - if (this.scanQueued.has(node.path)) return;
143 - node.loading = true;
144 - this.scanQueued.add(node.path);
145 - this.scanQueue.push({ node, depth });
146 - this.scanState.pending = this.scanQueue.length;
147 - this.scanState.isScanning = true;
149 - if (!this.scanTimer) {
150 - this.scanTimer = setTimeout(() => this.processScanBatch(), this.getScanDelay());
151 - }
152 - }
154 - stop(): void {
155 - if (this.lineCountTimer) {
156 - clearTimeout(this.lineCountTimer);
157 - this.lineCountTimer = null;
158 - }
159 - if (this.scanTimer) {
160 - clearTimeout(this.scanTimer);
161 - this.scanTimer = null;
162 - }
163 - }
165 - // ── Line counting internals ──────────────────────────────────────
167 - private async updateLineCount(node: FileNode): Promise<void> {
168 - try {
169 - const fileStat = await stat(node.path);
170 - if (fileStat.size > MAX_LINE_COUNT_BYTES) {
171 - node.lineCount = undefined;
172 - return;
173 - }
174 - const cached = this.lineCountCache.get(node.path);
175 - if (cached && cached.size === fileStat.size && cached.mtimeMs === fileStat.mtimeMs) {
176 - node.lineCount = cached.count;
177 - return;
178 - }
179 - const content = await readFile(node.path, "utf-8");
180 - const count = content.split("\n").length;
181 - node.lineCount = count;
182 - this.lineCountCache.set(node.path, { size: fileStat.size, mtimeMs: fileStat.mtimeMs, count });
183 - } catch {
184 - node.lineCount = undefined;
185 - }
186 - }
188 - private async processLineCountBatch(): Promise<void> {
189 - this.lineCountTimer = null;
190 - const batch = this.lineCountQueue.splice(0, LINE_COUNT_BATCH_SIZE);
191 - if (batch.length === 0) return;
193 - await Promise.all(
194 - batch.map(async (node) => {
195 - await this.updateLineCount(node);
196 - this.lineCountPending.delete(node.path);
197 - }),
198 - );
200 - this.onUpdate?.();
201 - this.requestRender();
203 - if (this.lineCountQueue.length > 0) {
204 - this.lineCountTimer = setTimeout(() => this.processLineCountBatch(), LINE_COUNT_BATCH_DELAY_MS);
205 - }
206 - }
208 - // ── Directory scanning internals ─────────────────────────────────
210 - private shouldAutoScan(depth: number): boolean {
211 - if (this.repo) return false;
212 - if (this.scanState.mode === "safe") return depth <= 0;
213 - return depth <= MAX_TREE_DEPTH;
214 - }
216 - private getScanBatchSize(): number {
217 - return this.scanState.mode === "safe" ? 1 : SCAN_BATCH_SIZE;
218 - }
220 - private getScanDelay(): number {
221 - return this.scanState.mode === "safe" ? SCAN_BATCH_DELAY_MS * 4 : SCAN_BATCH_DELAY_MS;
222 - }
224 - private async scanDirectory(node: FileNode, depth: number): Promise<void> {
225 - try {
226 - const entries = await readdir(node.path, { withFileTypes: true });
227 - const sorted = [...entries].sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
229 - if (node.path === this.cwd && this.scanState.mode === "full" && sorted.length >= SAFE_MODE_ENTRY_THRESHOLD) {
230 - this.scanState.mode = "safe";
231 - this.scanState.isPartial = true;
232 - this.scanQueue.length = 0;
233 - this.scanQueued.clear();
234 - }
236 - const dirs: FileNode[] = [];
237 - const files: FileNode[] = [];
239 - for (const entry of sorted) {
240 - if (this.ignored.has(entry.name) || entry.name.startsWith(".")) continue;
241 - const fullPath = join(node.path, entry.name);
242 - const childDepth = depth + 1;
244 - if (entry.isDirectory()) {
245 - const dirNode: FileNode = {
246 - name: entry.name,
247 - path: fullPath,
248 - isDirectory: true,
249 - realPath: await realpath(fullPath).catch(() => resolve(fullPath)),
250 - parent: node,
251 - children: undefined,
252 - expanded: childDepth < 1,
253 - hasChangedChildren: false,
254 - };
255 - dirs.push(dirNode);
256 - this.nodeByPath.set(fullPath, dirNode);
257 - if (this.shouldAutoScan(childDepth)) {
258 - this.enqueueScan(dirNode, childDepth);
259 - }
260 - continue;
261 - }
263 - if (entry.isSymbolicLink()) {
264 - const pathInfo = await getPathInfo(fullPath, true);
265 - if (pathInfo.isDirectory) {
266 - const isCycle = pathInfo.realPath ? hasAncestorRealPath(node, pathInfo.realPath) : false;
267 - const dirNode: FileNode = {
268 - name: entry.name,
269 - path: fullPath,
270 - isDirectory: true,
271 - isSymlink: true,
272 - realPath: pathInfo.realPath,
273 - parent: node,
274 - children: isCycle ? [] : undefined,
275 - expanded: childDepth < 1,
276 - hasChangedChildren: false,
277 - };
278 - dirs.push(dirNode);
279 - this.nodeByPath.set(fullPath, dirNode);
280 - if (!isCycle && this.shouldAutoScan(childDepth)) {
281 - this.enqueueScan(dirNode, childDepth);
282 - }
283 - continue;
284 - }
286 - const symlinkFileNode: FileNode = {
287 - name: entry.name,
288 - path: fullPath,
289 - isDirectory: false,
290 - isSymlink: true,
291 - parent: node,
292 - agentModified: this.agentModifiedFiles.has(fullPath),
293 - };
294 - files.push(symlinkFileNode);
295 - this.nodeByPath.set(fullPath, symlinkFileNode);
296 - this.queueLineCount(symlinkFileNode);
297 - continue;
298 - }
300 - const fileNode: FileNode = {
301 - name: entry.name,
302 - path: fullPath,
303 - isDirectory: false,
304 - parent: node,
305 - agentModified: this.agentModifiedFiles.has(fullPath),
306 - };
307 - files.push(fileNode);
308 - this.nodeByPath.set(fullPath, fileNode);
309 - this.queueLineCount(fileNode);
310 - }
312 - node.children = [...dirs, ...files];
313 - } catch {
314 - node.children = [];
315 - } finally {
316 - node.loading = false;
317 - this.scanQueued.delete(node.path);
318 - }
319 - }
321 - private async processScanBatch(): Promise<void> {
322 - this.scanTimer = null;
323 - const batch = this.scanQueue.splice(0, this.getScanBatchSize());
324 - if (batch.length === 0) {
325 - this.scanState.isScanning = false;
326 - this.scanState.pending = 0;
327 - return;
328 - }
330 - for (const item of batch) {
331 - await this.scanDirectory(item.node, item.depth);
332 - }
334 - this.scanState.pending = this.scanQueue.length;
335 - this.scanState.isScanning = this.scanQueue.length > 0;
337 - this.onUpdate?.();
338 - this.requestRender();
340 - if (this.scanQueue.length > 0) {
341 - this.scanTimer = setTimeout(() => this.processScanBatch(), this.getScanDelay());
342 - }
343 - }

pi/agent/extensions/files-widget/types.ts

Deleted
deleted file mode 100644
1 -export interface DiffStats {
2 - additions: number;
3 - deletions: number;
4 -}
6 -export interface FileNode {
7 - name: string;
8 - path: string;
9 - isDirectory: boolean;
10 - isSymlink?: boolean;
11 - realPath?: string;
12 - parent?: FileNode;
13 - children?: FileNode[];
14 - expanded?: boolean;
15 - gitStatus?: string;
16 - agentModified?: boolean;
17 - lineCount?: number;
18 - diffStats?: DiffStats;
19 - hasChangedChildren?: boolean; // For directories
20 - // Aggregated stats for directories
21 - totalLines?: number;
22 - totalAdditions?: number;
23 - totalDeletions?: number;
24 - lineCountComplete?: boolean;
25 - loading?: boolean;
26 -}
28 -export interface FlatNode {
29 - node: FileNode;
30 - depth: number;
31 -}

pi/agent/extensions/files-widget/utils.ts

Deleted
deleted file mode 100644
1 -import { execSync } from "node:child_process";
3 -export function hasCommand(cmd: string): boolean {
4 - try {
5 - execSync(`which ${cmd}`, { stdio: "ignore" });
6 - return true;
7 - } catch {
8 - return false;
9 - }
10 -}
12 -export function isUntrackedStatus(status?: string): boolean {
13 - return status === "?" || status === "??";
14 -}
16 -export function isIgnoredStatus(status?: string): boolean {
17 - return status === "!" || status === "!!";
18 -}
20 -export function isMarkdownPath(path: string): boolean {
21 - return path.toLowerCase().endsWith(".md");
22 -}
24 -export function stripLeadingEmptyLines(lines: string[]): string[] {
25 - let startIdx = 0;
26 - while (startIdx < lines.length && !lines[startIdx].trim()) {
27 - startIdx++;
28 - }
29 - return lines.slice(startIdx);
30 -}

pi/agent/extensions/files-widget/viewer.ts

Deleted
deleted file mode 100644
1 -/**
2 - * Based on tmustier/pi-extensions (files-widget). MIT License.
3 - */
4 -import type { Theme } from "@mariozechner/pi-coding-agent";
5 -import { Key, matchesKey, truncateToWidth, wrapTextWithAnsi } from "@mariozechner/pi-tui";
6 -import { readFileSync, statSync } from "node:fs";
7 -import { relative } from "node:path";
9 -import {
10 - DEFAULT_VIEWER_HEIGHT,
11 - MAX_VIEWER_HEIGHT,
12 - MIN_PANEL_HEIGHT,
13 - SEARCH_SCROLL_OFFSET,
14 -} from "./constants";
15 -import { loadFileContent } from "./file-viewer";
16 -import type { FileNode } from "./types";
17 -import { isMarkdownPath, isUntrackedStatus } from "./utils";
18 -import { createTextInputBuffer } from "./input-utils";
20 -const COMMENT_EDITOR_MAX_VISIBLE_LINES = 4;
22 -export interface CommentPayload {
23 - relPath: string;
24 - lineRange: string;
25 - ext: string;
26 - selectedText: string;
29 -export type ViewerAction =
30 - | { type: "none" }
31 - | { type: "close" }
32 - | { type: "navigate"; direction: 1 | -1 };
34 -type ViewerMode = "normal" | "select" | "search" | "comment";
36 -interface ViewerState {
37 - file: FileNode | null;
38 - content: string[];
39 - rawContent: string;
40 - scroll: number;
41 - diffMode: boolean;
42 - renderMarkdown: boolean;
43 - mode: ViewerMode;
44 - selectStart: number;
45 - selectEnd: number;
46 - commentText: string;
47 - searchQuery: string;
48 - searchMatches: number[];
49 - searchIndex: number;
50 - lastRenderWidth: number;
51 - lastLoadedMtimeMs: number | null;
52 - height: number;
55 -export interface ViewerController {
56 - isOpen(): boolean;
57 - getFile(): FileNode | null;
58 - setFile(file: FileNode): void;
59 - updateFileRef(file: FileNode | null): void;
60 - close(): void;
61 - render(width: number): string[];
62 - handleInput(data: string): ViewerAction;
65 -export function createViewer(
66 - cwd: string,
67 - theme: Theme,
68 - requestComment: (payload: CommentPayload, comment: string) => void
69 -): ViewerController {
70 - const searchInput = createTextInputBuffer();
71 - const commentInput = createTextInputBuffer({ preserveNewlines: true });
73 - const state: ViewerState = {
74 - file: null,
75 - content: [],
76 - rawContent: "",
77 - scroll: 0,
78 - diffMode: false,
79 - renderMarkdown: true,
80 - mode: "normal",
81 - selectStart: 0,
82 - selectEnd: 0,
83 - commentText: "",
84 - searchQuery: "",
85 - searchMatches: [],
86 - searchIndex: 0,
87 - lastRenderWidth: 0,
88 - lastLoadedMtimeMs: null,
89 - height: DEFAULT_VIEWER_HEIGHT,
90 - };
92 - function isMarkdownFile(): boolean {
93 - return !!state.file && isMarkdownPath(state.file.path);
94 - }
96 - function isRenderedMarkdownMode(): boolean {
97 - return isMarkdownFile() && !state.diffMode && state.renderMarkdown;
98 - }
100 - function switchMarkdownToRaw(): boolean {
101 - if (!isRenderedMarkdownMode()) return false;
102 - state.renderMarkdown = false;
103 - const width = state.lastRenderWidth || process.stdout.columns || 80;
104 - reloadContent(width);
105 - return true;
106 - }
108 - function toggleMarkdownMode(): void {
109 - if (!isMarkdownFile() || state.diffMode) return;
110 - state.renderMarkdown = !state.renderMarkdown;
111 - state.lastRenderWidth = 0;
112 - resetSearch();
113 - setMode("normal");
114 - clampScroll();
115 - }
117 - function resetSearch(): void {
118 - state.searchQuery = "";
119 - state.searchMatches = [];
120 - state.searchIndex = 0;
121 - }
123 - function resetComment(): void {
124 - state.commentText = "";
125 - }
127 - function clearSelection(): void {
128 - state.selectStart = 0;
129 - state.selectEnd = 0;
130 - }
132 - function setMode(mode: ViewerMode): void {
133 - if (mode !== state.mode) {
134 - searchInput.reset();
135 - commentInput.reset();
136 - }
138 - state.mode = mode;
139 - if (mode !== "search") resetSearch();
140 - if (mode !== "comment") resetComment();
141 - if (mode === "normal") {
142 - clearSelection();
143 - }
144 - }
146 - function getMaxScroll(): number {
147 - return Math.max(0, state.content.length - state.height);
148 - }
150 - function refreshRawContent(): void {
151 - if (!state.file) return;
153 - try {
154 - const fileStat = statSync(state.file.path);
155 - state.rawContent = readFileSync(state.file.path, "utf-8");
156 - state.file.lineCount = state.rawContent.split("\n").length;
157 - state.lastLoadedMtimeMs = fileStat.mtimeMs;
158 - } catch {
159 - state.rawContent = "";
160 - state.file.lineCount = undefined;
161 - state.lastLoadedMtimeMs = null;
162 - }
163 - }
165 - function hasFileChangedOnDisk(): boolean {
166 - if (!state.file) return false;
168 - try {
169 - return state.lastLoadedMtimeMs === null || statSync(state.file.path).mtimeMs !== state.lastLoadedMtimeMs;
170 - } catch {
171 - return state.lastLoadedMtimeMs !== null;
172 - }
173 - }
175 - function clampScroll(): void {
176 - state.scroll = Math.min(getMaxScroll(), Math.max(0, state.scroll));
177 - }
179 - function reloadContent(width: number): void {
180 - if (!state.file) return;
181 - refreshRawContent();
182 - const hasChanges = !!state.file.gitStatus;
183 - const result = loadFileContent(state.file.path, cwd, state.diffMode, hasChanges, width, state.renderMarkdown);
184 - state.content = result.lines;
185 - state.renderMarkdown = result.renderedMarkdown;
186 - state.lastRenderWidth = width;
187 - clampScroll();
188 - if (state.searchQuery) {
189 - updateSearchMatches({ preserveActiveMatch: true });
190 - }
191 - }
193 - function updateSearchMatches(options: { preserveActiveMatch?: boolean } = {}): void {
194 - const activeMatch = options.preserveActiveMatch ? state.searchMatches[state.searchIndex] : undefined;
196 - state.searchMatches = [];
197 - if (!state.searchQuery) {
198 - state.searchIndex = 0;
199 - return;
200 - }
202 - const q = state.searchQuery.toLowerCase();
203 - const rawLines = state.rawContent.split("\n");
204 - for (let i = 0; i < rawLines.length; i++) {
205 - if (rawLines[i].toLowerCase().includes(q)) {
206 - state.searchMatches.push(i);
207 - }
208 - }
210 - if (state.searchMatches.length === 0) {
211 - state.searchIndex = 0;
212 - return;
213 - }
215 - if (activeMatch === undefined) {
216 - state.searchIndex = 0;
217 - } else {
218 - let nearestIndex = 0;
219 - let nearestDistance = Number.POSITIVE_INFINITY;
220 - for (let i = 0; i < state.searchMatches.length; i++) {
221 - const distance = Math.abs(state.searchMatches[i] - activeMatch);
222 - if (distance < nearestDistance) {
223 - nearestDistance = distance;
224 - nearestIndex = i;
225 - }
226 - }
227 - state.searchIndex = nearestIndex;
228 - }
230 - state.scroll = Math.max(0, state.searchMatches[state.searchIndex] - SEARCH_SCROLL_OFFSET);
231 - clampScroll();
232 - }
234 - function jumpToNextMatch(direction: 1 | -1): void {
235 - if (state.searchMatches.length === 0) return;
236 - state.searchIndex += direction;
237 - if (state.searchIndex < 0) state.searchIndex = state.searchMatches.length - 1;
238 - if (state.searchIndex >= state.searchMatches.length) state.searchIndex = 0;
239 - state.scroll = Math.max(0, state.searchMatches[state.searchIndex] - SEARCH_SCROLL_OFFSET);
240 - clampScroll();
241 - }
243 - function buildCommentPayload(): CommentPayload | null {
244 - if (!state.file) return null;
246 - const rawLines = state.rawContent.split("\n");
247 - const selectedText = rawLines.slice(state.selectStart, state.selectEnd + 1).join("\n");
248 - const relPath = relative(cwd, state.file.path);
249 - const lineRange = state.selectStart === state.selectEnd
250 - ? `line ${state.selectStart + 1}`
251 - : `lines ${state.selectStart + 1}-${state.selectEnd + 1}`;
252 - const ext = state.file.name.split(".").pop() || "";
254 - return { relPath, lineRange, ext, selectedText };
255 - }
257 - function sendComment(comment: string): void {
258 - const payload = buildCommentPayload();
259 - if (!payload) return;
261 - requestComment(payload, comment);
262 - setMode("normal");
263 - }
265 - function renderHeader(width: number): string {
266 - if (!state.file) return "";
267 - const isUntracked = isUntrackedStatus(state.file.gitStatus);
269 - let header = theme.bold(state.file.name);
270 - if (isUntracked) {
271 - header += theme.fg("dim", " [UNTRACKED]");
272 - } else if (state.diffMode) {
273 - header += theme.fg("warning", " [DIFF]");
274 - } else if (isMarkdownFile()) {
275 - header += theme.fg("accent", state.renderMarkdown ? " [RENDERED]" : " [RAW]");
276 - }
277 - if (state.mode === "select" || state.mode === "comment") {
278 - header += theme.fg("accent", ` [SELECT ${state.selectStart + 1}-${state.selectEnd + 1}]`);
279 - }
281 - if (state.file.diffStats) {
282 - if (state.file.diffStats.additions > 0) {
283 - header += theme.fg("success", ` +${state.file.diffStats.additions}`);
284 - }
285 - if (state.file.diffStats.deletions > 0) {
286 - header += theme.fg("error", ` -${state.file.diffStats.deletions}`);
287 - }
288 - } else if (isUntracked && state.file.lineCount !== undefined) {
289 - header += theme.fg("success", ` +${state.file.lineCount}`);
290 - }
292 - if (state.file.lineCount !== undefined) {
293 - header += theme.fg("dim", ` ${state.file.lineCount}L`);
294 - }
296 - if (state.mode === "search") {
297 - header += theme.fg("accent", ` /${state.searchQuery}█`);
298 - } else if (state.searchQuery && state.searchMatches.length > 0) {
299 - header += theme.fg("dim", ` [${state.searchIndex + 1}/${state.searchMatches.length}]`);
300 - }
302 - return truncateToWidth(header, width);
303 - }
305 - function renderCommentEditor(width: number): string[] {
306 - const contentWidth = Math.max(1, width - 2);
307 - const wrappedLines: string[] = [];
308 - const logicalLines = state.commentText.split("\n");
310 - for (const line of logicalLines) {
311 - if (line.length === 0) {
312 - wrappedLines.push("");
313 - continue;
314 - }
315 - wrappedLines.push(...wrapTextWithAnsi(line, contentWidth));
316 - }
318 - if (wrappedLines.length === 0) {
319 - wrappedLines.push("");
320 - }
322 - const lastIndex = wrappedLines.length - 1;
323 - wrappedLines[lastIndex] = `${wrappedLines[lastIndex]}█`;
325 - const overflow = Math.max(0, wrappedLines.length - COMMENT_EDITOR_MAX_VISIBLE_LINES);
326 - const visibleLines = wrappedLines.slice(-COMMENT_EDITOR_MAX_VISIBLE_LINES);
327 - if (overflow > 0 && visibleLines.length > 0) {
328 - visibleLines[0] = `…${visibleLines[0]}`;
329 - }
331 - return [
332 - truncateToWidth(theme.fg("accent", "Comment:"), width),
333 - ...visibleLines.map(line => truncateToWidth(` ${line}`, width)),
334 - ];
335 - }
337 - function renderFooter(width: number): string[] {
338 - const lines: string[] = [];
339 - const pct = state.content.length > 0
340 - ? Math.round((state.scroll / Math.max(1, state.content.length - state.height)) * 100)
341 - : 0;
343 - if (state.mode === "comment") {
344 - lines.push(...renderCommentEditor(width));
345 - lines.push(theme.fg("borderMuted", "─".repeat(width)));
346 - }
348 - let help: string;
349 - if (state.mode === "comment") {
350 - help = theme.fg("dim", "Enter: newline Ctrl+Enter/Ctrl+D: send Esc: cancel");
351 - } else if (state.mode === "select") {
352 - help = theme.fg("dim", "j/k: extend c: comment Esc: cancel");
353 - } else if (state.mode === "search") {
354 - help = theme.fg("dim", "Type to search Enter: confirm Esc: cancel");
355 - } else {
356 - const isUntracked = state.file && isUntrackedStatus(state.file.gitStatus);
357 - const markdownHelp = isMarkdownFile() && !state.diffMode ? "m: raw/render " : "";
358 - help = theme.fg(
359 - "dim",
360 - `j/k: scroll /: search n/N: next/prev match ${markdownHelp}[]: files ${state.file?.gitStatus && !isUntracked ? "d: diff " : ""}q: back ${pct}%`
361 - );
362 - }
363 - lines.push(truncateToWidth(help, width));
365 - return lines;
366 - }
368 - return {
369 - isOpen(): boolean {
370 - return !!state.file;
371 - },
373 - getFile(): FileNode | null {
374 - return state.file;
375 - },
377 - setFile(file: FileNode): void {
378 - state.file = file;
379 - state.scroll = 0;
380 - state.diffMode = !!file.gitStatus && !isUntrackedStatus(file.gitStatus);
381 - state.renderMarkdown = isMarkdownPath(file.path);
382 - setMode("normal");
383 - state.content = [];
384 - state.lastRenderWidth = 0;
385 - state.lastLoadedMtimeMs = null;
386 - refreshRawContent();
387 - },
389 - updateFileRef(file: FileNode | null): void {
390 - state.file = file;
391 - },
393 - close(): void {
394 - state.file = null;
395 - state.content = [];
396 - state.rawContent = "";
397 - state.renderMarkdown = true;
398 - state.lastLoadedMtimeMs = null;
399 - setMode("normal");
400 - },
402 - render(width: number): string[] {
403 - if (!state.file) return [];
405 - const shouldAutoRefresh = state.mode !== "select" && state.mode !== "comment";
406 - if (state.lastRenderWidth !== width || state.content.length === 0 || (shouldAutoRefresh && hasFileChangedOnDisk())) {
407 - reloadContent(width);
408 - }
410 - const lines: string[] = [];
411 - lines.push(renderHeader(width));
412 - lines.push(theme.fg("borderMuted", "─".repeat(width)));
414 - const visible = state.content.slice(state.scroll, state.scroll + state.height);
415 - for (let i = 0; i < state.height; i++) {
416 - if (i < visible.length) {
417 - const lineIdx = state.scroll + i;
418 - let line = truncateToWidth(visible[i] || "", width);
419 - if ((state.mode === "select" || state.mode === "comment") && lineIdx >= state.selectStart && lineIdx <= state.selectEnd) {
420 - line = theme.bg("selectedBg", line);
421 - }
422 - lines.push(line);
423 - } else {
424 - lines.push(theme.fg("dim", "~"));
425 - }
426 - }
428 - lines.push(theme.fg("borderMuted", "─".repeat(width)));
429 - lines.push(...renderFooter(width));
431 - return lines;
432 - },
434 - handleInput(data: string): ViewerAction {
435 - if (!state.file) return { type: "none" };
437 - if (state.mode === "comment") {
438 - if (matchesKey(data, "ctrl+enter") || matchesKey(data, "ctrl+d") || matchesKey(data, "alt+enter")) {
439 - const comment = state.commentText.trim();
440 - if (comment) {
441 - sendComment(comment);
442 - } else {
443 - setMode("normal");
444 - }
445 - } else if (matchesKey(data, Key.enter) || matchesKey(data, "shift+enter")) {
446 - state.commentText += "\n";
447 - } else if (matchesKey(data, Key.escape)) {
448 - setMode("normal");
449 - } else if (matchesKey(data, Key.backspace)) {
450 - state.commentText = state.commentText.slice(0, -1);
451 - } else {
452 - const text = commentInput.push(data);
453 - if (text) {
454 - state.commentText += text;
455 - }
456 - }
457 - return { type: "none" };
458 - }
460 - if (state.mode === "search") {
461 - if (matchesKey(data, Key.enter)) {
462 - setMode("normal");
463 - } else if (matchesKey(data, Key.escape)) {
464 - setMode("normal");
465 - } else if (matchesKey(data, Key.backspace)) {
466 - state.searchQuery = state.searchQuery.slice(0, -1);
467 - updateSearchMatches();
468 - } else {
469 - const text = searchInput.push(data);
470 - if (text) {
471 - state.searchQuery += text;
472 - updateSearchMatches();
473 - }
474 - }
475 - return { type: "none" };
476 - }
478 - if (matchesKey(data, "q") && state.mode !== "select") {
479 - return { type: "close" };
480 - }
481 - if (matchesKey(data, Key.escape)) {
482 - if (state.mode === "select") {
483 - setMode("normal");
484 - } else if (state.searchQuery) {
485 - resetSearch();
486 - } else {
487 - return { type: "close" };
488 - }
489 - return { type: "none" };
490 - }
491 - if (matchesKey(data, "/") && state.mode !== "select") {
492 - switchMarkdownToRaw();
493 - setMode("search");
494 - return { type: "none" };
495 - }
496 - if (matchesKey(data, "n") && state.mode !== "select" && state.searchMatches.length > 0) {
497 - jumpToNextMatch(1);
498 - return { type: "none" };
499 - }
500 - if (matchesKey(data, "N") && state.mode !== "select" && state.searchMatches.length > 0) {
501 - jumpToNextMatch(-1);
502 - return { type: "none" };
503 - }
504 - if (matchesKey(data, "j") || matchesKey(data, Key.down)) {
505 - if (state.mode === "select") {
506 - state.selectEnd = Math.min(state.content.length - 1, state.selectEnd + 1);
507 - } else {
508 - state.scroll = Math.min(getMaxScroll(), state.scroll + 1);
509 - }
510 - return { type: "none" };
511 - }
512 - if (matchesKey(data, "k") || matchesKey(data, Key.up)) {
513 - if (state.mode === "select") {
514 - state.selectEnd = Math.max(state.selectStart, state.selectEnd - 1);
515 - } else {
516 - state.scroll = Math.max(0, state.scroll - 1);
517 - }
518 - return { type: "none" };
519 - }
520 - if (matchesKey(data, Key.pageDown)) {
521 - state.scroll = Math.min(getMaxScroll(), state.scroll + state.height);
522 - return { type: "none" };
523 - }
524 - if (matchesKey(data, Key.pageUp)) {
525 - state.scroll = Math.max(0, state.scroll - state.height);
526 - return { type: "none" };
527 - }
528 - if (matchesKey(data, "g")) {
529 - state.scroll = 0;
530 - return { type: "none" };
531 - }
532 - if (matchesKey(data, "shift+g")) {
533 - state.scroll = getMaxScroll();
534 - return { type: "none" };
535 - }
536 - if (matchesKey(data, "+") || matchesKey(data, "=")) {
537 - state.height = Math.min(MAX_VIEWER_HEIGHT, state.height + 5);
538 - clampScroll();
539 - return { type: "none" };
540 - }
541 - if (matchesKey(data, "-") || matchesKey(data, "_")) {
542 - state.height = Math.max(MIN_PANEL_HEIGHT, state.height - 5);
543 - clampScroll();
544 - return { type: "none" };
545 - }
546 - if (matchesKey(data, "d") && state.mode !== "select" && state.file.gitStatus && !isUntrackedStatus(state.file.gitStatus)) {
547 - state.diffMode = !state.diffMode;
548 - state.lastRenderWidth = 0;
549 - state.scroll = 0;
550 - return { type: "none" };
551 - }
552 - if (matchesKey(data, "m") && state.mode !== "select" && state.mode !== "comment") {
553 - toggleMarkdownMode();
554 - return { type: "none" };
555 - }
556 - if (matchesKey(data, "v") && state.mode !== "select") {
557 - if (switchMarkdownToRaw()) {
558 - return { type: "none" };
559 - }
560 - state.mode = "select";
561 - state.selectStart = state.scroll;
562 - state.selectEnd = state.scroll;
563 - return { type: "none" };
564 - }
565 - if (matchesKey(data, "c") && state.mode === "select") {
566 - state.mode = "comment";
567 - state.commentText = "";
568 - return { type: "none" };
569 - }
570 - if (matchesKey(data, "]") && state.mode !== "select") {
571 - return { type: "navigate", direction: 1 };
572 - }
573 - if (matchesKey(data, "[") && state.mode !== "select") {
574 - return { type: "navigate", direction: -1 };
575 - }
577 - return { type: "none" };
578 - },
579 - };

pi/agent/extensions/tilldone/index.ts

Deleted
deleted file mode 100644
1 -/**
2 - * TillDone — opt-in task discipline.
3 - *
4 - * Behavior:
5 - * - off by default
6 - * - --tilldone starts enabled
7 - * - /tilldone toggles; /tilldone on|off|status|show for control
8 - * - active tool only while enabled
9 - * - task state: idle → inprogress → done
10 - */
12 -import { StringEnum } from "@mariozechner/pi-ai";
13 -import type { ExtensionAPI, ExtensionContext, Theme } from "@mariozechner/pi-coding-agent";
14 -import { matchesKey, Text, truncateToWidth } from "@mariozechner/pi-tui";
15 -import { Type } from "typebox";
17 -// ── Types ──────────────────────────────────────────────────────────────
19 -type TaskStatus = "idle" | "inprogress" | "done";
20 -type TillDoneAction = "new-list" | "add" | "toggle" | "remove" | "update" | "list" | "clear";
21 -type StatusColor = "dim" | "accent" | "success";
22 -type ResultColor = "success" | "accent" | "warning";
24 -type Task = {
25 - id: number;
26 - text: string;
27 - status: TaskStatus;
28 -};
30 -type TillDoneParams = {
31 - action: TillDoneAction;
32 - text?: string;
33 - texts?: string[];
34 - description?: string;
35 - id?: number;
36 -};
38 -type TillDoneDetails = {
39 - action: TillDoneAction;
40 - tasks: Task[];
41 - nextId: number;
42 - listTitle?: string;
43 - listDescription?: string;
44 - ok?: boolean;
45 -};
47 -type TillDoneState = {
48 - enabled: boolean;
49 - tasks: Task[];
50 - nextId: number;
51 - listTitle?: string;
52 - listDescription?: string;
53 - nudgedThisCycle: boolean;
54 -};
56 -type TillDoneStateMarker = { enabled: boolean };
57 -type TextContent = { type: "text"; text: string };
58 -type TillDoneResult = { content: TextContent[]; details: TillDoneDetails };
59 -type ActionHandler = (params: TillDoneParams, ctx: ExtensionContext) => Promise<TillDoneResult> | TillDoneResult;
61 -type Counts = {
62 - idle: number;
63 - active: number;
64 - done: number;
65 - remaining: number;
66 - total: number;
67 -};
69 -const TillDoneSchema = Type.Object({
70 - action: StringEnum(["new-list", "add", "toggle", "remove", "update", "list", "clear"] as const),
71 - text: Type.Optional(Type.String({ description: "Task text (add/update), or list title (new-list)." })),
72 - texts: Type.Optional(Type.Array(Type.String(), { description: "Multiple task texts (add)." })),
73 - description: Type.Optional(Type.String({ description: "List description (new-list)." })),
74 - id: Type.Optional(Type.Number({ description: "Task id (toggle/remove/update)." })),
75 -});
77 -// ── Constants ──────────────────────────────────────────────────────────
79 -const TOOL = "tilldone";
80 -const STATE_ENTRY = "tilldone-state";
81 -const STATUS_KEY = "tilldone";
82 -const CURRENT_WIDGET_KEY = "tilldone-current";
83 -const CONFIRM_TIMEOUT_MS = 30_000;
84 -const LIST_PREVIEW_LIMIT = 5;
85 -const WIDGET_PLACEMENT = "belowEditor" as const;
87 -const STATUS_ICON: Record<TaskStatus, string> = { idle: "○", inprogress: "●", done: "✓" };
88 -const STATUS_LABEL: Record<TaskStatus, string> = { idle: "idle", inprogress: "in progress", done: "done" };
89 -const STATUS_COLOR: Record<TaskStatus, StatusColor> = { idle: "dim", inprogress: "accent", done: "success" };
90 -const NEXT_STATUS: Record<TaskStatus, TaskStatus> = { idle: "inprogress", inprogress: "done", done: "idle" };
92 -const SHOW_ARGS = new Set(["show", "list"]);
93 -const ON_ARGS = new Set(["on", "enable", "enabled"]);
94 -const OFF_ARGS = new Set(["off", "disable", "disabled"]);
95 -const STATUS_ARGS = new Set(["status", "state"]);
96 -const TOGGLE_ARGS = new Set(["", "toggle"]);
98 -const RESULT_ICON: Record<TillDoneAction, string> = {
99 - "new-list": "✓",
100 - add: "+",
101 - toggle: "⟳",
102 - remove: "✕",
103 - update: "✓",
104 - list: "",
105 - clear: "✓",
106 -};
108 -const RESULT_COLOR: Partial<Record<TillDoneAction, ResultColor>> = {
109 - toggle: "accent",
110 - remove: "warning",
111 -};
113 -// ── Pure helpers ───────────────────────────────────────────────────────
115 -function initialState(enabled = false): TillDoneState {
116 - return { enabled, tasks: [], nextId: 1, nudgedThisCycle: false };
119 -function cloneTask(task: Task): Task {
120 - return { ...task };
123 -function snapshot(state: TillDoneState, action: TillDoneAction, ok: boolean): TillDoneDetails {
124 - return {
125 - action,
126 - tasks: state.tasks.map(cloneTask),
127 - nextId: state.nextId,
128 - listTitle: state.listTitle,
129 - listDescription: state.listDescription,
130 - ok,
131 - };
134 -function textContent(text: string): TextContent {
135 - return { type: "text", text };
138 -function result(state: TillDoneState, action: TillDoneAction, text: string, ok = true): TillDoneResult {
139 - return { content: [textContent(text)], details: snapshot(state, action, ok) };
142 -function isStateMarker(value: unknown): value is TillDoneStateMarker {
143 - return typeof value === "object" && value !== null && typeof (value as TillDoneStateMarker).enabled === "boolean";
146 -function isDetails(value: unknown): value is TillDoneDetails {
147 - if (typeof value !== "object" || value === null) return false;
148 - const details = value as Partial<TillDoneDetails>;
149 - return typeof details.action === "string" && Array.isArray(details.tasks) && typeof details.nextId === "number";
152 -function counts(tasks: Task[]): Counts {
153 - let idle = 0;
154 - let active = 0;
155 - let done = 0;
157 - for (const task of tasks) {
158 - if (task.status === "done") done++;
159 - else if (task.status === "inprogress") active++;
160 - else idle++;
161 - }
163 - return { idle, active, done, remaining: idle + active, total: tasks.length };
166 -function activeTask(tasks: Task[]): Task | undefined {
167 - return tasks.find((task) => task.status === "inprogress");
170 -function taskById(tasks: Task[], id: number): Task | undefined {
171 - return tasks.find((task) => task.id === id);
174 -function requiredText(params: TillDoneParams): string | undefined {
175 - const text = params.text?.trim();
176 - return text ? text : undefined;
179 -function addItems(params: TillDoneParams): string[] {
180 - if (params.texts?.length) return params.texts.map((item) => item.trim()).filter(Boolean);
181 - const text = params.text?.trim();
182 - return text ? [text] : [];
185 -function firstText(result: { content?: Array<{ type: string; text?: string }> }): string {
186 - const item = result.content?.[0];
187 - return item?.type === "text" ? item.text ?? "" : "";
190 -function formatTaskLine(task: Task): string {
191 - return `${STATUS_ICON[task.status]} #${task.id} [${STATUS_LABEL[task.status]}]: ${task.text}`;
194 -function formatPlainList(state: TillDoneState): string {
195 - if (state.tasks.length === 0) return "No tasks.";
196 - const header = state.listTitle ? `${state.listTitle}\n` : "";
197 - return header + state.tasks.map(formatTaskLine).join("\n");
200 -function formatNudgeList(tasks: Task[]): string {
201 - return tasks.map((task) => ` ${formatTaskLine(task)}`).join("\n");
204 -function formatStatus(state: TillDoneState, theme: Theme): string {
205 - const c = counts(state.tasks);
206 - const title = state.listTitle ? `📋 ${state.listTitle}` : "📋 TillDone";
207 - const prefix = theme.fg("accent", title);
208 - const progress = state.tasks.length === 0
209 - ? theme.fg("warning", "no tasks")
210 - : theme.fg(c.remaining === 0 ? "success" : "warning", `${c.remaining}/${c.total} open`);
211 - return `${prefix}: ${progress}`;
214 -function renderTaskLine(task: Task, theme: Theme): string {
215 - const color = STATUS_COLOR[task.status];
216 - return `${theme.fg(color, STATUS_ICON[task.status])} ${theme.fg("accent", `#${task.id}`)} ${theme.fg(color, task.text)}`;
219 -function renderCurrentTask(task: Task, theme: Theme): string {
220 - return `${theme.fg("accent", "●")} ${theme.fg("dim", "NOW")} ${theme.fg("accent", `#${task.id}`)} ${theme.fg("success", task.text)}`;
223 -function renderTaskList(tasks: Task[], expanded: boolean, theme: Theme): string {
224 - const visible = expanded ? tasks : tasks.slice(0, LIST_PREVIEW_LIMIT);
225 - const lines = visible.map((task) => renderTaskLine(task, theme));
226 - if (!expanded && tasks.length > visible.length) lines.push(theme.fg("dim", `… ${tasks.length - visible.length} more`));
227 - return lines.join("\n");
230 -function normalizeCommandArg(args: string): string {
231 - return args.trim().toLowerCase();
234 -// ── /tilldone show component ───────────────────────────────────────────
236 -class TillDoneListComponent {
237 - private cachedWidth?: number;
238 - private cachedLines?: string[];
240 - constructor(
241 - private readonly state: TillDoneState,
242 - private readonly theme: Theme,
243 - private readonly close: () => void,
244 - ) {}
246 - handleInput(data: string): void {
247 - if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c") || matchesKey(data, "q")) this.close();
248 - }
250 - render(width: number): string[] {
251 - if (this.cachedLines && this.cachedWidth === width) return this.cachedLines;
253 - const theme = this.theme;
254 - const c = counts(this.state.tasks);
255 - const title = this.state.listTitle ?? "TillDone";
256 - const mode = this.state.enabled ? theme.fg("success", "on") : theme.fg("dim", "off");
257 - const lines = [
258 - "",
259 - `${theme.fg("accent", theme.bold(title))} ${theme.fg("dim", "[")}${mode}${theme.fg("dim", "]")}`,
260 - ];
262 - if (this.state.listDescription) lines.push(theme.fg("muted", this.state.listDescription));
263 - lines.push(`${theme.fg("success", `${c.done} done`)} ${theme.fg("accent", `${c.active} active`)} ${theme.fg("muted", `${c.idle} idle`)}`);
264 - lines.push("");
265 - lines.push(this.state.tasks.length === 0 ? theme.fg("dim", "No tasks. Enable, then ask agent to add tasks.") : renderTaskList(this.state.tasks, true, theme));
266 - lines.push("", theme.fg("dim", "q/Esc close · /tilldone toggles · /tilldone on|off|status|show"), "");
268 - this.cachedWidth = width;
269 - this.cachedLines = lines.flatMap((line) => line.split("\n")).map((line) => truncateToWidth(line, width));
270 - return this.cachedLines;
271 - }
273 - invalidate(): void {
274 - this.cachedWidth = undefined;
275 - this.cachedLines = undefined;
276 - }
279 -// ── Extension ─────────────────────────────────────────────────────────
281 -export default function tilldoneExtension(pi: ExtensionAPI) {
282 - const state = initialState();
284 - pi.registerFlag("tilldone", {
285 - description: "Enable TillDone task discipline at startup",
286 - type: "boolean",
287 - default: false,
288 - });
290 - function replaceState(next: TillDoneState): void {
291 - state.enabled = next.enabled;
292 - state.tasks = next.tasks;
293 - state.nextId = next.nextId;
294 - state.listTitle = next.listTitle;
295 - state.listDescription = next.listDescription;
296 - state.nudgedThisCycle = next.nudgedThisCycle;
297 - }
299 - function setToolActive(active: boolean): void {
300 - const activeTools = new Set(pi.getActiveTools());
301 - if (activeTools.has(TOOL) === active) return;
302 - if (active) activeTools.add(TOOL);
303 - else activeTools.delete(TOOL);
304 - pi.setActiveTools([...activeTools]);
305 - }
307 - function refreshWidget(ctx: ExtensionContext): void {
308 - if (!ctx.hasUI) return;
309 - if (!state.enabled || !activeTask(state.tasks)) {
310 - ctx.ui.setWidget(CURRENT_WIDGET_KEY, undefined);
311 - return;
312 - }
314 - ctx.ui.setWidget(CURRENT_WIDGET_KEY, (_tui, theme) => ({
315 - render(width: number): string[] {
316 - const current = activeTask(state.tasks);
317 - return current ? [truncateToWidth(renderCurrentTask(current, theme), width)] : [];
318 - },
319 - invalidate() {},
320 - }), { placement: WIDGET_PLACEMENT });
321 - }
323 - function refreshUI(ctx: ExtensionContext): void {
324 - setToolActive(state.enabled);
325 - if (!ctx.hasUI) return;
327 - if (!state.enabled) {
328 - ctx.ui.setStatus(STATUS_KEY, undefined);
329 - ctx.ui.setWidget(CURRENT_WIDGET_KEY, undefined);
330 - return;
331 - }
333 - ctx.ui.setStatus(STATUS_KEY, formatStatus(state, ctx.ui.theme));
334 - refreshWidget(ctx);
335 - }
337 - function persistEnabled(): void {
338 - pi.appendEntry<TillDoneStateMarker>(STATE_ENTRY, { enabled: state.enabled });
339 - }
341 - function setEnabled(enabled: boolean, ctx: ExtensionContext): void {
342 - state.enabled = enabled;
343 - persistEnabled();
344 - refreshUI(ctx);
345 - }
347 - function applyEntry(next: TillDoneState, entry: ReturnType<ExtensionContext["sessionManager"]["getBranch"]>[number]): void {
348 - if (entry.type === "custom" && entry.customType === STATE_ENTRY && isStateMarker(entry.data)) {
349 - next.enabled = entry.data.enabled;
350 - return;
351 - }
353 - if (entry.type !== "message") return;
354 - const message = entry.message;
355 - if (message.role !== "toolResult" || message.toolName !== TOOL || !isDetails(message.details)) return;
357 - next.tasks = message.details.tasks.map(cloneTask);
358 - next.nextId = message.details.nextId;
359 - next.listTitle = message.details.listTitle;
360 - next.listDescription = message.details.listDescription;
361 - }
363 - function reconstruct(ctx: ExtensionContext): void {
364 - const next = initialState(Boolean(pi.getFlag("tilldone")));
365 - for (const entry of ctx.sessionManager.getBranch()) applyEntry(next, entry);
366 - replaceState(next);
367 - refreshUI(ctx);
368 - }
370 - async function confirmReplace(ctx: ExtensionContext): Promise<boolean> {
371 - if (!ctx.hasUI || (state.tasks.length === 0 && !state.listTitle)) return true;
372 - return ctx.ui.confirm(
373 - "Start new TillDone list?",
374 - `Replace${state.listTitle ? ` ${state.listTitle}` : " current list"} (${state.tasks.length} task(s))?`,
375 - { timeout: CONFIRM_TIMEOUT_MS },
376 - );
377 - }
379 - async function confirmClear(ctx: ExtensionContext): Promise<boolean> {
380 - if (!ctx.hasUI || state.tasks.length === 0) return true;
381 - return ctx.ui.confirm("Clear TillDone?", `Remove ${state.tasks.length} task(s)?`, { timeout: CONFIRM_TIMEOUT_MS });
382 - }
384 - function finish(ctx: ExtensionContext, action: TillDoneAction, text: string): TillDoneResult {
385 - refreshUI(ctx);
386 - return result(state, action, text);
387 - }
389 - const handlers: Record<TillDoneAction, ActionHandler> = {
390 - "new-list": async (params, ctx) => {
391 - const title = requiredText(params);
392 - if (!title) return result(state, "new-list", "Missing title. Pass text for new-list.", false);
393 - if (!(await confirmReplace(ctx))) return result(state, "new-list", "New list cancelled.", false);
395 - state.tasks = [];
396 - state.nextId = 1;
397 - state.listTitle = title;
398 - state.listDescription = params.description?.trim() || undefined;
400 - const suffix = state.listDescription ? ` — ${state.listDescription}` : "";
401 - return finish(ctx, "new-list", `New list: ${state.listTitle}${suffix}`);
402 - },
404 - add: (params, ctx) => {
405 - const items = addItems(params);
406 - if (items.length === 0) return result(state, "add", "Missing task text. Pass text or texts.", false);
408 - const added = items.map((text) => {
409 - const task: Task = { id: state.nextId++, text, status: "idle" };
410 - state.tasks.push(task);
411 - return task;
412 - });
414 - const message = added.length === 1
415 - ? `Added #${added[0]!.id}: ${added[0]!.text}`
416 - : `Added ${added.length} tasks: ${added.map((task) => `#${task.id}`).join(", ")}`;
417 - return finish(ctx, "add", message);
418 - },
420 - toggle: (params, ctx) => {
421 - if (params.id === undefined) return result(state, "toggle", "Missing id for toggle.", false);
422 - const task = taskById(state.tasks, params.id);
423 - if (!task) return result(state, "toggle", `Task #${params.id} not found.`, false);
425 - const previous = task.status;
426 - task.status = NEXT_STATUS[task.status];
428 - const paused: Task[] = [];
429 - if (task.status === "inprogress") {
430 - for (const other of state.tasks) {
431 - if (other.id === task.id || other.status !== "inprogress") continue;
432 - other.status = "idle";
433 - paused.push(other);
434 - }
435 - }
437 - const suffix = paused.length > 0 ? `\nPaused ${paused.map((item) => `#${item.id}`).join(", ")} → idle.` : "";
438 - return finish(ctx, "toggle", `Task #${task.id}: ${previous} → ${task.status}${suffix}`);
439 - },
441 - remove: (params, ctx) => {
442 - if (params.id === undefined) return result(state, "remove", "Missing id for remove.", false);
443 - const index = state.tasks.findIndex((task) => task.id === params.id);
444 - if (index < 0) return result(state, "remove", `Task #${params.id} not found.`, false);
446 - const [removed] = state.tasks.splice(index, 1);
447 - return finish(ctx, "remove", `Removed #${removed!.id}: ${removed!.text}`);
448 - },
450 - update: (params, ctx) => {
451 - if (params.id === undefined) return result(state, "update", "Missing id for update.", false);
452 - const text = requiredText(params);
453 - if (!text) return result(state, "update", "Missing replacement text for update.", false);
454 - const task = taskById(state.tasks, params.id);
455 - if (!task) return result(state, "update", `Task #${params.id} not found.`, false);
457 - const previous = task.text;
458 - task.text = text;
459 - return finish(ctx, "update", `Updated #${task.id}: ${previous} → ${task.text}`);
460 - },
462 - list: (_params, ctx) => finish(ctx, "list", formatPlainList(state)),
464 - clear: async (_params, ctx) => {
465 - if (!(await confirmClear(ctx))) return result(state, "clear", "Clear cancelled.", false);
466 - const count = state.tasks.length;
467 - state.tasks = [];
468 - state.nextId = 1;
469 - state.listTitle = undefined;
470 - state.listDescription = undefined;
471 - return finish(ctx, "clear", `Cleared ${count} task(s)`);
472 - },
473 - };
475 - // ── Lifecycle ─────────────────────────────────────────────────────
477 - pi.on("session_start", async (_event, ctx) => reconstruct(ctx));
478 - pi.on("session_tree", async (_event, ctx) => reconstruct(ctx));
479 - pi.on("session_shutdown", async (_event, ctx) => {
480 - if (!ctx.hasUI) return;
481 - ctx.ui.setStatus(STATUS_KEY, undefined);
482 - ctx.ui.setWidget(CURRENT_WIDGET_KEY, undefined);
483 - });
485 - // ── Gate: only active when enabled ─────────────────────────────────
487 - pi.on("tool_call", async (event) => {
488 - if (!state.enabled || event.toolName === TOOL) return;
490 - const c = counts(state.tasks);
491 - if (c.total === 0) {
492 - return { block: true, reason: "TillDone enabled but no tasks exist. Use tilldone new-list or add before other tools." };
493 - }
494 - if (c.remaining === 0) {
495 - return { block: true, reason: "TillDone list complete. Add tasks, start a new list, or /tilldone off before using other tools." };
496 - }
497 - if (c.active === 0) {
498 - return { block: true, reason: "No TillDone task in progress. Use tilldone toggle <id> before work." };
499 - }
500 - });
502 - // ── Nudge: continue until all tasks done ───────────────────────────
504 - pi.on("agent_end", async () => {
505 - if (!state.enabled || state.nudgedThisCycle) return;
506 - const incomplete = state.tasks.filter((task) => task.status !== "done");
507 - if (incomplete.length === 0) return;
509 - state.nudgedThisCycle = true;
510 - pi.sendMessage({
511 - customType: "tilldone-nudge",
512 - content: `TillDone: ${incomplete.length} incomplete task(s):\n\n${formatNudgeList(incomplete)}\n\nContinue, raise found issues/slop/bugs, or mark verified tasks done with tilldone toggle.`,
513 - display: true,
514 - }, { triggerTurn: true });
515 - });
517 - pi.on("input", async () => {
518 - state.nudgedThisCycle = false;
519 - return { action: "continue" as const };
520 - });
522 - // ── Tool ──────────────────────────────────────────────────────────
524 - pi.registerTool({
525 - name: TOOL,
526 - label: "TillDone",
527 - description:
528 - "Manage the TillDone task list. Actions: new-list (text=title, description), add (text or texts[]), toggle (id: idle→inprogress→done), remove (id), update (id + text), list, clear. Exactly one task should be in progress while working.",
529 - promptSnippet: "Track task discipline with idle/inprogress/done tasks.",
530 - promptGuidelines: [
531 - "Use tilldone before other tools when TillDone is enabled: create tasks, toggle exactly one task to inprogress, work, verify, then toggle it done.",
532 - "Use tilldone to raise newly found issues, slop, or bugs as tasks instead of silently ignoring them.",
533 - ],
534 - parameters: TillDoneSchema,
536 - async execute(_toolCallId, params: TillDoneParams, _signal, _onUpdate, ctx) {
537 - if (!state.enabled) return result(state, "list", "TillDone disabled. Run /tilldone or start pi with --tilldone.", false);
538 - return handlers[params.action](params, ctx);
539 - },
541 - renderCall(args: TillDoneParams, theme) {
542 - const parts = [theme.fg("toolTitle", theme.bold("tilldone")), theme.fg("muted", args.action)];
543 - if (args.texts?.length) parts.push(theme.fg("dim", `${args.texts.length} tasks`));
544 - else if (args.text) parts.push(theme.fg("dim", `"${args.text}"`));
545 - if (args.description) parts.push(theme.fg("dim", `— ${args.description}`));
546 - if (args.id !== undefined) parts.push(theme.fg("accent", `#${args.id}`));
547 - return new Text(parts.join(" "), 0, 0);
548 - },
550 - renderResult(toolResult, { expanded }, theme) {
551 - const details = isDetails(toolResult.details) ? toolResult.details : undefined;
552 - if (!details) return new Text(firstText(toolResult), 0, 0);
553 - if (details.action === "list") {
554 - if (details.tasks.length === 0) return new Text(theme.fg("dim", "No tasks"), 0, 0);
555 - const title = details.listTitle ? `${theme.fg("accent", details.listTitle)}\n` : "";
556 - return new Text(title + renderTaskList(details.tasks, expanded, theme), 0, 0);
557 - }
559 - const icon = details.ok === false ? "!" : RESULT_ICON[details.action];
560 - const color = details.ok === false ? "warning" : RESULT_COLOR[details.action] ?? "success";
561 - return new Text(`${theme.fg(color, icon)} ${theme.fg("muted", firstText(toolResult))}`.trim(), 0, 0);
562 - },
563 - });
565 - // ── Command ───────────────────────────────────────────────────────
567 - pi.registerCommand("tilldone", {
568 - description: "Toggle TillDone; args: on | off | toggle | status | show",
569 - handler: async (args, ctx) => {
570 - const arg = normalizeCommandArg(args);
572 - if (SHOW_ARGS.has(arg)) {
573 - if (!ctx.hasUI) {
574 - ctx.ui.notify("/tilldone show requires interactive mode", "error");
575 - return;
576 - }
577 - await ctx.ui.custom<void>((_tui, theme, _kb, done) => new TillDoneListComponent(state, theme, () => done()));
578 - return;
579 - }
581 - if (STATUS_ARGS.has(arg)) {
582 - const c = counts(state.tasks);
583 - ctx.ui.notify(`TillDone ${state.enabled ? "on" : "off"}: ${c.remaining}/${c.total} open`, "info");
584 - return;
585 - }
587 - if (ON_ARGS.has(arg)) setEnabled(true, ctx);
588 - else if (OFF_ARGS.has(arg)) setEnabled(false, ctx);
589 - else if (TOGGLE_ARGS.has(arg)) setEnabled(!state.enabled, ctx);
590 - else {
591 - ctx.ui.notify("Usage: /tilldone [on|off|toggle|status|show]", "warning");
592 - return;
593 - }
595 - ctx.ui.notify(`TillDone ${state.enabled ? "enabled" : "disabled"}`, "info");
596 - },
597 - });

pi/agent/extensions/tilldone/package.json

Deleted
deleted file mode 100644
1 -{
2 - "name": "@bugabinga/pi-ext-tilldone",
3 - "version": "0.0.0",
4 - "private": true,
5 - "type": "module",
6 - "main": "index.ts",
7 - "peerDependencies": {
8 - "@mariozechner/pi-ai": "*",
9 - "@mariozechner/pi-coding-agent": "*",
10 - "@mariozechner/pi-tui": "*",
11 - "typebox": "*"
12 - }
13 -}