@schnick371/devsteps-shared 0.0.1 → 0.5.1

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.
Files changed (71) hide show
  1. package/README.md +66 -7
  2. package/dist/core/add.d.ts +23 -0
  3. package/dist/core/add.d.ts.map +1 -0
  4. package/dist/core/add.js +102 -0
  5. package/dist/core/add.js.map +1 -0
  6. package/dist/core/archive.d.ts +24 -0
  7. package/dist/core/archive.d.ts.map +1 -0
  8. package/dist/core/archive.js +109 -0
  9. package/dist/core/archive.js.map +1 -0
  10. package/dist/core/bulk-update.d.ts +34 -0
  11. package/dist/core/bulk-update.d.ts.map +1 -0
  12. package/dist/core/bulk-update.js +141 -0
  13. package/dist/core/bulk-update.js.map +1 -0
  14. package/dist/core/context.d.ts +54 -0
  15. package/dist/core/context.d.ts.map +1 -0
  16. package/dist/core/context.js +198 -0
  17. package/dist/core/context.js.map +1 -0
  18. package/dist/core/get.d.ts +10 -0
  19. package/dist/core/get.d.ts.map +1 -0
  20. package/dist/core/get.js +28 -0
  21. package/dist/core/get.js.map +1 -0
  22. package/dist/core/index.d.ts +9 -0
  23. package/dist/core/index.d.ts.map +1 -0
  24. package/dist/core/index.js +9 -0
  25. package/dist/core/index.js.map +1 -0
  26. package/dist/core/list.d.ts +19 -0
  27. package/dist/core/list.d.ts.map +1 -0
  28. package/dist/core/list.js +64 -0
  29. package/dist/core/list.js.map +1 -0
  30. package/dist/core/update.d.ts +23 -0
  31. package/dist/core/update.d.ts.map +1 -0
  32. package/dist/core/update.js +118 -0
  33. package/dist/core/update.js.map +1 -0
  34. package/dist/core/validation.d.ts +28 -0
  35. package/dist/core/validation.d.ts.map +1 -0
  36. package/dist/core/validation.js +205 -0
  37. package/dist/core/validation.js.map +1 -0
  38. package/dist/index.d.ts +5 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +5 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/schemas/index.d.ts +286 -0
  43. package/dist/schemas/index.d.ts.map +1 -0
  44. package/dist/schemas/index.js +200 -0
  45. package/dist/schemas/index.js.map +1 -0
  46. package/dist/schemas/project.d.ts +134 -0
  47. package/dist/schemas/project.d.ts.map +1 -0
  48. package/dist/schemas/project.js +54 -0
  49. package/dist/schemas/project.js.map +1 -0
  50. package/dist/schemas/relationships.d.ts +30 -0
  51. package/dist/schemas/relationships.d.ts.map +1 -0
  52. package/dist/schemas/relationships.js +41 -0
  53. package/dist/schemas/relationships.js.map +1 -0
  54. package/dist/types/commands.d.ts +92 -0
  55. package/dist/types/commands.d.ts.map +1 -0
  56. package/dist/types/commands.js +14 -0
  57. package/dist/types/commands.js.map +1 -0
  58. package/dist/types/index.d.ts +3 -0
  59. package/dist/types/index.d.ts.map +1 -0
  60. package/dist/types/index.js +2 -0
  61. package/dist/types/index.js.map +1 -0
  62. package/dist/utils/cache.d.ts +80 -0
  63. package/dist/utils/cache.d.ts.map +1 -0
  64. package/dist/utils/cache.js +169 -0
  65. package/dist/utils/cache.js.map +1 -0
  66. package/dist/utils/index.d.ts +72 -0
  67. package/dist/utils/index.d.ts.map +1 -0
  68. package/dist/utils/index.js +148 -0
  69. package/dist/utils/index.js.map +1 -0
  70. package/package.json +47 -15
  71. package/index.js +0 -6
@@ -0,0 +1,80 @@
1
+ export interface CacheStats {
2
+ size: number;
3
+ keys: string[];
4
+ hits: number;
5
+ misses: number;
6
+ hitRate: number;
7
+ }
8
+ /**
9
+ * Cache configuration
10
+ */
11
+ export declare const CACHE_CONFIG: {
12
+ PROJECT_MD_TTL: number;
13
+ PACKAGE_ANALYSIS_TTL: number;
14
+ ITEM_COUNTS_TTL: number;
15
+ RECENT_UPDATES_TTL: number;
16
+ MAX_CACHE_SIZE: number;
17
+ };
18
+ /**
19
+ * Smart context cache with TTL and file-based invalidation
20
+ */
21
+ export declare class ContextCache {
22
+ private cache;
23
+ private hits;
24
+ private misses;
25
+ /**
26
+ * Get cached value
27
+ * @param key Cache key
28
+ * @param maxAge Maximum age in milliseconds
29
+ * @param filePath Optional file path for mtime-based invalidation
30
+ * @returns Cached value or null if invalid/expired
31
+ */
32
+ get<T>(key: string, maxAge: number, filePath?: string): T | null;
33
+ /**
34
+ * Set cached value
35
+ * @param key Cache key
36
+ * @param data Data to cache
37
+ * @param filePath Optional file path for mtime tracking
38
+ */
39
+ set<T>(key: string, data: T, filePath?: string): void;
40
+ /**
41
+ * Check if key exists and is valid
42
+ * @param key Cache key
43
+ * @param maxAge Maximum age in milliseconds
44
+ * @param filePath Optional file path for mtime-based invalidation
45
+ * @returns true if valid cached value exists
46
+ */
47
+ has(key: string, maxAge: number, filePath?: string): boolean;
48
+ /**
49
+ * Clear entire cache
50
+ */
51
+ clear(): void;
52
+ /**
53
+ * Clear specific cache key
54
+ * @param key Cache key to clear
55
+ */
56
+ delete(key: string): boolean;
57
+ /**
58
+ * Clear cache entries matching pattern
59
+ * @param pattern Regex pattern to match keys
60
+ */
61
+ clearPattern(pattern: RegExp): number;
62
+ /**
63
+ * Get cache statistics
64
+ * @returns Cache statistics including hit rate
65
+ */
66
+ stats(): CacheStats;
67
+ /**
68
+ * Reset hit/miss counters
69
+ */
70
+ resetStats(): void;
71
+ }
72
+ /**
73
+ * Get or create global cache instance
74
+ */
75
+ export declare function getCache(): ContextCache;
76
+ /**
77
+ * Clear global cache
78
+ */
79
+ export declare function clearGlobalCache(): void;
80
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/utils/cache.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;CAMxB,CAAC;AAEF;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAA0C;IACvD,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,MAAM,CAAK;IAEnB;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAoChE;;;;;OAKG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IA0BrD;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO;IAI5D;;OAEG;IACH,KAAK,IAAI,IAAI;IAMb;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI5B;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAWrC;;;OAGG;IACH,KAAK,IAAI,UAAU;IAanB;;OAEG;IACH,UAAU,IAAI,IAAI;CAInB;AAKD;;GAEG;AACH,wBAAgB,QAAQ,IAAI,YAAY,CAKvC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAIvC"}
@@ -0,0 +1,169 @@
1
+ import { statSync } from 'node:fs';
2
+ /**
3
+ * Cache configuration
4
+ */
5
+ export const CACHE_CONFIG = {
6
+ PROJECT_MD_TTL: 60 * 60 * 1000, // 1 hour
7
+ PACKAGE_ANALYSIS_TTL: 30 * 60 * 1000, // 30 minutes
8
+ ITEM_COUNTS_TTL: 5 * 60 * 1000, // 5 minutes
9
+ RECENT_UPDATES_TTL: 1 * 60 * 1000, // 1 minute
10
+ MAX_CACHE_SIZE: 1000, // Maximum number of cache entries
11
+ };
12
+ /**
13
+ * Smart context cache with TTL and file-based invalidation
14
+ */
15
+ export class ContextCache {
16
+ cache = new Map();
17
+ hits = 0;
18
+ misses = 0;
19
+ /**
20
+ * Get cached value
21
+ * @param key Cache key
22
+ * @param maxAge Maximum age in milliseconds
23
+ * @param filePath Optional file path for mtime-based invalidation
24
+ * @returns Cached value or null if invalid/expired
25
+ */
26
+ get(key, maxAge, filePath) {
27
+ const entry = this.cache.get(key);
28
+ if (!entry) {
29
+ this.misses++;
30
+ return null;
31
+ }
32
+ // Check file modification time
33
+ if (filePath && entry.mtime !== undefined) {
34
+ try {
35
+ const currentMtime = statSync(filePath).mtimeMs;
36
+ if (currentMtime > entry.mtime) {
37
+ this.cache.delete(key);
38
+ this.misses++;
39
+ return null;
40
+ }
41
+ }
42
+ catch {
43
+ // File doesn't exist anymore, invalidate cache
44
+ this.cache.delete(key);
45
+ this.misses++;
46
+ return null;
47
+ }
48
+ }
49
+ // Check TTL
50
+ if (Date.now() - entry.timestamp > maxAge) {
51
+ this.cache.delete(key);
52
+ this.misses++;
53
+ return null;
54
+ }
55
+ this.hits++;
56
+ return entry.data;
57
+ }
58
+ /**
59
+ * Set cached value
60
+ * @param key Cache key
61
+ * @param data Data to cache
62
+ * @param filePath Optional file path for mtime tracking
63
+ */
64
+ set(key, data, filePath) {
65
+ // Enforce max cache size (simple LRU: remove oldest)
66
+ if (this.cache.size >= CACHE_CONFIG.MAX_CACHE_SIZE) {
67
+ const firstKey = this.cache.keys().next().value;
68
+ if (firstKey) {
69
+ this.cache.delete(firstKey);
70
+ }
71
+ }
72
+ let mtime;
73
+ if (filePath) {
74
+ try {
75
+ mtime = statSync(filePath).mtimeMs;
76
+ }
77
+ catch {
78
+ // File doesn't exist, don't track mtime
79
+ mtime = undefined;
80
+ }
81
+ }
82
+ this.cache.set(key, {
83
+ data,
84
+ timestamp: Date.now(),
85
+ mtime,
86
+ });
87
+ }
88
+ /**
89
+ * Check if key exists and is valid
90
+ * @param key Cache key
91
+ * @param maxAge Maximum age in milliseconds
92
+ * @param filePath Optional file path for mtime-based invalidation
93
+ * @returns true if valid cached value exists
94
+ */
95
+ has(key, maxAge, filePath) {
96
+ return this.get(key, maxAge, filePath) !== null;
97
+ }
98
+ /**
99
+ * Clear entire cache
100
+ */
101
+ clear() {
102
+ this.cache.clear();
103
+ this.hits = 0;
104
+ this.misses = 0;
105
+ }
106
+ /**
107
+ * Clear specific cache key
108
+ * @param key Cache key to clear
109
+ */
110
+ delete(key) {
111
+ return this.cache.delete(key);
112
+ }
113
+ /**
114
+ * Clear cache entries matching pattern
115
+ * @param pattern Regex pattern to match keys
116
+ */
117
+ clearPattern(pattern) {
118
+ let cleared = 0;
119
+ for (const key of this.cache.keys()) {
120
+ if (pattern.test(key)) {
121
+ this.cache.delete(key);
122
+ cleared++;
123
+ }
124
+ }
125
+ return cleared;
126
+ }
127
+ /**
128
+ * Get cache statistics
129
+ * @returns Cache statistics including hit rate
130
+ */
131
+ stats() {
132
+ const total = this.hits + this.misses;
133
+ const hitRate = total > 0 ? this.hits / total : 0;
134
+ return {
135
+ size: this.cache.size,
136
+ keys: Array.from(this.cache.keys()),
137
+ hits: this.hits,
138
+ misses: this.misses,
139
+ hitRate: Math.round(hitRate * 100) / 100,
140
+ };
141
+ }
142
+ /**
143
+ * Reset hit/miss counters
144
+ */
145
+ resetStats() {
146
+ this.hits = 0;
147
+ this.misses = 0;
148
+ }
149
+ }
150
+ // Global singleton instance
151
+ let globalCache = null;
152
+ /**
153
+ * Get or create global cache instance
154
+ */
155
+ export function getCache() {
156
+ if (!globalCache) {
157
+ globalCache = new ContextCache();
158
+ }
159
+ return globalCache;
160
+ }
161
+ /**
162
+ * Clear global cache
163
+ */
164
+ export function clearGlobalCache() {
165
+ if (globalCache) {
166
+ globalCache.clear();
167
+ }
168
+ }
169
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/utils/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AA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IACH,UAAU;QACR,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;CACF;AAED,4BAA4B;AAC5B,IAAI,WAAW,GAAwB,IAAI,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,QAAQ;IACtB,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,WAAW,GAAG,IAAI,YAAY,EAAE,CAAC;IACnC,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC9B,IAAI,WAAW,EAAE,CAAC;QAChB,WAAW,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;AACH,CAAC"}
@@ -0,0 +1,72 @@
1
+ import type { ItemType, Methodology } from '../schemas/index.js';
2
+ export { ContextCache, CACHE_CONFIG, getCache, clearGlobalCache, type CacheStats, } from './cache.js';
3
+ /**
4
+ * Type to plural directory mapping
5
+ */
6
+ export declare const TYPE_TO_DIRECTORY: Record<ItemType, string>;
7
+ /**
8
+ * Get methodology configuration
9
+ */
10
+ export declare function getMethodologyConfig(methodology: Methodology): {
11
+ item_types: ItemType[];
12
+ item_prefixes: {
13
+ epic: string;
14
+ story: string;
15
+ task: string;
16
+ bug: string;
17
+ spike: string;
18
+ test: string;
19
+ };
20
+ directories: string[];
21
+ } | {
22
+ item_types: ItemType[];
23
+ item_prefixes: {
24
+ requirement: string;
25
+ feature: string;
26
+ task: string;
27
+ bug: string;
28
+ test: string;
29
+ };
30
+ directories: string[];
31
+ } | {
32
+ item_types: ItemType[];
33
+ item_prefixes: {
34
+ epic: string;
35
+ story: string;
36
+ requirement: string;
37
+ feature: string;
38
+ task: string;
39
+ bug: string;
40
+ spike: string;
41
+ test: string;
42
+ };
43
+ directories: string[];
44
+ };
45
+ /**
46
+ * Generates a new item ID with proper prefix and number
47
+ */
48
+ export declare function generateItemId(type: string, counter: number, prefixes?: Record<string, string>): string;
49
+ /**
50
+ * Parses an item ID into type and number
51
+ */
52
+ export declare function parseItemId(id: string): {
53
+ type: ItemType;
54
+ number: number;
55
+ } | null;
56
+ /**
57
+ * Formats a date for display
58
+ */
59
+ export declare function formatDate(date: string | Date): string;
60
+ /**
61
+ * Gets current timestamp in ISO format
62
+ */
63
+ export declare function getCurrentTimestamp(): string;
64
+ /**
65
+ * Validates email format
66
+ */
67
+ export declare function isValidEmail(email: string): boolean;
68
+ /**
69
+ * Sanitizes a string for use in filenames
70
+ */
71
+ export declare function sanitizeFilename(name: string): string;
72
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGjE,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAStD,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW;gBAGU,QAAQ,EAAE;;;;;;;;;;;gBAYV,QAAQ,EAAE;;;;;;;;;;gBAoBtE,QAAQ,EAAE;;;;;;;;;;;;EAyBpB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,MAAM,CAgBR;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAmBjF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAGtD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKrD"}
@@ -0,0 +1,148 @@
1
+ // Export cache utilities
2
+ export { ContextCache, CACHE_CONFIG, getCache, clearGlobalCache, } from './cache.js';
3
+ /**
4
+ * Type to plural directory mapping
5
+ */
6
+ export const TYPE_TO_DIRECTORY = {
7
+ epic: 'epics',
8
+ story: 'stories',
9
+ task: 'tasks',
10
+ requirement: 'requirements',
11
+ feature: 'features',
12
+ bug: 'bugs',
13
+ spike: 'spikes',
14
+ test: 'tests',
15
+ };
16
+ /**
17
+ * Get methodology configuration
18
+ */
19
+ export function getMethodologyConfig(methodology) {
20
+ const configs = {
21
+ scrum: {
22
+ item_types: ['epic', 'story', 'task', 'bug', 'spike', 'test'],
23
+ item_prefixes: {
24
+ epic: 'EPIC',
25
+ story: 'STORY',
26
+ task: 'TASK',
27
+ bug: 'BUG',
28
+ spike: 'SPIKE',
29
+ test: 'TEST',
30
+ },
31
+ directories: ['epics', 'stories', 'tasks', 'bugs', 'spikes', 'tests'],
32
+ },
33
+ waterfall: {
34
+ item_types: ['requirement', 'feature', 'task', 'bug', 'test'],
35
+ item_prefixes: {
36
+ requirement: 'REQ',
37
+ feature: 'FEAT',
38
+ task: 'TASK',
39
+ bug: 'BUG',
40
+ test: 'TEST',
41
+ },
42
+ directories: ['requirements', 'features', 'tasks', 'bugs', 'tests'],
43
+ },
44
+ hybrid: {
45
+ item_types: [
46
+ 'epic',
47
+ 'story',
48
+ 'requirement',
49
+ 'feature',
50
+ 'task',
51
+ 'bug',
52
+ 'spike',
53
+ 'test',
54
+ ],
55
+ item_prefixes: {
56
+ epic: 'EPIC',
57
+ story: 'STORY',
58
+ requirement: 'REQ',
59
+ feature: 'FEAT',
60
+ task: 'TASK',
61
+ bug: 'BUG',
62
+ spike: 'SPIKE',
63
+ test: 'TEST',
64
+ },
65
+ directories: [
66
+ 'epics',
67
+ 'stories',
68
+ 'requirements',
69
+ 'features',
70
+ 'tasks',
71
+ 'bugs',
72
+ 'spikes',
73
+ 'tests',
74
+ ],
75
+ },
76
+ };
77
+ return configs[methodology];
78
+ }
79
+ /**
80
+ * Generates a new item ID with proper prefix and number
81
+ */
82
+ export function generateItemId(type, counter, prefixes) {
83
+ const defaultPrefixes = {
84
+ epic: 'EPIC',
85
+ story: 'STORY',
86
+ task: 'TASK',
87
+ requirement: 'REQ',
88
+ feature: 'FEAT',
89
+ bug: 'BUG',
90
+ spike: 'SPIKE',
91
+ test: 'TEST',
92
+ };
93
+ const prefixMap = prefixes || defaultPrefixes;
94
+ const prefix = prefixMap[type] || 'ITEM';
95
+ const paddedNumber = counter.toString().padStart(3, '0');
96
+ return `${prefix}-${paddedNumber}`;
97
+ }
98
+ /**
99
+ * Parses an item ID into type and number
100
+ */
101
+ export function parseItemId(id) {
102
+ const match = id.match(/^(EPIC|STORY|TASK|REQ|FEAT|BUG|SPIKE|TEST)-(\d+)$/);
103
+ if (!match)
104
+ return null;
105
+ const typeMap = {
106
+ EPIC: 'epic',
107
+ STORY: 'story',
108
+ TASK: 'task',
109
+ REQ: 'requirement',
110
+ FEAT: 'feature',
111
+ BUG: 'bug',
112
+ SPIKE: 'spike',
113
+ TEST: 'test',
114
+ };
115
+ return {
116
+ type: typeMap[match[1]],
117
+ number: Number.parseInt(match[2], 10),
118
+ };
119
+ }
120
+ /**
121
+ * Formats a date for display
122
+ */
123
+ export function formatDate(date) {
124
+ const d = typeof date === 'string' ? new Date(date) : date;
125
+ return d.toISOString();
126
+ }
127
+ /**
128
+ * Gets current timestamp in ISO format
129
+ */
130
+ export function getCurrentTimestamp() {
131
+ return new Date().toISOString();
132
+ }
133
+ /**
134
+ * Validates email format
135
+ */
136
+ export function isValidEmail(email) {
137
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
138
+ }
139
+ /**
140
+ * Sanitizes a string for use in filenames
141
+ */
142
+ export function sanitizeFilename(name) {
143
+ return name
144
+ .toLowerCase()
145
+ .replace(/[^a-z0-9]+/g, '-')
146
+ .replace(/^-|-$/g, '');
147
+ }
148
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,yBAAyB;AACzB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,gBAAgB,GAEjB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA6B;IACzD,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,cAAc;IAC3B,OAAO,EAAE,UAAU;IACnB,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,QAAQ;IACf,IAAI,EAAE,OAAO;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,WAAwB;IAC3D,MAAM,OAAO,GAAG;QACd,KAAK,EAAE;YACL,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAe;YAC3E,aAAa,EAAE;gBACb,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,OAAO;gBACd,IAAI,EAAE,MAAM;gBACZ,GAAG,EAAE,KAAK;gBACV,KAAK,EAAE,OAAO;gBACd,IAAI,EAAE,MAAM;aACb;YACD,WAAW,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC;SACtE;QACD,SAAS,EAAE;YACT,UAAU,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK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,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC3B,CAAC"}
package/package.json CHANGED
@@ -1,18 +1,9 @@
1
1
  {
2
2
  "name": "@schnick371/devsteps-shared",
3
- "version": "0.0.1",
4
- "description": "Reserved for DevSteps project - Never Code Alone. Shared types, schemas, and utilities for AI-assisted developer task tracking.",
5
- "keywords": [
6
- "devsteps",
7
- "task-tracking",
8
- "project-management",
9
- "agile",
10
- "scrum",
11
- "waterfall",
12
- "ai-assisted",
13
- "development-workflow"
14
- ],
15
- "author": "Thomas Hertel <thomas.hantke@devcrumbs.dev>",
3
+ "version": "0.5.1",
4
+ "license": "Apache-2.0",
5
+ "description": "Never Code Alone. Shared types, schemas, and utilities for DevSteps task tracking.",
6
+ "author": "Thomas Hertel <thomas.hantke@devsteps.dev>",
16
7
  "homepage": "https://devsteps.dev",
17
8
  "repository": {
18
9
  "type": "git",
@@ -22,9 +13,50 @@
22
13
  "bugs": {
23
14
  "url": "https://github.com/Schnick371/devsteps/issues"
24
15
  },
25
- "license": "Apache-2.0",
16
+ "keywords": [
17
+ "devsteps",
18
+ "task-tracking",
19
+ "project-management",
20
+ "agile",
21
+ "scrum",
22
+ "waterfall"
23
+ ],
24
+ "type": "module",
25
+ "main": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "default": "./dist/index.js"
31
+ },
32
+ "./schemas": {
33
+ "types": "./dist/schemas/index.d.ts",
34
+ "default": "./dist/schemas/index.js"
35
+ },
36
+ "./types": {
37
+ "types": "./dist/types/index.d.ts",
38
+ "default": "./dist/types/index.js"
39
+ }
40
+ },
41
+ "files": [
42
+ "dist",
43
+ "README.md",
44
+ "LICENSE.md"
45
+ ],
26
46
  "publishConfig": {
27
47
  "access": "public"
28
48
  },
29
- "main": "index.js"
49
+ "scripts": {
50
+ "build": "tsc",
51
+ "dev": "tsc --watch",
52
+ "typecheck": "tsc --noEmit",
53
+ "clean": "rm -rf dist"
54
+ },
55
+ "dependencies": {
56
+ "zod": "latest"
57
+ },
58
+ "devDependencies": {
59
+ "@types/bun": "latest",
60
+ "typescript": "latest"
61
+ }
30
62
  }
package/index.js DELETED
@@ -1,6 +0,0 @@
1
- // DevSteps Shared - Reserved Package
2
- // Full implementation coming soon
3
- module.exports = {
4
- version: '0.0.1',
5
- status: 'reserved'
6
- };