orquesta-cli 0.2.96 → 0.2.97
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/cli.js
CHANGED
|
@@ -377,6 +377,14 @@ program
|
|
|
377
377
|
await Promise.all([toolsPromise, syncPromise]);
|
|
378
378
|
spinner.stop();
|
|
379
379
|
process.stdout.write('\x1B[2J\x1B[0f');
|
|
380
|
+
if (!process.stdin.isTTY) {
|
|
381
|
+
spinner.stop();
|
|
382
|
+
console.log(chalk.yellow('No interactive terminal available (stdin is not a TTY).'));
|
|
383
|
+
console.log(chalk.dim('For non-interactive use run: orquesta -p "your prompt" (reads the prompt from stdin when value is omitted).'));
|
|
384
|
+
if (cleanup)
|
|
385
|
+
await cleanup();
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
380
388
|
if (options.verbose || options.debug) {
|
|
381
389
|
console.log(chalk.cyan('Starting Orquesta CLI...\n'));
|
|
382
390
|
}
|
|
@@ -2,7 +2,7 @@ export declare function directoryExists(dirPath: string): Promise<boolean>;
|
|
|
2
2
|
export declare function fileExists(filePath: string): Promise<boolean>;
|
|
3
3
|
export declare function ensureDirectory(dirPath: string): Promise<void>;
|
|
4
4
|
export declare function readJsonFile<T>(filePath: string): Promise<T | null>;
|
|
5
|
-
export declare function writeJsonFile<T>(filePath: string, data: T): Promise<void>;
|
|
5
|
+
export declare function writeJsonFile<T>(filePath: string, data: T, mode?: number): Promise<void>;
|
|
6
6
|
export declare function readTextFile(filePath: string): Promise<string>;
|
|
7
7
|
export declare function writeTextFile(filePath: string, content: string): Promise<void>;
|
|
8
8
|
export declare function getFileSize(filePath: string): Promise<number>;
|
|
@@ -49,14 +49,20 @@ export async function readJsonFile(filePath) {
|
|
|
49
49
|
throw error;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
export async function writeJsonFile(filePath, data) {
|
|
52
|
+
export async function writeJsonFile(filePath, data, mode) {
|
|
53
53
|
try {
|
|
54
54
|
const dirPath = path.dirname(filePath);
|
|
55
55
|
await ensureDirectory(dirPath);
|
|
56
56
|
const content = JSON.stringify(data, null, 2);
|
|
57
57
|
const tmpPath = `${filePath}.tmp.${process.pid}.${tmpCounter++}`;
|
|
58
58
|
try {
|
|
59
|
-
await writeFile(tmpPath, content, 'utf-8');
|
|
59
|
+
await writeFile(tmpPath, content, mode !== undefined ? { encoding: 'utf-8', mode } : 'utf-8');
|
|
60
|
+
if (mode !== undefined) {
|
|
61
|
+
try {
|
|
62
|
+
await new Promise((res, rej) => fs.chmod(tmpPath, mode, e => e ? rej(e) : res()));
|
|
63
|
+
}
|
|
64
|
+
catch { }
|
|
65
|
+
}
|
|
60
66
|
await rename(tmpPath, filePath);
|
|
61
67
|
}
|
|
62
68
|
catch (err) {
|