kubeagent 0.1.36 → 0.1.44
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/README.md +32 -0
- package/dist/auth.js +15 -0
- package/dist/check/index.js +77 -0
- package/dist/check/run.js +114 -0
- package/dist/cli.js +25 -2
- package/dist/detector/sources.js +1 -1
- package/dist/diagnoser/index.js +37 -11
- package/dist/monitor/index.js +45 -14
- package/dist/notify/discord.js +6 -9
- package/dist/notify/ssrf-guard.js +150 -0
- package/dist/notify/teams.js +6 -9
- package/dist/notify/webhook.js +7 -9
- package/dist/orchestrator.js +2 -1
- package/dist/telemetry.js +27 -1
- package/package.json +10 -1
- package/dist/auth.d.ts +0 -29
- package/dist/cli.d.ts +0 -2
- package/dist/config.d.ts +0 -75
- package/dist/debug.d.ts +0 -10
- package/dist/detector/cache.d.ts +0 -6
- package/dist/detector/cache.test.d.ts +0 -1
- package/dist/detector/cache.test.js +0 -54
- package/dist/detector/catalog.d.ts +0 -17
- package/dist/detector/catalog.test.d.ts +0 -1
- package/dist/detector/catalog.test.js +0 -33
- package/dist/detector/eol.d.ts +0 -13
- package/dist/detector/eol.test.d.ts +0 -1
- package/dist/detector/eol.test.js +0 -78
- package/dist/detector/image-parser.d.ts +0 -11
- package/dist/detector/image-parser.test.d.ts +0 -1
- package/dist/detector/image-parser.test.js +0 -87
- package/dist/detector/index.d.ts +0 -33
- package/dist/detector/index.test.d.ts +0 -1
- package/dist/detector/index.test.js +0 -210
- package/dist/detector/osv.d.ts +0 -12
- package/dist/detector/osv.test.d.ts +0 -1
- package/dist/detector/osv.test.js +0 -86
- package/dist/detector/report.d.ts +0 -6
- package/dist/detector/sources.d.ts +0 -42
- package/dist/diagnoser/index.d.ts +0 -17
- package/dist/diagnoser/tools.d.ts +0 -119
- package/dist/kb/loader.d.ts +0 -1
- package/dist/kb/writer.d.ts +0 -12
- package/dist/kubectl-config.d.ts +0 -7
- package/dist/kubectl.d.ts +0 -13
- package/dist/monitor/checks.d.ts +0 -71
- package/dist/monitor/index.d.ts +0 -17
- package/dist/monitor/resolve.test.d.ts +0 -1
- package/dist/monitor/resolve.test.js +0 -21
- package/dist/monitor/types.d.ts +0 -11
- package/dist/notify/discord.d.ts +0 -4
- package/dist/notify/index.d.ts +0 -6
- package/dist/notify/pagerduty.d.ts +0 -9
- package/dist/notify/pagerduty.test.d.ts +0 -1
- package/dist/notify/pagerduty.test.js +0 -97
- package/dist/notify/setup.d.ts +0 -9
- package/dist/notify/slack.d.ts +0 -4
- package/dist/notify/teams.d.ts +0 -3
- package/dist/notify/telegram.d.ts +0 -9
- package/dist/notify/webhook.d.ts +0 -3
- package/dist/notify/webhook.test.d.ts +0 -1
- package/dist/notify/webhook.test.js +0 -53
- package/dist/onboard/cluster-scan.d.ts +0 -42
- package/dist/onboard/code-scan.d.ts +0 -9
- package/dist/onboard/index.d.ts +0 -3
- package/dist/onboard/interview.d.ts +0 -12
- package/dist/onboard/project-matcher.d.ts +0 -25
- package/dist/orchestrator.d.ts +0 -3
- package/dist/proxy-client.d.ts +0 -27
- package/dist/render.d.ts +0 -5
- package/dist/telemetry.d.ts +0 -1
- package/dist/telemetry.test.d.ts +0 -1
- package/dist/telemetry.test.js +0 -18
- package/dist/update-notifier.d.ts +0 -1
- package/dist/update-notifier.test.d.ts +0 -1
- package/dist/update-notifier.test.js +0 -50
- package/dist/verifier.d.ts +0 -9
- package/dist/version-check.d.ts +0 -14
- package/dist/version-check.test.d.ts +0 -1
- package/dist/version-check.test.js +0 -179
package/dist/notify/discord.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Issue } from "../monitor/types.js";
|
|
2
|
-
import type { DiscordChannel } from "../config.js";
|
|
3
|
-
export declare function sendDiscordQuestion(channel: DiscordChannel, question: string, choices: string[] | undefined, clusterContext?: string): Promise<void>;
|
|
4
|
-
export declare function sendDiscord(issues: Issue[], channel: DiscordChannel, clusterContext?: string): Promise<void>;
|
package/dist/notify/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Issue } from "../monitor/types.js";
|
|
2
|
-
import type { KubeAgentConfig, NotificationChannel } from "../config.js";
|
|
3
|
-
export declare function sendNotification(issues: Issue[], config: KubeAgentConfig, clusterContext?: string): Promise<void>;
|
|
4
|
-
export declare function broadcastQuestion(question: string, choices: string[] | undefined, config: KubeAgentConfig, clusterContext?: string): Promise<void>;
|
|
5
|
-
export declare function sendResolve(resolvedKeys: string[], config: KubeAgentConfig, clusterContext?: string): Promise<void>;
|
|
6
|
-
export declare function describeChannel(channel: NotificationChannel): string;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Issue } from "../monitor/types.js";
|
|
2
|
-
import type { PagerDutyChannel } from "../config.js";
|
|
3
|
-
export declare function dedupKey(issue: Issue): string;
|
|
4
|
-
export declare function sendPagerDuty(issues: Issue[], channel: PagerDutyChannel, clusterContext?: string): Promise<void>;
|
|
5
|
-
export declare function resolvePagerDuty(dedupKeys: string[], channel: PagerDutyChannel): Promise<void>;
|
|
6
|
-
export declare function testPagerDutyCredentials(routingKey: string): Promise<{
|
|
7
|
-
ok: boolean;
|
|
8
|
-
error?: string;
|
|
9
|
-
}>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
-
const mockFetch = vi.fn();
|
|
3
|
-
vi.stubGlobal("fetch", mockFetch);
|
|
4
|
-
const channel = { type: "pagerduty", routing_key: "R0123456789abcdef", severity: "warning" };
|
|
5
|
-
const issue = { kind: "pod_crashloop", severity: "critical", namespace: "prod", resource: "api-web", message: "Pod crash-looping (3 times)", details: {}, timestamp: new Date("2026-01-01T00:00:00Z") };
|
|
6
|
-
describe("sendPagerDuty", () => {
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
mockFetch.mockReset();
|
|
9
|
-
mockFetch.mockResolvedValue({ ok: true, status: 202, json: async () => ({ status: "success" }) });
|
|
10
|
-
});
|
|
11
|
-
it("POSTs to PagerDuty Events API v2", async () => {
|
|
12
|
-
const { sendPagerDuty } = await import("./pagerduty.js");
|
|
13
|
-
await sendPagerDuty([issue], channel, "hetzner-prod");
|
|
14
|
-
expect(mockFetch.mock.calls[0][0]).toBe("https://events.pagerduty.com/v2/enqueue");
|
|
15
|
-
});
|
|
16
|
-
it("sends trigger with correct dedup_key", async () => {
|
|
17
|
-
const { sendPagerDuty } = await import("./pagerduty.js");
|
|
18
|
-
await sendPagerDuty([issue], channel);
|
|
19
|
-
const body = JSON.parse(mockFetch.mock.calls[0][1].body);
|
|
20
|
-
expect(body.event_action).toBe("trigger");
|
|
21
|
-
expect(body.dedup_key).toBe("kubeagent:pod_crashloop:prod:api-web");
|
|
22
|
-
expect(body.routing_key).toBe("R0123456789abcdef");
|
|
23
|
-
});
|
|
24
|
-
it("maps critical severity correctly", async () => {
|
|
25
|
-
const { sendPagerDuty } = await import("./pagerduty.js");
|
|
26
|
-
await sendPagerDuty([{ ...issue, severity: "critical" }], channel);
|
|
27
|
-
const body = JSON.parse(mockFetch.mock.calls[0][1].body);
|
|
28
|
-
expect(body.payload.severity).toBe("critical");
|
|
29
|
-
});
|
|
30
|
-
it("maps warning severity correctly", async () => {
|
|
31
|
-
const { sendPagerDuty } = await import("./pagerduty.js");
|
|
32
|
-
await sendPagerDuty([{ ...issue, severity: "warning" }], channel);
|
|
33
|
-
const body = JSON.parse(mockFetch.mock.calls[0][1].body);
|
|
34
|
-
expect(body.payload.severity).toBe("warning");
|
|
35
|
-
});
|
|
36
|
-
it("maps info severity correctly", async () => {
|
|
37
|
-
const { sendPagerDuty } = await import("./pagerduty.js");
|
|
38
|
-
await sendPagerDuty([{ ...issue, severity: "info" }], channel);
|
|
39
|
-
const body = JSON.parse(mockFetch.mock.calls[0][1].body);
|
|
40
|
-
expect(body.payload.severity).toBe("info");
|
|
41
|
-
});
|
|
42
|
-
it("fires one request per issue", async () => {
|
|
43
|
-
const { sendPagerDuty } = await import("./pagerduty.js");
|
|
44
|
-
await sendPagerDuty([issue, { ...issue, kind: "pod_oom", resource: "worker" }], channel);
|
|
45
|
-
expect(mockFetch).toHaveBeenCalledTimes(2);
|
|
46
|
-
});
|
|
47
|
-
it("does not throw on non-2xx", async () => {
|
|
48
|
-
mockFetch.mockResolvedValue({ ok: false, status: 400, statusText: "Bad Request", json: async () => ({}) });
|
|
49
|
-
const { sendPagerDuty } = await import("./pagerduty.js");
|
|
50
|
-
await expect(sendPagerDuty([issue], channel)).resolves.not.toThrow();
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
describe("resolvePagerDuty", () => {
|
|
54
|
-
beforeEach(() => {
|
|
55
|
-
mockFetch.mockReset();
|
|
56
|
-
mockFetch.mockResolvedValue({ ok: true, status: 202, json: async () => ({}) });
|
|
57
|
-
});
|
|
58
|
-
it("sends resolve events for each dedup key", async () => {
|
|
59
|
-
const { resolvePagerDuty } = await import("./pagerduty.js");
|
|
60
|
-
await resolvePagerDuty(["kubeagent:pod_crashloop:prod:api-web", "kubeagent:pod_oom:prod:worker"], channel);
|
|
61
|
-
expect(mockFetch).toHaveBeenCalledTimes(2);
|
|
62
|
-
const body0 = JSON.parse(mockFetch.mock.calls[0][1].body);
|
|
63
|
-
expect(body0.event_action).toBe("resolve");
|
|
64
|
-
expect(body0.dedup_key).toBe("kubeagent:pod_crashloop:prod:api-web");
|
|
65
|
-
});
|
|
66
|
-
it("does not throw on error", async () => {
|
|
67
|
-
mockFetch.mockRejectedValue(new Error("network failure"));
|
|
68
|
-
const { resolvePagerDuty } = await import("./pagerduty.js");
|
|
69
|
-
await expect(resolvePagerDuty(["kubeagent:pod_crashloop:prod:api-web"], channel)).resolves.not.toThrow();
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
describe("testPagerDutyCredentials", () => {
|
|
73
|
-
beforeEach(() => {
|
|
74
|
-
mockFetch.mockReset();
|
|
75
|
-
mockFetch.mockResolvedValue({ ok: true, status: 202, json: async () => ({}) });
|
|
76
|
-
});
|
|
77
|
-
it("returns ok:true when trigger succeeds", async () => {
|
|
78
|
-
const { testPagerDutyCredentials } = await import("./pagerduty.js");
|
|
79
|
-
const result = await testPagerDutyCredentials("R0123456789abcdef");
|
|
80
|
-
expect(result.ok).toBe(true);
|
|
81
|
-
expect(result.error).toBeUndefined();
|
|
82
|
-
});
|
|
83
|
-
it("returns ok:false with error when trigger fails", async () => {
|
|
84
|
-
mockFetch.mockResolvedValue({ ok: false, status: 400, statusText: "Bad Request", json: async () => ({ message: "Invalid routing key" }) });
|
|
85
|
-
const { testPagerDutyCredentials } = await import("./pagerduty.js");
|
|
86
|
-
const result = await testPagerDutyCredentials("bad-key");
|
|
87
|
-
expect(result.ok).toBe(false);
|
|
88
|
-
expect(result.error).toBe("Invalid routing key");
|
|
89
|
-
});
|
|
90
|
-
it("returns ok:false on network error", async () => {
|
|
91
|
-
mockFetch.mockRejectedValue(new Error("ECONNREFUSED"));
|
|
92
|
-
const { testPagerDutyCredentials } = await import("./pagerduty.js");
|
|
93
|
-
const result = await testPagerDutyCredentials("R0123456789abcdef");
|
|
94
|
-
expect(result.ok).toBe(false);
|
|
95
|
-
expect(result.error).toBe("ECONNREFUSED");
|
|
96
|
-
});
|
|
97
|
-
});
|
package/dist/notify/setup.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { NotificationChannel, SlackChannel, TelegramChannel } from "../config.js";
|
|
2
|
-
import type { WebhookChannel, PagerDutyChannel, DiscordChannel, TeamsChannel } from "../config.js";
|
|
3
|
-
export declare function setupSlack(): Promise<SlackChannel | null>;
|
|
4
|
-
export declare function setupTelegram(): Promise<TelegramChannel | null>;
|
|
5
|
-
export declare function setupWebhook(): Promise<WebhookChannel | null>;
|
|
6
|
-
export declare function setupPagerDuty(): Promise<PagerDutyChannel | null>;
|
|
7
|
-
export declare function setupDiscord(): Promise<DiscordChannel | null>;
|
|
8
|
-
export declare function setupTeams(): Promise<TeamsChannel | null>;
|
|
9
|
-
export declare function interactiveAddChannel(): Promise<NotificationChannel | null>;
|
package/dist/notify/slack.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Issue } from "../monitor/types.js";
|
|
2
|
-
import type { SlackChannel } from "../config.js";
|
|
3
|
-
export declare function sendSlackQuestion(channel: SlackChannel, question: string, choices: string[] | undefined, clusterContext?: string): Promise<void>;
|
|
4
|
-
export declare function sendSlack(issues: Issue[], channel: SlackChannel, clusterContext?: string): Promise<void>;
|
package/dist/notify/teams.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Issue } from "../monitor/types.js";
|
|
2
|
-
import type { TelegramChannel } from "../config.js";
|
|
3
|
-
export declare function sendTelegramQuestion(channel: TelegramChannel, question: string, choices: string[] | undefined, clusterContext?: string): Promise<void>;
|
|
4
|
-
export declare function sendTelegram(issues: Issue[], channel: TelegramChannel, clusterContext?: string): Promise<void>;
|
|
5
|
-
export declare function autoDetectTelegramChatId(botToken: string): Promise<string | null>;
|
|
6
|
-
export declare function testTelegramCredentials(botToken: string, chatId: string): Promise<{
|
|
7
|
-
ok: boolean;
|
|
8
|
-
error?: string;
|
|
9
|
-
}>;
|
package/dist/notify/webhook.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
-
const mockFetch = vi.fn();
|
|
3
|
-
vi.stubGlobal("fetch", mockFetch);
|
|
4
|
-
const channel = { type: "webhook", url: "https://example.com/hook", secret: "testsecret", severity: "warning" };
|
|
5
|
-
const issue = { kind: "pod_crashloop", severity: "critical", namespace: "prod", resource: "api-web", message: "Pod crash-looping", details: { restartCount: 3 }, timestamp: new Date("2026-01-01T00:00:00Z") };
|
|
6
|
-
describe("sendWebhook", () => {
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
mockFetch.mockReset();
|
|
9
|
-
mockFetch.mockResolvedValue({ ok: true, status: 200, statusText: "OK" });
|
|
10
|
-
});
|
|
11
|
-
it("POSTs to the configured URL", async () => {
|
|
12
|
-
const { sendWebhook } = await import("./webhook.js");
|
|
13
|
-
await sendWebhook([issue], channel, "hetzner-prod");
|
|
14
|
-
expect(mockFetch).toHaveBeenCalledOnce();
|
|
15
|
-
expect(mockFetch.mock.calls[0][0]).toBe("https://example.com/hook");
|
|
16
|
-
expect(mockFetch.mock.calls[0][1].method).toBe("POST");
|
|
17
|
-
});
|
|
18
|
-
it("sends Authorization: Bearer header when secret is set", async () => {
|
|
19
|
-
const { sendWebhook } = await import("./webhook.js");
|
|
20
|
-
await sendWebhook([issue], channel, "hetzner-prod");
|
|
21
|
-
expect(mockFetch.mock.calls[0][1].headers["Authorization"]).toBe("Bearer testsecret");
|
|
22
|
-
});
|
|
23
|
-
it("omits Authorization header when no secret", async () => {
|
|
24
|
-
const noSecretChannel = { ...channel, secret: undefined };
|
|
25
|
-
const { sendWebhook } = await import("./webhook.js");
|
|
26
|
-
await sendWebhook([issue], noSecretChannel);
|
|
27
|
-
expect(mockFetch.mock.calls[0][1].headers["Authorization"]).toBeUndefined();
|
|
28
|
-
});
|
|
29
|
-
it("includes cluster, timestamp, and issues in payload", async () => {
|
|
30
|
-
const { sendWebhook } = await import("./webhook.js");
|
|
31
|
-
await sendWebhook([issue], channel, "hetzner-prod");
|
|
32
|
-
const body = JSON.parse(mockFetch.mock.calls[0][1].body);
|
|
33
|
-
expect(body.cluster).toBe("hetzner-prod");
|
|
34
|
-
expect(body.issues).toHaveLength(1);
|
|
35
|
-
expect(body.issues[0].kind).toBe("pod_crashloop");
|
|
36
|
-
});
|
|
37
|
-
it("does not throw on non-2xx response", async () => {
|
|
38
|
-
mockFetch.mockResolvedValue({ ok: false, status: 500, statusText: "Error" });
|
|
39
|
-
const { sendWebhook } = await import("./webhook.js");
|
|
40
|
-
await expect(sendWebhook([issue], channel)).resolves.not.toThrow();
|
|
41
|
-
});
|
|
42
|
-
it("does not throw on network error", async () => {
|
|
43
|
-
mockFetch.mockRejectedValue(new Error("network failure"));
|
|
44
|
-
const { sendWebhook } = await import("./webhook.js");
|
|
45
|
-
await expect(sendWebhook([issue], channel)).resolves.not.toThrow();
|
|
46
|
-
});
|
|
47
|
-
it("rejects invalid URL without throwing", async () => {
|
|
48
|
-
const badChannel = { ...channel, url: "not-a-url" };
|
|
49
|
-
const { sendWebhook } = await import("./webhook.js");
|
|
50
|
-
await expect(sendWebhook([issue], badChannel)).resolves.not.toThrow();
|
|
51
|
-
expect(mockFetch).not.toHaveBeenCalled();
|
|
52
|
-
});
|
|
53
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { type KubectlOptions } from "../kubectl.js";
|
|
2
|
-
export interface NodeInfo {
|
|
3
|
-
name: string;
|
|
4
|
-
roles: string[];
|
|
5
|
-
version: string;
|
|
6
|
-
os: string;
|
|
7
|
-
}
|
|
8
|
-
export interface DeploymentInfo {
|
|
9
|
-
name: string;
|
|
10
|
-
namespace: string;
|
|
11
|
-
replicas: number;
|
|
12
|
-
image: string;
|
|
13
|
-
}
|
|
14
|
-
export interface StatefulSetInfo {
|
|
15
|
-
name: string;
|
|
16
|
-
namespace: string;
|
|
17
|
-
replicas: number;
|
|
18
|
-
image: string;
|
|
19
|
-
}
|
|
20
|
-
export interface ServiceInfo {
|
|
21
|
-
name: string;
|
|
22
|
-
namespace: string;
|
|
23
|
-
type: string;
|
|
24
|
-
ports: string;
|
|
25
|
-
}
|
|
26
|
-
export interface IngressInfo {
|
|
27
|
-
name: string;
|
|
28
|
-
namespace: string;
|
|
29
|
-
hosts: string[];
|
|
30
|
-
tls: boolean;
|
|
31
|
-
}
|
|
32
|
-
export interface ClusterInfo {
|
|
33
|
-
context: string;
|
|
34
|
-
nodes: NodeInfo[];
|
|
35
|
-
namespaces: string[];
|
|
36
|
-
deployments: DeploymentInfo[];
|
|
37
|
-
statefulsets: StatefulSetInfo[];
|
|
38
|
-
services: ServiceInfo[];
|
|
39
|
-
ingresses: IngressInfo[];
|
|
40
|
-
}
|
|
41
|
-
export declare function scanCluster(options: KubectlOptions, onProgress?: (step: string) => void): Promise<ClusterInfo>;
|
|
42
|
-
export declare function formatClusterMarkdown(info: ClusterInfo): string;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export interface TechStack {
|
|
2
|
-
language: string;
|
|
3
|
-
framework: string;
|
|
4
|
-
runtimeVersion: string;
|
|
5
|
-
dependencies: string[];
|
|
6
|
-
buildTool: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function detectTechStack(codePath: string): TechStack;
|
|
9
|
-
export declare function formatProjectMarkdown(projectName: string, codePath: string, stack: TechStack, extraNotes?: string): string;
|
package/dist/onboard/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ClusterInfo } from "./cluster-scan.js";
|
|
2
|
-
import type { TechStack } from "./code-scan.js";
|
|
3
|
-
interface InterviewContext {
|
|
4
|
-
cluster: ClusterInfo;
|
|
5
|
-
projects: Array<{
|
|
6
|
-
name: string;
|
|
7
|
-
path: string;
|
|
8
|
-
stack: TechStack;
|
|
9
|
-
}>;
|
|
10
|
-
}
|
|
11
|
-
export declare function runInterview(context: InterviewContext): Promise<Map<string, string>>;
|
|
12
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type TechStack } from "./code-scan.js";
|
|
2
|
-
import type { DeploymentInfo, StatefulSetInfo } from "./cluster-scan.js";
|
|
3
|
-
export interface ProjectCandidate {
|
|
4
|
-
dir: string;
|
|
5
|
-
name: string;
|
|
6
|
-
stack: TechStack;
|
|
7
|
-
packageName?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface WorkloadRef {
|
|
10
|
-
name: string;
|
|
11
|
-
namespace: string;
|
|
12
|
-
image: string;
|
|
13
|
-
kind: "Deployment" | "StatefulSet";
|
|
14
|
-
}
|
|
15
|
-
export interface MatchSuggestion {
|
|
16
|
-
project: ProjectCandidate;
|
|
17
|
-
workload: WorkloadRef;
|
|
18
|
-
score: number;
|
|
19
|
-
reasons: string[];
|
|
20
|
-
}
|
|
21
|
-
/** Scan a parent directory and return all subdirectories that look like code projects. */
|
|
22
|
-
export declare function scanProjectDirectory(parentDir: string): ProjectCandidate[];
|
|
23
|
-
export declare function matchProjectsToWorkloads(projects: ProjectCandidate[], deployments: DeploymentInfo[], statefulsets: StatefulSetInfo[]): MatchSuggestion[];
|
|
24
|
-
/** For each project, return only its best-matching workload (if score ≥ threshold). */
|
|
25
|
-
export declare function bestMatches(suggestions: MatchSuggestion[], threshold?: number): MatchSuggestion[];
|
package/dist/orchestrator.d.ts
DELETED
package/dist/proxy-client.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { AuthState } from "./auth.js";
|
|
2
|
-
import type { V1MessagesRequest, V1MessagesResponse } from "@kubeagent/shared/v1-messages.js";
|
|
3
|
-
export declare function proxyRequest(auth: AuthState, body: V1MessagesRequest): Promise<V1MessagesResponse>;
|
|
4
|
-
export declare function fetchSlackWebhook(auth: AuthState): Promise<{
|
|
5
|
-
connected: boolean;
|
|
6
|
-
webhookUrl?: string;
|
|
7
|
-
channelName?: string;
|
|
8
|
-
teamName?: string;
|
|
9
|
-
}>;
|
|
10
|
-
export declare function reportIncident(auth: AuthState, incident: {
|
|
11
|
-
clusterContext: string;
|
|
12
|
-
issues: string;
|
|
13
|
-
analysis: string;
|
|
14
|
-
actionTaken?: string;
|
|
15
|
-
verified?: boolean;
|
|
16
|
-
}): Promise<void>;
|
|
17
|
-
export declare function registerWebhook(auth: AuthState, url: string, label: string | undefined, severity: string): Promise<{
|
|
18
|
-
secret?: string;
|
|
19
|
-
}>;
|
|
20
|
-
export declare function notifyViaServer(auth: AuthState, issues: Array<{
|
|
21
|
-
kind: string;
|
|
22
|
-
severity: string;
|
|
23
|
-
message: string;
|
|
24
|
-
namespace?: string;
|
|
25
|
-
resource?: string;
|
|
26
|
-
}>, clusterContext?: string): Promise<void>;
|
|
27
|
-
export declare function pingWatchCycle(auth: AuthState): Promise<void>;
|
package/dist/render.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function renderMarkdown(text: string): string;
|
|
2
|
-
/** Print a labelled section divider: ── Label ──────────── */
|
|
3
|
-
export declare function sectionHeader(label: string, color?: import("chalk").ChalkInstance): void;
|
|
4
|
-
/** Print a two-line command approval box. */
|
|
5
|
-
export declare function commandBox(cmd: string): void;
|
package/dist/telemetry.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function sendTelemetry(cliVersion: string): void;
|
package/dist/telemetry.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/telemetry.test.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { homedir } from "node:os";
|
|
4
|
-
const TELEMETRY_DIR = join(homedir(), ".kubeagent");
|
|
5
|
-
const SENT_FILE = join(TELEMETRY_DIR, ".telemetry-sent");
|
|
6
|
-
describe("sendTelemetry", () => {
|
|
7
|
-
it("module exports sendTelemetry function", async () => {
|
|
8
|
-
const mod = await import("./telemetry.js");
|
|
9
|
-
expect(typeof mod.sendTelemetry).toBe("function");
|
|
10
|
-
});
|
|
11
|
-
it("does not throw when called", async () => {
|
|
12
|
-
// If marker file already exists from a real run, this just returns early.
|
|
13
|
-
// If not, it fires a fetch that will fail silently (no server).
|
|
14
|
-
// Either way it should not throw.
|
|
15
|
-
const { sendTelemetry } = await import("./telemetry.js");
|
|
16
|
-
expect(() => sendTelemetry("0.0.0-test")).not.toThrow();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function checkForUpdate(): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
2
|
-
// Mock chalk to return plain strings
|
|
3
|
-
vi.mock("chalk", () => {
|
|
4
|
-
const identity = (s) => s;
|
|
5
|
-
const handler = {
|
|
6
|
-
get: () => new Proxy(identity, handler),
|
|
7
|
-
apply: (_t, _this, args) => args[0],
|
|
8
|
-
};
|
|
9
|
-
return { default: new Proxy(identity, handler) };
|
|
10
|
-
});
|
|
11
|
-
describe("update-notifier", () => {
|
|
12
|
-
let originalFetch;
|
|
13
|
-
beforeEach(() => {
|
|
14
|
-
originalFetch = globalThis.fetch;
|
|
15
|
-
});
|
|
16
|
-
afterEach(() => {
|
|
17
|
-
globalThis.fetch = originalFetch;
|
|
18
|
-
vi.restoreAllMocks();
|
|
19
|
-
});
|
|
20
|
-
it("prints update message when newer version exists", async () => {
|
|
21
|
-
globalThis.fetch = vi.fn().mockResolvedValue({
|
|
22
|
-
ok: true,
|
|
23
|
-
json: () => Promise.resolve({ version: "99.0.0" }),
|
|
24
|
-
});
|
|
25
|
-
const spy = vi.spyOn(console, "log").mockImplementation(() => { });
|
|
26
|
-
const { checkForUpdate } = await import("./update-notifier.js");
|
|
27
|
-
await checkForUpdate();
|
|
28
|
-
expect(spy).toHaveBeenCalled();
|
|
29
|
-
const output = spy.mock.calls.map((c) => c.join(" ")).join("\n");
|
|
30
|
-
expect(output).toContain("Update available");
|
|
31
|
-
expect(output).toContain("99.0.0");
|
|
32
|
-
});
|
|
33
|
-
it("prints nothing when already up to date", async () => {
|
|
34
|
-
globalThis.fetch = vi.fn().mockResolvedValue({
|
|
35
|
-
ok: true,
|
|
36
|
-
json: () => Promise.resolve({ version: "0.0.1" }),
|
|
37
|
-
});
|
|
38
|
-
const spy = vi.spyOn(console, "log").mockImplementation(() => { });
|
|
39
|
-
const { checkForUpdate } = await import("./update-notifier.js");
|
|
40
|
-
await checkForUpdate();
|
|
41
|
-
expect(spy).not.toHaveBeenCalled();
|
|
42
|
-
});
|
|
43
|
-
it("prints nothing on network error", async () => {
|
|
44
|
-
globalThis.fetch = vi.fn().mockRejectedValue(new Error("offline"));
|
|
45
|
-
const spy = vi.spyOn(console, "log").mockImplementation(() => { });
|
|
46
|
-
const { checkForUpdate } = await import("./update-notifier.js");
|
|
47
|
-
await checkForUpdate();
|
|
48
|
-
expect(spy).not.toHaveBeenCalled();
|
|
49
|
-
});
|
|
50
|
-
});
|
package/dist/verifier.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Issue, IssueKind } from "./monitor/types.js";
|
|
2
|
-
import type { KubectlOptions } from "./kubectl.js";
|
|
3
|
-
export interface VerificationResult {
|
|
4
|
-
passed: boolean;
|
|
5
|
-
remainingIssues: Issue[];
|
|
6
|
-
message: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function evaluateResult(currentIssues: Issue[], originalIssueKinds: IssueKind[]): VerificationResult;
|
|
9
|
-
export declare function verify(originalIssueKinds: IssueKind[], kubectlOptions: KubectlOptions, cooldownMs?: number): Promise<VerificationResult>;
|
package/dist/version-check.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare function isBelow(version: string, floor: string): boolean;
|
|
2
|
-
/**
|
|
3
|
-
* Verifies that the running CLI is still supported by the server at
|
|
4
|
-
* `serverUrl`.
|
|
5
|
-
*
|
|
6
|
-
* Behaviour:
|
|
7
|
-
* - Fetches the server's `minSupported` version (cached per-server for 24h).
|
|
8
|
-
* - If the running version is strictly below the floor, prints a mandatory-
|
|
9
|
-
* update message and exits the process with code 1.
|
|
10
|
-
* - On network failure with no cached value, returns silently — we don't
|
|
11
|
-
* want to lock users out when the server is unreachable for transient
|
|
12
|
-
* reasons. A stale cache is preferred over no cache when offline.
|
|
13
|
-
*/
|
|
14
|
-
export declare function enforceMinVersion(currentVersion: string, serverUrl: string): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|