fraim-framework 2.0.45 → 2.0.46
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.
|
@@ -8,6 +8,7 @@ const commander_1 = require("commander");
|
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const child_process_1 = require("child_process");
|
|
11
12
|
const digest_utils_1 = require("../../utils/digest-utils");
|
|
12
13
|
const config_loader_1 = require("../../fraim/config-loader");
|
|
13
14
|
const version_utils_1 = require("../../utils/version-utils");
|
|
@@ -19,6 +20,8 @@ const runSync = async (options) => {
|
|
|
19
20
|
const workflowsRelativePath = config.customizations?.workflowsPath || '.fraim/workflows';
|
|
20
21
|
const workflowsDir = path_1.default.resolve(projectRoot, workflowsRelativePath);
|
|
21
22
|
const digestPath = path_1.default.join(fraimDir, '.digest');
|
|
23
|
+
// Check for CLI updates first
|
|
24
|
+
await checkAndUpdateCLI();
|
|
22
25
|
// In npm package, stubs are in node_modules/@fraim/framework/registry/stubs/workflows
|
|
23
26
|
// We need to handle both "running from source" (src/cli/commands) and "running from dist" (dist/src/cli/commands)
|
|
24
27
|
// Try 4 levels up (dist/src/cli/commands -> root)
|
|
@@ -163,6 +166,84 @@ const runSync = async (options) => {
|
|
|
163
166
|
}
|
|
164
167
|
};
|
|
165
168
|
exports.runSync = runSync;
|
|
169
|
+
async function checkAndUpdateCLI() {
|
|
170
|
+
try {
|
|
171
|
+
console.log(chalk_1.default.blue('🔍 Checking for FRAIM CLI updates...'));
|
|
172
|
+
const currentVersion = (0, version_utils_1.getFraimVersion)();
|
|
173
|
+
const latestVersion = await getLatestNpmVersion('fraim-framework');
|
|
174
|
+
if (!latestVersion) {
|
|
175
|
+
console.log(chalk_1.default.yellow('⚠️ Could not check for updates. Continuing with current version.'));
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (currentVersion === latestVersion) {
|
|
179
|
+
console.log(chalk_1.default.green(`✅ FRAIM CLI is up to date (${currentVersion})`));
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
console.log(chalk_1.default.yellow(`📦 New version available: ${currentVersion} → ${latestVersion}`));
|
|
183
|
+
console.log(chalk_1.default.blue('🔄 Auto-updating FRAIM CLI...'));
|
|
184
|
+
const success = await updateGlobalPackage('fraim-framework', latestVersion);
|
|
185
|
+
if (success) {
|
|
186
|
+
console.log(chalk_1.default.green(`✅ Successfully updated to FRAIM ${latestVersion}`));
|
|
187
|
+
console.log(chalk_1.default.gray(' Restart may be required for some changes to take effect.'));
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
console.log(chalk_1.default.yellow('⚠️ Auto-update failed. Please run: npm install -g fraim-framework@latest'));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
console.log(chalk_1.default.yellow('⚠️ Could not check for updates. Continuing with current version.'));
|
|
195
|
+
}
|
|
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 {
|
|
213
|
+
resolve(null);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
npmProcess.on('error', () => {
|
|
217
|
+
resolve(null);
|
|
218
|
+
});
|
|
219
|
+
// Timeout after 5 seconds
|
|
220
|
+
setTimeout(() => {
|
|
221
|
+
npmProcess.kill();
|
|
222
|
+
resolve(null);
|
|
223
|
+
}, 5000);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
async function updateGlobalPackage(packageName, version) {
|
|
227
|
+
return new Promise((resolve) => {
|
|
228
|
+
console.log(chalk_1.default.gray(` Running: npm install -g ${packageName}@${version}`));
|
|
229
|
+
// Use npm.cmd on Windows, npm on Unix
|
|
230
|
+
const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
231
|
+
const npmProcess = (0, child_process_1.spawn)(npmCommand, ['install', '-g', `${packageName}@${version}`], {
|
|
232
|
+
stdio: ['ignore', 'pipe', 'pipe']
|
|
233
|
+
});
|
|
234
|
+
npmProcess.on('close', (code) => {
|
|
235
|
+
resolve(code === 0);
|
|
236
|
+
});
|
|
237
|
+
npmProcess.on('error', () => {
|
|
238
|
+
resolve(false);
|
|
239
|
+
});
|
|
240
|
+
// Timeout after 30 seconds
|
|
241
|
+
setTimeout(() => {
|
|
242
|
+
npmProcess.kill();
|
|
243
|
+
resolve(false);
|
|
244
|
+
}, 30000);
|
|
245
|
+
});
|
|
246
|
+
}
|
|
166
247
|
exports.syncCommand = new commander_1.Command('sync')
|
|
167
248
|
.description('Sync workflow stubs from the framework registry')
|
|
168
249
|
.option('-f, --force', 'Force sync even if digest matches')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fraim-framework",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.46",
|
|
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": {
|
|
@@ -86,7 +86,6 @@
|
|
|
86
86
|
"cors": "^2.8.5",
|
|
87
87
|
"dotenv": "^16.4.7",
|
|
88
88
|
"express": "^5.2.1",
|
|
89
|
-
"fraim-framework": "^2.0.38",
|
|
90
89
|
"markdown-it": "^14.1.0",
|
|
91
90
|
"markdown-it-highlightjs": "^4.2.0",
|
|
92
91
|
"mongodb": "^7.0.0",
|