@geminilight/mindos 0.6.14 → 0.6.15
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/bin/cli.js +37 -14
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -771,16 +771,19 @@ ${dim('Shortcut: mindos start --daemon → install + start in one step')}
|
|
|
771
771
|
|
|
772
772
|
// Stage 3: Rebuild
|
|
773
773
|
writeUpdateStatus('rebuilding', vOpts);
|
|
774
|
-
|
|
774
|
+
let daemonBuildFailed = '';
|
|
775
|
+
try {
|
|
776
|
+
buildIfNeeded(updatedRoot);
|
|
777
|
+
} catch (err) {
|
|
778
|
+
daemonBuildFailed = err instanceof Error ? err.message : String(err);
|
|
779
|
+
console.error(yellow(`\n Pre-build failed: ${daemonBuildFailed}`));
|
|
780
|
+
console.error(yellow(' Daemon will attempt to rebuild on startup...\n'));
|
|
781
|
+
}
|
|
775
782
|
|
|
776
|
-
// Stage 4: Restart
|
|
783
|
+
// Stage 4: Restart — always attempt, even if pre-build failed
|
|
784
|
+
// (daemon has auto-restart; `mindos start` retries the build)
|
|
777
785
|
writeUpdateStatus('restarting', vOpts);
|
|
778
786
|
await runGatewayCommand('install');
|
|
779
|
-
// install() starts the service:
|
|
780
|
-
// - systemd: daemon-reload + enable + start
|
|
781
|
-
// - launchd: bootstrap (RunAtLoad=true auto-starts)
|
|
782
|
-
// Do NOT call start() again — on macOS kickstart -k would kill the
|
|
783
|
-
// just-started process, causing a port-conflict race with KeepAlive.
|
|
784
787
|
const updateConfig = (() => {
|
|
785
788
|
try { return JSON.parse(readFileSync(CONFIG_PATH, 'utf-8')); } catch { return {}; }
|
|
786
789
|
})();
|
|
@@ -799,8 +802,11 @@ ${dim('Shortcut: mindos start --daemon → install + start in one step')}
|
|
|
799
802
|
console.log(`${'─'.repeat(53)}\n`);
|
|
800
803
|
writeUpdateStatus('done', vOpts);
|
|
801
804
|
} else {
|
|
802
|
-
|
|
803
|
-
|
|
805
|
+
const failMsg = daemonBuildFailed
|
|
806
|
+
? `Build failed (${daemonBuildFailed}), server did not come back up`
|
|
807
|
+
: 'Server did not come back up in time';
|
|
808
|
+
writeUpdateFailed('restarting', failMsg, vOpts);
|
|
809
|
+
console.error(red(`✘ ${failMsg}. Check logs: mindos logs\n`));
|
|
804
810
|
process.exit(1);
|
|
805
811
|
}
|
|
806
812
|
} else {
|
|
@@ -828,9 +834,17 @@ ${dim('Shortcut: mindos start --daemon → install + start in one step')}
|
|
|
828
834
|
|
|
829
835
|
// Stage 3: Rebuild
|
|
830
836
|
writeUpdateStatus('rebuilding', vOpts);
|
|
831
|
-
|
|
837
|
+
let buildFailed = '';
|
|
838
|
+
try {
|
|
839
|
+
buildIfNeeded(updatedRoot);
|
|
840
|
+
} catch (err) {
|
|
841
|
+
buildFailed = err instanceof Error ? err.message : String(err);
|
|
842
|
+
console.error(yellow(`\n Pre-build failed: ${buildFailed}`));
|
|
843
|
+
console.error(yellow(' Starting server anyway (it will retry the build)...\n'));
|
|
844
|
+
}
|
|
832
845
|
|
|
833
|
-
// Stage 4: Restart
|
|
846
|
+
// Stage 4: Restart — always attempt, even if pre-build failed
|
|
847
|
+
// (`mindos start` has its own build-on-startup logic)
|
|
834
848
|
writeUpdateStatus('restarting', vOpts);
|
|
835
849
|
const newCliPath = resolve(updatedRoot, 'bin', 'cli.js');
|
|
836
850
|
const childEnv = { ...process.env };
|
|
@@ -858,13 +872,22 @@ ${dim('Shortcut: mindos start --daemon → install + start in one step')}
|
|
|
858
872
|
console.log(`${'─'.repeat(53)}\n`);
|
|
859
873
|
writeUpdateStatus('done', vOpts);
|
|
860
874
|
} else {
|
|
861
|
-
|
|
862
|
-
|
|
875
|
+
const failMsg = buildFailed
|
|
876
|
+
? `Build failed (${buildFailed}), server did not come back up`
|
|
877
|
+
: 'Server did not come back up in time';
|
|
878
|
+
writeUpdateFailed('restarting', failMsg, vOpts);
|
|
879
|
+
console.error(red(`✘ ${failMsg}. Check logs: mindos logs\n`));
|
|
863
880
|
process.exit(1);
|
|
864
881
|
}
|
|
865
882
|
} else {
|
|
866
883
|
// No running instance — just build and tell user to start manually
|
|
867
|
-
|
|
884
|
+
try {
|
|
885
|
+
buildIfNeeded(updatedRoot);
|
|
886
|
+
} catch (err) {
|
|
887
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
888
|
+
console.error(yellow(`\n Pre-build failed: ${msg}`));
|
|
889
|
+
console.error(dim(' The build will be retried when you run `mindos start`.'));
|
|
890
|
+
}
|
|
868
891
|
console.log(`\n${green('✔')} ${bold(`Updated: ${currentVersion} → ${newVersion}`)}`);
|
|
869
892
|
console.log(dim(' Run `mindos start` to start the updated version.'));
|
|
870
893
|
console.log(` ${dim('View changelog:')} ${cyan('https://github.com/GeminiLight/MindOS/releases')}\n`);
|
package/package.json
CHANGED