+6
-0
@@ -11,5 +11,11 @@ export declare const ok: (msg: string) => string; | ||
| export declare const cyan: import("picocolors/types").Formatter; | ||
| export declare const gray: import("picocolors/types").Formatter; | ||
| export declare const magenta: import("picocolors/types").Formatter; | ||
| export declare const blue: import("picocolors/types").Formatter; | ||
| export declare const white: import("picocolors/types").Formatter; | ||
| export declare function kv(key: string, value: unknown): string; | ||
| export declare function box(width: number, height: number, x?: number, y?: number): string; | ||
| export declare function entity(type: string, name: string, id?: string): string; | ||
| export declare function truncate(text: string, maxLen?: number, ellipsis?: string): string; | ||
| export declare function quoted(text: string, maxLen?: number): string; | ||
| export interface ListOptions { | ||
@@ -16,0 +22,0 @@ numbered?: boolean; |
+13
-0
@@ -14,2 +14,6 @@ import pc from 'picocolors'; | ||
| export const cyan = pc.cyan; | ||
| export const gray = pc.gray; | ||
| export const magenta = pc.magenta; | ||
| export const blue = pc.blue; | ||
| export const white = pc.white; | ||
| // === Primitives === | ||
@@ -32,2 +36,11 @@ export function kv(key, value) { | ||
| } | ||
| export function truncate(text, maxLen = 40, ellipsis = '…') { | ||
| if (text.length <= maxLen) | ||
| return text; | ||
| return text.slice(0, maxLen - ellipsis.length) + ellipsis; | ||
| } | ||
| export function quoted(text, maxLen) { | ||
| const t = maxLen ? truncate(text, maxLen) : text; | ||
| return `"${t.replace(/\n/g, '↵')}"`; | ||
| } | ||
| function formatDetails(details, indent) { | ||
@@ -34,0 +47,0 @@ if (Array.isArray(details)) { |
+1
-1
| { | ||
| "name": "agentfmt", | ||
| "version": "0.1.0", | ||
| "version": "0.1.1", | ||
| "description": "Token-efficient CLI output formatting for LLM agents", | ||
@@ -5,0 +5,0 @@ "type": "module", |
+5
-0
@@ -68,2 +68,7 @@ # agentfmt | ||
| entity('frame', 'Header', '1:23') // [frame] "Header" (1:23) | ||
| // Text utilities | ||
| truncate('long text here', 8) // long tex… | ||
| quoted('hello\nworld') // "hello↵world" | ||
| quoted('very long text', 10) // "very long…" | ||
| ``` | ||
@@ -70,0 +75,0 @@ |
16884
6.62%264
7.76%318
1.6%