@skillsmith/cli 0.3.2 → 0.3.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/dist/.tsbuildinfo +1 -1
- package/dist/src/commands/manage.d.ts.map +1 -1
- package/dist/src/commands/manage.js +4 -0
- package/dist/src/commands/manage.js.map +1 -1
- package/dist/src/commands/recommend-scoring.d.ts +29 -0
- package/dist/src/commands/recommend-scoring.d.ts.map +1 -0
- package/dist/src/commands/recommend-scoring.js +141 -0
- package/dist/src/commands/recommend-scoring.js.map +1 -0
- package/dist/src/commands/recommend.helpers.d.ts +3 -21
- package/dist/src/commands/recommend.helpers.d.ts.map +1 -1
- package/dist/src/commands/recommend.helpers.js +2 -133
- package/dist/src/commands/recommend.helpers.js.map +1 -1
- package/dist/src/commands/search-formatters.d.ts +35 -0
- package/dist/src/commands/search-formatters.d.ts.map +1 -0
- package/dist/src/commands/search-formatters.js +128 -0
- package/dist/src/commands/search-formatters.js.map +1 -0
- package/dist/src/commands/search-types.d.ts +46 -0
- package/dist/src/commands/search-types.d.ts.map +1 -0
- package/dist/src/commands/search-types.js +12 -0
- package/dist/src/commands/search-types.js.map +1 -0
- package/dist/src/commands/search.d.ts +3 -0
- package/dist/src/commands/search.d.ts.map +1 -1
- package/dist/src/commands/search.js +5 -110
- package/dist/src/commands/search.js.map +1 -1
- package/dist/src/templates/mcp-server.template.d.ts +2 -17
- package/dist/src/templates/mcp-server.template.d.ts.map +1 -1
- package/dist/src/templates/mcp-server.template.js +9 -108
- package/dist/src/templates/mcp-server.template.js.map +1 -1
- package/dist/src/templates/mcp-template-handlers.d.ts +33 -0
- package/dist/src/templates/mcp-template-handlers.d.ts.map +1 -0
- package/dist/src/templates/mcp-template-handlers.js +106 -0
- package/dist/src/templates/mcp-template-handlers.js.map +1 -0
- package/dist/src/templates/mcp-template-types.d.ts +48 -0
- package/dist/src/templates/mcp-template-types.d.ts.map +1 -0
- package/dist/src/templates/mcp-template-types.js +18 -0
- package/dist/src/templates/mcp-template-types.js.map +1 -0
- package/dist/src/utils/license-types.d.ts +88 -0
- package/dist/src/utils/license-types.d.ts.map +1 -0
- package/dist/src/utils/license-types.js +60 -0
- package/dist/src/utils/license-types.js.map +1 -0
- package/dist/src/utils/license-validation.d.ts +61 -0
- package/dist/src/utils/license-validation.d.ts.map +1 -0
- package/dist/src/utils/license-validation.js +198 -0
- package/dist/src/utils/license-validation.js.map +1 -0
- package/dist/src/utils/license.d.ts +4 -71
- package/dist/src/utils/license.d.ts.map +1 -1
- package/dist/src/utils/license.js +7 -241
- package/dist/src/utils/license.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-1433: MCP Server Template Handlers
|
|
3
|
+
*
|
|
4
|
+
* Code generation helpers for MCP server scaffolding.
|
|
5
|
+
*
|
|
6
|
+
* @module mcp-template-handlers
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Escape single quotes in strings for safe template interpolation
|
|
10
|
+
*/
|
|
11
|
+
export function escapeQuotes(str) {
|
|
12
|
+
return str.replace(/'/g, "\\'");
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Generate tool definition code for a single tool
|
|
16
|
+
*/
|
|
17
|
+
export function generateToolDefinition(tool, indent = ' ') {
|
|
18
|
+
const properties = [];
|
|
19
|
+
const required = [];
|
|
20
|
+
for (const param of tool.parameters || []) {
|
|
21
|
+
properties.push(`${indent} ${param.name}: {
|
|
22
|
+
${indent} type: '${param.type}',
|
|
23
|
+
${indent} description: '${escapeQuotes(param.description)}',
|
|
24
|
+
${indent} },`);
|
|
25
|
+
if (param.required) {
|
|
26
|
+
required.push(`'${param.name}'`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const propertiesStr = properties.length > 0 ? properties.join('\n') : '';
|
|
30
|
+
const requiredStr = required.length > 0 ? `\n${indent} required: [${required.join(', ')}],` : '';
|
|
31
|
+
return `${indent}{
|
|
32
|
+
${indent} name: '${escapeQuotes(tool.name)}',
|
|
33
|
+
${indent} description: '${escapeQuotes(tool.description)}',
|
|
34
|
+
${indent} inputSchema: {
|
|
35
|
+
${indent} type: 'object',
|
|
36
|
+
${indent} properties: {
|
|
37
|
+
${propertiesStr}
|
|
38
|
+
${indent} },${requiredStr}
|
|
39
|
+
${indent} },
|
|
40
|
+
${indent}},`;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Generate tool handler case for switch statement
|
|
44
|
+
*/
|
|
45
|
+
export function generateToolCase(tool) {
|
|
46
|
+
const handlerName = `handle${tool.name.charAt(0).toUpperCase()}${tool.name.slice(1).replace(/-/g, '')}Tool`;
|
|
47
|
+
const argsType = `${tool.name.charAt(0).toUpperCase()}${tool.name.slice(1).replace(/-/g, '')}ToolArgs`;
|
|
48
|
+
return ` case '${tool.name}':
|
|
49
|
+
return ${handlerName}(args as unknown as ${argsType})`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Generate tool import statement
|
|
53
|
+
*/
|
|
54
|
+
export function generateToolImport(tool) {
|
|
55
|
+
const baseName = tool.name.charAt(0).toUpperCase() + tool.name.slice(1).replace(/-/g, '');
|
|
56
|
+
return `import { handle${baseName}Tool, type ${baseName}ToolArgs } from './${tool.name}.js'`;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Generate a stub implementation file for a custom tool
|
|
60
|
+
*/
|
|
61
|
+
export function generateToolImplementation(tool) {
|
|
62
|
+
const baseName = tool.name.charAt(0).toUpperCase() + tool.name.slice(1).replace(/-/g, '');
|
|
63
|
+
const params = tool.parameters || [];
|
|
64
|
+
// Generate TypeScript interface properties
|
|
65
|
+
const interfaceProps = params
|
|
66
|
+
.map((p) => {
|
|
67
|
+
const tsType = p.type === 'array' ? 'unknown[]' : p.type === 'object' ? 'Record<string, unknown>' : p.type;
|
|
68
|
+
return ` ${p.name}${p.required ? '' : '?'}: ${tsType}`;
|
|
69
|
+
})
|
|
70
|
+
.join('\n');
|
|
71
|
+
// Generate implementation placeholder
|
|
72
|
+
const returnPlaceholder = params.length > 0
|
|
73
|
+
? `\`${tool.name} called with: \${JSON.stringify({ ${params.map((p) => `${p.name}: args.${p.name}`).join(', ')} })}\``
|
|
74
|
+
: `'${tool.name} called'`;
|
|
75
|
+
return `/**
|
|
76
|
+
* ${baseName} Tool Implementation
|
|
77
|
+
*
|
|
78
|
+
* ${escapeQuotes(tool.description)}
|
|
79
|
+
* TODO: Implement your tool logic here.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
export interface ${baseName}ToolArgs {
|
|
83
|
+
${interfaceProps || ' // No parameters'}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export async function handle${baseName}Tool(args: ${baseName}ToolArgs): Promise<string> {
|
|
87
|
+
// TODO: Implement ${tool.name} logic
|
|
88
|
+
return ${returnPlaceholder}
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Generate tool documentation for README
|
|
94
|
+
*/
|
|
95
|
+
export function generateToolDocs(tools) {
|
|
96
|
+
if (tools.length === 0) {
|
|
97
|
+
return '- `example` - An example tool that echoes input';
|
|
98
|
+
}
|
|
99
|
+
return tools
|
|
100
|
+
.map((tool) => {
|
|
101
|
+
const params = tool.parameters?.map((p) => `\`${p.name}\``).join(', ') || 'none';
|
|
102
|
+
return `- \`${tool.name}\` - ${tool.description}\n - Parameters: ${params}`;
|
|
103
|
+
})
|
|
104
|
+
.join('\n');
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=mcp-template-handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-template-handlers.js","sourceRoot":"","sources":["../../../src/templates/mcp-template-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,OAAO,CAAC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AAI,CAAC,IAAI,MAAM,CAAA;QAChF,OAAO,OAAO,IAAI,CAAC,IAAI,QAAQ,IAAI,CAAC,WAAW,qBAAqB,MAAM,EAAE,CAAA;IAC9E,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-1433: MCP Server Template Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for MCP server scaffolding.
|
|
5
|
+
*
|
|
6
|
+
* @module mcp-template-types
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Input data for rendering MCP server templates
|
|
10
|
+
*/
|
|
11
|
+
export interface McpServerTemplateData {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
tools: McpToolDefinition[];
|
|
15
|
+
author: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Tool definition for MCP server
|
|
19
|
+
*/
|
|
20
|
+
export interface McpToolDefinition {
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
parameters?: McpParameterDefinition[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Parameter definition for MCP tool
|
|
27
|
+
*/
|
|
28
|
+
export interface McpParameterDefinition {
|
|
29
|
+
name: string;
|
|
30
|
+
type: 'string' | 'number' | 'boolean' | 'array' | 'object';
|
|
31
|
+
description: string;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Dependency version constants for easier maintenance
|
|
36
|
+
*/
|
|
37
|
+
export declare const VERSIONS: {
|
|
38
|
+
readonly MCP_SDK: "^1.0.0";
|
|
39
|
+
readonly TYPES_NODE: "^20.0.0";
|
|
40
|
+
readonly TSX: "^4.0.0";
|
|
41
|
+
readonly TYPESCRIPT: "^5.0.0";
|
|
42
|
+
readonly NODE_ENGINE: ">=18.0.0";
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Type for version keys
|
|
46
|
+
*/
|
|
47
|
+
export type VersionKey = keyof typeof VERSIONS;
|
|
48
|
+
//# sourceMappingURL=mcp-template-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-template-types.d.ts","sourceRoot":"","sources":["../../../src/templates/mcp-template-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,iBAAiB,EAAE,CAAA;IAC1B,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,sBAAsB,EAAE,CAAA;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAA;IAC1D,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;CAMX,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,QAAQ,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-1433: MCP Server Template Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for MCP server scaffolding.
|
|
5
|
+
*
|
|
6
|
+
* @module mcp-template-types
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Dependency version constants for easier maintenance
|
|
10
|
+
*/
|
|
11
|
+
export const VERSIONS = {
|
|
12
|
+
MCP_SDK: '^1.0.0',
|
|
13
|
+
TYPES_NODE: '^20.0.0',
|
|
14
|
+
TSX: '^4.0.0',
|
|
15
|
+
TYPESCRIPT: '^5.0.0',
|
|
16
|
+
NODE_ENGINE: '>=18.0.0',
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=mcp-template-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-template-types.js","sourceRoot":"","sources":["../../../src/templates/mcp-template-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+BH;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,QAAQ;IACjB,UAAU,EAAE,SAAS;IACrB,GAAG,EAAE,QAAQ;IACb,UAAU,EAAE,QAAQ;IACpB,WAAW,EAAE,UAAU;CACf,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* License Types for Skillsmith CLI
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for license validation and display.
|
|
5
|
+
*
|
|
6
|
+
* @module @skillsmith/cli/utils/license-types
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Available license tiers
|
|
10
|
+
* - community: Free tier (1,000 API calls/month)
|
|
11
|
+
* - individual: Solo developers ($9.99/mo, 10,000 API calls/month)
|
|
12
|
+
* - team: Teams ($25/user/mo, 100,000 API calls/month)
|
|
13
|
+
* - enterprise: Full enterprise ($55/user/mo, unlimited)
|
|
14
|
+
*/
|
|
15
|
+
export type LicenseTier = 'community' | 'individual' | 'team' | 'enterprise';
|
|
16
|
+
/**
|
|
17
|
+
* Quota information for display
|
|
18
|
+
*/
|
|
19
|
+
export interface QuotaInfo {
|
|
20
|
+
/** API calls used this period */
|
|
21
|
+
used: number;
|
|
22
|
+
/** API call limit (-1 for unlimited) */
|
|
23
|
+
limit: number;
|
|
24
|
+
/** Percentage used */
|
|
25
|
+
percentUsed: number;
|
|
26
|
+
/** When the quota resets */
|
|
27
|
+
resetAt: Date;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* License status information returned by license check
|
|
31
|
+
*/
|
|
32
|
+
export interface LicenseStatus {
|
|
33
|
+
/** Whether the license is valid */
|
|
34
|
+
valid: boolean;
|
|
35
|
+
/** License tier level */
|
|
36
|
+
tier: LicenseTier;
|
|
37
|
+
/** Expiration date for paid tiers */
|
|
38
|
+
expiresAt?: Date;
|
|
39
|
+
/** List of enabled features for this tier */
|
|
40
|
+
features: string[];
|
|
41
|
+
/** Error message if license validation failed */
|
|
42
|
+
error?: string;
|
|
43
|
+
/** Optional quota information */
|
|
44
|
+
quota?: QuotaInfo;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* License key payload structure (decoded from license key)
|
|
48
|
+
* @deprecated Used only for fallback when enterprise package unavailable
|
|
49
|
+
*/
|
|
50
|
+
export interface LicensePayload {
|
|
51
|
+
tier: LicenseTier;
|
|
52
|
+
expiresAt: string;
|
|
53
|
+
features: string[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Interface for enterprise LicenseValidator
|
|
57
|
+
* @see packages/enterprise/src/license/LicenseValidator.ts
|
|
58
|
+
*/
|
|
59
|
+
export interface EnterpriseLicenseValidator {
|
|
60
|
+
validate(key: string): Promise<{
|
|
61
|
+
valid: boolean;
|
|
62
|
+
license?: {
|
|
63
|
+
tier: LicenseTier;
|
|
64
|
+
features: string[];
|
|
65
|
+
expiresAt: Date;
|
|
66
|
+
};
|
|
67
|
+
error?: {
|
|
68
|
+
code: string;
|
|
69
|
+
message: string;
|
|
70
|
+
};
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Default features by tier
|
|
75
|
+
*
|
|
76
|
+
* Note: Community tier uses CLI-specific display names for UI purposes.
|
|
77
|
+
* Individual, Team and Enterprise tiers use canonical feature names from @skillsmith/enterprise.
|
|
78
|
+
*
|
|
79
|
+
* @see packages/enterprise/src/license/types.ts for canonical feature definitions
|
|
80
|
+
*/
|
|
81
|
+
export declare const TIER_FEATURES: Record<LicenseTier, string[]>;
|
|
82
|
+
/**
|
|
83
|
+
* API call limits per tier (per month)
|
|
84
|
+
* Note: These are reference values matching the enterprise package quotas.
|
|
85
|
+
* Actual quota enforcement happens in the MCP server via QuotaEnforcementService.
|
|
86
|
+
*/
|
|
87
|
+
export declare const TIER_QUOTAS: Record<LicenseTier, number>;
|
|
88
|
+
//# sourceMappingURL=license-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license-types.d.ts","sourceRoot":"","sources":["../../../src/utils/license-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,MAAM,GAAG,YAAY,CAAA;AAE5E;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,sBAAsB;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,4BAA4B;IAC5B,OAAO,EAAE,IAAI,CAAA;CACd;AAED;;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;IACd,iCAAiC;IACjC,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAC7B,KAAK,EAAE,OAAO,CAAA;QACd,OAAO,CAAC,EAAE;YACR,IAAI,EAAE,WAAW,CAAA;YACjB,QAAQ,EAAE,MAAM,EAAE,CAAA;YAClB,SAAS,EAAE,IAAI,CAAA;SAChB,CAAA;QACD,KAAK,CAAC,EAAE;YACN,IAAI,EAAE,MAAM,CAAA;YACZ,OAAO,EAAE,MAAM,CAAA;SAChB,CAAA;KACF,CAAC,CAAA;CACH;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,CAgCvD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAKnD,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* License Types for Skillsmith CLI
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for license validation and display.
|
|
5
|
+
*
|
|
6
|
+
* @module @skillsmith/cli/utils/license-types
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Default features by tier
|
|
10
|
+
*
|
|
11
|
+
* Note: Community tier uses CLI-specific display names for UI purposes.
|
|
12
|
+
* Individual, Team and Enterprise tiers use canonical feature names from @skillsmith/enterprise.
|
|
13
|
+
*
|
|
14
|
+
* @see packages/enterprise/src/license/types.ts for canonical feature definitions
|
|
15
|
+
*/
|
|
16
|
+
export const TIER_FEATURES = {
|
|
17
|
+
community: ['basic_search', 'skill_install', 'local_validation'],
|
|
18
|
+
individual: ['basic_analytics', 'email_support'],
|
|
19
|
+
team: [
|
|
20
|
+
// Individual features (inherited)
|
|
21
|
+
'basic_analytics',
|
|
22
|
+
'email_support',
|
|
23
|
+
// Team features
|
|
24
|
+
'team_workspaces',
|
|
25
|
+
'private_skills',
|
|
26
|
+
'usage_analytics',
|
|
27
|
+
'priority_support',
|
|
28
|
+
],
|
|
29
|
+
enterprise: [
|
|
30
|
+
// Individual features (inherited)
|
|
31
|
+
'basic_analytics',
|
|
32
|
+
'email_support',
|
|
33
|
+
// Team features (inherited)
|
|
34
|
+
'team_workspaces',
|
|
35
|
+
'private_skills',
|
|
36
|
+
'usage_analytics',
|
|
37
|
+
'priority_support',
|
|
38
|
+
// Enterprise-only features (canonical names from enterprise package)
|
|
39
|
+
'sso_saml',
|
|
40
|
+
'rbac',
|
|
41
|
+
'audit_logging',
|
|
42
|
+
'siem_export',
|
|
43
|
+
'compliance_reports',
|
|
44
|
+
'private_registry',
|
|
45
|
+
'custom_integrations',
|
|
46
|
+
'advanced_analytics',
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* API call limits per tier (per month)
|
|
51
|
+
* Note: These are reference values matching the enterprise package quotas.
|
|
52
|
+
* Actual quota enforcement happens in the MCP server via QuotaEnforcementService.
|
|
53
|
+
*/
|
|
54
|
+
export const TIER_QUOTAS = {
|
|
55
|
+
community: 1_000,
|
|
56
|
+
individual: 10_000,
|
|
57
|
+
team: 100_000,
|
|
58
|
+
enterprise: -1, // Unlimited
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=license-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license-types.js","sourceRoot":"","sources":["../../../src/utils/license-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAwEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAkC;IAC1D,SAAS,EAAE,CAAC,cAAc,EAAE,eAAe,EAAE,kBAAkB,CAAC;IAChE,UAAU,EAAE,CAAC,iBAAiB,EAAE,eAAe,CAAC;IAChD,IAAI,EAAE;QACJ,kCAAkC;QAClC,iBAAiB;QACjB,eAAe;QACf,gBAAgB;QAChB,iBAAiB;QACjB,gBAAgB;QAChB,iBAAiB;QACjB,kBAAkB;KACnB;IACD,UAAU,EAAE;QACV,kCAAkC;QAClC,iBAAiB;QACjB,eAAe;QACf,4BAA4B;QAC5B,iBAAiB;QACjB,gBAAgB;QAChB,iBAAiB;QACjB,kBAAkB;QAClB,qEAAqE;QACrE,UAAU;QACV,MAAM;QACN,eAAe;QACf,aAAa;QACb,oBAAoB;QACpB,kBAAkB;QAClB,qBAAqB;QACrB,oBAAoB;KACrB;CACF,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAgC;IACtD,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,CAAC,EAAE,YAAY;CAC7B,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* License Validation Helpers for Skillsmith CLI
|
|
3
|
+
*
|
|
4
|
+
* Handles license key decoding, validation, and enterprise package loading.
|
|
5
|
+
*
|
|
6
|
+
* @module @skillsmith/cli/utils/license-validation
|
|
7
|
+
*/
|
|
8
|
+
import type { LicensePayload, LicenseStatus, EnterpriseLicenseValidator } from './license-types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Attempt to load the enterprise license validator
|
|
11
|
+
* Returns null if the package is not installed (expected for community users)
|
|
12
|
+
*
|
|
13
|
+
* @returns Enterprise validator or null if not available
|
|
14
|
+
*/
|
|
15
|
+
export declare function tryLoadEnterpriseValidator(): Promise<EnterpriseLicenseValidator | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Reset the enterprise validator cache (for testing purposes)
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function _resetEnterpriseValidatorCache(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Decode and validate a license key using simple base64 JSON decoding
|
|
23
|
+
*
|
|
24
|
+
* @deprecated This function is used only when @skillsmith/enterprise is not available.
|
|
25
|
+
* For paid tiers, enterprise package with proper RS256 JWT validation should be used.
|
|
26
|
+
* Community users without a license key don't need validation.
|
|
27
|
+
*
|
|
28
|
+
* @param licenseKey - The license key to decode
|
|
29
|
+
* @returns Decoded payload or null if invalid
|
|
30
|
+
*/
|
|
31
|
+
export declare function decodeLicenseKey(licenseKey: string): LicensePayload | null;
|
|
32
|
+
/**
|
|
33
|
+
* Check if a license has expired
|
|
34
|
+
*
|
|
35
|
+
* @param expiresAt - Expiration date
|
|
36
|
+
* @returns True if expired
|
|
37
|
+
*/
|
|
38
|
+
export declare function isExpired(expiresAt: Date): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Get the current license status using legacy base64 decoding
|
|
41
|
+
*
|
|
42
|
+
* @deprecated Use getLicenseStatus() which properly uses enterprise JWT validation.
|
|
43
|
+
* This function is preserved only for backwards compatibility in tests.
|
|
44
|
+
*
|
|
45
|
+
* @returns Promise resolving to license status
|
|
46
|
+
*/
|
|
47
|
+
export declare function getLicenseStatusLegacy(): Promise<LicenseStatus>;
|
|
48
|
+
/**
|
|
49
|
+
* Get the current license status
|
|
50
|
+
*
|
|
51
|
+
* Reads the license key from SKILLSMITH_LICENSE_KEY environment variable.
|
|
52
|
+
* If no key is set, returns community tier (not an error).
|
|
53
|
+
* If key is invalid or expired, returns status with error but continues.
|
|
54
|
+
*
|
|
55
|
+
* When @skillsmith/enterprise is available, uses proper RS256 JWT validation.
|
|
56
|
+
* Otherwise, falls back to simple base64 JSON decoding (for development/testing only).
|
|
57
|
+
*
|
|
58
|
+
* @returns Promise resolving to license status
|
|
59
|
+
*/
|
|
60
|
+
export declare function getLicenseStatus(): Promise<LicenseStatus>;
|
|
61
|
+
//# sourceMappingURL=license-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license-validation.d.ts","sourceRoot":"","sources":["../../../src/utils/license-validation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAA;AAMnG;;;;;GAKG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CA4B7F;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAoB1E;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,IAAI,GAAG,OAAO,CAElD;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,aAAa,CAAC,CA4CrE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC,CA0D/D"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* License Validation Helpers for Skillsmith CLI
|
|
3
|
+
*
|
|
4
|
+
* Handles license key decoding, validation, and enterprise package loading.
|
|
5
|
+
*
|
|
6
|
+
* @module @skillsmith/cli/utils/license-validation
|
|
7
|
+
*/
|
|
8
|
+
import { TIER_FEATURES } from './license-types.js';
|
|
9
|
+
// Cache for the enterprise validator to avoid repeated dynamic imports
|
|
10
|
+
let enterpriseValidatorCache = undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Attempt to load the enterprise license validator
|
|
13
|
+
* Returns null if the package is not installed (expected for community users)
|
|
14
|
+
*
|
|
15
|
+
* @returns Enterprise validator or null if not available
|
|
16
|
+
*/
|
|
17
|
+
export async function tryLoadEnterpriseValidator() {
|
|
18
|
+
// Return cached result if already loaded
|
|
19
|
+
if (enterpriseValidatorCache !== undefined) {
|
|
20
|
+
return enterpriseValidatorCache;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
// Dynamic import with variable to prevent TypeScript from resolving at compile time
|
|
24
|
+
// This is an optional peer dependency that may not be installed
|
|
25
|
+
const packageName = '@skillsmith/enterprise';
|
|
26
|
+
const enterprise = (await import(/* webpackIgnore: true */ packageName));
|
|
27
|
+
if (enterprise['LicenseValidator']) {
|
|
28
|
+
const ValidatorClass = enterprise['LicenseValidator'];
|
|
29
|
+
enterpriseValidatorCache = new ValidatorClass();
|
|
30
|
+
return enterpriseValidatorCache;
|
|
31
|
+
}
|
|
32
|
+
enterpriseValidatorCache = null;
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// Enterprise package not installed - this is expected for community users
|
|
37
|
+
enterpriseValidatorCache = null;
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Reset the enterprise validator cache (for testing purposes)
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export function _resetEnterpriseValidatorCache() {
|
|
46
|
+
enterpriseValidatorCache = undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Decode and validate a license key using simple base64 JSON decoding
|
|
50
|
+
*
|
|
51
|
+
* @deprecated This function is used only when @skillsmith/enterprise is not available.
|
|
52
|
+
* For paid tiers, enterprise package with proper RS256 JWT validation should be used.
|
|
53
|
+
* Community users without a license key don't need validation.
|
|
54
|
+
*
|
|
55
|
+
* @param licenseKey - The license key to decode
|
|
56
|
+
* @returns Decoded payload or null if invalid
|
|
57
|
+
*/
|
|
58
|
+
export function decodeLicenseKey(licenseKey) {
|
|
59
|
+
try {
|
|
60
|
+
// License key format: base64 encoded JSON
|
|
61
|
+
// In production, this would include cryptographic signature verification
|
|
62
|
+
const decoded = Buffer.from(licenseKey, 'base64').toString('utf-8');
|
|
63
|
+
const payload = JSON.parse(decoded);
|
|
64
|
+
// Validate required fields
|
|
65
|
+
if (!payload.tier || !['team', 'enterprise'].includes(payload.tier)) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
if (!payload.expiresAt || isNaN(Date.parse(payload.expiresAt))) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return payload;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Check if a license has expired
|
|
79
|
+
*
|
|
80
|
+
* @param expiresAt - Expiration date
|
|
81
|
+
* @returns True if expired
|
|
82
|
+
*/
|
|
83
|
+
export function isExpired(expiresAt) {
|
|
84
|
+
return expiresAt < new Date();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get the current license status using legacy base64 decoding
|
|
88
|
+
*
|
|
89
|
+
* @deprecated Use getLicenseStatus() which properly uses enterprise JWT validation.
|
|
90
|
+
* This function is preserved only for backwards compatibility in tests.
|
|
91
|
+
*
|
|
92
|
+
* @returns Promise resolving to license status
|
|
93
|
+
*/
|
|
94
|
+
export async function getLicenseStatusLegacy() {
|
|
95
|
+
const licenseKey = process.env['SKILLSMITH_LICENSE_KEY'];
|
|
96
|
+
// No license key = community tier (free, not an error)
|
|
97
|
+
if (!licenseKey) {
|
|
98
|
+
return {
|
|
99
|
+
valid: true,
|
|
100
|
+
tier: 'community',
|
|
101
|
+
features: TIER_FEATURES.community,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
// Decode the license key
|
|
105
|
+
const payload = decodeLicenseKey(licenseKey);
|
|
106
|
+
if (!payload) {
|
|
107
|
+
return {
|
|
108
|
+
valid: false,
|
|
109
|
+
tier: 'community',
|
|
110
|
+
features: TIER_FEATURES.community,
|
|
111
|
+
error: 'Invalid license key format',
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const expiresAt = new Date(payload.expiresAt);
|
|
115
|
+
// Check expiration
|
|
116
|
+
if (isExpired(expiresAt)) {
|
|
117
|
+
return {
|
|
118
|
+
valid: false,
|
|
119
|
+
tier: 'community',
|
|
120
|
+
expiresAt,
|
|
121
|
+
features: TIER_FEATURES.community,
|
|
122
|
+
error: `License expired on ${expiresAt.toISOString().split('T')[0]}`,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
// Valid paid license
|
|
126
|
+
return {
|
|
127
|
+
valid: true,
|
|
128
|
+
tier: payload.tier,
|
|
129
|
+
expiresAt,
|
|
130
|
+
features: payload.features || TIER_FEATURES[payload.tier],
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Get the current license status
|
|
135
|
+
*
|
|
136
|
+
* Reads the license key from SKILLSMITH_LICENSE_KEY environment variable.
|
|
137
|
+
* If no key is set, returns community tier (not an error).
|
|
138
|
+
* If key is invalid or expired, returns status with error but continues.
|
|
139
|
+
*
|
|
140
|
+
* When @skillsmith/enterprise is available, uses proper RS256 JWT validation.
|
|
141
|
+
* Otherwise, falls back to simple base64 JSON decoding (for development/testing only).
|
|
142
|
+
*
|
|
143
|
+
* @returns Promise resolving to license status
|
|
144
|
+
*/
|
|
145
|
+
export async function getLicenseStatus() {
|
|
146
|
+
const licenseKey = process.env['SKILLSMITH_LICENSE_KEY'];
|
|
147
|
+
// No license key = community tier (free, not an error)
|
|
148
|
+
if (!licenseKey) {
|
|
149
|
+
return {
|
|
150
|
+
valid: true,
|
|
151
|
+
tier: 'community',
|
|
152
|
+
features: TIER_FEATURES.community,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
// Try to use enterprise validator for proper JWT verification
|
|
156
|
+
const validator = await tryLoadEnterpriseValidator();
|
|
157
|
+
if (validator) {
|
|
158
|
+
// Enterprise package available - use proper RS256 JWT validation
|
|
159
|
+
try {
|
|
160
|
+
const result = await validator.validate(licenseKey);
|
|
161
|
+
if (result.valid && result.license) {
|
|
162
|
+
return {
|
|
163
|
+
valid: true,
|
|
164
|
+
tier: result.license.tier,
|
|
165
|
+
expiresAt: result.license.expiresAt,
|
|
166
|
+
features: result.license.features.length > 0
|
|
167
|
+
? result.license.features
|
|
168
|
+
: TIER_FEATURES[result.license.tier],
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
// Invalid license - return error with community fallback
|
|
172
|
+
return {
|
|
173
|
+
valid: false,
|
|
174
|
+
tier: 'community',
|
|
175
|
+
features: TIER_FEATURES.community,
|
|
176
|
+
error: result.error?.message || 'Invalid license key',
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
// Validation threw an error - treat as invalid
|
|
181
|
+
return {
|
|
182
|
+
valid: false,
|
|
183
|
+
tier: 'community',
|
|
184
|
+
features: TIER_FEATURES.community,
|
|
185
|
+
error: 'License validation failed',
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Enterprise package not available - fall back to community tier
|
|
190
|
+
// Note: We don't attempt base64 decoding for paid tiers without proper validation
|
|
191
|
+
// This ensures security by requiring the enterprise package for paid features
|
|
192
|
+
return {
|
|
193
|
+
valid: true,
|
|
194
|
+
tier: 'community',
|
|
195
|
+
features: TIER_FEATURES.community,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=license-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license-validation.js","sourceRoot":"","sources":["../../../src/utils/license-validation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,uEAAuE;AACvE,IAAI,wBAAwB,GAAkD,SAAS,CAAA;AAEvF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B;IAC9C,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;QAC5C,MAAM,UAAU,GAAG,CAAC,MAAM,MAAM,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAGtE,CAAA;QAED,IAAI,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACnC,MAAM,cAAc,GAAG,UAAU,CAAC,kBAAkB,CAAyC,CAAA;YAC7F,wBAAwB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