kspec 1.0.7 → 1.0.10
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/index.js +20 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -42,7 +42,26 @@ function formatDate(format) {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function slugify(text) {
|
|
45
|
-
|
|
45
|
+
// Extract key words and create a meaningful short identifier
|
|
46
|
+
const words = text.toLowerCase()
|
|
47
|
+
.replace(/[^a-z0-9\s]/g, ' ') // Replace non-alphanumeric with spaces
|
|
48
|
+
.split(/\s+/)
|
|
49
|
+
.filter(word => word.length > 2) // Remove short words
|
|
50
|
+
.filter(word => !['the', 'and', 'for', 'with', 'app', 'web', 'api'].includes(word)); // Remove common words
|
|
51
|
+
|
|
52
|
+
// Take first 3-4 meaningful words and truncate to max 25 chars total
|
|
53
|
+
let slug = words.slice(0, 4).join('-');
|
|
54
|
+
if (slug.length > 25) {
|
|
55
|
+
slug = words.slice(0, 3).join('-');
|
|
56
|
+
}
|
|
57
|
+
if (slug.length > 25) {
|
|
58
|
+
slug = words.slice(0, 2).join('-');
|
|
59
|
+
}
|
|
60
|
+
if (slug.length > 25) {
|
|
61
|
+
slug = slug.slice(0, 25);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return slug.replace(/^-+|-+$/g, '') || 'feature';
|
|
46
65
|
}
|
|
47
66
|
|
|
48
67
|
function detectCli() {
|