kubeagent 0.1.32 → 0.1.33
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/onboard/index.js +15 -0
- package/package.json +1 -1
package/dist/onboard/index.js
CHANGED
|
@@ -8,9 +8,20 @@ import { writeClusterKb, writeProjectKb, ensureKbDir } from "../kb/writer.js";
|
|
|
8
8
|
import { saveConfig, loadConfig, configDir, ALL_ACTIONS, DEFAULT_SAFE_ACTIONS } from "../config.js";
|
|
9
9
|
import { interactiveAddChannel } from "../notify/setup.js";
|
|
10
10
|
import { pickContext } from "../kubectl-config.js";
|
|
11
|
+
import { loadAuth } from "../auth.js";
|
|
11
12
|
import { join } from "node:path";
|
|
12
13
|
import { homedir } from "node:os";
|
|
13
14
|
import readline from "node:readline";
|
|
15
|
+
function pingOnboardComplete() {
|
|
16
|
+
const auth = loadAuth();
|
|
17
|
+
if (!auth?.apiKey)
|
|
18
|
+
return;
|
|
19
|
+
fetch(`${auth.serverUrl}/v1/onboard/complete`, {
|
|
20
|
+
method: "POST",
|
|
21
|
+
headers: { Authorization: `ApiKey ${auth.apiKey}` },
|
|
22
|
+
signal: AbortSignal.timeout(5000),
|
|
23
|
+
}).catch(() => { });
|
|
24
|
+
}
|
|
14
25
|
function expandPath(p) {
|
|
15
26
|
return p.startsWith("~/") ? homedir() + p.slice(1) : p;
|
|
16
27
|
}
|
|
@@ -147,6 +158,8 @@ export async function onboard(opts = {}) {
|
|
|
147
158
|
notifications: { ...existingConfig.notifications, channels: newChannels },
|
|
148
159
|
clusters: existingConfig.clusters.map((c) => c.context === contextName ? { ...c, codepaths: codePaths.map((p) => p.path) } : c),
|
|
149
160
|
});
|
|
161
|
+
// fallow-ignore-next-line code-duplication
|
|
162
|
+
pingOnboardComplete();
|
|
150
163
|
console.log(chalk.green(`\nKnowledge base written to ${kbDir}`));
|
|
151
164
|
console.log(chalk.green(`Config saved to ${configDir()}/config.yaml`));
|
|
152
165
|
console.log(chalk.dim("\nRun `kubeagent watch` to start monitoring."));
|
|
@@ -341,6 +354,8 @@ export async function onboard(opts = {}) {
|
|
|
341
354
|
config.clusters.push(clusterConfig);
|
|
342
355
|
}
|
|
343
356
|
saveConfig(config);
|
|
357
|
+
// fallow-ignore-next-line code-duplication
|
|
358
|
+
pingOnboardComplete();
|
|
344
359
|
console.log(chalk.green(`\nKnowledge base written to ${kbDir}`));
|
|
345
360
|
console.log(chalk.green(`Config saved to ${configDir()}/config.yaml`));
|
|
346
361
|
console.log(chalk.dim("\nRun `kubeagent watch` to start monitoring."));
|