claude-code-templates 1.1.2 → 1.1.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-scanner.js +103 -3
package/package.json
CHANGED
package/src/command-scanner.js
CHANGED
|
@@ -87,8 +87,8 @@ function scanCommandsInDirectory(commandsDir, category) {
|
|
|
87
87
|
|
|
88
88
|
commands.push({
|
|
89
89
|
name: commandName,
|
|
90
|
-
displayName: metadata.title
|
|
91
|
-
description: metadata.description
|
|
90
|
+
displayName: createShortDisplayName(commandName, metadata.title),
|
|
91
|
+
description: createShortDescription(metadata.description, commandName),
|
|
92
92
|
category: category,
|
|
93
93
|
filePath: filePath,
|
|
94
94
|
checked: metadata.defaultChecked || false
|
|
@@ -145,6 +145,104 @@ function parseCommandMetadata(content, commandName) {
|
|
|
145
145
|
return metadata;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Creates a short display name from command name for better console display
|
|
150
|
+
* @param {string} commandName - The command name
|
|
151
|
+
* @param {string} title - The full title from markdown
|
|
152
|
+
* @returns {string} Short display name
|
|
153
|
+
*/
|
|
154
|
+
function createShortDisplayName(commandName, title) {
|
|
155
|
+
// Define mapping for common command names to short display names
|
|
156
|
+
const shortNames = {
|
|
157
|
+
'api-endpoint': 'API Endpoint',
|
|
158
|
+
'debug': 'Debug',
|
|
159
|
+
'lint': 'Lint',
|
|
160
|
+
'test': 'Test',
|
|
161
|
+
'refactor': 'Refactor',
|
|
162
|
+
'typescript-migrate': 'TS Migration',
|
|
163
|
+
'npm-scripts': 'NPM Scripts',
|
|
164
|
+
'component': 'Component',
|
|
165
|
+
'hooks': 'Hooks',
|
|
166
|
+
'state-management': 'State Mgmt',
|
|
167
|
+
'middleware': 'Middleware',
|
|
168
|
+
'route': 'Route',
|
|
169
|
+
'database': 'Database',
|
|
170
|
+
'components': 'Components',
|
|
171
|
+
'services': 'Services',
|
|
172
|
+
'composables': 'Composables',
|
|
173
|
+
'django-model': 'Django Model',
|
|
174
|
+
'flask-route': 'Flask Route',
|
|
175
|
+
'git-workflow': 'Git Workflow',
|
|
176
|
+
'project-setup': 'Project Setup'
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// Return predefined short name if available
|
|
180
|
+
if (shortNames[commandName]) {
|
|
181
|
+
return shortNames[commandName];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// If title is short enough, use it
|
|
185
|
+
if (title && title.length <= 15) {
|
|
186
|
+
return title;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Create short name from command name
|
|
190
|
+
return commandName
|
|
191
|
+
.split('-')
|
|
192
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
193
|
+
.join(' ');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Creates a short description for better console display
|
|
198
|
+
* @param {string} description - The full description
|
|
199
|
+
* @param {string} commandName - The command name
|
|
200
|
+
* @returns {string} Short description
|
|
201
|
+
*/
|
|
202
|
+
function createShortDescription(description, commandName) {
|
|
203
|
+
// Define short descriptions for common commands
|
|
204
|
+
const shortDescriptions = {
|
|
205
|
+
'api-endpoint': 'Generate API endpoint',
|
|
206
|
+
'debug': 'Debug issues',
|
|
207
|
+
'lint': 'Fix linting issues',
|
|
208
|
+
'test': 'Run tests',
|
|
209
|
+
'refactor': 'Refactor code',
|
|
210
|
+
'typescript-migrate': 'Migrate to TypeScript',
|
|
211
|
+
'npm-scripts': 'Manage NPM scripts',
|
|
212
|
+
'component': 'Create component',
|
|
213
|
+
'hooks': 'React hooks helper',
|
|
214
|
+
'state-management': 'Manage state',
|
|
215
|
+
'middleware': 'Create middleware',
|
|
216
|
+
'route': 'Create route',
|
|
217
|
+
'database': 'Database operations',
|
|
218
|
+
'components': 'Create components',
|
|
219
|
+
'services': 'Create services',
|
|
220
|
+
'composables': 'Create composables',
|
|
221
|
+
'django-model': 'Create Django model',
|
|
222
|
+
'flask-route': 'Create Flask route',
|
|
223
|
+
'git-workflow': 'Git workflow helper',
|
|
224
|
+
'project-setup': 'Setup project'
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// Return predefined short description if available
|
|
228
|
+
if (shortDescriptions[commandName]) {
|
|
229
|
+
return shortDescriptions[commandName];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// If description exists and is short enough, use it
|
|
233
|
+
if (description && description.length <= 40) {
|
|
234
|
+
return description;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Truncate long descriptions
|
|
238
|
+
if (description && description.length > 40) {
|
|
239
|
+
return description.substring(0, 37) + '...';
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Fallback to command name
|
|
243
|
+
return `${commandName.replace('-', ' ')} command`;
|
|
244
|
+
}
|
|
245
|
+
|
|
148
246
|
/**
|
|
149
247
|
* Get commands available for a specific language and framework combination
|
|
150
248
|
* @param {string} language - The language template
|
|
@@ -171,5 +269,7 @@ module.exports = {
|
|
|
171
269
|
getAvailableCommands,
|
|
172
270
|
getCommandsForLanguageAndFramework,
|
|
173
271
|
scanCommandsInDirectory,
|
|
174
|
-
parseCommandMetadata
|
|
272
|
+
parseCommandMetadata,
|
|
273
|
+
createShortDisplayName,
|
|
274
|
+
createShortDescription
|
|
175
275
|
};
|