decharge-scout 1.1.0 → 1.2.1

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.
Files changed (2) hide show
  1. package/index.js +24 -8
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -174,16 +174,32 @@ async function main(options) {
174
174
  const detectedLocation = await getLocation();
175
175
  locationSpinner.succeed(chalk.green(`šŸ“ Detected Location: ${detectedLocation}`));
176
176
 
177
- // Ask user to confirm or override
177
+ // Ask user to confirm or override (with timeout)
178
178
  console.log(chalk.blue('\nYou can use this location or enter a custom one.'));
179
- const customLocation = await question('Enter custom location (or press Enter to use detected): ');
179
+ console.log(chalk.gray('(Press Enter to use detected location, or type custom location)'));
180
180
 
181
- location = customLocation.trim() || detectedLocation;
182
-
183
- if (customLocation.trim()) {
184
- console.log(chalk.green(`āœ“ Using custom location: ${location}`));
185
- } else {
186
- console.log(chalk.green(`āœ“ Using detected location: ${location}`));
181
+ try {
182
+ // Create a promise that auto-resolves after 10 seconds
183
+ const timeoutPromise = new Promise((resolve) => {
184
+ setTimeout(() => {
185
+ console.log(chalk.yellow('\nā±ļø No input received, using detected location...'));
186
+ resolve('');
187
+ }, 10000);
188
+ });
189
+
190
+ const questionPromise = question('Enter custom location (or press Enter): ');
191
+
192
+ const customLocation = await Promise.race([questionPromise, timeoutPromise]);
193
+ location = customLocation.trim() || detectedLocation;
194
+
195
+ if (customLocation.trim()) {
196
+ console.log(chalk.green(`āœ“ Using custom location: ${location}`));
197
+ } else {
198
+ console.log(chalk.green(`āœ“ Using detected location: ${location}`));
199
+ }
200
+ } catch (error) {
201
+ console.log(chalk.yellow(`\nāš ļø Prompt error, using detected location: ${detectedLocation}`));
202
+ location = detectedLocation;
187
203
  }
188
204
  } else {
189
205
  console.log(chalk.green(`šŸ“ Location: ${location}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "decharge-scout",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "AI-powered energy grid data scout with Solana integration",
5
5
  "main": "index.js",
6
6
  "type": "module",