swiftcn 1.0.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.
- package/dist/commands/add.d.ts +4 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +109 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +152 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +4 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +67 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/container.d.ts +11 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/container.js +14 -0
- package/dist/container.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/services/ConfigService.d.ts +16 -0
- package/dist/services/ConfigService.d.ts.map +1 -0
- package/dist/services/ConfigService.js +27 -0
- package/dist/services/ConfigService.js.map +1 -0
- package/dist/services/FetcherService.d.ts +26 -0
- package/dist/services/FetcherService.d.ts.map +1 -0
- package/dist/services/FetcherService.js +60 -0
- package/dist/services/FetcherService.js.map +1 -0
- package/dist/services/FileService.d.ts +27 -0
- package/dist/services/FileService.d.ts.map +1 -0
- package/dist/services/FileService.js +46 -0
- package/dist/services/FileService.js.map +1 -0
- package/dist/services/GitService.d.ts +11 -0
- package/dist/services/GitService.d.ts.map +1 -0
- package/dist/services/GitService.js +21 -0
- package/dist/services/GitService.js.map +1 -0
- package/dist/services/RegistryService.d.ts +20 -0
- package/dist/services/RegistryService.d.ts.map +1 -0
- package/dist/services/RegistryService.js +43 -0
- package/dist/services/RegistryService.js.map +1 -0
- package/dist/services/index.d.ts +6 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +6 -0
- package/dist/services/index.js.map +1 -0
- package/dist/types/config.schema.d.ts +22 -0
- package/dist/types/config.schema.d.ts.map +1 -0
- package/dist/types/config.schema.js +9 -0
- package/dist/types/config.schema.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/options.schema.d.ts +47 -0
- package/dist/types/options.schema.d.ts.map +1 -0
- package/dist/types/options.schema.js +18 -0
- package/dist/types/options.schema.js.map +1 -0
- package/dist/types/registry.schema.d.ts +187 -0
- package/dist/types/registry.schema.d.ts.map +1 -0
- package/dist/types/registry.schema.js +39 -0
- package/dist/types/registry.schema.js.map +1 -0
- package/dist/utils/constants.d.ts +27 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +33 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/errors.d.ts +25 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +34 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/paths.d.ts +34 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +87 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/ui.d.ts +35 -0
- package/dist/utils/ui.d.ts.map +1 -0
- package/dist/utils/ui.js +115 -0
- package/dist/utils/ui.js.map +1 -0
- package/package.json +54 -0
- package/registry.json +133 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const componentSchema = z.object({
|
|
3
|
+
name: z.string(),
|
|
4
|
+
description: z.string(),
|
|
5
|
+
files: z.array(z.string()),
|
|
6
|
+
sdui_files: z.array(z.string()).optional(),
|
|
7
|
+
variants: z.array(z.string()).optional(),
|
|
8
|
+
sizes: z.array(z.string()).optional(),
|
|
9
|
+
sduiType: z.string().optional(),
|
|
10
|
+
sduiProps: z.array(z.string()).optional(),
|
|
11
|
+
});
|
|
12
|
+
export const registrySchema = z.object({
|
|
13
|
+
$schema: z.string().optional(),
|
|
14
|
+
name: z.string(),
|
|
15
|
+
version: z.string(),
|
|
16
|
+
description: z.string(),
|
|
17
|
+
license: z.string(),
|
|
18
|
+
author: z.string(),
|
|
19
|
+
repository: z.string(),
|
|
20
|
+
config: z.object({
|
|
21
|
+
componentsPath: z.string(),
|
|
22
|
+
themePath: z.string(),
|
|
23
|
+
sduiPath: z.string(),
|
|
24
|
+
platforms: z.array(z.string()),
|
|
25
|
+
prefix: z.string(),
|
|
26
|
+
}),
|
|
27
|
+
theme: z.object({
|
|
28
|
+
core: z.array(z.string()),
|
|
29
|
+
palettes: z.array(z.string()),
|
|
30
|
+
provider: z.array(z.string()),
|
|
31
|
+
}),
|
|
32
|
+
components: z.record(z.string(), componentSchema),
|
|
33
|
+
sdui: z.object({
|
|
34
|
+
core: z.array(z.string()),
|
|
35
|
+
wrappers: z.array(z.string()),
|
|
36
|
+
transports: z.record(z.string(), z.string()),
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=registry.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.schema.js","sourceRoot":"","sources":["../../src/types/registry.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1B,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC1C,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,M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,CAAC;IACjD,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QACzB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC7B,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;KAC7C,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for swiftcn CLI
|
|
3
|
+
* Centralized configuration values and allowed paths
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Allowed repository URLs for cloning
|
|
7
|
+
* Only repositories in this list can be used as sources
|
|
8
|
+
*/
|
|
9
|
+
export declare const ALLOWED_REPO_URLS: readonly ["https://github.com/Dicky019/swiftcn.git"];
|
|
10
|
+
/**
|
|
11
|
+
* Allowed source paths within the repository
|
|
12
|
+
* Files can only be copied from these subdirectories
|
|
13
|
+
*/
|
|
14
|
+
export declare const ALLOWED_SOURCE_PATHS: readonly ["Source/Components", "Source/Theme", "Source/SDUI"];
|
|
15
|
+
/**
|
|
16
|
+
* Configuration file name
|
|
17
|
+
*/
|
|
18
|
+
export declare const CONFIG_FILE_NAME = "swiftcn.json";
|
|
19
|
+
/**
|
|
20
|
+
* Base source directory name
|
|
21
|
+
*/
|
|
22
|
+
export declare const SOURCE_PATH = "Source";
|
|
23
|
+
/**
|
|
24
|
+
* Maximum allowed length for component names
|
|
25
|
+
*/
|
|
26
|
+
export declare const MAX_COMPONENT_NAME_LENGTH = 50;
|
|
27
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB,sDAEpB,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,oBAAoB,+DAIvB,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,gBAAgB,iBAAiB,CAAA;AAE9C;;GAEG;AACH,eAAO,MAAM,WAAW,WAAW,CAAA;AAEnC;;GAEG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for swiftcn CLI
|
|
3
|
+
* Centralized configuration values and allowed paths
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Allowed repository URLs for cloning
|
|
7
|
+
* Only repositories in this list can be used as sources
|
|
8
|
+
*/
|
|
9
|
+
export const ALLOWED_REPO_URLS = [
|
|
10
|
+
'https://github.com/Dicky019/swiftcn.git'
|
|
11
|
+
];
|
|
12
|
+
/**
|
|
13
|
+
* Allowed source paths within the repository
|
|
14
|
+
* Files can only be copied from these subdirectories
|
|
15
|
+
*/
|
|
16
|
+
export const ALLOWED_SOURCE_PATHS = [
|
|
17
|
+
'Source/Components',
|
|
18
|
+
'Source/Theme',
|
|
19
|
+
'Source/SDUI'
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* Configuration file name
|
|
23
|
+
*/
|
|
24
|
+
export const CONFIG_FILE_NAME = 'swiftcn.json';
|
|
25
|
+
/**
|
|
26
|
+
* Base source directory name
|
|
27
|
+
*/
|
|
28
|
+
export const SOURCE_PATH = 'Source';
|
|
29
|
+
/**
|
|
30
|
+
* Maximum allowed length for component names
|
|
31
|
+
*/
|
|
32
|
+
export const MAX_COMPONENT_NAME_LENGTH = 50;
|
|
33
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,yCAAyC;CACjC,CAAA;AAEV;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,mBAAmB;IACnB,cAAc;IACd,aAAa;CACL,CAAA;AAEV;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAA;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAA;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error handling utilities for swiftcn CLI
|
|
3
|
+
* Provides structured error types with error codes
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Error codes for different failure scenarios
|
|
7
|
+
*/
|
|
8
|
+
export declare enum ErrorCode {
|
|
9
|
+
CONFIG_NOT_FOUND = "CONFIG_NOT_FOUND",
|
|
10
|
+
COMPONENT_NOT_FOUND = "COMPONENT_NOT_FOUND",
|
|
11
|
+
PATH_TRAVERSAL = "PATH_TRAVERSAL",
|
|
12
|
+
INVALID_INPUT = "INVALID_INPUT",
|
|
13
|
+
GIT_CLONE_FAILED = "GIT_CLONE_FAILED",
|
|
14
|
+
FILE_COPY_FAILED = "FILE_COPY_FAILED",
|
|
15
|
+
REGISTRY_LOAD_FAILED = "REGISTRY_LOAD_FAILED"
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Custom error class for swiftcn CLI operations
|
|
19
|
+
* Extends native Error with structured error codes
|
|
20
|
+
*/
|
|
21
|
+
export declare class SwiftCNError extends Error {
|
|
22
|
+
readonly code: ErrorCode;
|
|
23
|
+
constructor(message: string, code: ErrorCode);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,oBAAY,SAAS;IACnB,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;IAC3C,cAAc,mBAAmB;IACjC,aAAa,kBAAkB;IAC/B,gBAAgB,qBAAqB;IACrC,gBAAgB,qBAAqB;IACrC,oBAAoB,yBAAyB;CAC9C;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC,SAAgB,IAAI,EAAE,SAAS,CAAA;gBAEnB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS;CAU7C"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error handling utilities for swiftcn CLI
|
|
3
|
+
* Provides structured error types with error codes
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Error codes for different failure scenarios
|
|
7
|
+
*/
|
|
8
|
+
export var ErrorCode;
|
|
9
|
+
(function (ErrorCode) {
|
|
10
|
+
ErrorCode["CONFIG_NOT_FOUND"] = "CONFIG_NOT_FOUND";
|
|
11
|
+
ErrorCode["COMPONENT_NOT_FOUND"] = "COMPONENT_NOT_FOUND";
|
|
12
|
+
ErrorCode["PATH_TRAVERSAL"] = "PATH_TRAVERSAL";
|
|
13
|
+
ErrorCode["INVALID_INPUT"] = "INVALID_INPUT";
|
|
14
|
+
ErrorCode["GIT_CLONE_FAILED"] = "GIT_CLONE_FAILED";
|
|
15
|
+
ErrorCode["FILE_COPY_FAILED"] = "FILE_COPY_FAILED";
|
|
16
|
+
ErrorCode["REGISTRY_LOAD_FAILED"] = "REGISTRY_LOAD_FAILED";
|
|
17
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
18
|
+
/**
|
|
19
|
+
* Custom error class for swiftcn CLI operations
|
|
20
|
+
* Extends native Error with structured error codes
|
|
21
|
+
*/
|
|
22
|
+
export class SwiftCNError extends Error {
|
|
23
|
+
code;
|
|
24
|
+
constructor(message, code) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = 'SwiftCNError';
|
|
27
|
+
this.code = code;
|
|
28
|
+
// Maintains proper stack trace for where our error was thrown (only available on V8)
|
|
29
|
+
if (Error.captureStackTrace) {
|
|
30
|
+
Error.captureStackTrace(this, SwiftCNError);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,kDAAqC,CAAA;IACrC,wDAA2C,CAAA;IAC3C,8CAAiC,CAAA;IACjC,4CAA+B,CAAA;IAC/B,kDAAqC,CAAA;IACrC,kDAAqC,CAAA;IACrC,0DAA6C,CAAA;AAC/C,CAAC,EARW,SAAS,KAAT,SAAS,QAQpB;AAED;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrB,IAAI,CAAW;IAE/B,YAAY,OAAe,EAAE,IAAe;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,cAAc,CAAA;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAEhB,qFAAqF;QACrF,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;QAC7C,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path sanitization and validation utilities
|
|
3
|
+
* Prevents path traversal attacks and validates user input
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Sanitizes a path by normalizing and validating it
|
|
7
|
+
* @param inputPath - The path to sanitize
|
|
8
|
+
* @returns The sanitized path
|
|
9
|
+
* @throws {SwiftCNError} If path contains invalid characters or patterns
|
|
10
|
+
*/
|
|
11
|
+
export declare function sanitizePath(inputPath: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if a path contains path traversal attempts
|
|
14
|
+
* @param inputPath - The path to check
|
|
15
|
+
* @returns true if path contains traversal patterns
|
|
16
|
+
*/
|
|
17
|
+
export declare function isPathTraversal(inputPath: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Resolves a relative path against a base path securely
|
|
20
|
+
* Ensures the resolved path stays within the base directory
|
|
21
|
+
* @param basePath - The base directory path
|
|
22
|
+
* @param relativePath - The relative path to resolve
|
|
23
|
+
* @returns The resolved absolute path
|
|
24
|
+
* @throws {SwiftCNError} If the resolved path is outside the base directory
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveSecurePath(basePath: string, relativePath: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Validates a component name
|
|
29
|
+
* Component names must be alphanumeric with optional hyphens, max 50 chars
|
|
30
|
+
* @param name - The component name to validate
|
|
31
|
+
* @returns true if the name is valid
|
|
32
|
+
*/
|
|
33
|
+
export declare function isValidComponentName(name: string): boolean;
|
|
34
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAwBtD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAI1D;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CA6BhF;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAc1D"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path sanitization and validation utilities
|
|
3
|
+
* Prevents path traversal attacks and validates user input
|
|
4
|
+
*/
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { SwiftCNError, ErrorCode } from './errors.js';
|
|
7
|
+
import { MAX_COMPONENT_NAME_LENGTH } from './constants.js';
|
|
8
|
+
/**
|
|
9
|
+
* Sanitizes a path by normalizing and validating it
|
|
10
|
+
* @param inputPath - The path to sanitize
|
|
11
|
+
* @returns The sanitized path
|
|
12
|
+
* @throws {SwiftCNError} If path contains invalid characters or patterns
|
|
13
|
+
*/
|
|
14
|
+
export function sanitizePath(inputPath) {
|
|
15
|
+
if (!inputPath || typeof inputPath !== 'string') {
|
|
16
|
+
throw new SwiftCNError('Path must be a non-empty string', ErrorCode.INVALID_INPUT);
|
|
17
|
+
}
|
|
18
|
+
// Trim whitespace
|
|
19
|
+
const trimmed = inputPath.trim();
|
|
20
|
+
if (trimmed.length === 0) {
|
|
21
|
+
throw new SwiftCNError('Path cannot be empty', ErrorCode.INVALID_INPUT);
|
|
22
|
+
}
|
|
23
|
+
// Normalize the path to remove redundant separators and resolve . and ..
|
|
24
|
+
const normalized = path.normalize(trimmed);
|
|
25
|
+
// Check for path traversal after normalization
|
|
26
|
+
if (isPathTraversal(normalized)) {
|
|
27
|
+
throw new SwiftCNError('Path contains path traversal patterns (..)', ErrorCode.PATH_TRAVERSAL);
|
|
28
|
+
}
|
|
29
|
+
return normalized;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a path contains path traversal attempts
|
|
33
|
+
* @param inputPath - The path to check
|
|
34
|
+
* @returns true if path contains traversal patterns
|
|
35
|
+
*/
|
|
36
|
+
export function isPathTraversal(inputPath) {
|
|
37
|
+
// Check for .. in the path
|
|
38
|
+
const parts = inputPath.split(path.sep);
|
|
39
|
+
return parts.includes('..');
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolves a relative path against a base path securely
|
|
43
|
+
* Ensures the resolved path stays within the base directory
|
|
44
|
+
* @param basePath - The base directory path
|
|
45
|
+
* @param relativePath - The relative path to resolve
|
|
46
|
+
* @returns The resolved absolute path
|
|
47
|
+
* @throws {SwiftCNError} If the resolved path is outside the base directory
|
|
48
|
+
*/
|
|
49
|
+
export function resolveSecurePath(basePath, relativePath) {
|
|
50
|
+
// Reject absolute paths in user input
|
|
51
|
+
if (path.isAbsolute(relativePath)) {
|
|
52
|
+
throw new SwiftCNError('Relative path cannot be absolute', ErrorCode.PATH_TRAVERSAL);
|
|
53
|
+
}
|
|
54
|
+
// Sanitize the relative path first
|
|
55
|
+
const sanitized = sanitizePath(relativePath);
|
|
56
|
+
// Resolve the path against the base
|
|
57
|
+
const resolved = path.resolve(basePath, sanitized);
|
|
58
|
+
// Normalize both paths for comparison
|
|
59
|
+
const normalizedBase = path.resolve(basePath);
|
|
60
|
+
const normalizedResolved = path.resolve(resolved);
|
|
61
|
+
// Ensure the resolved path is within the base directory
|
|
62
|
+
if (!normalizedResolved.startsWith(normalizedBase + path.sep) &&
|
|
63
|
+
normalizedResolved !== normalizedBase) {
|
|
64
|
+
throw new SwiftCNError('Resolved path is outside the allowed directory', ErrorCode.PATH_TRAVERSAL);
|
|
65
|
+
}
|
|
66
|
+
return resolved;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Validates a component name
|
|
70
|
+
* Component names must be alphanumeric with optional hyphens, max 50 chars
|
|
71
|
+
* @param name - The component name to validate
|
|
72
|
+
* @returns true if the name is valid
|
|
73
|
+
*/
|
|
74
|
+
export function isValidComponentName(name) {
|
|
75
|
+
if (!name || typeof name !== 'string') {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
// Check length
|
|
79
|
+
if (name.length === 0 || name.length > MAX_COMPONENT_NAME_LENGTH) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
// Check pattern: alphanumeric + hyphen only
|
|
83
|
+
// Must start and end with alphanumeric (not hyphen)
|
|
84
|
+
const pattern = /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/;
|
|
85
|
+
return pattern.test(name);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAA;AAE1D;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,SAAiB;IAC5C,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,IAAI,YAAY,CAAC,iCAAiC,EAAE,SAAS,CAAC,aAAa,CAAC,CAAA;IACpF,CAAC;IAED,kBAAkB;IAClB,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAA;IAEhC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,YAAY,CAAC,sBAAsB,EAAE,SAAS,CAAC,aAAa,CAAC,CAAA;IACzE,CAAC;IAED,yEAAyE;IACzE,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAE1C,+CAA+C;IAC/C,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,YAAY,CACpB,4CAA4C,EAC5C,SAAS,CAAC,cAAc,CACzB,CAAA;IACH,CAAC;IAED,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,2BAA2B;IAC3B,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACvC,OAAO,KAAK,C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CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const ui: {
|
|
2
|
+
/** Print header with version */
|
|
3
|
+
header: () => void;
|
|
4
|
+
/** Format multi-line text with bar prefix */
|
|
5
|
+
formatWithBar: (text: string) => string;
|
|
6
|
+
/** Print a step/action message */
|
|
7
|
+
step: (message: string) => void;
|
|
8
|
+
/** Print a line continuation */
|
|
9
|
+
line: (message?: string) => void;
|
|
10
|
+
/** Print a file added */
|
|
11
|
+
fileAdded: (path: string) => void;
|
|
12
|
+
/** Print a file exists */
|
|
13
|
+
fileExists: (path: string) => void;
|
|
14
|
+
/** Print section header */
|
|
15
|
+
section: (title: string) => void;
|
|
16
|
+
/** Print info text */
|
|
17
|
+
info: (message: string) => void;
|
|
18
|
+
/** Print error */
|
|
19
|
+
error: (message: string) => void;
|
|
20
|
+
/** Print end of output */
|
|
21
|
+
end: (message?: string) => void;
|
|
22
|
+
/** Print empty line */
|
|
23
|
+
break: () => void;
|
|
24
|
+
/** Print a command hint */
|
|
25
|
+
command: (cmd: string, description?: string) => void;
|
|
26
|
+
/** Print success message with celebration */
|
|
27
|
+
success: (message: string) => void;
|
|
28
|
+
/** Print a hint/tip */
|
|
29
|
+
hint: (message: string) => void;
|
|
30
|
+
/** Print a labeled list (e.g., Variants: a · b · c) */
|
|
31
|
+
labeledList: (label: string, items: string[]) => void;
|
|
32
|
+
/** Apply accent color to text */
|
|
33
|
+
accent: (text: string) => string;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=ui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/utils/ui.ts"],"names":[],"mappings":"AAgDA,eAAO,MAAM,EAAE;IACb,gCAAgC;;IAUhC,6CAA6C;0BAlBlB,MAAM,KAAG,MAAM;IAqB1C,kCAAkC;oBAClB,MAAM;IAItB,gCAAgC;qBAChB,MAAM;IAItB,yBAAyB;sBACP,MAAM;IAIxB,0BAA0B;uBACP,MAAM;IAIzB,2BAA2B;qBACV,MAAM;IAKvB,sBAAsB;oBACN,MAAM;IAItB,kBAAkB;qBACD,MAAM;IAIvB,0BAA0B;oBACX,MAAM;IAKrB,uBAAuB;;IAKvB,2BAA2B;mBACZ,MAAM,gBAAgB,MAAM;IAQ3C,6CAA6C;uBAC1B,MAAM;IAIzB,uBAAuB;oBACP,MAAM;IAItB,uDAAuD;yBAClC,MAAM,SAAS,MAAM,EAAE;IAK5C,iCAAiC;mBAClB,MAAM;CACtB,CAAC"}
|
package/dist/utils/ui.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import pc from "picocolors";
|
|
2
|
+
const VERSION = "1.0.0";
|
|
3
|
+
// RGB color helper for true color terminals
|
|
4
|
+
const rgb = (r, g, b) => (text) => `\x1b[38;2;${r};${g};${b}m${text}\x1b[0m`;
|
|
5
|
+
// Gradient colors from #de5e44 to #ff9521
|
|
6
|
+
const gradientColors = [
|
|
7
|
+
rgb(222, 94, 68), // #de5e44
|
|
8
|
+
rgb(229, 105, 61), // #e5693d
|
|
9
|
+
rgb(236, 116, 54), // #ec7436
|
|
10
|
+
rgb(243, 127, 47), // #f37f2f
|
|
11
|
+
rgb(250, 138, 40), // #fa8a28
|
|
12
|
+
rgb(255, 149, 33), // #ff9521
|
|
13
|
+
];
|
|
14
|
+
// Accent color #fa8a28
|
|
15
|
+
const accent = rgb(250, 138, 40);
|
|
16
|
+
// ASCII Art Banner lines
|
|
17
|
+
const BANNER_LINES = [
|
|
18
|
+
"███████╗██╗ ██╗██╗███████╗████████╗ ██████╗███╗ ██╗",
|
|
19
|
+
"██╔════╝██║ ██║██║██╔════╝╚══██╔══╝██╔════╝████╗ ██║",
|
|
20
|
+
"███████╗██║ █╗ ██║██║█████╗ ██║ ██║ ██╔██╗ ██║",
|
|
21
|
+
"╚════██║██║███╗██║██║██╔══╝ ██║ ██║ ██║╚██╗██║",
|
|
22
|
+
"███████║╚███╔███╔╝██║██║ ██║ ╚██████╗██║ ╚████║",
|
|
23
|
+
"╚══════╝ ╚══╝╚══╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═══╝",
|
|
24
|
+
];
|
|
25
|
+
// Box-drawing characters
|
|
26
|
+
const S_BAR = "│";
|
|
27
|
+
const S_BAR_END = "└";
|
|
28
|
+
const S_BAR_H = "─";
|
|
29
|
+
const S_CORNER_TOP_LEFT = "┌";
|
|
30
|
+
const S_STEP_ACTIVE = "◇";
|
|
31
|
+
const S_STEP_ERROR = "✖";
|
|
32
|
+
const S_CONNECT_LEFT = "├";
|
|
33
|
+
/** Format text with bar prefix for each line */
|
|
34
|
+
const formatWithBar = (text) => {
|
|
35
|
+
return text
|
|
36
|
+
.split("\n")
|
|
37
|
+
.map((line) => `${pc.gray(S_BAR)} ${line}`)
|
|
38
|
+
.join("\n");
|
|
39
|
+
};
|
|
40
|
+
export const ui = {
|
|
41
|
+
/** Print header with version */
|
|
42
|
+
header: () => {
|
|
43
|
+
console.log();
|
|
44
|
+
BANNER_LINES.forEach((line, i) => {
|
|
45
|
+
console.log(gradientColors[i](line));
|
|
46
|
+
});
|
|
47
|
+
console.log();
|
|
48
|
+
console.log(`${pc.gray(S_CORNER_TOP_LEFT)} ${pc.dim(`v${VERSION}`)}`);
|
|
49
|
+
},
|
|
50
|
+
/** Format multi-line text with bar prefix */
|
|
51
|
+
formatWithBar,
|
|
52
|
+
/** Print a step/action message */
|
|
53
|
+
step: (message) => {
|
|
54
|
+
console.log(`${pc.green(S_STEP_ACTIVE)} ${message}`);
|
|
55
|
+
},
|
|
56
|
+
/** Print a line continuation */
|
|
57
|
+
line: (message = "") => {
|
|
58
|
+
console.log(`${pc.gray(S_BAR)} ${message}`);
|
|
59
|
+
},
|
|
60
|
+
/** Print a file added */
|
|
61
|
+
fileAdded: (path) => {
|
|
62
|
+
console.log(`${pc.gray(S_BAR)} ${pc.green("+")} ${path}`);
|
|
63
|
+
},
|
|
64
|
+
/** Print a file exists */
|
|
65
|
+
fileExists: (path) => {
|
|
66
|
+
console.log(`${pc.gray(S_BAR)} ${pc.yellow("~")} ${path} ${pc.dim("(exists)")}`);
|
|
67
|
+
},
|
|
68
|
+
/** Print section header */
|
|
69
|
+
section: (title) => {
|
|
70
|
+
const line = S_BAR_H.repeat(45 - title.length);
|
|
71
|
+
console.log(`${pc.gray(S_BAR)} ${title} ${pc.gray(line)}`);
|
|
72
|
+
},
|
|
73
|
+
/** Print info text */
|
|
74
|
+
info: (message) => {
|
|
75
|
+
console.log(`${pc.gray(S_BAR)} ${pc.dim(message)}`);
|
|
76
|
+
},
|
|
77
|
+
/** Print error */
|
|
78
|
+
error: (message) => {
|
|
79
|
+
console.log(`${pc.red(S_STEP_ERROR)} ${message}`);
|
|
80
|
+
},
|
|
81
|
+
/** Print end of output */
|
|
82
|
+
end: (message = "") => {
|
|
83
|
+
console.log(`${pc.gray(S_BAR_END)} ${message}`);
|
|
84
|
+
console.log();
|
|
85
|
+
},
|
|
86
|
+
/** Print empty line */
|
|
87
|
+
break: () => {
|
|
88
|
+
console.log(pc.gray(S_BAR));
|
|
89
|
+
},
|
|
90
|
+
/** Print a command hint */
|
|
91
|
+
command: (cmd, description) => {
|
|
92
|
+
if (description) {
|
|
93
|
+
console.log(`${pc.gray(S_BAR)} ${pc.gray("→")} ${accent(cmd)} ${pc.dim(description)}`);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
console.log(`${pc.gray(S_BAR)} ${pc.gray("→")} ${accent(cmd)}`);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
/** Print success message with celebration */
|
|
100
|
+
success: (message) => {
|
|
101
|
+
console.log(`${pc.green("◆")} ${pc.green(pc.bold(message))}`);
|
|
102
|
+
},
|
|
103
|
+
/** Print a hint/tip */
|
|
104
|
+
hint: (message) => {
|
|
105
|
+
console.log(`${pc.gray(S_BAR)} ${pc.dim("›")} ${pc.dim(message)}`);
|
|
106
|
+
},
|
|
107
|
+
/** Print a labeled list (e.g., Variants: a · b · c) */
|
|
108
|
+
labeledList: (label, items) => {
|
|
109
|
+
const formatted = items.map((item) => accent(item)).join(` ${pc.dim("·")} `);
|
|
110
|
+
console.log(`${pc.gray(S_BAR)} ${pc.bold(label + ":")} ${formatted}`);
|
|
111
|
+
},
|
|
112
|
+
/** Apply accent color to text */
|
|
113
|
+
accent: (text) => accent(text),
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/utils/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,OAAO,GAAG,OAAO,CAAC;AAExB,4CAA4C;AAC5C,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,IAAY,EAAE,EAAE,CAChE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC;AAE5C,0CAA0C;AAC1C,MAAM,cAAc,GAAG;IACrB,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,EAAI,UAAU;IAC9B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,EAAG,UAAU;IAC9B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,EAAG,UAAU;IAC9B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,EAAG,UAAU;IAC9B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,EAAG,UAAU;IAC9B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,EAAG,UAAU;CAC/B,CAAC;AAEF,uBAAuB;AACvB,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;AAEjC,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AAE,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,uBAAuB;IACvB,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,uDAAuD;IACvD,WAAW,EAAE,CAAC,KAAa,EAAE,KAAe,EAAE,EAAE;QAC9C,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7E,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,iCAAiC;IACjC,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;CACvC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "swiftcn",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI for swiftcn - shadcn/ui inspired SwiftUI components",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"swiftcn": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"dev": "tsc --watch",
|
|
12
|
+
"start": "node dist/index.js",
|
|
13
|
+
"typecheck": "tsc --noEmit",
|
|
14
|
+
"test": "vitest run",
|
|
15
|
+
"test:watch": "vitest",
|
|
16
|
+
"test:coverage": "vitest run --coverage",
|
|
17
|
+
"prepublishOnly": "npm run build"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"swiftui",
|
|
21
|
+
"components",
|
|
22
|
+
"cli",
|
|
23
|
+
"shadcn"
|
|
24
|
+
],
|
|
25
|
+
"author": "swiftcn",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/Dicky019/swiftcn.git"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=20.0.0"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"!dist/__tests__",
|
|
37
|
+
"registry.json"
|
|
38
|
+
],
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@clack/prompts": "^0.7.0",
|
|
41
|
+
"commander": "^12.1.0",
|
|
42
|
+
"fs-extra": "^11.2.0",
|
|
43
|
+
"picocolors": "^1.0.0",
|
|
44
|
+
"simple-git": "^3.24.0",
|
|
45
|
+
"zod": "^3.23.8"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/fs-extra": "^11.0.4",
|
|
49
|
+
"@types/node": "^20.14.0",
|
|
50
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
51
|
+
"typescript": "^5.4.5",
|
|
52
|
+
"vitest": "^4.0.18"
|
|
53
|
+
}
|
|
54
|
+
}
|