opencontext 1.0.1 → 1.0.2

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/dist/cli/index.js +27 -40
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -49,7 +49,7 @@ const boxen_1 = __importDefault(require("boxen"));
49
49
  const fs = __importStar(require("fs"));
50
50
  const path = __importStar(require("path"));
51
51
  const os = __importStar(require("os"));
52
- const VERSION = '1.0.1';
52
+ const VERSION = '1.0.2';
53
53
  const CONFIG_DIR = path.join(os.homedir(), '.opencontext');
54
54
  const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
55
55
  // ASCII Logo
@@ -230,6 +230,17 @@ function formatAnalysisResult(result) {
230
230
  sections.push(chalk_1.default.cyan('═══════════════════════════════════════════════════════════════\n'));
231
231
  return sections.join('\n');
232
232
  }
233
+ // Get Downloads folder path
234
+ function getDownloadsPath() {
235
+ return path.join(os.homedir(), 'Downloads');
236
+ }
237
+ // Generate filename from company name
238
+ function generateFilename(companyName) {
239
+ return companyName
240
+ .toLowerCase()
241
+ .replace(/[^a-z0-9]+/g, '-')
242
+ .replace(/^-|-$/g, '') + '-context.json';
243
+ }
233
244
  // Commands
234
245
  async function analyzeCommand(url, options) {
235
246
  const config = loadConfig();
@@ -250,16 +261,18 @@ async function analyzeCommand(url, options) {
250
261
  else {
251
262
  console.log(formatAnalysisResult(result));
252
263
  }
253
- // Save to file if requested
254
- if (options.output) {
255
- const outputPath = options.output;
256
- const dir = path.dirname(outputPath);
257
- if (!fs.existsSync(dir)) {
258
- fs.mkdirSync(dir, { recursive: true });
259
- }
260
- fs.writeFileSync(outputPath, JSON.stringify(result, null, 2));
261
- printSuccess(`Saved to ${outputPath}`);
264
+ // Always save to Downloads (or custom path if specified)
265
+ const downloadsDir = getDownloadsPath();
266
+ const filename = generateFilename(result.company_name);
267
+ const outputPath = options.output || path.join(downloadsDir, filename);
268
+ const dir = path.dirname(outputPath);
269
+ if (!fs.existsSync(dir)) {
270
+ fs.mkdirSync(dir, { recursive: true });
262
271
  }
272
+ fs.writeFileSync(outputPath, JSON.stringify(result, null, 2));
273
+ console.log();
274
+ console.log((0, boxen_1.default)(chalk_1.default.green.bold('Saved!') + '\n\n' +
275
+ chalk_1.default.dim('File: ') + chalk_1.default.white(outputPath), { padding: 1, borderColor: 'green', borderStyle: 'round' }));
263
276
  }
264
277
  catch (error) {
265
278
  spinner.fail('Analysis failed');
@@ -304,7 +317,7 @@ async function batchCommand(inputFile, options) {
304
317
  console.log((0, boxen_1.default)(chalk_1.default.white.bold(`Batch Analysis\n\n`) +
305
318
  chalk_1.default.dim(`Found ${chalk_1.default.cyan(urls.length.toString())} URLs to analyze`), { padding: 1, borderColor: 'cyan', borderStyle: 'round' }));
306
319
  console.log();
307
- const outputDir = options.outputDir || config.outputDir || './context-reports';
320
+ const outputDir = options.outputDir || path.join(getDownloadsPath(), 'opencontext-reports');
308
321
  if (!fs.existsSync(outputDir)) {
309
322
  fs.mkdirSync(outputDir, { recursive: true });
310
323
  }
@@ -430,28 +443,8 @@ async function interactiveMode() {
430
443
  validate: (input) => input.trim().length > 0 || 'URL is required'
431
444
  }
432
445
  ]);
433
- const { saveToFile } = await inquirer_1.default.prompt([
434
- {
435
- type: 'confirm',
436
- name: 'saveToFile',
437
- message: 'Save result to file?',
438
- default: true
439
- }
440
- ]);
441
- let outputPath;
442
- if (saveToFile) {
443
- const { path: outPath } = await inquirer_1.default.prompt([
444
- {
445
- type: 'input',
446
- name: 'path',
447
- message: 'Output file path:',
448
- default: './context-report.json'
449
- }
450
- ]);
451
- outputPath = outPath;
452
- }
453
446
  console.log();
454
- await analyzeCommand(url.trim(), { output: outputPath });
447
+ await analyzeCommand(url.trim(), {});
455
448
  break;
456
449
  }
457
450
  case 'batch': {
@@ -462,22 +455,16 @@ async function interactiveMode() {
462
455
  console.log(chalk_1.default.dim(' Supported formats: .json, .csv, .txt (one URL per line)'));
463
456
  break;
464
457
  }
465
- const { inputFile, outputDir } = await inquirer_1.default.prompt([
458
+ const { inputFile } = await inquirer_1.default.prompt([
466
459
  {
467
460
  type: 'list',
468
461
  name: 'inputFile',
469
462
  message: 'Select input file:',
470
463
  choices: files
471
- },
472
- {
473
- type: 'input',
474
- name: 'outputDir',
475
- message: 'Output directory:',
476
- default: config.outputDir || './context-reports'
477
464
  }
478
465
  ]);
479
466
  console.log();
480
- await batchCommand(inputFile, { outputDir });
467
+ await batchCommand(inputFile, {});
481
468
  break;
482
469
  }
483
470
  case 'config':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencontext",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "AI-powered company context analysis from your terminal. Extract comprehensive company profiles with a single command.",
5
5
  "main": "dist/cli/index.js",
6
6
  "bin": {