@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.
- package/LICENSE +21 -0
- package/README.md +223 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +163 -0
- package/dist/commands/logs/index.d.ts +11 -0
- package/dist/commands/logs/index.d.ts.map +1 -0
- package/dist/commands/logs/index.js +330 -0
- package/dist/commands/repo/index.d.ts +11 -0
- package/dist/commands/repo/index.d.ts.map +1 -0
- package/dist/commands/repo/index.js +612 -0
- package/dist/commands/spec/index.d.ts +11 -0
- package/dist/commands/spec/index.d.ts.map +1 -0
- package/dist/commands/spec/index.js +280 -0
- package/dist/commands/work/index.d.ts +11 -0
- package/dist/commands/work/index.d.ts.map +1 -0
- package/dist/commands/work/index.js +748 -0
- package/dist/commands/workflow/index.d.ts +31 -0
- package/dist/commands/workflow/index.d.ts.map +1 -0
- package/dist/commands/workflow/index.js +298 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +145 -0
- package/dist/utils/errors.d.ts +14 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +44 -0
- package/dist/utils/output.d.ts +18 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +39 -0
- package/dist/utils/validation.d.ts +30 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +49 -0
- package/package.json +66 -0
|
@@ -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
|
+
}
|