opencontext 1.0.0 → 1.0.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.
- package/dist/cli/index.js +34 -18
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -49,24 +49,24 @@ 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.
|
|
52
|
+
const VERSION = '1.0.1';
|
|
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
|
|
56
56
|
const LOGO = `
|
|
57
57
|
${chalk_1.default.cyan.bold(`
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
╔═══════════════════════════════════════════════════════════════════════╗
|
|
59
|
+
║ ║
|
|
60
|
+
║ ██████╗ ██████╗ ███████╗███╗ ██╗ ██████╗ ██████╗ ███╗ ██╗████████╗
|
|
61
|
+
║ ██╔═══██╗██╔══██╗██╔════╝████╗ ██║██╔════╝██╔═══██╗████╗ ██║╚══██╔══╝
|
|
62
|
+
║ ██║ ██║██████╔╝█████╗ ██╔██╗ ██║██║ ██║ ██║██╔██╗ ██║ ██║
|
|
63
|
+
║ ██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║██║ ██║ ██║██║╚██╗██║ ██║
|
|
64
|
+
║ ╚██████╔╝██║ ███████╗██║ ╚████║╚██████╗╚██████╔╝██║ ╚████║ ██║
|
|
65
|
+
║ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝
|
|
66
|
+
║ ║
|
|
67
|
+
║`)}${chalk_1.default.white(' ✨ AI-Powered Company Analysis ✨')}${chalk_1.default.cyan.bold(` ║
|
|
68
|
+
║ ║
|
|
69
|
+
╚═══════════════════════════════════════════════════════════════════════╝
|
|
70
70
|
`)}
|
|
71
71
|
`;
|
|
72
72
|
// Config management
|
|
@@ -120,11 +120,27 @@ async function analyzeUrl(url, config) {
|
|
|
120
120
|
if (config.geminiKey) {
|
|
121
121
|
body.apiKey = config.geminiKey;
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
let response;
|
|
124
|
+
try {
|
|
125
|
+
response = await fetch(endpoint, {
|
|
126
|
+
method: 'POST',
|
|
127
|
+
headers,
|
|
128
|
+
body: JSON.stringify(body)
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
// Network error - server not reachable
|
|
133
|
+
if (config.apiUrl.includes('localhost')) {
|
|
134
|
+
throw new Error(`Cannot connect to ${config.apiUrl}\n\n` +
|
|
135
|
+
` The API server is not running. To fix:\n\n` +
|
|
136
|
+
` Option 1: Start the server locally\n` +
|
|
137
|
+
` cd opencontext && npm run dev\n\n` +
|
|
138
|
+
` Option 2: Use a deployed API\n` +
|
|
139
|
+
` opencontext config\n` +
|
|
140
|
+
` (then set the API URL to your deployed instance)`);
|
|
141
|
+
}
|
|
142
|
+
throw new Error(`Cannot connect to ${config.apiUrl} - check your internet connection or API URL`);
|
|
143
|
+
}
|
|
128
144
|
if (!response.ok) {
|
|
129
145
|
const error = await response.json().catch(() => ({ error: 'Unknown error' }));
|
|
130
146
|
throw new Error(error.error || error.message || `HTTP ${response.status}`);
|
package/package.json
CHANGED