@kaddo/cli 3.103.0 → 3.104.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.
@@ -0,0 +1,49 @@
1
+ // src/utils/ui.ts
2
+ import * as p from "@clack/prompts";
3
+ var intro2 = (title) => p.intro(title);
4
+ var outro2 = (msg) => p.outro(msg);
5
+ var log2 = p.log;
6
+ var cancel2 = (msg) => p.cancel(msg);
7
+ async function text2(opts) {
8
+ const val = await p.text(opts);
9
+ if (p.isCancel(val)) {
10
+ p.cancel("Operation cancelled.");
11
+ process.exit(0);
12
+ }
13
+ return val;
14
+ }
15
+ async function confirm2(opts) {
16
+ const val = await p.confirm(opts);
17
+ if (p.isCancel(val)) {
18
+ p.cancel("Operation cancelled.");
19
+ process.exit(0);
20
+ }
21
+ return val;
22
+ }
23
+ async function select2(opts) {
24
+ const val = await p.select(opts);
25
+ if (p.isCancel(val)) {
26
+ p.cancel("Operation cancelled.");
27
+ process.exit(0);
28
+ }
29
+ return val;
30
+ }
31
+ async function multiselect2(opts) {
32
+ const val = await p.multiselect(opts);
33
+ if (p.isCancel(val)) {
34
+ p.cancel("Operation cancelled.");
35
+ process.exit(0);
36
+ }
37
+ return val;
38
+ }
39
+
40
+ export {
41
+ intro2 as intro,
42
+ outro2 as outro,
43
+ log2 as log,
44
+ cancel2 as cancel,
45
+ text2 as text,
46
+ confirm2 as confirm,
47
+ select2 as select,
48
+ multiselect2 as multiselect
49
+ };
package/dist/core.js CHANGED
@@ -1,11 +1,13 @@
1
+ import "./chunk-XCTQ5SFK.js";
2
+
1
3
  // src/utils/fs.ts
2
4
  import fs from "fs";
3
5
  import path from "path";
4
- function exists(p2) {
5
- return fs.existsSync(p2);
6
+ function exists(p) {
7
+ return fs.existsSync(p);
6
8
  }
7
- function readFile(p2) {
8
- return fs.readFileSync(p2, "utf-8");
9
+ function readFile(p) {
10
+ return fs.readFileSync(p, "utf-8");
9
11
  }
10
12
  function writeFile(filePath, content) {
11
13
  fs.mkdirSync(path.dirname(filePath), { recursive: true });
@@ -15,11 +17,11 @@ function readDir(dirPath) {
15
17
  if (!exists(dirPath)) return [];
16
18
  return fs.readdirSync(dirPath);
17
19
  }
18
- function isFile(p2) {
19
- return exists(p2) && fs.statSync(p2).isFile();
20
+ function isFile(p) {
21
+ return exists(p) && fs.statSync(p).isFile();
20
22
  }
21
- function isDir(p2) {
22
- return exists(p2) && fs.statSync(p2).isDirectory();
23
+ function isDir(p) {
24
+ return exists(p) && fs.statSync(p).isDirectory();
23
25
  }
24
26
  function cwd() {
25
27
  return process.cwd();
@@ -272,8 +274,8 @@ function isActiveState(s) {
272
274
  return ACTIVE_STATES.includes(s);
273
275
  }
274
276
  function lifecycleFolderOf(filePath) {
275
- const p2 = filePath.replace(/\\/g, "/");
276
- const m = p2.match(/\/delivery\/work-items\/([^/]+)\//);
277
+ const p = filePath.replace(/\\/g, "/");
278
+ const m = p.match(/\/delivery\/work-items\/([^/]+)\//);
277
279
  if (m && isLifecycleState(m[1])) return m[1];
278
280
  return null;
279
281
  }
@@ -296,8 +298,8 @@ function lifecycleCounts(states) {
296
298
 
297
299
  // src/services/knowledge-artifacts.ts
298
300
  var ARCH_DIR = "knowledge";
299
- function toPosix(p2) {
300
- return p2.replace(/\\/g, "/");
301
+ function toPosix(p) {
302
+ return p.replace(/\\/g, "/");
301
303
  }
302
304
  function relativeTo(dir, filePath) {
303
305
  const base = toPosix(dir).replace(/\/+$/, "");
@@ -392,9 +394,6 @@ function loadMappedModules(dir) {
392
394
  return modules;
393
395
  }
394
396
 
395
- // src/utils/ui.ts
396
- import * as p from "@clack/prompts";
397
-
398
397
  // src/commands/modules-map.ts
399
398
  import { parse as parseYaml5, stringify as stringifyYaml2 } from "yaml";
400
399
 
@@ -1565,10 +1564,10 @@ import { parse as parseYaml4, stringify as stringifyYaml } from "yaml";
1565
1564
  // src/core/capsule.ts
1566
1565
  var EXTERNAL_PATH = ".kaddo/external.yml";
1567
1566
  function loadExternalRegistry(dir) {
1568
- const p2 = join(dir, EXTERNAL_PATH);
1569
- if (!exists(p2)) return [];
1567
+ const p = join(dir, EXTERNAL_PATH);
1568
+ if (!exists(p)) return [];
1570
1569
  try {
1571
- const parsed = parseYaml6(readFile(p2));
1570
+ const parsed = parseYaml6(readFile(p));
1572
1571
  return Array.isArray(parsed?.external) ? parsed.external : [];
1573
1572
  } catch {
1574
1573
  return [];
@@ -1640,8 +1639,8 @@ var ALL_STATUSES = ["draft", "ready", "in-progress", "blocked", "completed"];
1640
1639
  function scopeStatuses(scope) {
1641
1640
  return scope === "all" ? { included: ALL_STATUSES, excluded: ["archived"] } : { included: ACTIVE_STATUSES, excluded: ["completed", "archived"] };
1642
1641
  }
1643
- function toPosix2(p2) {
1644
- return p2.replace(/\\/g, "/");
1642
+ function toPosix2(p) {
1643
+ return p.replace(/\\/g, "/");
1645
1644
  }
1646
1645
  function slug(s) {
1647
1646
  return s.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
@@ -1780,10 +1779,10 @@ function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
1780
1779
  }
1781
1780
  var ACTIVE_WI_STATES = /* @__PURE__ */ new Set(["draft", "ready", "in-progress", "blocked"]);
1782
1781
  function loadGraphSummary(dir) {
1783
- const p2 = join(dir, ".kaddo", "graph.json");
1784
- if (!exists(p2)) return null;
1782
+ const p = join(dir, ".kaddo", "graph.json");
1783
+ if (!exists(p)) return null;
1785
1784
  try {
1786
- const graph = JSON.parse(readFile(p2));
1785
+ const graph = JSON.parse(readFile(p));
1787
1786
  const nodes = Array.isArray(graph.nodes) ? graph.nodes : [];
1788
1787
  const edges = Array.isArray(graph.edges) ? graph.edges : [];
1789
1788
  const activeWiIds = new Set(
@@ -1810,8 +1809,8 @@ function loadGraphSummary(dir) {
1810
1809
 
1811
1810
  // src/core/graph-hints.ts
1812
1811
  var KNOWLEDGE3 = "knowledge";
1813
- function toPosix3(p2) {
1814
- return p2.replace(/\\/g, "/");
1812
+ function toPosix3(p) {
1813
+ return p.replace(/\\/g, "/");
1815
1814
  }
1816
1815
  function slug2(s) {
1817
1816
  return s.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
@@ -1820,9 +1819,9 @@ function isAdr2(a) {
1820
1819
  return toPosix3(a.filePath).includes("/tech/decisions/") && Boolean(a.type);
1821
1820
  }
1822
1821
  function capabilityHeadings(dir) {
1823
- const p2 = join(dir, KNOWLEDGE3, "product", "capabilities.md");
1824
- if (!exists(p2)) return [];
1825
- return readFile(p2).split(/\r?\n/).map((l) => l.match(/^#{2,3}\s+(.+?)\s*$/)).filter((m) => Boolean(m)).map((m) => m[1].trim()).filter((h) => !/^(summary|resumen|overview|capabilities|capacidades)$/i.test(h));
1822
+ const p = join(dir, KNOWLEDGE3, "product", "capabilities.md");
1823
+ if (!exists(p)) return [];
1824
+ return readFile(p).split(/\r?\n/).map((l) => l.match(/^#{2,3}\s+(.+?)\s*$/)).filter((m) => Boolean(m)).map((m) => m[1].trim()).filter((h) => !/^(summary|resumen|overview|capabilities|capacidades)$/i.test(h));
1826
1825
  }
1827
1826
  function humanMissing(field) {
1828
1827
  switch (field) {
@@ -1965,10 +1964,10 @@ function assessQuality(nodes, relationshipEdges, hintCount) {
1965
1964
  return "good";
1966
1965
  }
1967
1966
  function loadGraphHints(dir) {
1968
- const p2 = join(dir, ".kaddo", "graph-hints.json");
1969
- if (!exists(p2)) return null;
1967
+ const p = join(dir, ".kaddo", "graph-hints.json");
1968
+ if (!exists(p)) return null;
1970
1969
  try {
1971
- const report = JSON.parse(readFile(p2));
1970
+ const report = JSON.parse(readFile(p));
1972
1971
  const hints = Array.isArray(report.hints) ? report.hints : [];
1973
1972
  return {
1974
1973
  scope: String(report.scope ?? "active"),
@@ -2057,15 +2056,15 @@ function layerForType(type) {
2057
2056
  return null;
2058
2057
  }
2059
2058
  function layerFromPath(filePath) {
2060
- const p2 = filePath.replace(/\\/g, "/");
2061
- if (p2.includes(`/${KNOWLEDGE4}/business/`)) return "Business";
2062
- if (p2.includes(`/${KNOWLEDGE4}/product/`)) return "Product";
2063
- if (p2.includes(`/${KNOWLEDGE4}/tech/`)) return "Tech";
2064
- if (p2.includes(`/${KNOWLEDGE4}/delivery/`)) return "Delivery";
2059
+ const p = filePath.replace(/\\/g, "/");
2060
+ if (p.includes(`/${KNOWLEDGE4}/business/`)) return "Business";
2061
+ if (p.includes(`/${KNOWLEDGE4}/product/`)) return "Product";
2062
+ if (p.includes(`/${KNOWLEDGE4}/tech/`)) return "Tech";
2063
+ if (p.includes(`/${KNOWLEDGE4}/delivery/`)) return "Delivery";
2065
2064
  return null;
2066
2065
  }
2067
- function basename(p2) {
2068
- return p2.replace(/\\/g, "/").split("/").pop() ?? p2;
2066
+ function basename(p) {
2067
+ return p.replace(/\\/g, "/").split("/").pop() ?? p;
2069
2068
  }
2070
2069
  function discoverLayers(dir) {
2071
2070
  const acc = {
@@ -2195,10 +2194,10 @@ function analyzeContent(md) {
2195
2194
  return "weak";
2196
2195
  }
2197
2196
  function analyzeKnowledgeArtifact(dir, rel) {
2198
- const p2 = join(dir, rel);
2199
- if (!exists(p2)) return "missing";
2197
+ const p = join(dir, rel);
2198
+ if (!exists(p)) return "missing";
2200
2199
  try {
2201
- return analyzeContent(readFile(p2));
2200
+ return analyzeContent(readFile(p));
2202
2201
  } catch {
2203
2202
  return "missing";
2204
2203
  }
@@ -2393,10 +2392,10 @@ function splitRow(line) {
2393
2392
  function isSeparatorRow(cells) {
2394
2393
  return cells.length > 0 && cells.every((c) => SEPARATOR_CELL_RE.test(c) || c === "");
2395
2394
  }
2396
- function initiativeFromHeading(text3) {
2397
- const rm = text3.match(/^(RM-[\w.-]+)\s*[:\-–]?\s*(.*)$/);
2395
+ function initiativeFromHeading(text2) {
2396
+ const rm = text2.match(/^(RM-[\w.-]+)\s*[:\-–]?\s*(.*)$/);
2398
2397
  if (rm) return { id: rm[1], title: rm[2].trim() || void 0 };
2399
- return { title: text3.trim() || void 0 };
2398
+ return { title: text2.trim() || void 0 };
2400
2399
  }
2401
2400
  function extractDeps(cell) {
2402
2401
  if (!cell) return void 0;
@@ -2582,8 +2581,8 @@ var IMPORTANT = [
2582
2581
  "permis",
2583
2582
  "permission"
2584
2583
  ];
2585
- function matchesAny(text3, keywords) {
2586
- return keywords.some((k) => text3.includes(k));
2584
+ function matchesAny(text2, keywords) {
2585
+ return keywords.some((k) => text2.includes(k));
2587
2586
  }
2588
2587
  function classifyQuestion(question) {
2589
2588
  const t = question.toLowerCase();
@@ -2615,8 +2614,8 @@ function extractFromMarkdown(md) {
2615
2614
  if (m) {
2616
2615
  const bullet = m[1].trim();
2617
2616
  if (!bullet || /^_.*_$/.test(bullet)) continue;
2618
- const { text: text3, resolution_status } = parseResolution(bullet);
2619
- if (text3) out.push({ text: text3, resolution_status, line: i + 1, raw: line.trim() });
2617
+ const { text: text2, resolution_status } = parseResolution(bullet);
2618
+ if (text2) out.push({ text: text2, resolution_status, line: i + 1, raw: line.trim() });
2620
2619
  }
2621
2620
  }
2622
2621
  return out;
@@ -2642,11 +2641,11 @@ function buildOpenQuestionsReport(dir, now = /* @__PURE__ */ new Date()) {
2642
2641
  const questions = [];
2643
2642
  let seq = 0;
2644
2643
  for (const source of SOURCES) {
2645
- const p2 = join(dir, source);
2646
- if (!exists(p2)) continue;
2644
+ const p = join(dir, source);
2645
+ if (!exists(p)) continue;
2647
2646
  let md;
2648
2647
  try {
2649
- md = readFile(p2);
2648
+ md = readFile(p);
2650
2649
  } catch {
2651
2650
  continue;
2652
2651
  }
@@ -2758,7 +2757,7 @@ function buildCodexAdapterContext(dir) {
2758
2757
  hasSkills: skills.length > 0,
2759
2758
  skills,
2760
2759
  hasMcpHint: detectMcpHint(dir),
2761
- knowledgePaths: KNOWLEDGE_PATHS.filter((p2) => exists(join(dir, p2))),
2760
+ knowledgePaths: KNOWLEDGE_PATHS.filter((p) => exists(join(dir, p))),
2762
2761
  generatedPaths: GENERATED_PATHS
2763
2762
  };
2764
2763
  }
@@ -3019,19 +3018,19 @@ function hasRegisteredModules(modulesYmlPath) {
3019
3018
  return false;
3020
3019
  }
3021
3020
  }
3022
- function safeRead(p2) {
3021
+ function safeRead(p) {
3023
3022
  try {
3024
- return readFile(p2);
3023
+ return readFile(p);
3025
3024
  } catch {
3026
3025
  return null;
3027
3026
  }
3028
3027
  }
3029
3028
  function roadmapSignal(dir) {
3030
- const p2 = join(dir, "knowledge/delivery/roadmap.md");
3031
- if (!exists(p2)) return "missing";
3029
+ const p = join(dir, "knowledge/delivery/roadmap.md");
3030
+ if (!exists(p)) return "missing";
3032
3031
  let md;
3033
3032
  try {
3034
- md = readFile(p2);
3033
+ md = readFile(p);
3035
3034
  } catch {
3036
3035
  return "missing";
3037
3036
  }
@@ -6561,7 +6560,7 @@ var AGENT_PROMPTS = [
6561
6560
  // Graph relationship quality (metadata hints → precise front matter — VS-056)
6562
6561
  { fileName: "graph-agent.md", content: GRAPH_AGENT }
6563
6562
  // Every official prompt ends with its responsibility boundaries + Agent Trace footer.
6564
- ].map((p2) => ({ fileName: p2.fileName, content: withResponsibilityTrace(p2.fileName, p2.content) }));
6563
+ ].map((p) => ({ fileName: p.fileName, content: withResponsibilityTrace(p.fileName, p.content) }));
6565
6564
 
6566
6565
  // src/modules/agents.ts
6567
6566
  function withAgentFrontMatter(fileName, content) {
@@ -6813,10 +6812,10 @@ function parseRoadmapCandidateQuality(md) {
6813
6812
  }
6814
6813
  function buildRoadmapQuality(dir) {
6815
6814
  let md = "";
6816
- const p2 = join(dir, ROADMAP_PATH);
6817
- if (exists(p2)) {
6815
+ const p = join(dir, ROADMAP_PATH);
6816
+ if (exists(p)) {
6818
6817
  try {
6819
- md = readFile(p2);
6818
+ md = readFile(p);
6820
6819
  } catch {
6821
6820
  md = "";
6822
6821
  }
@@ -7417,11 +7416,11 @@ function analyzeMetadataHealth(dir) {
7417
7416
  let healthy = 0;
7418
7417
  let drifted = 0;
7419
7418
  for (const rel of KNOWLEDGE_FILES2) {
7420
- const p2 = join(dir, rel);
7421
- if (!exists(p2)) continue;
7419
+ const p = join(dir, rel);
7420
+ if (!exists(p)) continue;
7422
7421
  let data;
7423
7422
  try {
7424
- const raw = readFile(p2);
7423
+ const raw = readFile(p);
7425
7424
  data = matter5(raw).data;
7426
7425
  } catch {
7427
7426
  continue;
@@ -7450,13 +7449,13 @@ function analyzeMetadataHealth(dir) {
7450
7449
  if (exists(wiDir)) {
7451
7450
  const walkWIs = (d) => {
7452
7451
  for (const entry of readDir(d)) {
7453
- const p2 = join(d, entry);
7454
- if (isFile(p2) && entry.endsWith(".md")) {
7452
+ const p = join(d, entry);
7453
+ if (isFile(p) && entry.endsWith(".md")) {
7455
7454
  try {
7456
- const raw = readFile(p2);
7455
+ const raw = readFile(p);
7457
7456
  const fm = matter5(raw).data;
7458
7457
  if (fm.status === "done") {
7459
- const rel = p2.replace(dir + "/", "").replace(dir + "\\", "").replace(/\\/g, "/");
7458
+ const rel = p.replace(dir + "/", "").replace(dir + "\\", "").replace(/\\/g, "/");
7460
7459
  findings.push({
7461
7460
  file: rel,
7462
7461
  field: "status",
@@ -7466,8 +7465,8 @@ function analyzeMetadataHealth(dir) {
7466
7465
  }
7467
7466
  } catch {
7468
7467
  }
7469
- } else if (!isFile(p2) && !entry.startsWith(".")) {
7470
- walkWIs(p2);
7468
+ } else if (!isFile(p) && !entry.startsWith(".")) {
7469
+ walkWIs(p);
7471
7470
  }
7472
7471
  }
7473
7472
  };
@@ -8086,8 +8085,8 @@ var TECHNICAL_RELATIONSHIP_TYPES = /* @__PURE__ */ new Set([
8086
8085
  "implemented-by"
8087
8086
  ]);
8088
8087
  var PROVENANCE = /* @__PURE__ */ new Set(["declared", "derived", "agent-reviewed"]);
8089
- function isRelative(p2) {
8090
- return typeof p2 === "string" && p2.trim() !== "" && !/^([a-zA-Z]:[\\/]|\/)/.test(p2) && !p2.includes("..");
8088
+ function isRelative(p) {
8089
+ return typeof p === "string" && p.trim() !== "" && !/^([a-zA-Z]:[\\/]|\/)/.test(p) && !p.includes("..");
8091
8090
  }
8092
8091
  function strList(v) {
8093
8092
  return Array.isArray(v) ? v.map((x) => typeof x === "string" ? x.trim() : "").filter(Boolean) : [];
@@ -8130,9 +8129,9 @@ function parseTopologyContent(raw, dir) {
8130
8129
  const moduleRaw = typeof e.module === "string" ? e.module.trim() : void 0;
8131
8130
  if (moduleRaw && !validModules.has(moduleRaw)) findings.push({ level: "warning", message: `Entity "${id}" references unregistered module "${moduleRaw}".` });
8132
8131
  const rawImpl = e.implementation ?? e.implementation_refs;
8133
- const implementation = strList(rawImpl).filter((p2) => {
8134
- if (isRelative(p2)) return true;
8135
- findings.push({ level: "warning", message: `Entity "${id}" implementation ref "${p2}" is not a safe relative path and was dropped.` });
8132
+ const implementation = strList(rawImpl).filter((p) => {
8133
+ if (isRelative(p)) return true;
8134
+ findings.push({ level: "warning", message: `Entity "${id}" implementation ref "${p}" is not a safe relative path and was dropped.` });
8136
8135
  return false;
8137
8136
  });
8138
8137
  const prov = e.provenance;
@@ -8509,8 +8508,8 @@ function splitSections(body) {
8509
8508
  flush();
8510
8509
  return sections;
8511
8510
  }
8512
- function isPlaceholder(text3) {
8513
- const t = text3.trim();
8511
+ function isPlaceholder(text2) {
8512
+ const t = text2.trim();
8514
8513
  if (!t) return true;
8515
8514
  if (/^tbd$/i.test(t)) return true;
8516
8515
  if (/^_[^_]*_$/.test(t) && !t.includes("\n")) return true;
@@ -8537,15 +8536,15 @@ function extractBullets(body) {
8537
8536
  for (const line of body.split(/\r?\n/)) {
8538
8537
  const m = line.match(/^\s*[-*+]\s+(.*)$/);
8539
8538
  if (!m) continue;
8540
- let text3 = m[1].trim();
8539
+ let text2 = m[1].trim();
8541
8540
  let checked = null;
8542
- const cb = text3.match(/^\[([ xX])\]\s*(.*)$/);
8541
+ const cb = text2.match(/^\[([ xX])\]\s*(.*)$/);
8543
8542
  if (cb) {
8544
8543
  checked = cb[1].toLowerCase() === "x";
8545
- text3 = cb[2].trim();
8544
+ text2 = cb[2].trim();
8546
8545
  }
8547
- if (!text3 || isPlaceholder(text3)) continue;
8548
- out.push({ text: text3, checked });
8546
+ if (!text2 || isPlaceholder(text2)) continue;
8547
+ out.push({ text: text2, checked });
8549
8548
  }
8550
8549
  return out;
8551
8550
  }
@@ -9071,14 +9070,14 @@ function toInput(data, content) {
9071
9070
  for (const line of body.split(/\r?\n/)) {
9072
9071
  const m = line.match(/^\s*[-*+]\s+(.*)$/);
9073
9072
  if (!m) continue;
9074
- let text3 = m[1].trim();
9073
+ let text2 = m[1].trim();
9075
9074
  let checked = null;
9076
- const cb = text3.match(/^\[([ xX])\]\s*(.*)$/);
9075
+ const cb = text2.match(/^\[([ xX])\]\s*(.*)$/);
9077
9076
  if (cb) {
9078
9077
  checked = cb[1].toLowerCase() === "x";
9079
- text3 = cb[2].trim();
9078
+ text2 = cb[2].trim();
9080
9079
  }
9081
- if (text3) out.push({ text: text3, checked });
9080
+ if (text2) out.push({ text: text2, checked });
9082
9081
  }
9083
9082
  return out;
9084
9083
  })();
@@ -9903,7 +9902,7 @@ var SECRET_PATTERNS = [
9903
9902
  /\.pfx$/i
9904
9903
  ];
9905
9904
  function filterSecretPaths(paths) {
9906
- return paths.filter((p2) => !SECRET_PATTERNS.some((re) => re.test(p2)));
9905
+ return paths.filter((p) => !SECRET_PATTERNS.some((re) => re.test(p)));
9907
9906
  }
9908
9907
  function collectImplementationEvidence(dir, workItemId, input) {
9909
9908
  const artifacts = discoverWorkItems(dir);
@@ -11771,7 +11770,119 @@ ${item.description}` : item.title;
11771
11770
  importLocks.delete(lockKey);
11772
11771
  }
11773
11772
  }
11773
+
11774
+ // src/core/telemetry-consent.ts
11775
+ import { parse as parseYaml10, stringify as stringifyYaml6 } from "yaml";
11776
+ var CURRENT_CONSENT_VERSION = 1;
11777
+ var DEFERRAL_DURATION_MS = 24 * 60 * 60 * 1e3;
11778
+ function getConsentState(config) {
11779
+ if (!config) return "unset";
11780
+ const t = config.telemetry;
11781
+ if (!t) return "unset";
11782
+ if (t.consent === "enabled") return "enabled";
11783
+ if (t.consent === "disabled") return "disabled";
11784
+ if (t.consent === void 0) {
11785
+ if (t.enabled === true) return "enabled";
11786
+ if (t.enabled === false) return "disabled";
11787
+ }
11788
+ return "unset";
11789
+ }
11790
+ function isInteractive() {
11791
+ if (process.env.CI) return false;
11792
+ if (!process.stdin.isTTY) return false;
11793
+ if (!process.stdout.isTTY) return false;
11794
+ return true;
11795
+ }
11796
+ function persistConsent(dir, consent) {
11797
+ const configPath = join(dir, ".kaddo", "config.yml");
11798
+ if (!exists(configPath)) return;
11799
+ const raw = readFile(configPath);
11800
+ const doc = parseYaml10(raw) ?? {};
11801
+ const prev = doc.telemetry ?? {};
11802
+ delete prev.enabled;
11803
+ doc.telemetry = { ...prev, consent, consentVersion: CURRENT_CONSENT_VERSION };
11804
+ writeFile(configPath, stringifyYaml6(doc));
11805
+ }
11806
+ function isDeferralActive(dir) {
11807
+ const p = join(dir, ".kaddo", "telemetry-deferred.json");
11808
+ if (!exists(p)) return false;
11809
+ try {
11810
+ const data = JSON.parse(readFile(p));
11811
+ return data.deferredUntil > Date.now();
11812
+ } catch {
11813
+ return false;
11814
+ }
11815
+ }
11816
+ function deferConsent(dir) {
11817
+ const p = join(dir, ".kaddo", "telemetry-deferred.json");
11818
+ writeFile(p, JSON.stringify({ deferredUntil: Date.now() + DEFERRAL_DURATION_MS }));
11819
+ }
11820
+ function consentNotice() {
11821
+ return '[Telemetry consent] Anonymous usage telemetry has not been configured.\n Collects: command usage, version, lifecycle events.\n Never collects: source code, knowledge, prompts or PII.\n Use kaddo_set_telemetry_consent to enable, disable, or defer ("not-now").';
11822
+ }
11823
+
11824
+ // src/core/telemetry.ts
11825
+ import crypto6 from "crypto";
11826
+
11827
+ // src/core/telemetry-identity.ts
11828
+ import crypto4 from "crypto";
11829
+ var TELEMETRY_DIR = ".kaddo/telemetry";
11830
+ var IDENTITY_FILE = "identity.json";
11831
+ function identityPath(dir) {
11832
+ return join(dir, TELEMETRY_DIR, IDENTITY_FILE);
11833
+ }
11834
+ function loadIdentity(dir) {
11835
+ const p = identityPath(dir);
11836
+ if (!exists(p)) return null;
11837
+ try {
11838
+ return JSON.parse(readFile(p));
11839
+ } catch {
11840
+ return null;
11841
+ }
11842
+ }
11843
+
11844
+ // src/core/telemetry-events.ts
11845
+ import crypto5 from "crypto";
11846
+
11847
+ // src/core/telemetry-buffer.ts
11848
+ var TELEMETRY_DIR2 = ".kaddo/telemetry";
11849
+ var BUFFER_FILE = "buffer.json";
11850
+ function bufferPath(dir) {
11851
+ return join(dir, TELEMETRY_DIR2, BUFFER_FILE);
11852
+ }
11853
+ function readBuffer(dir) {
11854
+ const p = bufferPath(dir);
11855
+ if (!exists(p)) return [];
11856
+ try {
11857
+ const data = JSON.parse(readFile(p));
11858
+ return Array.isArray(data) ? data : [];
11859
+ } catch {
11860
+ return [];
11861
+ }
11862
+ }
11863
+ function bufferSize(dir) {
11864
+ return readBuffer(dir).length;
11865
+ }
11866
+
11867
+ // src/core/telemetry.ts
11868
+ function isEnabled(config) {
11869
+ return getConsentState(config) === "enabled";
11870
+ }
11871
+ function getStatus(dir) {
11872
+ const config = loadConfig(dir);
11873
+ const consent = getConsentState(config);
11874
+ const enabled = consent === "enabled";
11875
+ const identity = loadIdentity(dir);
11876
+ return {
11877
+ consent,
11878
+ enabled,
11879
+ registered: identity?.registered ?? false,
11880
+ pendingEvents: enabled ? bufferSize(dir) : 0,
11881
+ lastError: null
11882
+ };
11883
+ }
11774
11884
  export {
11885
+ CURRENT_CONSENT_VERSION,
11775
11886
  INTEGRATIONS_FILE,
11776
11887
  ImportError,
11777
11888
  IntegrationError,
@@ -11795,9 +11906,11 @@ export {
11795
11906
  collectImplementationEvidence,
11796
11907
  computeContentHash,
11797
11908
  computeRefinementStatus,
11909
+ consentNotice,
11798
11910
  createIntegration,
11799
11911
  createWorkItem,
11800
11912
  cwd,
11913
+ deferConsent,
11801
11914
  deleteIntegration,
11802
11915
  detectFormat,
11803
11916
  disableIntegration,
@@ -11813,6 +11926,7 @@ export {
11813
11926
  findLinkedWorkItem,
11814
11927
  findSystemPaths,
11815
11928
  getAvailableIntegrationTypes,
11929
+ getConsentState,
11816
11930
  getExternalWorkItem,
11817
11931
  getImpactCandidates,
11818
11932
  getIntegration,
@@ -11821,6 +11935,7 @@ export {
11821
11935
  getSystemMapProjection,
11822
11936
  getSystemNeighbors,
11823
11937
  getSystemNodeContext,
11938
+ getStatus as getTelemetryStatus,
11824
11939
  getWorkItem,
11825
11940
  getWorkItemCaptureDefinition,
11826
11941
  getWorkItemForEdit,
@@ -11830,7 +11945,10 @@ export {
11830
11945
  importWorkItem,
11831
11946
  integrationRegistry,
11832
11947
  isActiveState,
11948
+ isDeferralActive,
11949
+ isInteractive,
11833
11950
  isModule,
11951
+ isEnabled as isTelemetryEnabled,
11834
11952
  join,
11835
11953
  knowledgeLayers,
11836
11954
  lifecycleCounts,
@@ -11841,6 +11959,7 @@ export {
11841
11959
  loadMappedModules,
11842
11960
  loadSystemTopology,
11843
11961
  parseContent,
11962
+ persistConsent,
11844
11963
  previewImport,
11845
11964
  readFile,
11846
11965
  removeIntegrationSecret,
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 parseYaml3, stringify as stringifyYaml } from "yaml";
1183
+ import { parse as parseYaml4, stringify as stringifyYaml2 } from "yaml";
1129
1184
 
1130
1185
  // src/core/scan-baseline.ts
1131
- import { parse as parseYaml } from "yaml";
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 = parseYaml(readFile(configPath));
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 parseYaml2 } from "yaml";
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 = parseYaml2(readFile(configPath));
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 = parseYaml3(raw);
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, stringifyYaml(config));
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 parseYaml4, stringify as stringifyYaml2 } from "yaml";
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 = parseYaml4(raw);
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, stringifyYaml2(existing));
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, stringifyYaml2(filtered));
7076
+ writeFile(path11, stringifyYaml3(filtered));
7022
7077
  return true;
7023
7078
  }
7024
7079
 
7025
7080
  // src/services/mapped-modules.ts
7026
- import { parse as parseYaml5 } from "yaml";
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 = parseYaml5(readFile(path11));
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 = parseYaml5(readFile(configPath));
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 parseYaml7 } from "yaml";
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 parseYaml6 } from "yaml";
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 = parseYaml6(readFile(configPath));
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 parseYaml7(readFile(configPath));
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 parseYaml12 } from "yaml";
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 parseYaml10, stringify as stringifyYaml5 } from "yaml";
8561
+ import { parse as parseYaml11, stringify as stringifyYaml6 } from "yaml";
8507
8562
 
8508
8563
  // src/commands/modules-map.ts
8509
- import { parse as parseYaml9, stringify as stringifyYaml4 } from "yaml";
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 parseYaml8, stringify as stringifyYaml3 } from "yaml";
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 = parseYaml8(readFile(p));
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), stringifyYaml3(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 parseYaml8(readFile(configPath));
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 = parseYaml9(readFile(path11));
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), stringifyYaml4(descriptor));
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 = parseYaml10(readFile(p));
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 stringifyYaml5({ external: entries });
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 parseYaml11 } from "yaml";
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 = parseYaml11(readFile(modulesYmlPath));
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 parseYaml12(readFile(configPath));
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 parseYaml13 } from "yaml";
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 parseYaml14 } from "yaml";
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 parseYaml14(readFile(p));
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 parseYaml15, stringify as stringifyYaml6 } from "yaml";
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 = parseYaml15(readFile(configPath));
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 = parseYaml15(readFile(configPath));
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, stringifyYaml6(config));
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 = parseYaml15(readFile(configPath));
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 parseYaml16, stringify as stringifyYaml7 } from "yaml";
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 = parseYaml16(raw) ?? {};
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 stringifyYaml7(doc);
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 parseYaml17, stringify as stringifyYaml8 } from "yaml";
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 parseYaml17(readFile(abs)) ?? { integrations: [] };
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 parseYaml18 } from "yaml";
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 = parseYaml18(readFile(p));
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";
@@ -0,0 +1,20 @@
1
+ import {
2
+ cancel,
3
+ confirm,
4
+ intro,
5
+ log,
6
+ multiselect,
7
+ outro,
8
+ select,
9
+ text
10
+ } from "./chunk-XCTQ5SFK.js";
11
+ export {
12
+ cancel,
13
+ confirm,
14
+ intro,
15
+ log,
16
+ multiselect,
17
+ outro,
18
+ select,
19
+ text
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaddo/cli",
3
- "version": "3.103.0",
3
+ "version": "3.104.0",
4
4
  "description": "Knowledge Driven Development toolkit",
5
5
  "license": "MIT",
6
6
  "repository": {