kubeagent 0.1.19 → 0.1.20
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/auth.js +2 -1
- package/dist/cli.js +7 -0
- package/package.json +1 -1
package/dist/auth.js
CHANGED
|
@@ -129,7 +129,8 @@ export async function loginBrowser(serverUrl, appUrl) {
|
|
|
129
129
|
// fallback: just print the URL
|
|
130
130
|
}
|
|
131
131
|
console.log(`\nOpening browser for authentication...`);
|
|
132
|
-
console.log(`If the browser didn't open, visit:\n ${authUrl}
|
|
132
|
+
console.log(`If the browser didn't open, visit:\n ${authUrl}`);
|
|
133
|
+
console.log(`Or on a headless/remote machine, run: kubeagent login --device\n`);
|
|
133
134
|
});
|
|
134
135
|
// Timeout after 5 minutes
|
|
135
136
|
const timeoutId = setTimeout(() => {
|
package/dist/cli.js
CHANGED
|
@@ -390,6 +390,13 @@ program
|
|
|
390
390
|
.option("--device", "Use device code flow (for remote/headless machines — no browser required)")
|
|
391
391
|
.action(async (opts) => {
|
|
392
392
|
try {
|
|
393
|
+
// Auto-detect headless/SSH environments and switch to device flow
|
|
394
|
+
const isHeadless = process.platform === "linux" && !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY;
|
|
395
|
+
const isSsh = !!(process.env.SSH_TTY || process.env.SSH_CONNECTION || process.env.SSH_CLIENT);
|
|
396
|
+
if (!opts.device && (isHeadless || isSsh)) {
|
|
397
|
+
console.log(chalk.yellow("Headless/SSH environment detected — using device code flow."));
|
|
398
|
+
opts.device = true;
|
|
399
|
+
}
|
|
393
400
|
const auth = opts.device
|
|
394
401
|
? await loginDevice(opts.server, opts.appUrl)
|
|
395
402
|
: await loginBrowser(opts.server, opts.appUrl);
|