@fractary/faber-cli 1.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.
@@ -0,0 +1,49 @@
1
+ /**
2
+ * FABER CLI - Input Validation Utilities
3
+ *
4
+ * Common validation functions for CLI inputs
5
+ */
6
+ /**
7
+ * Parse and validate an integer string
8
+ * @param value - String value to parse
9
+ * @param fieldName - Field name for error messages
10
+ * @returns Validated integer
11
+ * @throws Error if value is not a valid integer
12
+ */
13
+ export function parseValidInteger(value, fieldName) {
14
+ const parsed = parseInt(value, 10);
15
+ if (isNaN(parsed)) {
16
+ throw new Error(`Invalid ${fieldName}: "${value}" is not a valid integer`);
17
+ }
18
+ if (!Number.isFinite(parsed)) {
19
+ throw new Error(`Invalid ${fieldName}: value is not finite`);
20
+ }
21
+ return parsed;
22
+ }
23
+ /**
24
+ * Parse and validate an optional integer string
25
+ * @param value - String value to parse (may be undefined)
26
+ * @param fieldName - Field name for error messages
27
+ * @returns Validated integer or undefined
28
+ * @throws Error if value is provided but not a valid integer
29
+ */
30
+ export function parseOptionalInteger(value, fieldName) {
31
+ if (!value) {
32
+ return undefined;
33
+ }
34
+ return parseValidInteger(value, fieldName);
35
+ }
36
+ /**
37
+ * Parse and validate a positive integer string
38
+ * @param value - String value to parse
39
+ * @param fieldName - Field name for error messages
40
+ * @returns Validated positive integer
41
+ * @throws Error if value is not a valid positive integer
42
+ */
43
+ export function parsePositiveInteger(value, fieldName) {
44
+ const parsed = parseValidInteger(value, fieldName);
45
+ if (parsed <= 0) {
46
+ throw new Error(`Invalid ${fieldName}: must be a positive integer (got ${parsed})`);
47
+ }
48
+ return parsed;
49
+ }
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@fractary/faber-cli",
3
+ "version": "1.1.0",
4
+ "description": "FABER CLI - Command-line interface for FABER development toolkit",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "fractary-faber": "dist/index.js"
8
+ },
9
+ "type": "module",
10
+ "files": [
11
+ "dist",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "dev": "tsc --watch",
17
+ "build": "tsc",
18
+ "test": "jest",
19
+ "test:watch": "jest --watch",
20
+ "lint": "eslint src --ext .ts",
21
+ "typecheck": "tsc --noEmit",
22
+ "prepublishOnly": "npm run build"
23
+ },
24
+ "keywords": [
25
+ "faber",
26
+ "cli",
27
+ "workflow",
28
+ "sdk",
29
+ "ai",
30
+ "development",
31
+ "automation"
32
+ ],
33
+ "author": "Fractary Team",
34
+ "license": "MIT",
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "dependencies": {
39
+ "@fractary/faber": "*",
40
+ "chalk": "^5.0.0",
41
+ "commander": "^12.0.0"
42
+ },
43
+ "devDependencies": {
44
+ "@types/jest": "^30.0.0",
45
+ "@types/node": "^20.19.26",
46
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
47
+ "@typescript-eslint/parser": "^6.19.0",
48
+ "eslint": "^8.56.0",
49
+ "jest": "^29.7.0",
50
+ "ts-jest": "^29.1.1",
51
+ "ts-node": "^10.9.2",
52
+ "typescript": "^5.3.3"
53
+ },
54
+ "engines": {
55
+ "node": ">=18.0.0"
56
+ },
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "git+https://github.com/fractary/faber.git",
60
+ "directory": "cli"
61
+ },
62
+ "bugs": {
63
+ "url": "https://github.com/fractary/faber/issues"
64
+ },
65
+ "homepage": "https://github.com/fractary/faber/tree/main/cli#readme"
66
+ }