@caelis/caelis 0.38.0 → 0.40.0

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/caelis.js CHANGED
@@ -73,6 +73,9 @@ function handoffEligible(platform, argv, stdinIsTTY) {
73
73
  'doctor',
74
74
  'serve',
75
75
  'server',
76
+ 'service',
77
+ 'svc',
78
+ 'gateway',
76
79
  'sandbox',
77
80
  ]);
78
81
  if (nonInteractiveCommands.has(first) ||
@@ -117,18 +117,31 @@ function createStatusRenderer(stream) {
117
117
  }
118
118
 
119
119
  function validateHandoffPlan(plan) {
120
- if (!plan || plan.version !== 1) {
120
+ if (!plan || plan.version !== 2) {
121
121
  throw new Error('invalid npm update handoff plan version');
122
122
  }
123
123
  if (!Array.isArray(plan.command) || plan.command.length === 0 ||
124
124
  plan.command.some((value) => typeof value !== 'string' || value.length === 0)) {
125
125
  throw new Error('invalid npm update command');
126
126
  }
127
- if (!plan.latest_version || !plan.executable) {
127
+ if (!plan.latest_version || !plan.executable || !plan.store_dir) {
128
128
  throw new Error('incomplete npm update handoff plan');
129
129
  }
130
130
  }
131
131
 
132
+ async function defaultActivateCaelis(executable, storeDir, signalCoordinator) {
133
+ const result = await runCapturedProcess(
134
+ executable,
135
+ ['service', 'start', '--store-dir', storeDir, '--format', 'json'],
136
+ { windowsHide: true },
137
+ signalCoordinator,
138
+ );
139
+ if (result.signal || result.code !== 0) {
140
+ const detail = String(result.stderr || result.stdout || '').trim();
141
+ throw new Error(`updated Caelis did not activate${detail ? `: ${detail}` : ''}`);
142
+ }
143
+ }
144
+
132
145
  function validateHandoffOwnership(ownership) {
133
146
  if (!ownership || ownership.version !== 1) {
134
147
  throw new Error('invalid npm update handoff ownership version');
@@ -248,6 +261,8 @@ async function executeHandoffPlan(plan, options = {}) {
248
261
  ((handoffPlan) => defaultRunInstall(handoffPlan, signalCoordinator));
249
262
  const verifyVersion = options.verifyVersion ||
250
263
  ((executable) => defaultVerifyVersion(executable, signalCoordinator));
264
+ const activateCaelis = options.activateCaelis ||
265
+ ((executable, storeDir) => defaultActivateCaelis(executable, storeDir, signalCoordinator));
251
266
  let phase = 'install';
252
267
 
253
268
  try {
@@ -268,6 +283,11 @@ async function executeHandoffPlan(plan, options = {}) {
268
283
  );
269
284
  }
270
285
  status.succeed(`Verified Caelis ${plan.latest_version}`);
286
+
287
+ phase = 'activate';
288
+ status.start('Activating updated Caelis…');
289
+ await activateCaelis(plan.executable, plan.store_dir);
290
+ status.succeed(`Activated Caelis ${plan.latest_version}`);
271
291
  stdout.write(
272
292
  // Keep this completion contract aligned with formatUpdateResult in
273
293
  // internal/cli/update.go; Go is silent while a handoff is active.
@@ -276,7 +296,10 @@ async function executeHandoffPlan(plan, options = {}) {
276
296
  );
277
297
  return 0;
278
298
  } catch (err) {
279
- status.fail(phase === 'install' ? 'npm install failed' : 'Version verification failed');
299
+ status.fail(
300
+ phase === 'install' ? 'npm install failed' :
301
+ phase === 'verify' ? 'Version verification failed' : 'Caelis activation failed',
302
+ );
280
303
  throw err;
281
304
  } finally {
282
305
  status.stop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caelis/caelis",
3
- "version": "0.38.0",
3
+ "version": "0.40.0",
4
4
  "description": "caelis CLI distributed via npm",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -37,12 +37,12 @@
37
37
  "publish-release": "node ./scripts/publish-release.mjs"
38
38
  },
39
39
  "optionalDependencies": {
40
- "@caelis/caelis-darwin-arm64": "0.38.0",
41
- "@caelis/caelis-darwin-x64": "0.38.0",
42
- "@caelis/caelis-linux-arm64": "0.38.0",
43
- "@caelis/caelis-linux-x64": "0.38.0",
44
- "@caelis/caelis-windows-arm64": "0.38.0",
45
- "@caelis/caelis-windows-x64": "0.38.0"
40
+ "@caelis/caelis-darwin-arm64": "0.40.0",
41
+ "@caelis/caelis-darwin-x64": "0.40.0",
42
+ "@caelis/caelis-linux-arm64": "0.40.0",
43
+ "@caelis/caelis-linux-x64": "0.40.0",
44
+ "@caelis/caelis-windows-arm64": "0.40.0",
45
+ "@caelis/caelis-windows-x64": "0.40.0"
46
46
  },
47
47
  "publishConfig": {
48
48
  "access": "public",