Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

Checkpoint: File edits

rUv984407cddc64
diff --git a/v3/@claude-flow/cli/src/update/index.ts b/v3/@claude-flow/cli/src/update/index.ts
new file mode 100644
index 0000000000..573ce7579b
--- /dev/null
+++ b/v3/@claude-flow/cli/src/update/index.ts
@@ -0,0 +1,114 @@
+/**
+ * Auto-update system for @claude-flow packages
+ *
+ * Features:
+ * - Rate-limited update checks (24h default)
+ * - Automatic patch updates for security packages
+ * - Compatibility validation before updates
+ * - Rollback capability
+ * - Update history logging
+ */
+
+export {
+ checkForUpdates,
+ checkSinglePackage,
+ getInstalledVersion,
+ UpdateCheckResult,
+ UpdateConfig,
+ DEFAULT_CONFIG,
+} from './checker.js';
+
+export {
+ shouldCheckForUpdates,
+ recordCheck,
+ getCachedVersions,
+ clearCache,
+ loadState,
+ RateLimitState,
+} from './rate-limiter.js';
+
+export {
+ validateUpdate,
+ validateBulkUpdate,
+ ValidationResult,
+} from './validator.js';
+
+export {
+ executeUpdate,
+ executeMultipleUpdates,
+ rollbackUpdate,
+ getUpdateHistory,
+ clearHistory,
+ loadHistory,
+ UpdateHistoryEntry,
+ UpdateExecutionResult,
+} from './executor.js';
+
+// Re-export a convenience function for startup
+import { checkForUpdates, UpdateCheckResult, DEFAULT_CONFIG } from './checker.js';
+import { executeMultipleUpdates } from './executor.js';
+import { getInstalledVersion } from './checker.js';
+
+/**
+ * Run auto-update check on startup
+ * This is the main entry point for the auto-update system
+ */
+export async function runStartupUpdateCheck(options: {
+ verbose?: boolean;
+ autoUpdate?: boolean;
+}): Promise<{
+ checked: boolean;
+ updatesAvailable: UpdateCheckResult[];
+ updatesApplied: string[];
+ skippedReason?: string;
+}> {
+ const result = {
+ checked: false,
+ updatesAvailable: [] as UpdateCheckResult[],
+ updatesApplied: [] as string[],
+ skippedReason: undefined as string | undefined,
+ };
+
+ try {
+ const { results, skipped, reason } = await checkForUpdates(DEFAULT_CONFIG);
+
+ if (skipped) {
+ result.skippedReason = reason;
+ return result;
+ }
+
+ result.checked = true;
+ result.updatesAvailable = results;
+
+ // Auto-update if enabled
+ if (options.autoUpdate !== false) {
+ const autoUpdateable = results.filter((r) => r.shouldAutoUpdate);
+
+ if (autoUpdateable.length > 0) {
+ // Get current installed packages
+ const installedPackages: Record<string, string> = {};
+ for (const update of autoUpdateable) {
+ const version = getInstalledVersion(update.package);
+ if (version) {
+ installedPackages[update.package] = version;
+ }
+ }
+
+ // Execute updates
+ const updateResults = await executeMultipleUpdates(
+ autoUpdateable,
+ installedPackages
+ );
+
+ result.updatesApplied = updateResults
+ .filter((r) => r.success)
+ .map((r) => `${r.package}@${r.version}`);
+ }
+ }
+
+ return result;
+ } catch {
+ // Silently fail on startup - don't block CLI usage
+ return result;
+ }
+}