karajan-code 2.34.0 → 3.0.0
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 +118 -36
- package/bin/kj-rag-mcp.js +75 -0
- package/docs/README.es.md +4 -4
- package/package.json +20 -16
- package/packages/hu-board/package.json +5 -2
- package/src/audit/deterministic-summary.js +20 -0
- package/src/audit/injection-findings.js +105 -0
- package/src/checks/hardware.js +150 -0
- package/src/checks/node.js +9 -10
- package/src/cli/register-meta.js +33 -0
- package/src/commands/doctor.js +2 -0
- package/src/commands/init.js +41 -1
- package/src/commands/rag-mcp.js +18 -0
- package/src/commands/telemetry.js +70 -0
- package/src/config/defaults.js +4 -1
- package/src/orchestrator/stages/coder-stage.js +3 -0
- package/src/orchestrator/stages/reviewer-stage.js +11 -0
- package/src/roles/audit-role.js +9 -1
- package/src/sonar/scanner.js +51 -16
- package/src/utils/quota-simulator.js +56 -0
- package/src/utils/telemetry.js +34 -12
package/src/utils/telemetry.js
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
const TELEMETRY_ENDPOINT = "https://karajan-code.web.app/api/telemetry";
|
|
1
|
+
export const TELEMETRY_ENDPOINT = "https://karajan-code.web.app/api/telemetry";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Build the exact JSON payload that would be POSTed for an event.
|
|
5
|
+
* Pure function: deterministic given (eventName, data) — exposed so
|
|
6
|
+
* `kj telemetry preview` can render the literal bytes the backend
|
|
7
|
+
* receives without performing any network call.
|
|
8
|
+
*
|
|
9
|
+
* The `data.version` field is folded into `v`; the rest of the
|
|
10
|
+
* event-specific keys ride through `...data` after the common ones,
|
|
11
|
+
* matching the order sent over the wire.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} eventName
|
|
14
|
+
* @param {object} [data]
|
|
15
|
+
* @returns {object}
|
|
16
|
+
*/
|
|
17
|
+
export function buildTelemetryPayload(eventName, data = {}) {
|
|
18
|
+
const { version, ...rest } = data;
|
|
19
|
+
return {
|
|
20
|
+
event: eventName,
|
|
21
|
+
v: version || "unknown",
|
|
22
|
+
os: process.platform,
|
|
23
|
+
node: process.version,
|
|
24
|
+
ts: Date.now(),
|
|
25
|
+
...rest
|
|
26
|
+
};
|
|
27
|
+
}
|
|
2
28
|
|
|
3
29
|
/**
|
|
4
30
|
* Send an anonymous telemetry event. Non-blocking, fire-and-forget.
|
|
@@ -12,14 +38,7 @@ export async function sendTelemetryEvent(eventName, data, config) {
|
|
|
12
38
|
if (!isTelemetryEnabled(config)) return;
|
|
13
39
|
|
|
14
40
|
try {
|
|
15
|
-
const payload =
|
|
16
|
-
event: eventName,
|
|
17
|
-
v: data.version || "unknown",
|
|
18
|
-
os: process.platform,
|
|
19
|
-
node: process.version,
|
|
20
|
-
ts: Date.now(),
|
|
21
|
-
...data
|
|
22
|
-
};
|
|
41
|
+
const payload = buildTelemetryPayload(eventName, data);
|
|
23
42
|
const controller = new AbortController();
|
|
24
43
|
const timeout = setTimeout(() => controller.abort(), 3000);
|
|
25
44
|
try {
|
|
@@ -48,12 +67,15 @@ export async function sendTelemetryEvent(eventName, data, config) {
|
|
|
48
67
|
}
|
|
49
68
|
|
|
50
69
|
/**
|
|
51
|
-
* Check if telemetry is enabled (opt-
|
|
52
|
-
*
|
|
70
|
+
* Check if telemetry is enabled (opt-in model).
|
|
71
|
+
*
|
|
72
|
+
* Returns true ONLY when the user explicitly answered "yes" in the
|
|
73
|
+
* `kj init` wizard and we persisted `telemetry: true` to their config.
|
|
74
|
+
* Anything else — undefined, null, missing key, false — disables sending.
|
|
53
75
|
*
|
|
54
76
|
* @param {object} [config] - Karajan config
|
|
55
77
|
* @returns {boolean}
|
|
56
78
|
*/
|
|
57
79
|
export function isTelemetryEnabled(config) {
|
|
58
|
-
return config?.telemetry
|
|
80
|
+
return config?.telemetry === true;
|
|
59
81
|
}
|