@celilo/cli 0.3.13 → 0.3.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celilo/cli",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "description": "Celilo — home lab orchestration CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -210,6 +210,25 @@ async function initInteractive(cliOverrides: Record<string, string> = {}): Promi
210
210
  if (!has('ssh.public_key')) {
211
211
  const detectedKeys = autoDetectSSHKeys();
212
212
  const existingSshKey = defaults['ssh.public_key'];
213
+
214
+ // Fresh box, no key in ~/.ssh and no previously-saved key — point the
215
+ // user at ssh-keygen rather than making them paste at a blank prompt.
216
+ // They can also skip this branch by passing ssh.public_key=... on the CLI.
217
+ if (detectedKeys.length === 0 && !existingSshKey) {
218
+ p.cancel('No SSH key found in ~/.ssh/');
219
+ console.log();
220
+ console.log('Celilo uses an SSH key to reach managed machines');
221
+ console.log('(Proxmox hosts, VPS, Raspberry Pi, etc.). Generate one:');
222
+ console.log();
223
+ console.log(' ssh-keygen -t ed25519 -C "<your-email>"');
224
+ console.log();
225
+ console.log('Then re-run: celilo system init');
226
+ console.log();
227
+ console.log('Or, to paste a key from elsewhere without generating one:');
228
+ console.log(' celilo system init ssh.public_key="ssh-ed25519 AAAA..."');
229
+ return { success: false, error: 'No SSH key available — run ssh-keygen first' };
230
+ }
231
+
213
232
  let keySelected = false;
214
233
 
215
234
  if (detectedKeys.length === 1) {
@@ -258,7 +277,9 @@ async function initInteractive(cliOverrides: Record<string, string> = {}): Promi
258
277
  ? 'SSH public key (press Enter to keep existing)'
259
278
  : 'SSH public key',
260
279
  defaultValue: String(existingSshKey || ''),
261
- placeholder: String(existingSshKey) || 'ssh-ed25519 AAAA...',
280
+ // String(undefined) === 'undefined' (truthy), so guard explicitly —
281
+ // otherwise the prompt shows "undefined" as the placeholder text.
282
+ placeholder: existingSshKey ? String(existingSshKey) : 'ssh-ed25519 AAAA...',
262
283
  validate: (value) => {
263
284
  if (existingSshKey && !value) {
264
285
  return;