Enhance CLI tool with usage rendering and indented output formatting. Update user prompt for improved clarity and adjust verbosity settings. Modify file listing to return JSON strings for consistent output.

This commit is contained in:
sebseb7
2025-08-11 19:51:06 +02:00
parent f21aa45065
commit 31b8b5c719
3 changed files with 101 additions and 35 deletions

View File

@@ -160,7 +160,7 @@ export async function run(args) {
if (!includeHidden && fileName.startsWith(".")) {
return { cwd, files: [] };
}
return { cwd, files: [[fileName, "f", stat.size]] };
return { cwd, files: JSON.stringify([[fileName, 'f', stat.size]]) };
}
// Handle non-directory case
@@ -173,7 +173,7 @@ export async function run(args) {
const files = await listEntriesRecursive(resolvedBase, chrootResolved, depth === -1 ? Infinity : depth, includeHidden);
return {
cwd,
files: files.sort((a, b) => a[0].localeCompare(b[0])), // Sort for consistent output
files: JSON.stringify(files.sort((a, b) => a[0].localeCompare(b[0]))), // Sort for consistent output
};
} catch (err) {
return { err: `Failed to list files: ${err?.message || String(err)}` };