@kaddo/cli 3.103.0 → 3.105.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/dist/chunk-XCTQ5SFK.js +49 -0
- package/dist/core.js +696 -90
- package/dist/index.js +102 -90
- package/dist/ui-4AQHWUC4.js +20 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49,6 +49,52 @@ function join(...parts) {
|
|
|
49
49
|
|
|
50
50
|
// src/commands/init.ts
|
|
51
51
|
import path2 from "path";
|
|
52
|
+
|
|
53
|
+
// src/core/telemetry-consent.ts
|
|
54
|
+
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
55
|
+
var CURRENT_CONSENT_VERSION = 1;
|
|
56
|
+
var DEFERRAL_DURATION_MS = 24 * 60 * 60 * 1e3;
|
|
57
|
+
function getConsentState(config) {
|
|
58
|
+
if (!config) return "unset";
|
|
59
|
+
const t = config.telemetry;
|
|
60
|
+
if (!t) return "unset";
|
|
61
|
+
if (t.consent === "enabled") return "enabled";
|
|
62
|
+
if (t.consent === "disabled") return "disabled";
|
|
63
|
+
if (t.consent === void 0) {
|
|
64
|
+
if (t.enabled === true) return "enabled";
|
|
65
|
+
if (t.enabled === false) return "disabled";
|
|
66
|
+
}
|
|
67
|
+
return "unset";
|
|
68
|
+
}
|
|
69
|
+
function isInteractive() {
|
|
70
|
+
if (process.env.CI) return false;
|
|
71
|
+
if (!process.stdin.isTTY) return false;
|
|
72
|
+
if (!process.stdout.isTTY) return false;
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
function persistConsent(dir, consent) {
|
|
76
|
+
const configPath = join(dir, ".kaddo", "config.yml");
|
|
77
|
+
if (!exists(configPath)) return;
|
|
78
|
+
const raw = readFile(configPath);
|
|
79
|
+
const doc = parseYaml(raw) ?? {};
|
|
80
|
+
const prev = doc.telemetry ?? {};
|
|
81
|
+
delete prev.enabled;
|
|
82
|
+
doc.telemetry = { ...prev, consent, consentVersion: CURRENT_CONSENT_VERSION };
|
|
83
|
+
writeFile(configPath, stringifyYaml(doc));
|
|
84
|
+
}
|
|
85
|
+
async function ensureTelemetryConsent(dir, config) {
|
|
86
|
+
const state = getConsentState(config);
|
|
87
|
+
if (state !== "unset") return;
|
|
88
|
+
if (!isInteractive()) return;
|
|
89
|
+
const { confirm: confirm2 } = await import("./ui-PS2ZLJWL.js");
|
|
90
|
+
const accepted = await confirm2({
|
|
91
|
+
message: "Help improve Kaddo by sharing anonymous usage telemetry?\n Collects: command usage, version, lifecycle events.\n Never collects: source code, knowledge, prompts or PII.\n Change anytime: kaddo telemetry enable/disable",
|
|
92
|
+
initialValue: false
|
|
93
|
+
});
|
|
94
|
+
persistConsent(dir, accepted ? "enabled" : "disabled");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// src/commands/init.ts
|
|
52
98
|
var KADDO_DIR = ".kaddo";
|
|
53
99
|
var ARCH_DIR = "knowledge";
|
|
54
100
|
function inferProjectName(dir) {
|
|
@@ -407,6 +453,15 @@ async function runInit() {
|
|
|
407
453
|
log.success("Created knowledge/delivery/work-items/");
|
|
408
454
|
log.info("Next: run `kaddo scan` to detect your stack.");
|
|
409
455
|
}
|
|
456
|
+
if (isInteractive()) {
|
|
457
|
+
const enableTelemetry = await confirm({
|
|
458
|
+
message: "Help improve Kaddo by sharing anonymous usage telemetry?\n Collects: command usage, version, lifecycle events.\n Never collects: source code, knowledge, prompts or PII.\n Change anytime: kaddo telemetry enable/disable",
|
|
459
|
+
initialValue: false
|
|
460
|
+
});
|
|
461
|
+
persistConsent(dir, enableTelemetry ? "enabled" : "disabled");
|
|
462
|
+
if (enableTelemetry) log.success("Telemetry enabled.");
|
|
463
|
+
else log.info("Telemetry disabled. Change anytime with `kaddo telemetry enable`.");
|
|
464
|
+
}
|
|
410
465
|
outro("Kaddo initialized.");
|
|
411
466
|
}
|
|
412
467
|
|
|
@@ -1125,10 +1180,10 @@ function scan(dir) {
|
|
|
1125
1180
|
}
|
|
1126
1181
|
|
|
1127
1182
|
// src/commands/scan.ts
|
|
1128
|
-
import { parse as
|
|
1183
|
+
import { parse as parseYaml4, stringify as stringifyYaml2 } from "yaml";
|
|
1129
1184
|
|
|
1130
1185
|
// src/core/scan-baseline.ts
|
|
1131
|
-
import { parse as
|
|
1186
|
+
import { parse as parseYaml2 } from "yaml";
|
|
1132
1187
|
var SCAN_BASELINE_VERSION = "1";
|
|
1133
1188
|
var UNKNOWN = "unknown";
|
|
1134
1189
|
function meaningful(...values) {
|
|
@@ -1143,7 +1198,7 @@ function readProjectContext(dir) {
|
|
|
1143
1198
|
const configPath = join(dir, ".kaddo", "config.yml");
|
|
1144
1199
|
if (!exists(configPath)) return context;
|
|
1145
1200
|
try {
|
|
1146
|
-
const config =
|
|
1201
|
+
const config = parseYaml2(readFile(configPath));
|
|
1147
1202
|
const project = config.project ?? {};
|
|
1148
1203
|
const team = config.team ?? {};
|
|
1149
1204
|
if (typeof project.state === "string") context.state = project.state;
|
|
@@ -1240,7 +1295,7 @@ function renderInventory(baseline) {
|
|
|
1240
1295
|
|
|
1241
1296
|
// src/core/config.ts
|
|
1242
1297
|
import { z } from "zod";
|
|
1243
|
-
import { parse as
|
|
1298
|
+
import { parse as parseYaml3 } from "yaml";
|
|
1244
1299
|
var PROJECT_STATES = ["new", "pre-ai", "legacy", "ai-assisted"];
|
|
1245
1300
|
var TEAM_SIZES = ["indie", "small", "medium", "enterprise"];
|
|
1246
1301
|
var REPOSITORY_STRUCTURES = ["monorepo", "multirepo"];
|
|
@@ -1327,7 +1382,7 @@ function loadConfig(dir) {
|
|
|
1327
1382
|
if (!exists(configPath)) return null;
|
|
1328
1383
|
let raw;
|
|
1329
1384
|
try {
|
|
1330
|
-
raw =
|
|
1385
|
+
raw = parseYaml3(readFile(configPath));
|
|
1331
1386
|
} catch (err) {
|
|
1332
1387
|
const detail = err instanceof Error ? err.message : String(err);
|
|
1333
1388
|
throw new ConfigError(`Could not parse .kaddo/config.yml: ${detail}`);
|
|
@@ -1541,7 +1596,7 @@ function updateConfig(dir, result) {
|
|
|
1541
1596
|
if (!exists(configPath)) return;
|
|
1542
1597
|
try {
|
|
1543
1598
|
const raw = readFile(configPath);
|
|
1544
|
-
const config =
|
|
1599
|
+
const config = parseYaml4(raw);
|
|
1545
1600
|
const scanData = {
|
|
1546
1601
|
language: result.language,
|
|
1547
1602
|
framework: result.framework,
|
|
@@ -1556,7 +1611,7 @@ function updateConfig(dir, result) {
|
|
|
1556
1611
|
if (project && Array.isArray(project.domains) && project.domains.length === 0 && result.suggestedDomains.length > 0) {
|
|
1557
1612
|
project.domains = result.suggestedDomains.map((d) => `# ${d}`);
|
|
1558
1613
|
}
|
|
1559
|
-
writeFile(configPath,
|
|
1614
|
+
writeFile(configPath, stringifyYaml2(config));
|
|
1560
1615
|
} catch {
|
|
1561
1616
|
}
|
|
1562
1617
|
}
|
|
@@ -6986,14 +7041,14 @@ function analyzeGuard(touchedFiles, artifacts, silentWithoutOwnership) {
|
|
|
6986
7041
|
}
|
|
6987
7042
|
|
|
6988
7043
|
// src/services/ignore-store.ts
|
|
6989
|
-
import { parse as
|
|
7044
|
+
import { parse as parseYaml5, stringify as stringifyYaml3 } from "yaml";
|
|
6990
7045
|
var IGNORE_FILE = ".kaddo/ignores.yml";
|
|
6991
7046
|
function loadIgnores(dir) {
|
|
6992
7047
|
const path11 = join(dir, IGNORE_FILE);
|
|
6993
7048
|
if (!exists(path11)) return [];
|
|
6994
7049
|
try {
|
|
6995
7050
|
const raw = readFile(path11);
|
|
6996
|
-
const parsed =
|
|
7051
|
+
const parsed = parseYaml5(raw);
|
|
6997
7052
|
return Array.isArray(parsed) ? parsed : [];
|
|
6998
7053
|
} catch {
|
|
6999
7054
|
return [];
|
|
@@ -7008,7 +7063,7 @@ function saveIgnore(dir, entry) {
|
|
|
7008
7063
|
} else {
|
|
7009
7064
|
existing.push(entry);
|
|
7010
7065
|
}
|
|
7011
|
-
writeFile(path11,
|
|
7066
|
+
writeFile(path11, stringifyYaml3(existing));
|
|
7012
7067
|
}
|
|
7013
7068
|
function isIgnored(ignores, artifactId) {
|
|
7014
7069
|
return ignores.find((e) => e.artifact_id === artifactId);
|
|
@@ -7018,12 +7073,12 @@ function removeIgnore(dir, artifactId) {
|
|
|
7018
7073
|
const existing = loadIgnores(dir);
|
|
7019
7074
|
const filtered = existing.filter((e) => e.artifact_id !== artifactId);
|
|
7020
7075
|
if (filtered.length === existing.length) return false;
|
|
7021
|
-
writeFile(path11,
|
|
7076
|
+
writeFile(path11, stringifyYaml3(filtered));
|
|
7022
7077
|
return true;
|
|
7023
7078
|
}
|
|
7024
7079
|
|
|
7025
7080
|
// src/services/mapped-modules.ts
|
|
7026
|
-
import { parse as
|
|
7081
|
+
import { parse as parseYaml6 } from "yaml";
|
|
7027
7082
|
var DESCRIPTOR_PATH = ".kaddo/modules.yml";
|
|
7028
7083
|
function toStringArray(value) {
|
|
7029
7084
|
return Array.isArray(value) ? value.map((v) => String(v)).filter(Boolean) : [];
|
|
@@ -7044,7 +7099,7 @@ function loadMappedModules(dir) {
|
|
|
7044
7099
|
if (!exists(path11)) return [];
|
|
7045
7100
|
let parsed;
|
|
7046
7101
|
try {
|
|
7047
|
-
parsed =
|
|
7102
|
+
parsed = parseYaml6(readFile(path11));
|
|
7048
7103
|
} catch {
|
|
7049
7104
|
return [];
|
|
7050
7105
|
}
|
|
@@ -7086,7 +7141,7 @@ function detectModuleStatus(coreDir, repoPath) {
|
|
|
7086
7141
|
}
|
|
7087
7142
|
let parsed = null;
|
|
7088
7143
|
try {
|
|
7089
|
-
parsed =
|
|
7144
|
+
parsed = parseYaml6(readFile(configPath));
|
|
7090
7145
|
} catch {
|
|
7091
7146
|
}
|
|
7092
7147
|
const project = parsed?.project;
|
|
@@ -7500,7 +7555,7 @@ function analyzeScopeCoverage(artifact, registeredModuleIds, frontendModuleIds)
|
|
|
7500
7555
|
|
|
7501
7556
|
// src/commands/guard.ts
|
|
7502
7557
|
import path4 from "path";
|
|
7503
|
-
import { parse as
|
|
7558
|
+
import { parse as parseYaml8 } from "yaml";
|
|
7504
7559
|
|
|
7505
7560
|
// src/plugins/prisma.ts
|
|
7506
7561
|
var DESTRUCTIVE_SQL = [
|
|
@@ -7645,13 +7700,13 @@ function runPlugins(plugins, touchedFiles, readFile2) {
|
|
|
7645
7700
|
}
|
|
7646
7701
|
|
|
7647
7702
|
// src/services/owners.ts
|
|
7648
|
-
import { parse as
|
|
7703
|
+
import { parse as parseYaml7 } from "yaml";
|
|
7649
7704
|
var CONFIG_PATH = ".kaddo/config.yml";
|
|
7650
7705
|
function loadOwners(dir) {
|
|
7651
7706
|
const configPath = join(dir, CONFIG_PATH);
|
|
7652
7707
|
if (!exists(configPath)) return {};
|
|
7653
7708
|
try {
|
|
7654
|
-
const config =
|
|
7709
|
+
const config = parseYaml7(readFile(configPath));
|
|
7655
7710
|
const raw = config.owners ?? {};
|
|
7656
7711
|
const result = {};
|
|
7657
7712
|
for (const [domain, people] of Object.entries(raw)) {
|
|
@@ -7896,7 +7951,7 @@ function loadConfig2(dir) {
|
|
|
7896
7951
|
const configPath = join(dir, CONFIG_PATH2);
|
|
7897
7952
|
if (!exists(configPath)) return {};
|
|
7898
7953
|
try {
|
|
7899
|
-
return
|
|
7954
|
+
return parseYaml8(readFile(configPath));
|
|
7900
7955
|
} catch {
|
|
7901
7956
|
return {};
|
|
7902
7957
|
}
|
|
@@ -8309,7 +8364,7 @@ function runIgnoreRemove(artifactId) {
|
|
|
8309
8364
|
|
|
8310
8365
|
// src/commands/explain.ts
|
|
8311
8366
|
import matter6 from "gray-matter";
|
|
8312
|
-
import { parse as
|
|
8367
|
+
import { parse as parseYaml13 } from "yaml";
|
|
8313
8368
|
|
|
8314
8369
|
// src/core/delivery-phase.ts
|
|
8315
8370
|
function layer(layers, name) {
|
|
@@ -8503,10 +8558,10 @@ function assessPhase(input) {
|
|
|
8503
8558
|
|
|
8504
8559
|
// src/core/capsule.ts
|
|
8505
8560
|
import matter3 from "gray-matter";
|
|
8506
|
-
import { parse as
|
|
8561
|
+
import { parse as parseYaml11, stringify as stringifyYaml6 } from "yaml";
|
|
8507
8562
|
|
|
8508
8563
|
// src/commands/modules-map.ts
|
|
8509
|
-
import { parse as
|
|
8564
|
+
import { parse as parseYaml10, stringify as stringifyYaml5 } from "yaml";
|
|
8510
8565
|
|
|
8511
8566
|
// src/templates/registry.ts
|
|
8512
8567
|
var QUALITY = "## Quality checklist";
|
|
@@ -10047,7 +10102,7 @@ function getTemplate(id) {
|
|
|
10047
10102
|
|
|
10048
10103
|
// src/commands/modules-discover.ts
|
|
10049
10104
|
import path5 from "path";
|
|
10050
|
-
import { parse as
|
|
10105
|
+
import { parse as parseYaml9, stringify as stringifyYaml4 } from "yaml";
|
|
10051
10106
|
var CONFIG_PATH3 = ".kaddo/config.yml";
|
|
10052
10107
|
var MODULES_YML = ".kaddo/modules.yml";
|
|
10053
10108
|
var MODULES_MD = "knowledge/tech/modules/modules.md";
|
|
@@ -10068,7 +10123,7 @@ function readModulesYml(dir) {
|
|
|
10068
10123
|
const p = join(dir, MODULES_YML);
|
|
10069
10124
|
if (!exists(p)) return { version: 1, system: "", workspace_roots: [".."], modules: [] };
|
|
10070
10125
|
try {
|
|
10071
|
-
const parsed =
|
|
10126
|
+
const parsed = parseYaml9(readFile(p));
|
|
10072
10127
|
return {
|
|
10073
10128
|
version: parsed.version ?? 1,
|
|
10074
10129
|
system: parsed.system ?? "",
|
|
@@ -10080,13 +10135,13 @@ function readModulesYml(dir) {
|
|
|
10080
10135
|
}
|
|
10081
10136
|
}
|
|
10082
10137
|
function writeModulesYml(dir, yml) {
|
|
10083
|
-
writeFile(join(dir, MODULES_YML),
|
|
10138
|
+
writeFile(join(dir, MODULES_YML), stringifyYaml4(yml));
|
|
10084
10139
|
}
|
|
10085
10140
|
function readRepoConfig(repoDir) {
|
|
10086
10141
|
const configPath = join(repoDir, CONFIG_PATH3);
|
|
10087
10142
|
if (!exists(configPath)) return null;
|
|
10088
10143
|
try {
|
|
10089
|
-
return
|
|
10144
|
+
return parseYaml9(readFile(configPath));
|
|
10090
10145
|
} catch {
|
|
10091
10146
|
return null;
|
|
10092
10147
|
}
|
|
@@ -10429,14 +10484,14 @@ function readModulesDescriptor(dir) {
|
|
|
10429
10484
|
const path11 = join(dir, DESCRIPTOR_PATH2);
|
|
10430
10485
|
if (!exists(path11)) return { version: 1, modules: [] };
|
|
10431
10486
|
try {
|
|
10432
|
-
const parsed =
|
|
10487
|
+
const parsed = parseYaml10(readFile(path11));
|
|
10433
10488
|
return { version: parsed.version ?? 1, modules: parsed.modules ?? [] };
|
|
10434
10489
|
} catch {
|
|
10435
10490
|
return { version: 1, modules: [] };
|
|
10436
10491
|
}
|
|
10437
10492
|
}
|
|
10438
10493
|
function writeModulesDescriptor(dir, descriptor) {
|
|
10439
|
-
writeFile(join(dir, DESCRIPTOR_PATH2),
|
|
10494
|
+
writeFile(join(dir, DESCRIPTOR_PATH2), stringifyYaml5(descriptor));
|
|
10440
10495
|
}
|
|
10441
10496
|
function moduleDir(id) {
|
|
10442
10497
|
return `knowledge/tech/modules/${id}`;
|
|
@@ -10775,14 +10830,14 @@ function loadExternalRegistry(dir) {
|
|
|
10775
10830
|
const p = join(dir, EXTERNAL_PATH);
|
|
10776
10831
|
if (!exists(p)) return [];
|
|
10777
10832
|
try {
|
|
10778
|
-
const parsed =
|
|
10833
|
+
const parsed = parseYaml11(readFile(p));
|
|
10779
10834
|
return Array.isArray(parsed?.external) ? parsed.external : [];
|
|
10780
10835
|
} catch {
|
|
10781
10836
|
return [];
|
|
10782
10837
|
}
|
|
10783
10838
|
}
|
|
10784
10839
|
function serializeExternalRegistry(entries) {
|
|
10785
|
-
return
|
|
10840
|
+
return stringifyYaml6({ external: entries });
|
|
10786
10841
|
}
|
|
10787
10842
|
function sectionList(md, title) {
|
|
10788
10843
|
const re = new RegExp(`^##\\s+${title}\\s*$`, "im");
|
|
@@ -12265,7 +12320,7 @@ function buildSharedFileStatuses(statuses) {
|
|
|
12265
12320
|
}
|
|
12266
12321
|
|
|
12267
12322
|
// src/core/next-step.ts
|
|
12268
|
-
import { parse as
|
|
12323
|
+
import { parse as parseYaml12 } from "yaml";
|
|
12269
12324
|
|
|
12270
12325
|
// src/core/decisions.ts
|
|
12271
12326
|
var CANDIDATES_DISCOVERY = "knowledge/tech/discovery/decision-candidates.md";
|
|
@@ -12384,7 +12439,7 @@ function buildDeliveryState(dir) {
|
|
|
12384
12439
|
}
|
|
12385
12440
|
function hasRegisteredModules(modulesYmlPath) {
|
|
12386
12441
|
try {
|
|
12387
|
-
const parsed =
|
|
12442
|
+
const parsed = parseYaml12(readFile(modulesYmlPath));
|
|
12388
12443
|
return Array.isArray(parsed?.modules) && parsed.modules.length > 0;
|
|
12389
12444
|
} catch {
|
|
12390
12445
|
return false;
|
|
@@ -14393,7 +14448,7 @@ function readConfig(dir) {
|
|
|
14393
14448
|
const configPath = join(dir, CONFIG_PATH5);
|
|
14394
14449
|
if (!exists(configPath)) return {};
|
|
14395
14450
|
try {
|
|
14396
|
-
return
|
|
14451
|
+
return parseYaml13(readFile(configPath));
|
|
14397
14452
|
} catch {
|
|
14398
14453
|
return {};
|
|
14399
14454
|
}
|
|
@@ -15642,7 +15697,7 @@ function renderUnderstandTerminal(plan) {
|
|
|
15642
15697
|
}
|
|
15643
15698
|
|
|
15644
15699
|
// src/core/delivery.ts
|
|
15645
|
-
import { parse as
|
|
15700
|
+
import { parse as parseYaml14 } from "yaml";
|
|
15646
15701
|
function slugify4(s) {
|
|
15647
15702
|
return s.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
15648
15703
|
}
|
|
@@ -16121,14 +16176,14 @@ async function runClassify(opts = {}) {
|
|
|
16121
16176
|
}
|
|
16122
16177
|
|
|
16123
16178
|
// src/commands/status.ts
|
|
16124
|
-
import { parse as
|
|
16179
|
+
import { parse as parseYaml15 } from "yaml";
|
|
16125
16180
|
var ARCH_DIR8 = "knowledge";
|
|
16126
16181
|
var CONFIG_PATH6 = ".kaddo/config.yml";
|
|
16127
16182
|
function loadConfig3(dir) {
|
|
16128
16183
|
const p = join(dir, CONFIG_PATH6);
|
|
16129
16184
|
if (!exists(p)) return {};
|
|
16130
16185
|
try {
|
|
16131
|
-
return
|
|
16186
|
+
return parseYaml15(readFile(p));
|
|
16132
16187
|
} catch {
|
|
16133
16188
|
return {};
|
|
16134
16189
|
}
|
|
@@ -16372,13 +16427,13 @@ function runHistory(opts = {}) {
|
|
|
16372
16427
|
}
|
|
16373
16428
|
|
|
16374
16429
|
// src/commands/add.ts
|
|
16375
|
-
import { parse as
|
|
16430
|
+
import { parse as parseYaml16, stringify as stringifyYaml7 } from "yaml";
|
|
16376
16431
|
var CONFIG_PATH7 = ".kaddo/config.yml";
|
|
16377
16432
|
function readProjectState(dir) {
|
|
16378
16433
|
const configPath = join(dir, CONFIG_PATH7);
|
|
16379
16434
|
if (!exists(configPath)) return void 0;
|
|
16380
16435
|
try {
|
|
16381
|
-
const config =
|
|
16436
|
+
const config = parseYaml16(readFile(configPath));
|
|
16382
16437
|
return config.project?.state;
|
|
16383
16438
|
} catch {
|
|
16384
16439
|
return void 0;
|
|
@@ -16402,12 +16457,12 @@ function markModuleInstalled(dir, configKey, moduleName) {
|
|
|
16402
16457
|
const configPath = join(dir, CONFIG_PATH7);
|
|
16403
16458
|
if (!exists(configPath)) return;
|
|
16404
16459
|
try {
|
|
16405
|
-
const config =
|
|
16460
|
+
const config = parseYaml16(readFile(configPath));
|
|
16406
16461
|
config[configKey] = { installed: true, installed_at: (/* @__PURE__ */ new Date()).toISOString().split("T")[0] };
|
|
16407
16462
|
const modules = config.modules ?? [];
|
|
16408
16463
|
if (!modules.includes(moduleName)) modules.push(moduleName);
|
|
16409
16464
|
config.modules = modules;
|
|
16410
|
-
writeFile(configPath,
|
|
16465
|
+
writeFile(configPath, stringifyYaml7(config));
|
|
16411
16466
|
} catch {
|
|
16412
16467
|
}
|
|
16413
16468
|
}
|
|
@@ -16415,7 +16470,7 @@ function isModuleInstalled(dir, configKey) {
|
|
|
16415
16470
|
const configPath = join(dir, CONFIG_PATH7);
|
|
16416
16471
|
if (!exists(configPath)) return false;
|
|
16417
16472
|
try {
|
|
16418
|
-
const config =
|
|
16473
|
+
const config = parseYaml16(readFile(configPath));
|
|
16419
16474
|
const moduleConfig = config[configKey];
|
|
16420
16475
|
return moduleConfig?.installed === true;
|
|
16421
16476
|
} catch {
|
|
@@ -17452,7 +17507,7 @@ function runGraphExport(opts = {}) {
|
|
|
17452
17507
|
}
|
|
17453
17508
|
|
|
17454
17509
|
// src/core/system-topology.ts
|
|
17455
|
-
import { parse as
|
|
17510
|
+
import { parse as parseYaml17, stringify as stringifyYaml8 } from "yaml";
|
|
17456
17511
|
import fs3 from "fs";
|
|
17457
17512
|
import path7 from "path";
|
|
17458
17513
|
import crypto from "crypto";
|
|
@@ -17499,7 +17554,7 @@ function loadSystemTopology(dir) {
|
|
|
17499
17554
|
function parseTopologyContent(raw, dir) {
|
|
17500
17555
|
let parsed;
|
|
17501
17556
|
try {
|
|
17502
|
-
parsed =
|
|
17557
|
+
parsed = parseYaml17(raw) ?? {};
|
|
17503
17558
|
} catch {
|
|
17504
17559
|
return { entities: [], relationships: [], findings: [{ level: "blocking", message: "The topology could not be parsed." }] };
|
|
17505
17560
|
}
|
|
@@ -17617,7 +17672,7 @@ function serializeTopology(entities, relationships) {
|
|
|
17617
17672
|
})),
|
|
17618
17673
|
relationships: relationships.map((r) => ({ from: r.from, to: r.to, type: r.type, ...r.evidence.length ? { evidence: r.evidence } : {} }))
|
|
17619
17674
|
};
|
|
17620
|
-
return
|
|
17675
|
+
return stringifyYaml8(doc);
|
|
17621
17676
|
}
|
|
17622
17677
|
function atomicWrite(filePath, content) {
|
|
17623
17678
|
fs3.mkdirSync(path7.dirname(filePath), { recursive: true });
|
|
@@ -17734,7 +17789,7 @@ async function runTopologyApply(file, opts = {}) {
|
|
|
17734
17789
|
|
|
17735
17790
|
// src/services/integrations.ts
|
|
17736
17791
|
import matter11 from "gray-matter";
|
|
17737
|
-
import { parse as
|
|
17792
|
+
import { parse as parseYaml18, stringify as stringifyYaml9 } from "yaml";
|
|
17738
17793
|
|
|
17739
17794
|
// src/core/work-item-write.ts
|
|
17740
17795
|
import fs4 from "fs";
|
|
@@ -18798,7 +18853,7 @@ function loadRaw(dir) {
|
|
|
18798
18853
|
const abs = join(dir, INTEGRATIONS_FILE);
|
|
18799
18854
|
if (!exists(abs)) return { integrations: [] };
|
|
18800
18855
|
try {
|
|
18801
|
-
return
|
|
18856
|
+
return parseYaml18(readFile(abs)) ?? { integrations: [] };
|
|
18802
18857
|
} catch {
|
|
18803
18858
|
return { integrations: [] };
|
|
18804
18859
|
}
|
|
@@ -19570,7 +19625,7 @@ function runReportImpact(opts = {}) {
|
|
|
19570
19625
|
}
|
|
19571
19626
|
|
|
19572
19627
|
// src/core/savings.ts
|
|
19573
|
-
import { parse as
|
|
19628
|
+
import { parse as parseYaml19 } from "yaml";
|
|
19574
19629
|
var DEFAULT_ASSUMPTIONS = {
|
|
19575
19630
|
currency: "USD",
|
|
19576
19631
|
hourly_cost: 40,
|
|
@@ -19588,7 +19643,7 @@ function loadAssumptions(dir) {
|
|
|
19588
19643
|
const p = join(dir, SAVINGS_PATH);
|
|
19589
19644
|
if (!exists(p)) return { assumptions: { ...DEFAULT_ASSUMPTIONS }, source: "default" };
|
|
19590
19645
|
try {
|
|
19591
|
-
const raw =
|
|
19646
|
+
const raw = parseYaml19(readFile(p));
|
|
19592
19647
|
const a = raw?.assumptions ?? {};
|
|
19593
19648
|
const t = raw?.team ?? {};
|
|
19594
19649
|
const num = (v, d) => typeof v === "number" && Number.isFinite(v) ? v : d;
|
|
@@ -22068,49 +22123,6 @@ function bufferSize(dir) {
|
|
|
22068
22123
|
return readBuffer(dir).length;
|
|
22069
22124
|
}
|
|
22070
22125
|
|
|
22071
|
-
// src/core/telemetry-consent.ts
|
|
22072
|
-
import { parse as parseYaml19, stringify as stringifyYaml9 } from "yaml";
|
|
22073
|
-
var CURRENT_CONSENT_VERSION = 1;
|
|
22074
|
-
function getConsentState(config) {
|
|
22075
|
-
if (!config) return "unset";
|
|
22076
|
-
const t = config.telemetry;
|
|
22077
|
-
if (!t) return "unset";
|
|
22078
|
-
if (t.consent === "enabled") return "enabled";
|
|
22079
|
-
if (t.consent === "disabled") return "disabled";
|
|
22080
|
-
if (t.consent === void 0) {
|
|
22081
|
-
if (t.enabled === true) return "enabled";
|
|
22082
|
-
if (t.enabled === false) return "disabled";
|
|
22083
|
-
}
|
|
22084
|
-
return "unset";
|
|
22085
|
-
}
|
|
22086
|
-
function isInteractive() {
|
|
22087
|
-
if (process.env.CI) return false;
|
|
22088
|
-
if (!process.stdin.isTTY) return false;
|
|
22089
|
-
if (!process.stdout.isTTY) return false;
|
|
22090
|
-
return true;
|
|
22091
|
-
}
|
|
22092
|
-
function persistConsent(dir, consent) {
|
|
22093
|
-
const configPath = join(dir, ".kaddo", "config.yml");
|
|
22094
|
-
if (!exists(configPath)) return;
|
|
22095
|
-
const raw = readFile(configPath);
|
|
22096
|
-
const doc = parseYaml19(raw) ?? {};
|
|
22097
|
-
const prev = doc.telemetry ?? {};
|
|
22098
|
-
delete prev.enabled;
|
|
22099
|
-
doc.telemetry = { ...prev, consent, consentVersion: CURRENT_CONSENT_VERSION };
|
|
22100
|
-
writeFile(configPath, stringifyYaml9(doc));
|
|
22101
|
-
}
|
|
22102
|
-
async function ensureTelemetryConsent(dir, config) {
|
|
22103
|
-
const state = getConsentState(config);
|
|
22104
|
-
if (state !== "unset") return;
|
|
22105
|
-
if (!isInteractive()) return;
|
|
22106
|
-
const { confirm: confirm2 } = await import("./ui-PS2ZLJWL.js");
|
|
22107
|
-
const accepted = await confirm2({
|
|
22108
|
-
message: "Help improve Kaddo by sharing anonymous usage telemetry?\n Collects: command usage, version, lifecycle events.\n Never collects: source code, knowledge, prompts or PII.\n Change anytime: kaddo telemetry enable/disable",
|
|
22109
|
-
initialValue: false
|
|
22110
|
-
});
|
|
22111
|
-
persistConsent(dir, accepted ? "enabled" : "disabled");
|
|
22112
|
-
}
|
|
22113
|
-
|
|
22114
22126
|
// src/core/telemetry.ts
|
|
22115
22127
|
var TELEMETRY_ENDPOINT = "https://telemetry.kaddo.org";
|
|
22116
22128
|
var EVENTS_PATH = "/v1/events";
|