MCPcopy Create free account
hub / github.com/neomjs/neo / syncGithubWorkflow

Function syncGithubWorkflow

ai/scripts/maintenance/syncGithubWorkflow.mjs:70–107  ·  view source on GitHub ↗

* @summary CLI entry point for the full GitHub Workflow mirror sync. * @returns {Promise }

()

Source from the content-addressed store, hash-verified

68 * @returns {Promise<void>}
69 */
70async function syncGithubWorkflow() {
71 const verbose = process.argv.includes('--verbose');
72 GH_Config.data.logLevel = verbose ? 'debug' : 'info';
73
74 try {
75 await assertSyncGithubWorkflowDevBranch();
76 } catch (error) {
77 console.error(error.message);
78 process.exit(1);
79 }
80
81 console.log('🔄 Starting full GitHub Workflow sync via GH_SyncService.runFullSync()...');
82
83 // Run the full workflow sync under the shared heavy-maintenance lease so this CLI
84 // cannot collide with orchestrator maintenance tasks or another manual graph-heavy
85 // script. The whole-run guard keeps graph ingestion protected until the sync stages
86 // have a narrower concurrency boundary.
87 let outcome;
88 try {
89 outcome = await withHeavyMaintenanceLease(
90 async () => GH_SyncService.runFullSync(),
91 {owner: 'syncGithubWorkflow', reason: 'manual-cli', metadata: {script: 'ai/scripts/maintenance/syncGithubWorkflow.mjs', verbose}}
92 );
93 } catch (e) {
94 console.error('❌ Sync failed:', e);
95 process.exit(1);
96 }
97
98 if (outcome.status === 'held') {
99 const held = outcome.lease;
100 console.log(`⏸️ Deferred: heavy-maintenance lease held by '${held.owner}' (reason='${held.reason}', pid=${held.pid}, acquiredAt=${held.acquiredAt}).`);
101 console.log(' This script will not run while another heavy-maintenance task is active. Re-invoke once the active owner completes.');
102 process.exit(0);
103 }
104
105 console.log('✅ Sync complete:', outcome.result);
106 process.exit(0);
107}
108
109if (import.meta.url === pathToFileURL(process.argv[1] || '').href) {
110 syncGithubWorkflow();

Callers 1

Calls 6

includesMethod · 0.80
errorMethod · 0.80
runFullSyncMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected