kubeagent 0.1.18 → 0.1.19
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/cli.js +1 -1
- package/dist/kubectl-config.js +9 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -102,7 +102,7 @@ program
|
|
|
102
102
|
console.log(chalk.dim(" │") + bannerInner + " ".repeat(pad) + chalk.dim("│"));
|
|
103
103
|
console.log(chalk.dim(" └" + "─".repeat(bannerWidth) + "┘"));
|
|
104
104
|
console.log(chalk.dim(" Ctrl+C to stop\n"));
|
|
105
|
-
const noInteractive = opts.
|
|
105
|
+
const noInteractive = opts.interactive === false || !process.stdin.isTTY;
|
|
106
106
|
if (noInteractive) {
|
|
107
107
|
console.log(chalk.dim(" Non-interactive mode — approvals auto-denied, questions skipped\n"));
|
|
108
108
|
}
|
package/dist/kubectl-config.js
CHANGED
|
@@ -23,11 +23,20 @@ export async function pickContext() {
|
|
|
23
23
|
contexts = await listContexts();
|
|
24
24
|
}
|
|
25
25
|
catch {
|
|
26
|
+
if (!process.stdin.isTTY)
|
|
27
|
+
throw new Error("No Kubernetes contexts found and stdin is not interactive");
|
|
26
28
|
return ask("Kubernetes context to use:");
|
|
27
29
|
}
|
|
28
30
|
if (contexts.length === 0) {
|
|
31
|
+
if (!process.stdin.isTTY)
|
|
32
|
+
throw new Error("No Kubernetes contexts found");
|
|
29
33
|
return ask("Kubernetes context to use:");
|
|
30
34
|
}
|
|
35
|
+
// Non-interactive: auto-select current context without prompting
|
|
36
|
+
if (!process.stdin.isTTY) {
|
|
37
|
+
const current = contexts.find((c) => c.current);
|
|
38
|
+
return current?.name ?? contexts[0].name;
|
|
39
|
+
}
|
|
31
40
|
console.log(chalk.bold("\nAvailable Kubernetes contexts:\n"));
|
|
32
41
|
contexts.forEach((ctx, i) => {
|
|
33
42
|
const marker = ctx.current ? chalk.green(" (current)") : "";
|