@heyhuynhgiabuu/pi-pretty 0.6.24 → 0.6.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +64 -1
- package/dist/config.d.ts +19 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +38 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +263 -1
- package/dist/index.js.map +1 -1
- package/dist/session-color.d.ts +30 -0
- package/dist/session-color.d.ts.map +1 -0
- package/dist/session-color.js +170 -0
- package/dist/session-color.js.map +1 -0
- package/dist/tools/bash.js +1 -1
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/find.js +4 -4
- package/dist/tools/find.js.map +1 -1
- package/dist/tools/grep.js +1 -1
- package/dist/tools/grep.js.map +1 -1
- package/dist/tools/ls.js +2 -2
- package/dist/tools/ls.js.map +1 -1
- package/dist/tools/read.js +2 -2
- package/dist/tools/read.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/working-indicator.d.ts +241 -0
- package/dist/working-indicator.d.ts.map +1 -0
- package/dist/working-indicator.js +679 -0
- package/dist/working-indicator.js.map +1 -0
- package/package.json +7 -6
- package/src/config.ts +48 -0
- package/src/index.ts +284 -2
- package/src/session-color.ts +172 -0
- package/src/tools/bash.ts +1 -1
- package/src/tools/find.ts +4 -4
- package/src/tools/grep.ts +1 -1
- package/src/tools/ls.ts +2 -2
- package/src/tools/read.ts +2 -2
- package/src/types.ts +4 -0
- package/src/working-indicator.ts +884 -0
package/src/tools/find.ts
CHANGED
|
@@ -150,7 +150,7 @@ export function registerFindTool(
|
|
|
150
150
|
const pathPart = theme.fg("toolOutput", pathArg);
|
|
151
151
|
const limitPart = limit !== undefined && limit !== null ? theme.fg("dim", ` limit ${limit}`) : "";
|
|
152
152
|
const out = `${findLabel} ${patternPart}${inPart}${pathPart}${limitPart}`;
|
|
153
|
-
text.setText(fillToolBackground(`\n${TOOL_RESULT_INDENT}${out}
|
|
153
|
+
text.setText(fillToolBackground(`\n${TOOL_RESULT_INDENT}${out}`, ctx.isError ? BG_ERROR : undefined));
|
|
154
154
|
return text;
|
|
155
155
|
},
|
|
156
156
|
|
|
@@ -168,7 +168,7 @@ export function registerFindTool(
|
|
|
168
168
|
const noticeStr = d.notices?.length
|
|
169
169
|
? `\n${TOOL_RESULT_INDENT}${theme.fg("warning", `[${d.notices.join(". ")}]`)}`
|
|
170
170
|
: "";
|
|
171
|
-
text.setText(fillToolBackground(
|
|
171
|
+
text.setText(fillToolBackground(`${TOOL_RESULT_INDENT}${theme.fg("dim", "0 files")}${noticeStr}\n`));
|
|
172
172
|
return text;
|
|
173
173
|
}
|
|
174
174
|
if (!ctx.expanded) {
|
|
@@ -190,14 +190,14 @@ export function registerFindTool(
|
|
|
190
190
|
const duration = renderToolDuration(r);
|
|
191
191
|
text.setText(
|
|
192
192
|
fillToolBackground(
|
|
193
|
-
|
|
193
|
+
`${TOOL_RESULT_INDENT}${theme.fg("dim", `${d.matchCount} files`)}${duration ? `${FG_DIM}· ${duration}${RST}` : ""}\n${rendered}${noticeStr}\n`,
|
|
194
194
|
),
|
|
195
195
|
);
|
|
196
196
|
return text;
|
|
197
197
|
}
|
|
198
198
|
const fc = r.content?.[0] as TextContent | undefined;
|
|
199
199
|
text.setText(
|
|
200
|
-
fillToolBackground(
|
|
200
|
+
fillToolBackground(`${TOOL_RESULT_INDENT}${theme.fg("dim", fc?.text?.slice(0, 120) ?? "0 files")}\n`),
|
|
201
201
|
);
|
|
202
202
|
return text;
|
|
203
203
|
},
|
package/src/tools/grep.ts
CHANGED
|
@@ -111,7 +111,7 @@ export function registerGrepTool(
|
|
|
111
111
|
if (limit !== undefined && limit !== null) out += theme.fg("dim", ` limit ${limit}`);
|
|
112
112
|
if (literal) out += theme.fg("dim", ` (literal)`);
|
|
113
113
|
if (caseInsensitive) out += theme.fg("dim", ` (case-insensitive)`);
|
|
114
|
-
text.setText(fillToolBackground(`\n${TOOL_RESULT_INDENT}${out}
|
|
114
|
+
text.setText(fillToolBackground(`\n${TOOL_RESULT_INDENT}${out}`, ctx.isError ? BG_ERROR : undefined));
|
|
115
115
|
return text;
|
|
116
116
|
},
|
|
117
117
|
|
package/src/tools/ls.ts
CHANGED
|
@@ -51,7 +51,7 @@ export function registerLsTool(
|
|
|
51
51
|
let out = theme.fg("toolTitle", theme.bold("ls"));
|
|
52
52
|
if (path) out += ` ${theme.fg("accent", path)}`;
|
|
53
53
|
if (limit !== undefined && limit !== null) out += theme.fg("toolOutput", ` (limit ${limit})`);
|
|
54
|
-
text.setText(fillToolBackground(`\n${TOOL_RESULT_INDENT}${out}
|
|
54
|
+
text.setText(fillToolBackground(`\n${TOOL_RESULT_INDENT}${out}`, ctx.isError ? BG_ERROR : undefined));
|
|
55
55
|
return text;
|
|
56
56
|
},
|
|
57
57
|
|
|
@@ -79,7 +79,7 @@ export function registerLsTool(
|
|
|
79
79
|
.join("\n");
|
|
80
80
|
text.setText(
|
|
81
81
|
fillToolBackground(
|
|
82
|
-
|
|
82
|
+
`${TOOL_RESULT_INDENT}${FG_DIM}${d.entryCount} entries${RST}${renderToolMetrics(result)}\n${rendered}\n`,
|
|
83
83
|
),
|
|
84
84
|
);
|
|
85
85
|
return text;
|
package/src/tools/read.ts
CHANGED
|
@@ -100,7 +100,7 @@ export function registerReadTool(
|
|
|
100
100
|
|
|
101
101
|
const path = String(args.path ?? "");
|
|
102
102
|
const label = theme.fg("error", theme.bold("→ read"));
|
|
103
|
-
text.setText(fillToolBackground(`\n${TOOL_RESULT_INDENT}${label} ${theme.fg("toolTitle", path)}
|
|
103
|
+
text.setText(fillToolBackground(`\n${TOOL_RESULT_INDENT}${label} ${theme.fg("toolTitle", path)}`, BG_ERROR));
|
|
104
104
|
return text;
|
|
105
105
|
},
|
|
106
106
|
|
|
@@ -137,7 +137,7 @@ export function registerReadTool(
|
|
|
137
137
|
if (!ctx.expanded) {
|
|
138
138
|
if (skillName) {
|
|
139
139
|
const header = renderSkillHeader(skillName, false, theme);
|
|
140
|
-
text.setText(fillToolBackground(`\n${TOOL_RESULT_INDENT}${header}
|
|
140
|
+
text.setText(fillToolBackground(`\n${TOOL_RESULT_INDENT}${header}`, BG_BASE));
|
|
141
141
|
return text;
|
|
142
142
|
}
|
|
143
143
|
text.setText(
|
package/src/types.ts
CHANGED
|
@@ -187,4 +187,8 @@ export interface PiPrettyDeps {
|
|
|
187
187
|
sdk?: SdkTools;
|
|
188
188
|
TextComponent?: new (text?: string, x?: number, y?: number) => ComponentLike;
|
|
189
189
|
fffModule?: typeof import("@ff-labs/fff-node");
|
|
190
|
+
/** Host AssistantMessageComponent class for the per-row label patch; defaults
|
|
191
|
+
* to the package export. Injectable so tests can verify against the exact
|
|
192
|
+
* class instance they construct rows from. */
|
|
193
|
+
assistantMessageComponent?: unknown;
|
|
190
194
|
}
|