@skillsmith/cli 0.1.0

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 (110) hide show
  1. package/dist/.tsbuildinfo +1 -0
  2. package/dist/src/commands/author.d.ts +33 -0
  3. package/dist/src/commands/author.d.ts.map +1 -0
  4. package/dist/src/commands/author.js +337 -0
  5. package/dist/src/commands/author.js.map +1 -0
  6. package/dist/src/commands/index.d.ts +9 -0
  7. package/dist/src/commands/index.d.ts.map +1 -0
  8. package/dist/src/commands/index.js +12 -0
  9. package/dist/src/commands/index.js.map +1 -0
  10. package/dist/src/commands/manage.d.ts +37 -0
  11. package/dist/src/commands/manage.d.ts.map +1 -0
  12. package/dist/src/commands/manage.js +308 -0
  13. package/dist/src/commands/manage.js.map +1 -0
  14. package/dist/src/commands/search.d.ts +12 -0
  15. package/dist/src/commands/search.d.ts.map +1 -0
  16. package/dist/src/commands/search.js +316 -0
  17. package/dist/src/commands/search.js.map +1 -0
  18. package/dist/src/config.d.ts +19 -0
  19. package/dist/src/config.d.ts.map +1 -0
  20. package/dist/src/config.js +21 -0
  21. package/dist/src/config.js.map +1 -0
  22. package/dist/src/import.d.ts +29 -0
  23. package/dist/src/import.d.ts.map +1 -0
  24. package/dist/src/import.js +255 -0
  25. package/dist/src/import.js.map +1 -0
  26. package/dist/src/index.d.ts +16 -0
  27. package/dist/src/index.d.ts.map +1 -0
  28. package/dist/src/index.js +65 -0
  29. package/dist/src/index.js.map +1 -0
  30. package/dist/src/templates/index.d.ts +8 -0
  31. package/dist/src/templates/index.d.ts.map +1 -0
  32. package/dist/src/templates/index.js +8 -0
  33. package/dist/src/templates/index.js.map +1 -0
  34. package/dist/src/templates/readme.md.template.d.ts +8 -0
  35. package/dist/src/templates/readme.md.template.d.ts.map +1 -0
  36. package/dist/src/templates/readme.md.template.js +86 -0
  37. package/dist/src/templates/readme.md.template.js.map +1 -0
  38. package/dist/src/templates/skill.md.template.d.ts +8 -0
  39. package/dist/src/templates/skill.md.template.d.ts.map +1 -0
  40. package/dist/src/templates/skill.md.template.js +99 -0
  41. package/dist/src/templates/skill.md.template.js.map +1 -0
  42. package/dist/src/utils/license.d.ts +82 -0
  43. package/dist/src/utils/license.d.ts.map +1 -0
  44. package/dist/src/utils/license.js +282 -0
  45. package/dist/src/utils/license.js.map +1 -0
  46. package/dist/src/utils/license.test.d.ts +7 -0
  47. package/dist/src/utils/license.test.d.ts.map +1 -0
  48. package/dist/src/utils/license.test.js +303 -0
  49. package/dist/src/utils/license.test.js.map +1 -0
  50. package/dist/src/utils/sanitize.d.ts +30 -0
  51. package/dist/src/utils/sanitize.d.ts.map +1 -0
  52. package/dist/src/utils/sanitize.js +45 -0
  53. package/dist/src/utils/sanitize.js.map +1 -0
  54. package/dist/tests/author.test.d.ts +5 -0
  55. package/dist/tests/author.test.d.ts.map +1 -0
  56. package/dist/tests/author.test.js +149 -0
  57. package/dist/tests/author.test.js.map +1 -0
  58. package/dist/tests/e2e/author.e2e.test.d.ts +9 -0
  59. package/dist/tests/e2e/author.e2e.test.d.ts.map +1 -0
  60. package/dist/tests/e2e/author.e2e.test.js +346 -0
  61. package/dist/tests/e2e/author.e2e.test.js.map +1 -0
  62. package/dist/tests/e2e/import.e2e.test.d.ts +10 -0
  63. package/dist/tests/e2e/import.e2e.test.d.ts.map +1 -0
  64. package/dist/tests/e2e/import.e2e.test.js +213 -0
  65. package/dist/tests/e2e/import.e2e.test.js.map +1 -0
  66. package/dist/tests/e2e/manage.e2e.test.d.ts +9 -0
  67. package/dist/tests/e2e/manage.e2e.test.d.ts.map +1 -0
  68. package/dist/tests/e2e/manage.e2e.test.js +277 -0
  69. package/dist/tests/e2e/manage.e2e.test.js.map +1 -0
  70. package/dist/tests/e2e/search.e2e.test.d.ts +10 -0
  71. package/dist/tests/e2e/search.e2e.test.d.ts.map +1 -0
  72. package/dist/tests/e2e/search.e2e.test.js +267 -0
  73. package/dist/tests/e2e/search.e2e.test.js.map +1 -0
  74. package/dist/tests/e2e/test-config.d.ts +39 -0
  75. package/dist/tests/e2e/test-config.d.ts.map +1 -0
  76. package/dist/tests/e2e/test-config.js +44 -0
  77. package/dist/tests/e2e/test-config.js.map +1 -0
  78. package/dist/tests/e2e/utils/baseline-collector.d.ts +107 -0
  79. package/dist/tests/e2e/utils/baseline-collector.d.ts.map +1 -0
  80. package/dist/tests/e2e/utils/baseline-collector.js +211 -0
  81. package/dist/tests/e2e/utils/baseline-collector.js.map +1 -0
  82. package/dist/tests/e2e/utils/hardcoded-detector.d.ts +46 -0
  83. package/dist/tests/e2e/utils/hardcoded-detector.d.ts.map +1 -0
  84. package/dist/tests/e2e/utils/hardcoded-detector.js +197 -0
  85. package/dist/tests/e2e/utils/hardcoded-detector.js.map +1 -0
  86. package/dist/tests/e2e/utils/index.d.ts +8 -0
  87. package/dist/tests/e2e/utils/index.d.ts.map +1 -0
  88. package/dist/tests/e2e/utils/index.js +8 -0
  89. package/dist/tests/e2e/utils/index.js.map +1 -0
  90. package/dist/tests/e2e/utils/linear-reporter.d.ts +60 -0
  91. package/dist/tests/e2e/utils/linear-reporter.d.ts.map +1 -0
  92. package/dist/tests/e2e/utils/linear-reporter.js +223 -0
  93. package/dist/tests/e2e/utils/linear-reporter.js.map +1 -0
  94. package/dist/tests/import.test.d.ts +5 -0
  95. package/dist/tests/import.test.d.ts.map +1 -0
  96. package/dist/tests/import.test.js +11 -0
  97. package/dist/tests/import.test.js.map +1 -0
  98. package/dist/tests/manage.test.d.ts +5 -0
  99. package/dist/tests/manage.test.d.ts.map +1 -0
  100. package/dist/tests/manage.test.js +135 -0
  101. package/dist/tests/manage.test.js.map +1 -0
  102. package/dist/tests/search.test.d.ts +5 -0
  103. package/dist/tests/search.test.d.ts.map +1 -0
  104. package/dist/tests/search.test.js +91 -0
  105. package/dist/tests/search.test.js.map +1 -0
  106. package/dist/vitest.config.d.ts +3 -0
  107. package/dist/vitest.config.d.ts.map +1 -0
  108. package/dist/vitest.config.js +9 -0
  109. package/dist/vitest.config.js.map +1 -0
  110. package/package.json +62 -0
@@ -0,0 +1,99 @@
1
+ /**
2
+ * SKILL.md Template
3
+ *
4
+ * Template for new skill SKILL.md files with YAML frontmatter.
5
+ */
6
+ export const SKILL_MD_TEMPLATE = `---
7
+ name: {{name}}
8
+ description: {{description}}
9
+ author: {{author}}
10
+ version: 1.0.0
11
+ category: {{category}}
12
+ tags:
13
+ - claude-skill
14
+ - {{category}}
15
+ license: MIT
16
+ created: {{date}}
17
+ ---
18
+
19
+ # {{name}}
20
+
21
+ {{description}}
22
+
23
+ ## Features
24
+
25
+ - Feature 1: Description of feature
26
+ - Feature 2: Description of feature
27
+ - Feature 3: Description of feature
28
+
29
+ ## Installation
30
+
31
+ \`\`\`bash
32
+ skillsmith install {{name}}
33
+ \`\`\`
34
+
35
+ Or manually:
36
+
37
+ \`\`\`bash
38
+ cp -r . ~/.claude/skills/{{name}}
39
+ \`\`\`
40
+
41
+ ## Usage
42
+
43
+ ### Basic Usage
44
+
45
+ Describe how to use the skill with examples.
46
+
47
+ ### Commands
48
+
49
+ | Command | Description |
50
+ |---------|-------------|
51
+ | \`/example\` | Description of example command |
52
+
53
+ ### Trigger Phrases
54
+
55
+ The skill responds to:
56
+ - "example phrase 1"
57
+ - "example phrase 2"
58
+
59
+ ## Configuration
60
+
61
+ | Setting | Default | Description |
62
+ |---------|---------|-------------|
63
+ | \`setting1\` | \`value\` | Description |
64
+
65
+ ## Scripts
66
+
67
+ ### example.js
68
+
69
+ Located in \`scripts/example.js\`:
70
+
71
+ \`\`\`javascript
72
+ // Your automation script here
73
+ \`\`\`
74
+
75
+ ## Resources
76
+
77
+ Files in the \`resources/\` directory:
78
+ - \`resource1.txt\` - Description
79
+
80
+ ## Dependencies
81
+
82
+ This skill requires:
83
+ - No external dependencies
84
+
85
+ ## Contributing
86
+
87
+ Contributions welcome! Please submit pull requests.
88
+
89
+ ## License
90
+
91
+ MIT License - see LICENSE file for details.
92
+
93
+ ## Changelog
94
+
95
+ ### 1.0.0 ({{date}})
96
+ - Initial release
97
+ `;
98
+ export default SKILL_MD_TEMPLATE;
99
+ //# sourceMappingURL=skill.md.template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill.md.template.js","sourceRoot":"","sources":["../../../src/templates/skill.md.template.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2FhC,CAAA;AAED,eAAe,iBAAiB,CAAA"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * License status utilities for Skillsmith CLI
3
+ *
4
+ * Handles license validation, status display, and tier formatting.
5
+ * Supports community (free), team, and enterprise license tiers.
6
+ *
7
+ * When @skillsmith/enterprise is available, uses proper RS256 JWT validation.
8
+ * Otherwise, falls back to community tier (no error).
9
+ *
10
+ * Environment variable: SKILLSMITH_LICENSE_KEY
11
+ *
12
+ * @see SMI-1090: CLI should use enterprise LicenseValidator when available
13
+ */
14
+ /**
15
+ * Available license tiers
16
+ */
17
+ export type LicenseTier = 'community' | 'team' | 'enterprise';
18
+ /**
19
+ * License status information returned by license check
20
+ */
21
+ export interface LicenseStatus {
22
+ /** Whether the license is valid */
23
+ valid: boolean;
24
+ /** License tier level */
25
+ tier: LicenseTier;
26
+ /** Expiration date for paid tiers */
27
+ expiresAt?: Date;
28
+ /** List of enabled features for this tier */
29
+ features: string[];
30
+ /** Error message if license validation failed */
31
+ error?: string;
32
+ }
33
+ /**
34
+ * Reset the enterprise validator cache (for testing purposes)
35
+ * @internal
36
+ */
37
+ export declare function _resetEnterpriseValidatorCache(): void;
38
+ /**
39
+ * Get the current license status
40
+ *
41
+ * Reads the license key from SKILLSMITH_LICENSE_KEY environment variable.
42
+ * If no key is set, returns community tier (not an error).
43
+ * If key is invalid or expired, returns status with error but continues.
44
+ *
45
+ * When @skillsmith/enterprise is available, uses proper RS256 JWT validation.
46
+ * Otherwise, falls back to simple base64 JSON decoding (for development/testing only).
47
+ *
48
+ * @returns Promise resolving to license status
49
+ */
50
+ export declare function getLicenseStatus(): Promise<LicenseStatus>;
51
+ /**
52
+ * Get the current license status using legacy base64 decoding
53
+ *
54
+ * @deprecated Use getLicenseStatus() which properly uses enterprise JWT validation.
55
+ * This function is preserved only for backwards compatibility in tests.
56
+ *
57
+ * @returns Promise resolving to license status
58
+ */
59
+ export declare function getLicenseStatusLegacy(): Promise<LicenseStatus>;
60
+ /**
61
+ * Format a tier badge with color
62
+ *
63
+ * @param tier - License tier
64
+ * @returns Formatted tier badge string
65
+ */
66
+ export declare function formatTierBadge(tier: LicenseTier): string;
67
+ /**
68
+ * Display license status on CLI startup
69
+ *
70
+ * Shows license tier, expiration (if applicable), and features for paid tiers.
71
+ * Uses colored output: green for valid, yellow for community, red for expired/invalid.
72
+ *
73
+ * @param status - License status to display
74
+ */
75
+ export declare function displayLicenseStatus(status: LicenseStatus): void;
76
+ /**
77
+ * Display the full CLI header with version and license info
78
+ *
79
+ * @param version - CLI version string
80
+ */
81
+ export declare function displayStartupHeader(version: string): Promise<void>;
82
+ //# sourceMappingURL=license.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../../../src/utils/license.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,MAAM,GAAG,YAAY,CAAA;AAE7D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,KAAK,EAAE,OAAO,CAAA;IACd,yBAAyB;IACzB,IAAI,EAAE,WAAW,CAAA;IACjB,qCAAqC;IACrC,SAAS,CAAC,EAAE,IAAI,CAAA;IAChB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAsED;;;GAGG;AACH,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AAuED;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC,CA0D/D;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,aAAa,CAAC,CA4CrE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAUzD;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAgBhE;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzE"}
@@ -0,0 +1,282 @@
1
+ /**
2
+ * License status utilities for Skillsmith CLI
3
+ *
4
+ * Handles license validation, status display, and tier formatting.
5
+ * Supports community (free), team, and enterprise license tiers.
6
+ *
7
+ * When @skillsmith/enterprise is available, uses proper RS256 JWT validation.
8
+ * Otherwise, falls back to community tier (no error).
9
+ *
10
+ * Environment variable: SKILLSMITH_LICENSE_KEY
11
+ *
12
+ * @see SMI-1090: CLI should use enterprise LicenseValidator when available
13
+ */
14
+ import chalk from 'chalk';
15
+ // Cache for the enterprise validator to avoid repeated dynamic imports
16
+ let enterpriseValidatorCache = undefined;
17
+ /**
18
+ * Attempt to load the enterprise license validator
19
+ * Returns null if the package is not installed (expected for community users)
20
+ *
21
+ * @returns Enterprise validator or null if not available
22
+ */
23
+ async function tryLoadEnterpriseValidator() {
24
+ // Return cached result if already loaded
25
+ if (enterpriseValidatorCache !== undefined) {
26
+ return enterpriseValidatorCache;
27
+ }
28
+ try {
29
+ // Dynamic import with variable to prevent TypeScript from resolving at compile time
30
+ // This is an optional peer dependency that may not be installed
31
+ const packageName = '@skillsmith/enterprise';
32
+ const enterprise = (await import(/* webpackIgnore: true */ packageName));
33
+ if (enterprise['LicenseValidator']) {
34
+ const ValidatorClass = enterprise['LicenseValidator'];
35
+ enterpriseValidatorCache = new ValidatorClass();
36
+ return enterpriseValidatorCache;
37
+ }
38
+ enterpriseValidatorCache = null;
39
+ return null;
40
+ }
41
+ catch {
42
+ // Enterprise package not installed - this is expected for community users
43
+ enterpriseValidatorCache = null;
44
+ return null;
45
+ }
46
+ }
47
+ /**
48
+ * Reset the enterprise validator cache (for testing purposes)
49
+ * @internal
50
+ */
51
+ export function _resetEnterpriseValidatorCache() {
52
+ enterpriseValidatorCache = undefined;
53
+ }
54
+ /**
55
+ * Default features by tier
56
+ *
57
+ * Note: Community tier uses CLI-specific display names for UI purposes.
58
+ * Team and Enterprise tiers use canonical feature names from @skillsmith/enterprise.
59
+ *
60
+ * @see packages/enterprise/src/license/types.ts for canonical feature definitions
61
+ */
62
+ const TIER_FEATURES = {
63
+ community: ['basic_search', 'skill_install', 'local_validation'],
64
+ team: ['team_workspaces', 'private_skills', 'usage_analytics', 'priority_support'],
65
+ enterprise: [
66
+ // Team features (inherited)
67
+ 'team_workspaces',
68
+ 'private_skills',
69
+ 'usage_analytics',
70
+ 'priority_support',
71
+ // Enterprise-only features (canonical names from enterprise package)
72
+ 'sso_saml',
73
+ 'rbac',
74
+ 'audit_logging',
75
+ 'siem_export',
76
+ 'compliance_reports',
77
+ 'private_registry',
78
+ ],
79
+ };
80
+ /**
81
+ * Decode and validate a license key using simple base64 JSON decoding
82
+ *
83
+ * @deprecated This function is used only when @skillsmith/enterprise is not available.
84
+ * For paid tiers, enterprise package with proper RS256 JWT validation should be used.
85
+ * Community users without a license key don't need validation.
86
+ *
87
+ * @param licenseKey - The license key to decode
88
+ * @returns Decoded payload or null if invalid
89
+ */
90
+ function decodeLicenseKey(licenseKey) {
91
+ try {
92
+ // License key format: base64 encoded JSON
93
+ // In production, this would include cryptographic signature verification
94
+ const decoded = Buffer.from(licenseKey, 'base64').toString('utf-8');
95
+ const payload = JSON.parse(decoded);
96
+ // Validate required fields
97
+ if (!payload.tier || !['team', 'enterprise'].includes(payload.tier)) {
98
+ return null;
99
+ }
100
+ if (!payload.expiresAt || isNaN(Date.parse(payload.expiresAt))) {
101
+ return null;
102
+ }
103
+ return payload;
104
+ }
105
+ catch {
106
+ return null;
107
+ }
108
+ }
109
+ /**
110
+ * Check if a license has expired
111
+ *
112
+ * @param expiresAt - Expiration date
113
+ * @returns True if expired
114
+ */
115
+ function isExpired(expiresAt) {
116
+ return expiresAt < new Date();
117
+ }
118
+ /**
119
+ * Get the current license status
120
+ *
121
+ * Reads the license key from SKILLSMITH_LICENSE_KEY environment variable.
122
+ * If no key is set, returns community tier (not an error).
123
+ * If key is invalid or expired, returns status with error but continues.
124
+ *
125
+ * When @skillsmith/enterprise is available, uses proper RS256 JWT validation.
126
+ * Otherwise, falls back to simple base64 JSON decoding (for development/testing only).
127
+ *
128
+ * @returns Promise resolving to license status
129
+ */
130
+ export async function getLicenseStatus() {
131
+ const licenseKey = process.env['SKILLSMITH_LICENSE_KEY'];
132
+ // No license key = community tier (free, not an error)
133
+ if (!licenseKey) {
134
+ return {
135
+ valid: true,
136
+ tier: 'community',
137
+ features: TIER_FEATURES.community,
138
+ };
139
+ }
140
+ // Try to use enterprise validator for proper JWT verification
141
+ const validator = await tryLoadEnterpriseValidator();
142
+ if (validator) {
143
+ // Enterprise package available - use proper RS256 JWT validation
144
+ try {
145
+ const result = await validator.validate(licenseKey);
146
+ if (result.valid && result.license) {
147
+ return {
148
+ valid: true,
149
+ tier: result.license.tier,
150
+ expiresAt: result.license.expiresAt,
151
+ features: result.license.features.length > 0
152
+ ? result.license.features
153
+ : TIER_FEATURES[result.license.tier],
154
+ };
155
+ }
156
+ // Invalid license - return error with community fallback
157
+ return {
158
+ valid: false,
159
+ tier: 'community',
160
+ features: TIER_FEATURES.community,
161
+ error: result.error?.message || 'Invalid license key',
162
+ };
163
+ }
164
+ catch {
165
+ // Validation threw an error - treat as invalid
166
+ return {
167
+ valid: false,
168
+ tier: 'community',
169
+ features: TIER_FEATURES.community,
170
+ error: 'License validation failed',
171
+ };
172
+ }
173
+ }
174
+ // Enterprise package not available - fall back to community tier
175
+ // Note: We don't attempt base64 decoding for paid tiers without proper validation
176
+ // This ensures security by requiring the enterprise package for paid features
177
+ return {
178
+ valid: true,
179
+ tier: 'community',
180
+ features: TIER_FEATURES.community,
181
+ };
182
+ }
183
+ /**
184
+ * Get the current license status using legacy base64 decoding
185
+ *
186
+ * @deprecated Use getLicenseStatus() which properly uses enterprise JWT validation.
187
+ * This function is preserved only for backwards compatibility in tests.
188
+ *
189
+ * @returns Promise resolving to license status
190
+ */
191
+ export async function getLicenseStatusLegacy() {
192
+ const licenseKey = process.env['SKILLSMITH_LICENSE_KEY'];
193
+ // No license key = community tier (free, not an error)
194
+ if (!licenseKey) {
195
+ return {
196
+ valid: true,
197
+ tier: 'community',
198
+ features: TIER_FEATURES.community,
199
+ };
200
+ }
201
+ // Decode the license key
202
+ const payload = decodeLicenseKey(licenseKey);
203
+ if (!payload) {
204
+ return {
205
+ valid: false,
206
+ tier: 'community',
207
+ features: TIER_FEATURES.community,
208
+ error: 'Invalid license key format',
209
+ };
210
+ }
211
+ const expiresAt = new Date(payload.expiresAt);
212
+ // Check expiration
213
+ if (isExpired(expiresAt)) {
214
+ return {
215
+ valid: false,
216
+ tier: 'community',
217
+ expiresAt,
218
+ features: TIER_FEATURES.community,
219
+ error: `License expired on ${expiresAt.toISOString().split('T')[0]}`,
220
+ };
221
+ }
222
+ // Valid paid license
223
+ return {
224
+ valid: true,
225
+ tier: payload.tier,
226
+ expiresAt,
227
+ features: payload.features || TIER_FEATURES[payload.tier],
228
+ };
229
+ }
230
+ /**
231
+ * Format a tier badge with color
232
+ *
233
+ * @param tier - License tier
234
+ * @returns Formatted tier badge string
235
+ */
236
+ export function formatTierBadge(tier) {
237
+ switch (tier) {
238
+ case 'enterprise':
239
+ return chalk.magenta.bold('Enterprise');
240
+ case 'team':
241
+ return chalk.blue.bold('Team');
242
+ case 'community':
243
+ default:
244
+ return chalk.yellow('Community');
245
+ }
246
+ }
247
+ /**
248
+ * Display license status on CLI startup
249
+ *
250
+ * Shows license tier, expiration (if applicable), and features for paid tiers.
251
+ * Uses colored output: green for valid, yellow for community, red for expired/invalid.
252
+ *
253
+ * @param status - License status to display
254
+ */
255
+ export function displayLicenseStatus(status) {
256
+ const tierBadge = formatTierBadge(status.tier);
257
+ if (status.tier === 'community') {
258
+ console.log(`License: ${tierBadge} ${chalk.dim('(free tier)')}`);
259
+ }
260
+ else if (status.valid && status.expiresAt) {
261
+ const expiresFormatted = status.expiresAt.toISOString().split('T')[0];
262
+ console.log(`License: ${tierBadge} ${chalk.green(`(expires: ${expiresFormatted})`)}`);
263
+ console.log(`Features: ${chalk.dim(status.features.join(', '))}`);
264
+ }
265
+ // Show warnings for invalid/expired licenses
266
+ if (status.error) {
267
+ console.log(chalk.red(`Warning: ${status.error}`));
268
+ console.log(chalk.dim('Continuing with community tier features'));
269
+ }
270
+ }
271
+ /**
272
+ * Display the full CLI header with version and license info
273
+ *
274
+ * @param version - CLI version string
275
+ */
276
+ export async function displayStartupHeader(version) {
277
+ console.log(`Skillsmith CLI v${version}`);
278
+ const status = await getLicenseStatus();
279
+ displayLicenseStatus(status);
280
+ console.log(); // Empty line after header
281
+ }
282
+ //# sourceMappingURL=license.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"license.js","sourceRoot":"","sources":["../../../src/utils/license.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAoDzB,uEAAuE;AACvE,IAAI,wBAAwB,GAAkD,SAAS,CAAA;AAEvF;;;;;GAKG;AACH,KAAK,UAAU,0BAA0B;IACvC,yCAAyC;IACzC,IAAI,wBAAwB,KAAK,SAAS,EAAE,CAAC;QAC3C,OAAO,wBAAwB,CAAA;IACjC,CAAC;IAED,IAAI,CAAC;QACH,oFAAoF;QACpF,gEAAgE;QAChE,MAAM,WAAW,GAAG,wBAAwB,CAAA;QA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AC,aAAa,CAAC,EAAE,CAAC,CAAA;IAClE,CAAC;SAAM,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QAC5C,MAAM,gBAAgB,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QACrE,OAAO,CAAC,GAAG,CAAC,YAAY,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC,aAAa,gBAAgB,GAAG,CAAC,EAAE,CAAC,CAAA;QACrF,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAA;IACnE,CAAC;IAED,6CAA6C;IAC7C,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC,CAAA;IACnE,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAe;IACxD,OAAO,CAAC,GAAG,CAAC,mBAAmB,OAAO,EAAE,CAAC,CAAA;IAEzC,MAAM,MAAM,GAAG,MAAM,gBAAgB,EAAE,CAAA;IACvC,oBAAoB,CAAC,MAAM,CAAC,CAAA;IAC5B,OAAO,CAAC,GAAG,EAAE,CAAA,CAAC,0BAA0B;AAC1C,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Tests for license utilities
3
+ *
4
+ * @see SMI-1090: CLI should use enterprise LicenseValidator when available
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=license.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"license.test.d.ts","sourceRoot":"","sources":["../../../src/utils/license.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}