@fractary/core-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.
- package/LICENSE +21 -0
- package/README.md +313 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +86 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/docs/index.d.ts +11 -0
- package/dist/commands/docs/index.d.ts.map +1 -0
- package/dist/commands/docs/index.js +276 -0
- package/dist/commands/docs/index.js.map +1 -0
- package/dist/commands/file/index.d.ts +11 -0
- package/dist/commands/file/index.d.ts.map +1 -0
- package/dist/commands/file/index.js +210 -0
- package/dist/commands/file/index.js.map +1 -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 +277 -0
- package/dist/commands/logs/index.js.map +1 -0
- package/dist/commands/logs/utils.d.ts +11 -0
- package/dist/commands/logs/utils.d.ts.map +1 -0
- package/dist/commands/logs/utils.js +39 -0
- package/dist/commands/logs/utils.js.map +1 -0
- package/dist/commands/repo/branch.d.ts +6 -0
- package/dist/commands/repo/branch.d.ts.map +1 -0
- package/dist/commands/repo/branch.js +128 -0
- package/dist/commands/repo/branch.js.map +1 -0
- package/dist/commands/repo/commit.d.ts +6 -0
- package/dist/commands/repo/commit.d.ts.map +1 -0
- package/dist/commands/repo/commit.js +51 -0
- package/dist/commands/repo/commit.js.map +1 -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 +33 -0
- package/dist/commands/repo/index.js.map +1 -0
- package/dist/commands/repo/pr.d.ts +6 -0
- package/dist/commands/repo/pr.d.ts.map +1 -0
- package/dist/commands/repo/pr.js +165 -0
- package/dist/commands/repo/pr.js.map +1 -0
- package/dist/commands/repo/status.d.ts +8 -0
- package/dist/commands/repo/status.d.ts.map +1 -0
- package/dist/commands/repo/status.js +123 -0
- package/dist/commands/repo/status.js.map +1 -0
- package/dist/commands/repo/tag.d.ts +6 -0
- package/dist/commands/repo/tag.d.ts.map +1 -0
- package/dist/commands/repo/tag.js +125 -0
- package/dist/commands/repo/tag.js.map +1 -0
- package/dist/commands/repo/worktree.d.ts +6 -0
- package/dist/commands/repo/worktree.d.ts.map +1 -0
- package/dist/commands/repo/worktree.js +137 -0
- package/dist/commands/repo/worktree.js.map +1 -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 +264 -0
- package/dist/commands/spec/index.js.map +1 -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 +773 -0
- package/dist/commands/work/index.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/sdk/factory.d.ts +51 -0
- package/dist/sdk/factory.d.ts.map +1 -0
- package/dist/sdk/factory.js +188 -0
- package/dist/sdk/factory.js.map +1 -0
- package/dist/utils/config.d.ts +71 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +219 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/errors.d.ts +42 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +144 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/output.d.ts +115 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +201 -0
- package/dist/utils/output.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration Management Utilities
|
|
4
|
+
*
|
|
5
|
+
* Handles configuration file discovery, loading, and migration from old paths.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.findConfigPath = findConfigPath;
|
|
45
|
+
exports.findLegacyConfigPath = findLegacyConfigPath;
|
|
46
|
+
exports.loadConfig = loadConfig;
|
|
47
|
+
exports.writeConfig = writeConfig;
|
|
48
|
+
exports.getDefaultConfigPath = getDefaultConfigPath;
|
|
49
|
+
exports.configExists = configExists;
|
|
50
|
+
exports.getConfigDir = getConfigDir;
|
|
51
|
+
exports.mergeConfig = mergeConfig;
|
|
52
|
+
const fs = __importStar(require("fs"));
|
|
53
|
+
const path = __importStar(require("path"));
|
|
54
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
55
|
+
/**
|
|
56
|
+
* Configuration paths
|
|
57
|
+
*/
|
|
58
|
+
const CONFIG_DIR = '.fractary/core';
|
|
59
|
+
const CONFIG_FILE = 'config.json';
|
|
60
|
+
const LEGACY_CONFIG_DIR = '.fractary/faber';
|
|
61
|
+
/**
|
|
62
|
+
* Find the configuration file path by walking up the directory tree
|
|
63
|
+
*
|
|
64
|
+
* @param startDir - Directory to start searching from (default: current working directory)
|
|
65
|
+
* @returns Path to config file or null if not found
|
|
66
|
+
*/
|
|
67
|
+
function findConfigPath(startDir = process.cwd()) {
|
|
68
|
+
let currentDir = startDir;
|
|
69
|
+
while (true) {
|
|
70
|
+
const configPath = path.join(currentDir, CONFIG_DIR, CONFIG_FILE);
|
|
71
|
+
if (fs.existsSync(configPath)) {
|
|
72
|
+
return configPath;
|
|
73
|
+
}
|
|
74
|
+
const parentDir = path.dirname(currentDir);
|
|
75
|
+
// Reached filesystem root
|
|
76
|
+
if (parentDir === currentDir) {
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
currentDir = parentDir;
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Find the legacy configuration file path
|
|
85
|
+
*
|
|
86
|
+
* @param startDir - Directory to start searching from
|
|
87
|
+
* @returns Path to legacy config file or null if not found
|
|
88
|
+
*/
|
|
89
|
+
function findLegacyConfigPath(startDir = process.cwd()) {
|
|
90
|
+
let currentDir = startDir;
|
|
91
|
+
while (true) {
|
|
92
|
+
const legacyPath = path.join(currentDir, LEGACY_CONFIG_DIR, CONFIG_FILE);
|
|
93
|
+
if (fs.existsSync(legacyPath)) {
|
|
94
|
+
return legacyPath;
|
|
95
|
+
}
|
|
96
|
+
const parentDir = path.dirname(currentDir);
|
|
97
|
+
if (parentDir === currentDir) {
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
currentDir = parentDir;
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Load configuration from file
|
|
106
|
+
*
|
|
107
|
+
* @param configPath - Path to config file (optional, will auto-discover if not provided)
|
|
108
|
+
* @returns Configuration object or null if not found
|
|
109
|
+
*/
|
|
110
|
+
function loadConfig(configPath) {
|
|
111
|
+
try {
|
|
112
|
+
const actualPath = configPath || findConfigPath();
|
|
113
|
+
if (!actualPath) {
|
|
114
|
+
// Try to migrate from legacy path
|
|
115
|
+
const legacyPath = findLegacyConfigPath();
|
|
116
|
+
if (legacyPath) {
|
|
117
|
+
return migrateLegacyConfig(legacyPath);
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
const content = fs.readFileSync(actualPath, 'utf-8');
|
|
122
|
+
return JSON.parse(content);
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
// Failed to load config
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Migrate legacy configuration from .fractary/faber to .fractary/core
|
|
131
|
+
*
|
|
132
|
+
* @param legacyPath - Path to legacy config file
|
|
133
|
+
* @returns Migrated configuration
|
|
134
|
+
*/
|
|
135
|
+
function migrateLegacyConfig(legacyPath) {
|
|
136
|
+
try {
|
|
137
|
+
console.log(chalk_1.default.yellow('Notice:'), 'Migrating configuration from', LEGACY_CONFIG_DIR, 'to', CONFIG_DIR);
|
|
138
|
+
const content = fs.readFileSync(legacyPath, 'utf-8');
|
|
139
|
+
const legacyConfig = JSON.parse(content);
|
|
140
|
+
// Extract relevant configuration sections
|
|
141
|
+
const coreConfig = {
|
|
142
|
+
work: legacyConfig.work,
|
|
143
|
+
repo: legacyConfig.repo,
|
|
144
|
+
spec: legacyConfig.spec,
|
|
145
|
+
logs: legacyConfig.logs,
|
|
146
|
+
file: legacyConfig.file,
|
|
147
|
+
docs: legacyConfig.docs,
|
|
148
|
+
};
|
|
149
|
+
// Write to new location
|
|
150
|
+
const legacyDir = path.dirname(legacyPath);
|
|
151
|
+
const projectRoot = path.dirname(path.dirname(legacyDir));
|
|
152
|
+
const newPath = path.join(projectRoot, CONFIG_DIR, CONFIG_FILE);
|
|
153
|
+
writeConfig(coreConfig, newPath);
|
|
154
|
+
console.log(chalk_1.default.green('✓'), 'Configuration migrated successfully');
|
|
155
|
+
return coreConfig;
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
console.error(chalk_1.default.red('Failed to migrate configuration:'), error);
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Write configuration to file
|
|
164
|
+
*
|
|
165
|
+
* @param config - Configuration object
|
|
166
|
+
* @param configPath - Path to write config to (optional, will use default if not provided)
|
|
167
|
+
*/
|
|
168
|
+
function writeConfig(config, configPath) {
|
|
169
|
+
const actualPath = configPath || getDefaultConfigPath();
|
|
170
|
+
// Ensure directory exists
|
|
171
|
+
const dir = path.dirname(actualPath);
|
|
172
|
+
if (!fs.existsSync(dir)) {
|
|
173
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
174
|
+
}
|
|
175
|
+
// Write configuration with pretty formatting
|
|
176
|
+
fs.writeFileSync(actualPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Get the default configuration file path for the current project
|
|
180
|
+
*
|
|
181
|
+
* @returns Default config path
|
|
182
|
+
*/
|
|
183
|
+
function getDefaultConfigPath() {
|
|
184
|
+
return path.join(process.cwd(), CONFIG_DIR, CONFIG_FILE);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Check if configuration exists
|
|
188
|
+
*
|
|
189
|
+
* @returns True if config exists, false otherwise
|
|
190
|
+
*/
|
|
191
|
+
function configExists() {
|
|
192
|
+
return findConfigPath() !== null || findLegacyConfigPath() !== null;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Get configuration directory path
|
|
196
|
+
*
|
|
197
|
+
* @returns Config directory path
|
|
198
|
+
*/
|
|
199
|
+
function getConfigDir() {
|
|
200
|
+
return path.join(process.cwd(), CONFIG_DIR);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Merge configuration objects
|
|
204
|
+
*
|
|
205
|
+
* @param base - Base configuration
|
|
206
|
+
* @param override - Configuration to merge in
|
|
207
|
+
* @returns Merged configuration
|
|
208
|
+
*/
|
|
209
|
+
function mergeConfig(base, override) {
|
|
210
|
+
return {
|
|
211
|
+
work: override.work !== undefined ? override.work : base.work,
|
|
212
|
+
repo: override.repo !== undefined ? override.repo : base.repo,
|
|
213
|
+
spec: override.spec !== undefined ? override.spec : base.spec,
|
|
214
|
+
logs: override.logs !== undefined ? override.logs : base.logs,
|
|
215
|
+
file: override.file !== undefined ? override.file : base.file,
|
|
216
|
+
docs: override.docs !== undefined ? override.docs : base.docs,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BH,wCAqBC;AAQD,oDAoBC;AAQD,gCAmBC;AA+CD,kCAWC;AAOD,oDAEC;AAOD,oCAEC;AAOD,oCAEC;AASD,kCASC;AAhND,uCAAyB;AACzB,2CAA6B;AAC7B,kDAA0B;AAc1B;;GAEG;AACH,MAAM,UAAU,GAAG,gBAAgB,CAAC;A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IAAI,oBAAoB,EAAE,KAAK,IAAI,CAAC;AACtE,CAAC;AAED;;;;GAIG;AACH,SAAgB,YAAY;IAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,IAAgB,EAAE,QAA6B;IACzE,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;QAC7D,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;QAC7D,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;QAC7D,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;QAC7D,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;QAC7D,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;KAC9D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Handling Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides centralized error handling for the CLI with proper exit codes
|
|
5
|
+
* and formatted error messages for both JSON and text output modes.
|
|
6
|
+
*/
|
|
7
|
+
import type { OutputOptions } from './output';
|
|
8
|
+
/**
|
|
9
|
+
* Custom CLI error class
|
|
10
|
+
*/
|
|
11
|
+
export declare class CLIError extends Error {
|
|
12
|
+
code: string;
|
|
13
|
+
constructor(code: string, message: string);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Exit codes for different error types
|
|
17
|
+
*/
|
|
18
|
+
export declare const ExitCodes: {
|
|
19
|
+
readonly SUCCESS: 0;
|
|
20
|
+
readonly GENERAL_ERROR: 1;
|
|
21
|
+
readonly INVALID_ARGUMENT: 2;
|
|
22
|
+
readonly NOT_FOUND: 3;
|
|
23
|
+
readonly PERMISSION_DENIED: 4;
|
|
24
|
+
readonly CONFLICT: 5;
|
|
25
|
+
readonly SDK_NOT_AVAILABLE: 9;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Handle errors and exit with appropriate code
|
|
29
|
+
*
|
|
30
|
+
* @param error - The error to handle
|
|
31
|
+
* @param options - Output options (JSON mode, etc.)
|
|
32
|
+
*/
|
|
33
|
+
export declare function handleError(error: unknown, options?: OutputOptions): never;
|
|
34
|
+
/**
|
|
35
|
+
* Wrap a function with error handling
|
|
36
|
+
*
|
|
37
|
+
* @param fn - The async function to wrap
|
|
38
|
+
* @param options - Output options
|
|
39
|
+
* @returns Wrapped function that handles errors
|
|
40
|
+
*/
|
|
41
|
+
export declare function withErrorHandling<T extends any[], R>(fn: (...args: T) => Promise<R>, options?: OutputOptions): (...args: T) => Promise<R>;
|
|
42
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACd,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAIjD;AAED;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;CAQZ,CAAC;AAEX;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,aAAkB,GAAG,KAAK,CA+E9E;AA+BD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,CAAC,EAClD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAC9B,OAAO,GAAE,aAAkB,GAC1B,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAQ5B"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Error Handling Utilities
|
|
4
|
+
*
|
|
5
|
+
* Provides centralized error handling for the CLI with proper exit codes
|
|
6
|
+
* and formatted error messages for both JSON and text output modes.
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ExitCodes = exports.CLIError = void 0;
|
|
13
|
+
exports.handleError = handleError;
|
|
14
|
+
exports.withErrorHandling = withErrorHandling;
|
|
15
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
16
|
+
const factory_1 = require("../sdk/factory");
|
|
17
|
+
/**
|
|
18
|
+
* Custom CLI error class
|
|
19
|
+
*/
|
|
20
|
+
class CLIError extends Error {
|
|
21
|
+
code;
|
|
22
|
+
constructor(code, message) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.code = code;
|
|
25
|
+
this.name = 'CLIError';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.CLIError = CLIError;
|
|
29
|
+
/**
|
|
30
|
+
* Exit codes for different error types
|
|
31
|
+
*/
|
|
32
|
+
exports.ExitCodes = {
|
|
33
|
+
SUCCESS: 0,
|
|
34
|
+
GENERAL_ERROR: 1,
|
|
35
|
+
INVALID_ARGUMENT: 2,
|
|
36
|
+
NOT_FOUND: 3,
|
|
37
|
+
PERMISSION_DENIED: 4,
|
|
38
|
+
CONFLICT: 5,
|
|
39
|
+
SDK_NOT_AVAILABLE: 9,
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Handle errors and exit with appropriate code
|
|
43
|
+
*
|
|
44
|
+
* @param error - The error to handle
|
|
45
|
+
* @param options - Output options (JSON mode, etc.)
|
|
46
|
+
*/
|
|
47
|
+
function handleError(error, options = {}) {
|
|
48
|
+
if (error instanceof factory_1.SDKNotAvailableError) {
|
|
49
|
+
if (options.json) {
|
|
50
|
+
console.error(JSON.stringify({
|
|
51
|
+
status: 'error',
|
|
52
|
+
error: {
|
|
53
|
+
code: 'SDK_NOT_AVAILABLE',
|
|
54
|
+
message: error.message,
|
|
55
|
+
sdk: error.sdk,
|
|
56
|
+
},
|
|
57
|
+
}, null, 2));
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
console.error(chalk_1.default.red('Error:'), error.message);
|
|
61
|
+
console.error(chalk_1.default.gray('\nMake sure @fractary/core is installed:'), chalk_1.default.cyan('npm install @fractary/core'));
|
|
62
|
+
}
|
|
63
|
+
process.exit(exports.ExitCodes.SDK_NOT_AVAILABLE);
|
|
64
|
+
}
|
|
65
|
+
if (error instanceof CLIError) {
|
|
66
|
+
if (options.json) {
|
|
67
|
+
console.error(JSON.stringify({
|
|
68
|
+
status: 'error',
|
|
69
|
+
error: {
|
|
70
|
+
code: error.code,
|
|
71
|
+
message: error.message,
|
|
72
|
+
},
|
|
73
|
+
}, null, 2));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
console.error(chalk_1.default.red('Error:'), error.message);
|
|
77
|
+
}
|
|
78
|
+
// Map error codes to exit codes
|
|
79
|
+
const exitCode = getExitCodeForError(error.code);
|
|
80
|
+
process.exit(exitCode);
|
|
81
|
+
}
|
|
82
|
+
// Handle generic errors
|
|
83
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
84
|
+
if (options.json) {
|
|
85
|
+
console.error(JSON.stringify({
|
|
86
|
+
status: 'error',
|
|
87
|
+
error: {
|
|
88
|
+
code: 'UNKNOWN_ERROR',
|
|
89
|
+
message: errorMessage,
|
|
90
|
+
},
|
|
91
|
+
}, null, 2));
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
console.error(chalk_1.default.red('Error:'), errorMessage);
|
|
95
|
+
// Include stack trace in non-JSON mode for debugging
|
|
96
|
+
if (error instanceof Error && error.stack) {
|
|
97
|
+
console.error(chalk_1.default.gray('\nStack trace:'));
|
|
98
|
+
console.error(chalk_1.default.gray(error.stack));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
process.exit(exports.ExitCodes.GENERAL_ERROR);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get exit code for a CLI error code
|
|
105
|
+
*/
|
|
106
|
+
function getExitCodeForError(code) {
|
|
107
|
+
switch (code) {
|
|
108
|
+
case 'INVALID_ARGUMENT':
|
|
109
|
+
case 'INVALID_INPUT':
|
|
110
|
+
case 'VALIDATION_ERROR':
|
|
111
|
+
return exports.ExitCodes.INVALID_ARGUMENT;
|
|
112
|
+
case 'NOT_FOUND':
|
|
113
|
+
case 'ISSUE_NOT_FOUND':
|
|
114
|
+
case 'SPEC_NOT_FOUND':
|
|
115
|
+
case 'LOG_NOT_FOUND':
|
|
116
|
+
return exports.ExitCodes.NOT_FOUND;
|
|
117
|
+
case 'PERMISSION_DENIED':
|
|
118
|
+
case 'UNAUTHORIZED':
|
|
119
|
+
return exports.ExitCodes.PERMISSION_DENIED;
|
|
120
|
+
case 'CONFLICT':
|
|
121
|
+
case 'ALREADY_EXISTS':
|
|
122
|
+
return exports.ExitCodes.CONFLICT;
|
|
123
|
+
default:
|
|
124
|
+
return exports.ExitCodes.GENERAL_ERROR;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Wrap a function with error handling
|
|
129
|
+
*
|
|
130
|
+
* @param fn - The async function to wrap
|
|
131
|
+
* @param options - Output options
|
|
132
|
+
* @returns Wrapped function that handles errors
|
|
133
|
+
*/
|
|
134
|
+
function withErrorHandling(fn, options = {}) {
|
|
135
|
+
return async (...args) => {
|
|
136
|
+
try {
|
|
137
|
+
return await fn(...args);
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
handleError(error, options);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAmCH,kCA+EC;AAsCD,8CAWC;AAjKD,kDAA0B;AAC1B,4CAAsD;AAGtD;;GAEG;AACH,MAAa,QAAS,SAAQ,KAAK;IACd;IAAnB,YAAmB,IAAY,EAAE,OAAe;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,SAAI,GAAJ,IAAI,CAAQ;QAE7B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AALD,4BAKC;AAED;;GAEG;AACU,QAAA,SAAS,GAAG;IACvB,OAAO,EAAE,CAAC;IACV,aAAa,EAAE,CAAC;IAChB,gBAAgB,EAAE,CAAC;IACnB,SAAS,EAAE,CAAC;IACZ,iBAAiB,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC;IACX,iBAAiB,EAAE,CAAC;CACZ,CAAC;AAEX;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,KAAc,EAAE,UAAyB,EAAE;IACrE,IAAI,KAAK,YAAY,8BAAoB,EAAE,CAAC;QAC1C,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YAC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O,iBAAS,CAAC,QAAQ,CAAC;QAE5B;YACE,OAAO,iBAAS,CAAC,aAAa,CAAC;IACnC,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAC/B,EAA8B,EAC9B,UAAyB,EAAE;IAE3B,OAAO,KAAK,EAAE,GAAG,IAAO,EAAc,EAAE;QACtC,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QAC3B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output Formatting Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides standardized output formatting for both JSON and text modes.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Output options
|
|
8
|
+
*/
|
|
9
|
+
export interface OutputOptions {
|
|
10
|
+
json?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Output a success message with data
|
|
14
|
+
*
|
|
15
|
+
* @param data - The data to output
|
|
16
|
+
* @param options - Output options
|
|
17
|
+
*/
|
|
18
|
+
export declare function success(data: any, options?: OutputOptions): void;
|
|
19
|
+
/**
|
|
20
|
+
* Output an error message
|
|
21
|
+
*
|
|
22
|
+
* @param message - The error message
|
|
23
|
+
* @param code - The error code
|
|
24
|
+
* @param options - Output options
|
|
25
|
+
*/
|
|
26
|
+
export declare function error(message: string, code: string, options?: OutputOptions): void;
|
|
27
|
+
/**
|
|
28
|
+
* Output a warning message
|
|
29
|
+
*
|
|
30
|
+
* @param message - The warning message
|
|
31
|
+
* @param options - Output options
|
|
32
|
+
*/
|
|
33
|
+
export declare function warning(message: string, options?: OutputOptions): void;
|
|
34
|
+
/**
|
|
35
|
+
* Output an info message
|
|
36
|
+
*
|
|
37
|
+
* @param message - The info message
|
|
38
|
+
* @param options - Output options
|
|
39
|
+
*/
|
|
40
|
+
export declare function info(message: string, options?: OutputOptions): void;
|
|
41
|
+
/**
|
|
42
|
+
* Create a formatted table
|
|
43
|
+
*
|
|
44
|
+
* @param headers - Table headers
|
|
45
|
+
* @param rows - Table rows
|
|
46
|
+
* @returns Formatted table as string
|
|
47
|
+
*/
|
|
48
|
+
export declare function formatTable(headers: string[], rows: string[][]): string;
|
|
49
|
+
/**
|
|
50
|
+
* Format a list of items
|
|
51
|
+
*
|
|
52
|
+
* @param items - The items to format
|
|
53
|
+
* @param bullet - The bullet character (default: •)
|
|
54
|
+
* @returns Formatted list as string
|
|
55
|
+
*/
|
|
56
|
+
export declare function formatList(items: string[], bullet?: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Format a key-value pair
|
|
59
|
+
*
|
|
60
|
+
* @param key - The key
|
|
61
|
+
* @param value - The value
|
|
62
|
+
* @param options - Formatting options
|
|
63
|
+
* @returns Formatted key-value as string
|
|
64
|
+
*/
|
|
65
|
+
export declare function formatKeyValue(key: string, value: string | number | boolean, options?: {
|
|
66
|
+
color?: boolean;
|
|
67
|
+
}): string;
|
|
68
|
+
/**
|
|
69
|
+
* Format a section with title and content
|
|
70
|
+
*
|
|
71
|
+
* @param title - The section title
|
|
72
|
+
* @param content - The section content
|
|
73
|
+
* @returns Formatted section as string
|
|
74
|
+
*/
|
|
75
|
+
export declare function formatSection(title: string, content: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Format a success checkmark
|
|
78
|
+
*
|
|
79
|
+
* @param message - The success message
|
|
80
|
+
* @returns Formatted success message
|
|
81
|
+
*/
|
|
82
|
+
export declare function formatSuccess(message: string): string;
|
|
83
|
+
/**
|
|
84
|
+
* Format an error cross
|
|
85
|
+
*
|
|
86
|
+
* @param message - The error message
|
|
87
|
+
* @returns Formatted error message
|
|
88
|
+
*/
|
|
89
|
+
export declare function formatError(message: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* Format a spinner/loading message
|
|
92
|
+
*
|
|
93
|
+
* @param message - The loading message
|
|
94
|
+
* @returns Formatted loading message
|
|
95
|
+
*/
|
|
96
|
+
export declare function formatLoading(message: string): string;
|
|
97
|
+
/**
|
|
98
|
+
* Truncate a string to a maximum length
|
|
99
|
+
*
|
|
100
|
+
* @param str - The string to truncate
|
|
101
|
+
* @param maxLength - The maximum length
|
|
102
|
+
* @returns Truncated string
|
|
103
|
+
*/
|
|
104
|
+
export declare function truncate(str: string, maxLength: number): string;
|
|
105
|
+
/**
|
|
106
|
+
* Format a timestamp
|
|
107
|
+
*
|
|
108
|
+
* @param date - The date to format
|
|
109
|
+
* @param options - Formatting options
|
|
110
|
+
* @returns Formatted timestamp
|
|
111
|
+
*/
|
|
112
|
+
export declare function formatTimestamp(date: Date | string, options?: {
|
|
113
|
+
relative?: boolean;
|
|
114
|
+
}): string;
|
|
115
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,GAAE,aAAkB,GAAG,IAAI,CAQpE;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,IAAI,CAMtF;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,IAAI,CAM1E;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,IAAI,CAMvE;AAED;;;;;;GAMG;AACH,wBAA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