fraim-framework 2.0.46 → 2.0.47

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.
@@ -170,18 +170,18 @@ async function checkAndUpdateCLI() {
170
170
  try {
171
171
  console.log(chalk_1.default.blue('🔍 Checking for FRAIM CLI updates...'));
172
172
  const currentVersion = (0, version_utils_1.getFraimVersion)();
173
- const latestVersion = await getLatestNpmVersion('fraim-framework');
173
+ const latestVersion = await getLatestNpmVersionHttp('fraim-framework');
174
174
  if (!latestVersion) {
175
175
  console.log(chalk_1.default.yellow('⚠️ Could not check for updates. Continuing with current version.'));
176
176
  return;
177
177
  }
178
- if (currentVersion === latestVersion) {
178
+ if (isVersionUpToDate(currentVersion, latestVersion)) {
179
179
  console.log(chalk_1.default.green(`✅ FRAIM CLI is up to date (${currentVersion})`));
180
180
  return;
181
181
  }
182
182
  console.log(chalk_1.default.yellow(`📦 New version available: ${currentVersion} → ${latestVersion}`));
183
183
  console.log(chalk_1.default.blue('🔄 Auto-updating FRAIM CLI...'));
184
- const success = await updateGlobalPackage('fraim-framework', latestVersion);
184
+ const success = await updateGlobalPackageHttp('fraim-framework', latestVersion);
185
185
  if (success) {
186
186
  console.log(chalk_1.default.green(`✅ Successfully updated to FRAIM ${latestVersion}`));
187
187
  console.log(chalk_1.default.gray(' Restart may be required for some changes to take effect.'));
@@ -194,42 +194,65 @@ async function checkAndUpdateCLI() {
194
194
  console.log(chalk_1.default.yellow('⚠️ Could not check for updates. Continuing with current version.'));
195
195
  }
196
196
  }
197
- async function getLatestNpmVersion(packageName) {
198
- return new Promise((resolve) => {
199
- // Use npm.cmd on Windows, npm on Unix
200
- const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
201
- const npmProcess = (0, child_process_1.spawn)(npmCommand, ['view', packageName, 'version'], {
202
- stdio: ['ignore', 'pipe', 'ignore']
203
- });
204
- let output = '';
205
- npmProcess.stdout.on('data', (data) => {
206
- output += data.toString();
207
- });
208
- npmProcess.on('close', (code) => {
209
- if (code === 0) {
210
- resolve(output.trim());
211
- }
212
- else {
197
+ async function getLatestNpmVersionHttp(packageName) {
198
+ try {
199
+ // Use Node.js built-in https module instead of spawn
200
+ const https = require('https');
201
+ return new Promise((resolve) => {
202
+ const req = https.get(`https://registry.npmjs.org/${packageName}/latest`, {
203
+ timeout: 5000,
204
+ headers: {
205
+ 'User-Agent': 'fraim-framework-cli'
206
+ }
207
+ }, (res) => {
208
+ let data = '';
209
+ res.on('data', (chunk) => {
210
+ data += chunk;
211
+ });
212
+ res.on('end', () => {
213
+ try {
214
+ const packageInfo = JSON.parse(data);
215
+ resolve(packageInfo.version || null);
216
+ }
217
+ catch (e) {
218
+ resolve(null);
219
+ }
220
+ });
221
+ });
222
+ req.on('error', () => {
213
223
  resolve(null);
214
- }
215
- });
216
- npmProcess.on('error', () => {
217
- resolve(null);
224
+ });
225
+ req.on('timeout', () => {
226
+ req.destroy();
227
+ resolve(null);
228
+ });
218
229
  });
219
- // Timeout after 5 seconds
220
- setTimeout(() => {
221
- npmProcess.kill();
222
- resolve(null);
223
- }, 5000);
224
- });
230
+ }
231
+ catch (error) {
232
+ return null;
233
+ }
234
+ }
235
+ function isVersionUpToDate(current, latest) {
236
+ // Simple version comparison - assumes semantic versioning
237
+ const currentParts = current.split('.').map(n => parseInt(n, 10));
238
+ const latestParts = latest.split('.').map(n => parseInt(n, 10));
239
+ for (let i = 0; i < Math.max(currentParts.length, latestParts.length); i++) {
240
+ const currentPart = currentParts[i] || 0;
241
+ const latestPart = latestParts[i] || 0;
242
+ if (currentPart < latestPart)
243
+ return false;
244
+ if (currentPart > latestPart)
245
+ return true;
246
+ }
247
+ return true; // Versions are equal
225
248
  }
226
- async function updateGlobalPackage(packageName, version) {
249
+ async function updateGlobalPackageHttp(packageName, version) {
227
250
  return new Promise((resolve) => {
228
251
  console.log(chalk_1.default.gray(` Running: npm install -g ${packageName}@${version}`));
229
252
  // Use npm.cmd on Windows, npm on Unix
230
253
  const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
231
254
  const npmProcess = (0, child_process_1.spawn)(npmCommand, ['install', '-g', `${packageName}@${version}`], {
232
- stdio: ['ignore', 'pipe', 'pipe']
255
+ stdio: ['ignore', 'ignore', 'ignore'] // Suppress output for cleaner experience
233
256
  });
234
257
  npmProcess.on('close', (code) => {
235
258
  resolve(code === 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fraim-framework",
3
- "version": "2.0.46",
3
+ "version": "2.0.47",
4
4
  "description": "FRAIM v2: Framework for Rigor-based AI Management - Transform from solo developer to AI manager orchestrating production-ready code with enterprise-grade discipline",
5
5
  "main": "index.js",
6
6
  "bin": {