genbox 1.0.99 → 1.0.100
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/dist/commands/cleanup-ssh.js +3 -2
- package/dist/index.js +2 -26
- package/package.json +1 -1
|
@@ -36,8 +36,9 @@ async function cleanupOrphanedSshConfigs(options = {}) {
|
|
|
36
36
|
}
|
|
37
37
|
throw error;
|
|
38
38
|
}
|
|
39
|
-
//
|
|
40
|
-
const
|
|
39
|
+
// Keep SSH configs for any non-terminated genbox (running, error, provisioning, stopped)
|
|
40
|
+
const activeGenboxes = existingGenboxes.filter(g => g.status !== 'terminated');
|
|
41
|
+
const existingNames = new Set(activeGenboxes.map(g => g.name));
|
|
41
42
|
// Find orphaned entries (SSH configs for genboxes that don't exist anymore)
|
|
42
43
|
const orphaned = sshEntries.filter(name => !existingNames.has(name));
|
|
43
44
|
if (orphaned.length === 0) {
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
4
|
const commander_1 = require("commander");
|
|
8
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
9
5
|
const init_1 = require("./commands/init");
|
|
10
|
-
const cleanup_ssh_1 = require("./commands/cleanup-ssh");
|
|
11
|
-
/**
|
|
12
|
-
* Auto-cleanup orphaned SSH configs on startup (non-blocking, silent)
|
|
13
|
-
* This runs in the background without affecting CLI startup time
|
|
14
|
-
*/
|
|
15
|
-
function autoCleanupSshConfigs() {
|
|
16
|
-
// Run cleanup in background - don't await, don't block startup
|
|
17
|
-
(0, cleanup_ssh_1.cleanupOrphanedSshConfigs)({ silent: true })
|
|
18
|
-
.then(removed => {
|
|
19
|
-
// Optionally log if GENBOX_DEBUG is set
|
|
20
|
-
if (process.env.GENBOX_DEBUG && removed.length > 0) {
|
|
21
|
-
console.error(chalk_1.default.dim(`[Auto-cleanup] Removed ${removed.length} orphaned SSH config(s): ${removed.join(', ')}`));
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
.catch(() => {
|
|
25
|
-
// Silently ignore errors - this is a background cleanup
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
// Run auto-cleanup on startup (non-blocking)
|
|
29
|
-
autoCleanupSshConfigs();
|
|
30
6
|
const program = new commander_1.Command();
|
|
31
7
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
32
8
|
const { version } = require('../package.json');
|
|
@@ -55,7 +31,7 @@ const migrate_1 = require("./commands/migrate");
|
|
|
55
31
|
const ssh_setup_1 = require("./commands/ssh-setup");
|
|
56
32
|
const rebuild_1 = require("./commands/rebuild");
|
|
57
33
|
const extend_1 = require("./commands/extend");
|
|
58
|
-
const
|
|
34
|
+
const cleanup_ssh_1 = require("./commands/cleanup-ssh");
|
|
59
35
|
program
|
|
60
36
|
.addCommand(init_1.initCommand)
|
|
61
37
|
.addCommand(create_1.createCommand)
|
|
@@ -80,5 +56,5 @@ program
|
|
|
80
56
|
.addCommand(ssh_setup_1.sshSetupCommand)
|
|
81
57
|
.addCommand(rebuild_1.rebuildCommand)
|
|
82
58
|
.addCommand(extend_1.extendCommand)
|
|
83
|
-
.addCommand(
|
|
59
|
+
.addCommand(cleanup_ssh_1.cleanupSshCommand);
|
|
84
60
|
program.parse(process.argv);
|