claude-code-templates 1.4.2 ā 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/command-stats.js +38 -17
package/package.json
CHANGED
package/src/command-stats.js
CHANGED
|
@@ -106,7 +106,12 @@ async function analyzeCommands(targetDir = process.cwd()) {
|
|
|
106
106
|
*/
|
|
107
107
|
function displayCommandStats(analysis) {
|
|
108
108
|
console.log(chalk.cyan('\nš Claude Code Command Analysis'));
|
|
109
|
-
|
|
109
|
+
|
|
110
|
+
// Calculate header width dynamically
|
|
111
|
+
const headerWidth = analysis.commands.length > 0 ?
|
|
112
|
+
Math.min(Math.max(...analysis.commands.map(cmd => cmd.name.length)), 25) + 60 : 80;
|
|
113
|
+
|
|
114
|
+
console.log(chalk.gray('ā'.repeat(headerWidth)));
|
|
110
115
|
|
|
111
116
|
if (!analysis.exists) {
|
|
112
117
|
console.log(chalk.yellow('ā ļø ' + analysis.message));
|
|
@@ -131,37 +136,53 @@ function displayCommandStats(analysis) {
|
|
|
131
136
|
console.log(chalk.green(`ā
Found ${analysis.total} command file(s) (${totalSizeKB} KB, ~${totalTokens} tokens total)`));
|
|
132
137
|
console.log('');
|
|
133
138
|
|
|
139
|
+
// Calculate dynamic column widths based on content
|
|
140
|
+
const maxNameLength = Math.max(
|
|
141
|
+
7, // Minimum width for "Command"
|
|
142
|
+
Math.max(...analysis.commands.map(cmd => cmd.name.length))
|
|
143
|
+
);
|
|
144
|
+
const nameWidth = Math.min(maxNameLength, 25); // Cap at 25 characters
|
|
145
|
+
|
|
134
146
|
// Table header
|
|
135
147
|
const header = chalk.bold.blue(
|
|
136
|
-
'Command'.padEnd(
|
|
137
|
-
'Size'.padEnd(
|
|
138
|
-
'Lines'.padEnd(
|
|
139
|
-
'Words'.padEnd(
|
|
140
|
-
'Tokens (aprox)'.padEnd(
|
|
148
|
+
'Command'.padEnd(nameWidth) + ' ā ' +
|
|
149
|
+
'Size'.padEnd(6) + ' ā ' +
|
|
150
|
+
'Lines'.padEnd(5) + ' ā ' +
|
|
151
|
+
'Words'.padEnd(5) + ' ā ' +
|
|
152
|
+
'Tokens (aprox)'.padEnd(13) + ' ā ' +
|
|
141
153
|
'Last Modified'
|
|
142
154
|
);
|
|
143
155
|
console.log(header);
|
|
144
|
-
|
|
156
|
+
|
|
157
|
+
// Create separator line with proper spacing
|
|
158
|
+
const separatorLength = nameWidth + 6 + 5 + 5 + 13 + 13 + 15; // Calculate total width
|
|
159
|
+
console.log(chalk.gray('ā'.repeat(separatorLength)));
|
|
145
160
|
|
|
146
161
|
// Table rows
|
|
147
162
|
analysis.commands.forEach(cmd => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
163
|
+
// Truncate command name if too long and add ellipsis
|
|
164
|
+
let displayName = cmd.name;
|
|
165
|
+
if (displayName.length > nameWidth) {
|
|
166
|
+
displayName = displayName.substring(0, nameWidth - 3) + '...';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const sizeFormatted = `${(cmd.size / 1024).toFixed(1)}KB`.padEnd(6);
|
|
170
|
+
const linesFormatted = cmd.lines.toString().padEnd(5);
|
|
171
|
+
const wordsFormatted = cmd.wordCount.toString().padEnd(5);
|
|
172
|
+
const tokensFormatted = cmd.tokens.toString().padEnd(13);
|
|
152
173
|
const dateFormatted = cmd.lastModified.toLocaleDateString();
|
|
153
174
|
|
|
154
|
-
const row = chalk.white(
|
|
155
|
-
chalk.cyan(sizeFormatted) +
|
|
156
|
-
chalk.yellow(linesFormatted) +
|
|
157
|
-
chalk.green(wordsFormatted) +
|
|
158
|
-
chalk.magenta(tokensFormatted) +
|
|
175
|
+
const row = chalk.white(displayName.padEnd(nameWidth)) + chalk.gray(' ā ') +
|
|
176
|
+
chalk.cyan(sizeFormatted) + chalk.gray(' ā ') +
|
|
177
|
+
chalk.yellow(linesFormatted) + chalk.gray(' ā ') +
|
|
178
|
+
chalk.green(wordsFormatted) + chalk.gray(' ā ') +
|
|
179
|
+
chalk.magenta(tokensFormatted) + chalk.gray(' ā ') +
|
|
159
180
|
chalk.gray(dateFormatted);
|
|
160
181
|
|
|
161
182
|
console.log(row);
|
|
162
183
|
});
|
|
163
184
|
|
|
164
|
-
console.log(chalk.gray('ā'.repeat(
|
|
185
|
+
console.log(chalk.gray('ā'.repeat(separatorLength)));
|
|
165
186
|
console.log(chalk.bold(`Total: ${analysis.total} commands, ${totalSizeKB} KB, ~${totalTokens} tokens`));
|
|
166
187
|
return true; // Indicate commands were found and displayed
|
|
167
188
|
}
|