fraim 2.0.116 → 2.0.117
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.
|
@@ -60,6 +60,19 @@ function parseModeOption(mode) {
|
|
|
60
60
|
process.exit(1);
|
|
61
61
|
}
|
|
62
62
|
const promptForFraimKey = async () => {
|
|
63
|
+
// In non-interactive environments (tests, installers), we cannot prompt.
|
|
64
|
+
// Respect FRAIM_NON_INTERACTIVE and require the key to be provided via
|
|
65
|
+
// CLI flag or environment variable.
|
|
66
|
+
if (process.env.FRAIM_NON_INTERACTIVE) {
|
|
67
|
+
const envKey = process.env.FRAIM_API_KEY || process.env.FRAIM_SETUP_KEY || process.env.FRAIM_INSTALL_KEY;
|
|
68
|
+
if (envKey) {
|
|
69
|
+
console.log(chalk_1.default.yellow('\nℹ️ Non-interactive mode: using FRAIM key from environment.'));
|
|
70
|
+
return envKey;
|
|
71
|
+
}
|
|
72
|
+
console.log(chalk_1.default.red('\n❌ Non-interactive mode: FRAIM key is required but cannot prompt.'));
|
|
73
|
+
console.log(chalk_1.default.yellow(' Provide a key via `--key=<key>` or set FRAIM_API_KEY.'));
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
63
76
|
console.log(chalk_1.default.blue('🔑 FRAIM Key Setup'));
|
|
64
77
|
console.log('FRAIM requires a valid API key to access workflows and features.\n');
|
|
65
78
|
let key = null;
|
|
@@ -102,6 +115,20 @@ const promptForFraimKey = async () => {
|
|
|
102
115
|
process.exit(1);
|
|
103
116
|
};
|
|
104
117
|
const promptForMode = async () => {
|
|
118
|
+
// Non-interactive environments (e.g. curl | sh installers, automated tests)
|
|
119
|
+
// cannot support interactive mode selection. When FRAIM_NON_INTERACTIVE is
|
|
120
|
+
// set, use FRAIM_SETUP_MODE/FRAIM_MODE if provided, otherwise default to
|
|
121
|
+
// conversational mode so no provider credentials are required.
|
|
122
|
+
if (process.env.FRAIM_NON_INTERACTIVE) {
|
|
123
|
+
const envMode = process.env.FRAIM_SETUP_MODE || process.env.FRAIM_MODE;
|
|
124
|
+
if (envMode) {
|
|
125
|
+
const parsed = parseModeOption(envMode);
|
|
126
|
+
console.log(chalk_1.default.yellow(`\nℹ️ Non-interactive mode: using mode "${parsed}" from environment.`));
|
|
127
|
+
return parsed;
|
|
128
|
+
}
|
|
129
|
+
console.log(chalk_1.default.yellow('\nℹ️ Non-interactive mode: defaulting to Conversational mode'));
|
|
130
|
+
return 'conversational';
|
|
131
|
+
}
|
|
105
132
|
console.log(chalk_1.default.blue('\n🎯 Usage Mode Selection'));
|
|
106
133
|
console.log(chalk_1.default.gray('Choose how you want to use FRAIM:\n'));
|
|
107
134
|
const response = await (0, prompts_1.default)({
|