vipcare 0.6.1 → 0.6.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/bin/vip.js +20 -7
  2. package/package.json +1 -1
package/bin/vip.js CHANGED
@@ -64,14 +64,16 @@ function gatherData(person) {
64
64
 
65
65
  if (person.linkedinUrl) sources.push(person.linkedinUrl);
66
66
 
67
+ // Collect all search results into one consolidated file
68
+ const searchEntries = [];
69
+
67
70
  if (person.rawSnippets.length) {
68
71
  rawParts.push('=== Web Search Results ===');
69
- rawParts.push(...person.rawSnippets);
70
- // Save each snippet as a raw source file
71
72
  person.rawSnippets.forEach((snippet, i) => {
72
- const url = person.otherUrls?.[i] || `search_result_${i}`;
73
- const safeName = url.replace(/https?:\/\//, '').replace(/[^\w.-]/g, '_').substring(0, 60);
74
- saveRawSource(personSlug, safeName, `# Search Result\n\nSource: ${url}\nFetched: ${new Date().toISOString()}\n\n${snippet}`);
73
+ if (!snippet.trim()) return; // skip empty
74
+ rawParts.push(snippet);
75
+ const url = person.otherUrls?.[i] || '';
76
+ if (url) searchEntries.push({ url, snippet });
75
77
  });
76
78
  }
77
79
 
@@ -79,13 +81,24 @@ function gatherData(person) {
79
81
  console.log(c.dim(` Searching the web for ${person.name}...`));
80
82
  const results = searchPerson(person.name);
81
83
  for (const r of results) {
84
+ if (!r.body?.trim() && !r.title?.trim()) continue; // skip empty
82
85
  rawParts.push(`${r.title}\n${r.body}`);
83
86
  if (!sources.includes(r.url)) sources.push(r.url);
84
- const safeName = r.url.replace(/https?:\/\//, '').replace(/[^\w.-]/g, '_').substring(0, 60);
85
- saveRawSource(personSlug, safeName, `# ${r.title}\n\nSource: ${r.url}\nFetched: ${new Date().toISOString()}\n\n${r.body}`);
87
+ searchEntries.push({ url: r.url, snippet: `${r.title}\n${r.body}` });
86
88
  }
87
89
  }
88
90
 
91
+ // Save all search results in ONE file
92
+ if (searchEntries.length) {
93
+ const timestamp = new Date().toISOString();
94
+ const content = `# Web Search Results\n\nFetched: ${timestamp}\nQuery: ${person.name}\n\n` +
95
+ searchEntries
96
+ .filter(e => e.snippet.trim())
97
+ .map(e => `---\n\n**Source:** ${e.url}\n\n${e.snippet}`)
98
+ .join('\n\n');
99
+ saveRawSource(personSlug, 'web_search', content);
100
+ }
101
+
89
102
  console.log(c.dim(` Raw data saved to ${path.join(getProfilesDir(), '.raw', personSlug)}/`));
90
103
  return [rawParts.join('\n\n'), sources];
91
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vipcare",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Auto-build VIP person profiles from Twitter/LinkedIn public data",
5
5
  "type": "module",
6
6
  "bin": {