@kaddo/cli 3.102.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.
package/dist/index.js CHANGED
@@ -1,4 +1,14 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ cancel,
4
+ confirm,
5
+ intro,
6
+ log,
7
+ multiselect,
8
+ outro,
9
+ select,
10
+ text
11
+ } from "./chunk-ZT3DUU53.js";
2
12
 
3
13
  // src/index.ts
4
14
  import { createRequire } from "module";
@@ -7,11 +17,11 @@ import { Command } from "commander";
7
17
  // src/utils/fs.ts
8
18
  import fs from "fs";
9
19
  import path from "path";
10
- function exists(p2) {
11
- return fs.existsSync(p2);
20
+ function exists(p) {
21
+ return fs.existsSync(p);
12
22
  }
13
- function readFile(p2) {
14
- return fs.readFileSync(p2, "utf-8");
23
+ function readFile(p) {
24
+ return fs.readFileSync(p, "utf-8");
15
25
  }
16
26
  function writeFile(filePath, content) {
17
27
  fs.mkdirSync(path.dirname(filePath), { recursive: true });
@@ -24,11 +34,11 @@ function readDir(dirPath) {
24
34
  if (!exists(dirPath)) return [];
25
35
  return fs.readdirSync(dirPath);
26
36
  }
27
- function isFile(p2) {
28
- return exists(p2) && fs.statSync(p2).isFile();
37
+ function isFile(p) {
38
+ return exists(p) && fs.statSync(p).isFile();
29
39
  }
30
- function isDir(p2) {
31
- return exists(p2) && fs.statSync(p2).isDirectory();
40
+ function isDir(p) {
41
+ return exists(p) && fs.statSync(p).isDirectory();
32
42
  }
33
43
  function cwd() {
34
44
  return process.cwd();
@@ -40,43 +50,48 @@ function join(...parts) {
40
50
  // src/commands/init.ts
41
51
  import path2 from "path";
42
52
 
43
- // src/utils/ui.ts
44
- import * as p from "@clack/prompts";
45
- var intro2 = (title) => p.intro(title);
46
- var outro2 = (msg) => p.outro(msg);
47
- var log2 = p.log;
48
- var cancel2 = (msg) => p.cancel(msg);
49
- async function text2(opts) {
50
- const val = await p.text(opts);
51
- if (p.isCancel(val)) {
52
- p.cancel("Operation cancelled.");
53
- process.exit(0);
54
- }
55
- return val;
56
- }
57
- async function confirm2(opts) {
58
- const val = await p.confirm(opts);
59
- if (p.isCancel(val)) {
60
- p.cancel("Operation cancelled.");
61
- process.exit(0);
62
- }
63
- return val;
64
- }
65
- async function select2(opts) {
66
- const val = await p.select(opts);
67
- if (p.isCancel(val)) {
68
- p.cancel("Operation cancelled.");
69
- process.exit(0);
70
- }
71
- return val;
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;
72
74
  }
73
- async function multiselect2(opts) {
74
- const val = await p.multiselect(opts);
75
- if (p.isCancel(val)) {
76
- p.cancel("Operation cancelled.");
77
- process.exit(0);
78
- }
79
- return val;
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");
80
95
  }
81
96
 
82
97
  // src/commands/init.ts
@@ -293,28 +308,28 @@ _Ideas and intentions not yet committed._
293
308
  }
294
309
  async function runInit() {
295
310
  const dir = cwd();
296
- intro2("kaddo init");
311
+ intro("kaddo init");
297
312
  if (!hasGit(dir)) {
298
- log2.warn("No Git repository detected. Kaddo works best inside a Git repo.");
313
+ log.warn("No Git repository detected. Kaddo works best inside a Git repo.");
299
314
  }
300
315
  const kaddoExists = exists(join(dir, KADDO_DIR, "config.yml"));
301
316
  if (kaddoExists) {
302
- const overwrite = await confirm2({
317
+ const overwrite = await confirm({
303
318
  message: "Kaddo is already initialized. Overwrite configuration?",
304
319
  initialValue: false
305
320
  });
306
321
  if (!overwrite) {
307
- outro2("Nothing changed.");
322
+ outro("Nothing changed.");
308
323
  return;
309
324
  }
310
325
  }
311
326
  const inferredName = inferProjectName(dir);
312
- const projectName = await text2({
327
+ const projectName = await text({
313
328
  message: "Project name",
314
329
  initialValue: inferredName,
315
330
  validate: (v) => v.trim().length === 0 ? "Project name is required." : void 0
316
331
  });
317
- const structure = await select2({
332
+ const structure = await select({
318
333
  message: "Repository structure",
319
334
  options: [
320
335
  { value: "monorepo", label: "Monorepo" },
@@ -327,7 +342,7 @@ async function runInit() {
327
342
  let parentSystem;
328
343
  let modId;
329
344
  if (structure === "multirepo") {
330
- role = await select2({
345
+ role = await select({
331
346
  message: "What is the role of this repository?",
332
347
  options: [
333
348
  { value: "core", label: "Core / system orchestrator" },
@@ -335,26 +350,26 @@ async function runInit() {
335
350
  ]
336
351
  });
337
352
  if (role === "core") {
338
- systemName3 = await text2({
353
+ systemName3 = await text({
339
354
  message: "System name",
340
355
  placeholder: "e.g. tryckers",
341
356
  validate: (v) => v.trim().length === 0 ? "System name is required." : void 0
342
357
  });
343
358
  }
344
359
  if (role === "module") {
345
- parentSystem = await text2({
360
+ parentSystem = await text({
346
361
  message: "Parent system name",
347
362
  placeholder: "e.g. tryckers",
348
363
  validate: (v) => v.trim().length === 0 ? "Parent system name is required." : void 0
349
364
  });
350
- modId = await text2({
365
+ modId = await text({
351
366
  message: "Module ID",
352
367
  placeholder: "e.g. frontend",
353
368
  validate: (v) => v.trim().length === 0 ? "Module ID is required." : void 0
354
369
  });
355
370
  }
356
371
  }
357
- const state = await select2({
372
+ const state = await select({
358
373
  message: "What kind of project is this?",
359
374
  options: [
360
375
  { value: "new", label: "New", hint: "Starting from scratch" },
@@ -363,7 +378,7 @@ async function runInit() {
363
378
  ],
364
379
  initialValue: "pre-ai"
365
380
  });
366
- const language = await select2({
381
+ const language = await select({
367
382
  message: "Project knowledge language (the CLI stays in English)",
368
383
  options: [
369
384
  { value: "en", label: "English" },
@@ -371,7 +386,7 @@ async function runInit() {
371
386
  ],
372
387
  initialValue: "en"
373
388
  });
374
- const teamSize = await select2({
389
+ const teamSize = await select({
375
390
  message: "Team size",
376
391
  options: [
377
392
  { value: "indie", label: "Indie", hint: "1 person" },
@@ -394,7 +409,7 @@ async function runInit() {
394
409
  };
395
410
  const kaddoConfigPath = join(dir, KADDO_DIR, "config.yml");
396
411
  writeFile(kaddoConfigPath, buildConfig(meta));
397
- log2.success("Created .kaddo/config.yml");
412
+ log.success("Created .kaddo/config.yml");
398
413
  if (role === "module") {
399
414
  ensureDir(join(dir, ARCH_DIR, "tech", "module"));
400
415
  writeFile(
@@ -407,10 +422,10 @@ async function runInit() {
407
422
  if (!exists(join(dir, ARCH_DIR, "tech", "codebase.md"))) {
408
423
  writeFile(join(dir, ARCH_DIR, "tech", "codebase.md"), buildKnowledge(projectName.trim()));
409
424
  }
410
- log2.success("Created knowledge/tech/module/module-context.md");
411
- log2.success("Created knowledge/tech/current-state.md");
412
- log2.success("Created knowledge/tech/codebase.md");
413
- log2.info("Next: run `kaddo scan` to detect your stack, then use module-context-agent to refine module-context.md.");
425
+ log.success("Created knowledge/tech/module/module-context.md");
426
+ log.success("Created knowledge/tech/current-state.md");
427
+ log.success("Created knowledge/tech/codebase.md");
428
+ log.info("Next: run `kaddo scan` to detect your stack, then use module-context-agent to refine module-context.md.");
414
429
  } else if (role === "core") {
415
430
  const sysName = systemName3?.trim() ?? projectName.trim();
416
431
  ensureDir(join(dir, ARCH_DIR, "delivery", "work-items"));
@@ -423,22 +438,31 @@ async function runInit() {
423
438
  writeFile(join(dir, ARCH_DIR, "tech", "system", "system-context.md"), buildSystemContext(sysName));
424
439
  writeFile(join(dir, ARCH_DIR, "tech", "modules", "modules.md"), buildModulesFile(sysName));
425
440
  writeFile(join(dir, KADDO_DIR, "modules.yml"), buildModulesYml(sysName));
426
- log2.success("Created knowledge/knowledge.md");
427
- log2.success("Created knowledge/delivery/roadmap.md");
428
- log2.success("Created knowledge/tech/system/system-context.md");
429
- log2.success("Created knowledge/tech/modules/modules.md");
430
- log2.success("Created .kaddo/modules.yml");
431
- log2.info("Next: run `kaddo scan` then `kaddo modules discover` to find sibling modules.");
441
+ log.success("Created knowledge/knowledge.md");
442
+ log.success("Created knowledge/delivery/roadmap.md");
443
+ log.success("Created knowledge/tech/system/system-context.md");
444
+ log.success("Created knowledge/tech/modules/modules.md");
445
+ log.success("Created .kaddo/modules.yml");
446
+ log.info("Next: run `kaddo scan` then `kaddo modules discover` to find sibling modules.");
432
447
  } else {
433
448
  ensureDir(join(dir, ARCH_DIR, "delivery", "work-items"));
434
449
  writeFile(join(dir, ARCH_DIR, "knowledge.md"), buildKnowledge(projectName.trim()));
435
450
  writeFile(join(dir, ARCH_DIR, "delivery", "roadmap.md"), buildRoadmap(projectName.trim()));
436
- log2.success("Created knowledge/knowledge.md");
437
- log2.success("Created knowledge/delivery/roadmap.md");
438
- log2.success("Created knowledge/delivery/work-items/");
439
- log2.info("Next: run `kaddo scan` to detect your stack.");
451
+ log.success("Created knowledge/knowledge.md");
452
+ log.success("Created knowledge/delivery/roadmap.md");
453
+ log.success("Created knowledge/delivery/work-items/");
454
+ log.info("Next: run `kaddo scan` to detect your stack.");
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`.");
440
464
  }
441
- outro2("Kaddo initialized.");
465
+ outro("Kaddo initialized.");
442
466
  }
443
467
 
444
468
  // src/core/scan-signals.ts
@@ -839,10 +863,10 @@ function detectEnvironment(dir) {
839
863
  const envFiles = [".env.example", ".env.local.example", ".env.template", ".env.sample"];
840
864
  const varNames = /* @__PURE__ */ new Set();
841
865
  for (const ef of envFiles) {
842
- const p2 = join(dir, ef);
843
- if (!exists(p2)) continue;
866
+ const p = join(dir, ef);
867
+ if (!exists(p)) continue;
844
868
  try {
845
- const lines = readFile(p2).split(/\r?\n/);
869
+ const lines = readFile(p).split(/\r?\n/);
846
870
  for (const line of lines) {
847
871
  const m = line.match(/^([A-Z][A-Z0-9_]+)\s*=/);
848
872
  if (m) varNames.add(m[1]);
@@ -1156,10 +1180,10 @@ function scan(dir) {
1156
1180
  }
1157
1181
 
1158
1182
  // src/commands/scan.ts
1159
- import { parse as parseYaml3, stringify as stringifyYaml } from "yaml";
1183
+ import { parse as parseYaml4, stringify as stringifyYaml2 } from "yaml";
1160
1184
 
1161
1185
  // src/core/scan-baseline.ts
1162
- import { parse as parseYaml } from "yaml";
1186
+ import { parse as parseYaml2 } from "yaml";
1163
1187
  var SCAN_BASELINE_VERSION = "1";
1164
1188
  var UNKNOWN = "unknown";
1165
1189
  function meaningful(...values) {
@@ -1174,7 +1198,7 @@ function readProjectContext(dir) {
1174
1198
  const configPath = join(dir, ".kaddo", "config.yml");
1175
1199
  if (!exists(configPath)) return context;
1176
1200
  try {
1177
- const config = parseYaml(readFile(configPath));
1201
+ const config = parseYaml2(readFile(configPath));
1178
1202
  const project = config.project ?? {};
1179
1203
  const team = config.team ?? {};
1180
1204
  if (typeof project.state === "string") context.state = project.state;
@@ -1271,7 +1295,7 @@ function renderInventory(baseline) {
1271
1295
 
1272
1296
  // src/core/config.ts
1273
1297
  import { z } from "zod";
1274
- import { parse as parseYaml2 } from "yaml";
1298
+ import { parse as parseYaml3 } from "yaml";
1275
1299
  var PROJECT_STATES = ["new", "pre-ai", "legacy", "ai-assisted"];
1276
1300
  var TEAM_SIZES = ["indie", "small", "medium", "enterprise"];
1277
1301
  var REPOSITORY_STRUCTURES = ["monorepo", "multirepo"];
@@ -1345,7 +1369,9 @@ var configSchema = z.object({
1345
1369
  guard: z.unknown().optional(),
1346
1370
  scan: z.unknown().optional(),
1347
1371
  telemetry: z.object({
1348
- enabled: z.boolean().default(false)
1372
+ consent: z.enum(["enabled", "disabled"]).optional(),
1373
+ consentVersion: z.number().optional(),
1374
+ enabled: z.boolean().optional()
1349
1375
  }).passthrough().optional()
1350
1376
  }).passthrough();
1351
1377
  function configPathFor(dir) {
@@ -1356,7 +1382,7 @@ function loadConfig(dir) {
1356
1382
  if (!exists(configPath)) return null;
1357
1383
  let raw;
1358
1384
  try {
1359
- raw = parseYaml2(readFile(configPath));
1385
+ raw = parseYaml3(readFile(configPath));
1360
1386
  } catch (err) {
1361
1387
  const detail = err instanceof Error ? err.message : String(err);
1362
1388
  throw new ConfigError(`Could not parse .kaddo/config.yml: ${detail}`);
@@ -1570,7 +1596,7 @@ function updateConfig(dir, result) {
1570
1596
  if (!exists(configPath)) return;
1571
1597
  try {
1572
1598
  const raw = readFile(configPath);
1573
- const config = parseYaml3(raw);
1599
+ const config = parseYaml4(raw);
1574
1600
  const scanData = {
1575
1601
  language: result.language,
1576
1602
  framework: result.framework,
@@ -1585,7 +1611,7 @@ function updateConfig(dir, result) {
1585
1611
  if (project && Array.isArray(project.domains) && project.domains.length === 0 && result.suggestedDomains.length > 0) {
1586
1612
  project.domains = result.suggestedDomains.map((d) => `# ${d}`);
1587
1613
  }
1588
- writeFile(configPath, stringifyYaml(config));
1614
+ writeFile(configPath, stringifyYaml2(config));
1589
1615
  } catch {
1590
1616
  }
1591
1617
  }
@@ -1594,21 +1620,21 @@ async function writeBaselineArtifacts(dir, result) {
1594
1620
  const baseline = buildBaseline(result, context);
1595
1621
  const scanJsonPath = join(dir, ".kaddo", "scan.json");
1596
1622
  writeFile(scanJsonPath, serializeBaseline(baseline));
1597
- log2.success("Wrote .kaddo/scan.json");
1623
+ log.success("Wrote .kaddo/scan.json");
1598
1624
  const inventoryPath = join(dir, "knowledge", "inventory.md");
1599
1625
  const inventoryExists = exists(inventoryPath);
1600
1626
  let writeInventory = true;
1601
1627
  if (inventoryExists) {
1602
- writeInventory = await confirm2({
1628
+ writeInventory = await confirm({
1603
1629
  message: "knowledge/inventory.md already exists. Overwrite it?",
1604
1630
  initialValue: true
1605
1631
  });
1606
1632
  }
1607
1633
  if (writeInventory) {
1608
1634
  writeFile(inventoryPath, renderInventory(baseline));
1609
- log2.success(`${inventoryExists ? "Updated" : "Wrote"} knowledge/inventory.md`);
1635
+ log.success(`${inventoryExists ? "Updated" : "Wrote"} knowledge/inventory.md`);
1610
1636
  } else {
1611
- log2.info("Kept existing knowledge/inventory.md.");
1637
+ log.info("Kept existing knowledge/inventory.md.");
1612
1638
  }
1613
1639
  }
1614
1640
  function printStateAwareNextStep(dir) {
@@ -1617,37 +1643,37 @@ function printStateAwareNextStep(dir) {
1617
1643
  config = loadConfig(dir);
1618
1644
  } catch (err) {
1619
1645
  if (err instanceof ConfigError) {
1620
- log2.warn(err.message);
1646
+ log.warn(err.message);
1621
1647
  return;
1622
1648
  }
1623
1649
  throw err;
1624
1650
  }
1625
1651
  if (!config) return;
1626
- log2.info(`This is a ${describeProject(config)}.`);
1627
- log2.info(`Next: ${nextStepsForState(config.project.state)}`);
1652
+ log.info(`This is a ${describeProject(config)}.`);
1653
+ log.info(`Next: ${nextStepsForState(config.project.state)}`);
1628
1654
  }
1629
1655
  async function runScan() {
1630
1656
  const dir = cwd();
1631
- intro2("kaddo scan");
1657
+ intro("kaddo scan");
1632
1658
  const result = scan(dir);
1633
1659
  printResult(result);
1634
1660
  await writeBaselineArtifacts(dir, result);
1635
1661
  const kaddoExists = exists(join(dir, ".kaddo", "config.yml"));
1636
1662
  if (kaddoExists) {
1637
- const save = await confirm2({
1663
+ const save = await confirm({
1638
1664
  message: "Save scan results to .kaddo/config.yml?",
1639
1665
  initialValue: true
1640
1666
  });
1641
1667
  if (save) {
1642
1668
  updateConfig(dir, result);
1643
- log2.success("Scan results saved to .kaddo/config.yml");
1669
+ log.success("Scan results saved to .kaddo/config.yml");
1644
1670
  }
1645
1671
  } else {
1646
- log2.warn("No .kaddo/config.yml found. Run `kaddo init` first to record project context.");
1672
+ log.warn("No .kaddo/config.yml found. Run `kaddo init` first to record project context.");
1647
1673
  }
1648
1674
  printStateAwareNextStep(dir);
1649
1675
  printCommandFooter("scan");
1650
- outro2("Scan complete.");
1676
+ outro("Scan complete.");
1651
1677
  }
1652
1678
 
1653
1679
  // src/core/knowledge-levels.ts
@@ -5390,7 +5416,7 @@ var AGENT_PROMPTS = [
5390
5416
  // Graph relationship quality (metadata hints → precise front matter — VS-056)
5391
5417
  { fileName: "graph-agent.md", content: GRAPH_AGENT }
5392
5418
  // Every official prompt ends with its responsibility boundaries + Agent Trace footer.
5393
- ].map((p2) => ({ fileName: p2.fileName, content: withResponsibilityTrace(p2.fileName, p2.content) }));
5419
+ ].map((p) => ({ fileName: p.fileName, content: withResponsibilityTrace(p.fileName, p.content) }));
5394
5420
 
5395
5421
  // src/agents/groups.ts
5396
5422
  var AGENT_GROUPS = {
@@ -6024,10 +6050,10 @@ function splitRow(line) {
6024
6050
  function isSeparatorRow(cells) {
6025
6051
  return cells.length > 0 && cells.every((c) => SEPARATOR_CELL_RE.test(c) || c === "");
6026
6052
  }
6027
- function initiativeFromHeading(text3) {
6028
- const rm = text3.match(/^(RM-[\w.-]+)\s*[:\-–]?\s*(.*)$/);
6053
+ function initiativeFromHeading(text2) {
6054
+ const rm = text2.match(/^(RM-[\w.-]+)\s*[:\-–]?\s*(.*)$/);
6029
6055
  if (rm) return { id: rm[1], title: rm[2].trim() || void 0 };
6030
- return { title: text3.trim() || void 0 };
6056
+ return { title: text2.trim() || void 0 };
6031
6057
  }
6032
6058
  function extractDeps(cell) {
6033
6059
  if (!cell) return void 0;
@@ -6149,16 +6175,16 @@ var ROADMAP_PATH = "knowledge/delivery/roadmap.md";
6149
6175
  function ensureWorkItemsDir(dir) {
6150
6176
  if (exists(join(dir, WORK_ITEMS_DIR))) return;
6151
6177
  if (!exists(join(dir, ".kaddo", "config.yml"))) {
6152
- log2.warn("Kaddo is not initialized. Run `kaddo init` first.");
6178
+ log.warn("Kaddo is not initialized. Run `kaddo init` first.");
6153
6179
  process.exit(1);
6154
6180
  }
6155
6181
  ensureDir(join(dir, WORK_ITEMS_DIR));
6156
- log2.info(`Created ${WORK_ITEMS_DIR}/`);
6182
+ log.info(`Created ${WORK_ITEMS_DIR}/`);
6157
6183
  }
6158
6184
  async function collectAcceptanceCriteria() {
6159
6185
  const criteria = [];
6160
6186
  while (true) {
6161
- const criterion = await text2({
6187
+ const criterion = await text({
6162
6188
  message: criteria.length === 0 ? "Acceptance criterion" : "Acceptance criterion",
6163
6189
  placeholder: "e.g. Users see confirmation after checkout",
6164
6190
  validate: (v) => criteria.length === 0 && v.trim().length === 0 ? "At least one criterion is required." : void 0
@@ -6170,7 +6196,7 @@ async function collectAcceptanceCriteria() {
6170
6196
  } else {
6171
6197
  criteria.push(trimmed);
6172
6198
  }
6173
- const addMore = await confirm2({ message: "Add another acceptance criterion?" });
6199
+ const addMore = await confirm({ message: "Add another acceptance criterion?" });
6174
6200
  if (!addMore) break;
6175
6201
  }
6176
6202
  return criteria.join("\n");
@@ -6188,13 +6214,13 @@ function printStateGuidance(dir) {
6188
6214
  config = loadConfig(dir);
6189
6215
  } catch (err) {
6190
6216
  if (err instanceof ConfigError) {
6191
- log2.warn(err.message);
6217
+ log.warn(err.message);
6192
6218
  return;
6193
6219
  }
6194
6220
  throw err;
6195
6221
  }
6196
6222
  if (!config) return;
6197
- log2.info(createGuidanceForState(config.project.state));
6223
+ log.info(createGuidanceForState(config.project.state));
6198
6224
  }
6199
6225
  function nextWorkItemId(dir) {
6200
6226
  const wiDir = join(dir, WORK_ITEMS_DIR);
@@ -6393,11 +6419,11 @@ async function runCreate(type, opts = {}) {
6393
6419
  }
6394
6420
  const level = getLevelForType(workItemType);
6395
6421
  const levelDef = getLevel(level);
6396
- intro2(`kaddo create ${workItemType}`);
6397
- log2.info(`Knowledge level: ${level} \u2014 ${levelDef.description}`);
6422
+ intro(`kaddo create ${workItemType}`);
6423
+ log.info(`Knowledge level: ${level} \u2014 ${levelDef.description}`);
6398
6424
  printStateGuidance(dir);
6399
6425
  ensureWorkItemsDir(dir);
6400
- const title = await text2({
6426
+ const title = await text({
6401
6427
  message: "Title for this work item",
6402
6428
  placeholder: `e.g. ${workItemType === "feature" ? "Add email verification to checkout" : workItemType === "hotfix" ? "Fix null pointer in payment handler" : workItemType === "bugfix" ? "Fix broken pagination on orders list" : workItemType === "chore" ? "Configure Vitest and CI pipeline" : "Explore caching strategies for API responses"}`,
6403
6429
  validate: (v) => v.trim().length === 0 ? "Title is required." : void 0
@@ -6408,7 +6434,7 @@ async function runCreate(type, opts = {}) {
6408
6434
  answers.acceptance_criteria = await collectAcceptanceCriteria();
6409
6435
  continue;
6410
6436
  }
6411
- const answer = await text2({
6437
+ const answer = await text({
6412
6438
  message: question.prompt,
6413
6439
  placeholder: question.placeholder,
6414
6440
  validate: question.required ? (v) => v.trim().length === 0 ? "This field is required." : void 0 : void 0
@@ -6425,24 +6451,24 @@ async function runCreate(type, opts = {}) {
6425
6451
 
6426
6452
  ${body}`;
6427
6453
  writeFile(filePath, content);
6428
- log2.success(`Created ${DRAFT_DIR}/${fileName}`);
6429
- log2.info(`New Work Items start in \`draft\`. Move to \`ready\` when scope and acceptance are set.`);
6430
- log2.info(`Add code globs to the front matter \`code:\` field to enable Guard Lite.`);
6431
- outro2(`Work item ${id} created.`);
6454
+ log.success(`Created ${DRAFT_DIR}/${fileName}`);
6455
+ log.info(`New Work Items start in \`draft\`. Move to \`ready\` when scope and acceptance are set.`);
6456
+ log.info(`Add code globs to the front matter \`code:\` field to enable Guard Lite.`);
6457
+ outro(`Work item ${id} created.`);
6432
6458
  }
6433
6459
  async function runCreateModule(dir, modType) {
6434
- intro2(`kaddo create ${modType.name}`);
6435
- log2.info(`Knowledge level: ${modType.knowledgeLevel} \u2014 ${modType.description}`);
6460
+ intro(`kaddo create ${modType.name}`);
6461
+ log.info(`Knowledge level: ${modType.knowledgeLevel} \u2014 ${modType.description}`);
6436
6462
  printStateGuidance(dir);
6437
6463
  ensureWorkItemsDir(dir);
6438
- const title = await text2({
6464
+ const title = await text({
6439
6465
  message: "Title for this work item",
6440
6466
  placeholder: `e.g. ${modType.questions[0]?.placeholder ?? modType.description}`,
6441
6467
  validate: (v) => v.trim().length === 0 ? "Title is required." : void 0
6442
6468
  });
6443
6469
  const answers = {};
6444
6470
  for (const q of modType.questions) {
6445
- const answer = await text2({
6471
+ const answer = await text({
6446
6472
  message: q.prompt,
6447
6473
  placeholder: q.placeholder,
6448
6474
  validate: q.required ? (v) => v.trim().length === 0 ? "This field is required." : void 0 : void 0
@@ -6459,9 +6485,9 @@ async function runCreateModule(dir, modType) {
6459
6485
 
6460
6486
  ${body}`;
6461
6487
  writeFile(filePath, content);
6462
- log2.success(`Created ${DRAFT_DIR}/${fileName}`);
6463
- log2.info(`Add code globs to the front matter \`code:\` field to enable Guard Lite.`);
6464
- outro2(`Work item ${id} created.`);
6488
+ log.success(`Created ${DRAFT_DIR}/${fileName}`);
6489
+ log.info(`Add code globs to the front matter \`code:\` field to enable Guard Lite.`);
6490
+ outro(`Work item ${id} created.`);
6465
6491
  }
6466
6492
  var K_LEVEL_RE = /^K[0-4]$/;
6467
6493
  function resolveCandidateType(candidate, cliType) {
@@ -6626,7 +6652,7 @@ function buildRoadmapWorkItem(opts) {
6626
6652
  ${body}` };
6627
6653
  }
6628
6654
  async function runCreateFromRoadmap(dir, cliType) {
6629
- intro2("kaddo create --from roadmap");
6655
+ intro("kaddo create --from roadmap");
6630
6656
  ensureWorkItemsDir(dir);
6631
6657
  const roadmapFull = join(dir, ROADMAP_PATH);
6632
6658
  if (!exists(roadmapFull)) {
@@ -6640,7 +6666,7 @@ async function runCreateFromRoadmap(dir, cliType) {
6640
6666
  console.error("Make sure your roadmap uses the Kaddo Roadmap Agent format.");
6641
6667
  process.exit(1);
6642
6668
  }
6643
- const candidateId = candidates.length === 1 ? candidates[0].id : await select2({
6669
+ const candidateId = candidates.length === 1 ? candidates[0].id : await select({
6644
6670
  message: "Which roadmap candidate do you want to create?",
6645
6671
  options: candidates.map((c) => ({
6646
6672
  value: c.id,
@@ -6651,7 +6677,7 @@ async function runCreateFromRoadmap(dir, cliType) {
6651
6677
  const candidate = candidates.find((c) => c.id === candidateId);
6652
6678
  let type = resolveCandidateType(candidate, cliType);
6653
6679
  if (!type) {
6654
- type = await select2({
6680
+ type = await select({
6655
6681
  message: candidate.type ? `Roadmap suggests type "${candidate.type}" (not a Kaddo type). Choose a Work Item type:` : "No type in roadmap candidate. Choose a Work Item type:",
6656
6682
  options: [
6657
6683
  { value: "feature", label: "feature" },
@@ -6664,14 +6690,14 @@ async function runCreateFromRoadmap(dir, cliType) {
6664
6690
  }
6665
6691
  const level = resolveCandidateLevel(candidate, type);
6666
6692
  const levelDef = getLevel(level);
6667
- log2.info(`Knowledge level: ${level} \u2014 ${levelDef.description}`);
6693
+ log.info(`Knowledge level: ${level} \u2014 ${levelDef.description}`);
6668
6694
  const answers = {};
6669
6695
  if (candidate.expectedValue) answers.expected_result = candidate.expectedValue;
6670
6696
  if (candidate.impact) answers.impact = candidate.impact;
6671
6697
  if (candidate.risk) answers.risks = candidate.risk;
6672
6698
  for (const question of levelDef.questions) {
6673
6699
  if (answers[question.frontMatterField]?.trim()) continue;
6674
- const answer = await text2({
6700
+ const answer = await text({
6675
6701
  message: question.prompt,
6676
6702
  placeholder: question.placeholder,
6677
6703
  validate: question.required ? (v) => v.trim().length === 0 ? "This field is required." : void 0 : void 0
@@ -6681,10 +6707,10 @@ async function runCreateFromRoadmap(dir, cliType) {
6681
6707
  const id = nextWorkItemId(dir);
6682
6708
  const { fileName, content } = buildRoadmapWorkItem({ id, type, level, candidate, answers });
6683
6709
  writeFile(join(dir, DRAFT_DIR, fileName), content);
6684
- log2.success(`Created ${DRAFT_DIR}/${fileName}`);
6685
- log2.info(`Traced to roadmap candidate ${candidate.id}${candidate.initiative?.id ? ` (initiative ${candidate.initiative.id})` : ""}.`);
6686
- log2.info(`Add code globs to the front matter \`code:\` field to enable Guard Lite.`);
6687
- outro2(`Work item ${id} created from roadmap.`);
6710
+ log.success(`Created ${DRAFT_DIR}/${fileName}`);
6711
+ log.info(`Traced to roadmap candidate ${candidate.id}${candidate.initiative?.id ? ` (initiative ${candidate.initiative.id})` : ""}.`);
6712
+ log.info(`Add code globs to the front matter \`code:\` field to enable Guard Lite.`);
6713
+ outro(`Work item ${id} created from roadmap.`);
6688
6714
  }
6689
6715
 
6690
6716
  // src/services/git.ts
@@ -6879,8 +6905,8 @@ function isActiveState(s) {
6879
6905
  return ACTIVE_STATES.includes(s);
6880
6906
  }
6881
6907
  function lifecycleFolderOf(filePath) {
6882
- const p2 = filePath.replace(/\\/g, "/");
6883
- const m = p2.match(/\/delivery\/work-items\/([^/]+)\//);
6908
+ const p = filePath.replace(/\\/g, "/");
6909
+ const m = p.match(/\/delivery\/work-items\/([^/]+)\//);
6884
6910
  if (m && isLifecycleState(m[1])) return m[1];
6885
6911
  return null;
6886
6912
  }
@@ -6903,8 +6929,8 @@ function lifecycleCounts(states) {
6903
6929
 
6904
6930
  // src/services/knowledge-artifacts.ts
6905
6931
  var ARCH_DIR2 = "knowledge";
6906
- function toPosix(p2) {
6907
- return p2.replace(/\\/g, "/");
6932
+ function toPosix(p) {
6933
+ return p.replace(/\\/g, "/");
6908
6934
  }
6909
6935
  function relativeTo(dir, filePath) {
6910
6936
  const base = toPosix(dir).replace(/\/+$/, "");
@@ -6946,8 +6972,8 @@ function discoverWorkItems(dir) {
6946
6972
  // src/core/diff-analysis.ts
6947
6973
  import { minimatch } from "minimatch";
6948
6974
  import path3 from "path";
6949
- function toPosix2(p2) {
6950
- return p2.replace(/\\/g, "/");
6975
+ function toPosix2(p) {
6976
+ return p.replace(/\\/g, "/");
6951
6977
  }
6952
6978
  function normalizeTouchedPathForProject(touchedPath, gitRoot, projectRoot) {
6953
6979
  const t = toPosix2(touchedPath).replace(/^\.\//, "").replace(/^\/+/, "");
@@ -6959,8 +6985,8 @@ function normalizeTouchedPathForProject(touchedPath, gitRoot, projectRoot) {
6959
6985
  if (t.startsWith(prefix + "/")) return t.slice(prefix.length + 1);
6960
6986
  return null;
6961
6987
  }
6962
- function normalizePath(p2) {
6963
- return p2.replace(/\\/g, "/");
6988
+ function normalizePath(p) {
6989
+ return p.replace(/\\/g, "/");
6964
6990
  }
6965
6991
  function fileMatchesGlob(file, glob) {
6966
6992
  return minimatch(normalizePath(file), glob, { matchBase: false, dot: true });
@@ -7015,14 +7041,14 @@ function analyzeGuard(touchedFiles, artifacts, silentWithoutOwnership) {
7015
7041
  }
7016
7042
 
7017
7043
  // src/services/ignore-store.ts
7018
- import { parse as parseYaml4, stringify as stringifyYaml2 } from "yaml";
7044
+ import { parse as parseYaml5, stringify as stringifyYaml3 } from "yaml";
7019
7045
  var IGNORE_FILE = ".kaddo/ignores.yml";
7020
7046
  function loadIgnores(dir) {
7021
7047
  const path11 = join(dir, IGNORE_FILE);
7022
7048
  if (!exists(path11)) return [];
7023
7049
  try {
7024
7050
  const raw = readFile(path11);
7025
- const parsed = parseYaml4(raw);
7051
+ const parsed = parseYaml5(raw);
7026
7052
  return Array.isArray(parsed) ? parsed : [];
7027
7053
  } catch {
7028
7054
  return [];
@@ -7037,7 +7063,7 @@ function saveIgnore(dir, entry) {
7037
7063
  } else {
7038
7064
  existing.push(entry);
7039
7065
  }
7040
- writeFile(path11, stringifyYaml2(existing));
7066
+ writeFile(path11, stringifyYaml3(existing));
7041
7067
  }
7042
7068
  function isIgnored(ignores, artifactId) {
7043
7069
  return ignores.find((e) => e.artifact_id === artifactId);
@@ -7047,12 +7073,12 @@ function removeIgnore(dir, artifactId) {
7047
7073
  const existing = loadIgnores(dir);
7048
7074
  const filtered = existing.filter((e) => e.artifact_id !== artifactId);
7049
7075
  if (filtered.length === existing.length) return false;
7050
- writeFile(path11, stringifyYaml2(filtered));
7076
+ writeFile(path11, stringifyYaml3(filtered));
7051
7077
  return true;
7052
7078
  }
7053
7079
 
7054
7080
  // src/services/mapped-modules.ts
7055
- import { parse as parseYaml5 } from "yaml";
7081
+ import { parse as parseYaml6 } from "yaml";
7056
7082
  var DESCRIPTOR_PATH = ".kaddo/modules.yml";
7057
7083
  function toStringArray(value) {
7058
7084
  return Array.isArray(value) ? value.map((v) => String(v)).filter(Boolean) : [];
@@ -7073,7 +7099,7 @@ function loadMappedModules(dir) {
7073
7099
  if (!exists(path11)) return [];
7074
7100
  let parsed;
7075
7101
  try {
7076
- parsed = parseYaml5(readFile(path11));
7102
+ parsed = parseYaml6(readFile(path11));
7077
7103
  } catch {
7078
7104
  return [];
7079
7105
  }
@@ -7115,7 +7141,7 @@ function detectModuleStatus(coreDir, repoPath) {
7115
7141
  }
7116
7142
  let parsed = null;
7117
7143
  try {
7118
- parsed = parseYaml5(readFile(configPath));
7144
+ parsed = parseYaml6(readFile(configPath));
7119
7145
  } catch {
7120
7146
  }
7121
7147
  const project = parsed?.project;
@@ -7144,10 +7170,10 @@ function detectModuleStatus(coreDir, repoPath) {
7144
7170
  function readModuleContext(coreDir, repoPath) {
7145
7171
  const newPath = join(coreDir, repoPath, "knowledge", "tech", "module", "module-context.md");
7146
7172
  const legacyPath = join(coreDir, repoPath, "knowledge", "module", "module-context.md");
7147
- const p2 = exists(newPath) ? newPath : legacyPath;
7148
- if (!exists(p2)) return null;
7173
+ const p = exists(newPath) ? newPath : legacyPath;
7174
+ if (!exists(p)) return null;
7149
7175
  try {
7150
- return readFile(p2);
7176
+ return readFile(p);
7151
7177
  } catch {
7152
7178
  return null;
7153
7179
  }
@@ -7233,11 +7259,11 @@ function analyzeMetadataHealth(dir) {
7233
7259
  let healthy = 0;
7234
7260
  let drifted = 0;
7235
7261
  for (const rel of KNOWLEDGE_FILES) {
7236
- const p2 = join(dir, rel);
7237
- if (!exists(p2)) continue;
7262
+ const p = join(dir, rel);
7263
+ if (!exists(p)) continue;
7238
7264
  let data;
7239
7265
  try {
7240
- const raw = readFile(p2);
7266
+ const raw = readFile(p);
7241
7267
  data = matter2(raw).data;
7242
7268
  } catch {
7243
7269
  continue;
@@ -7266,13 +7292,13 @@ function analyzeMetadataHealth(dir) {
7266
7292
  if (exists(wiDir)) {
7267
7293
  const walkWIs = (d) => {
7268
7294
  for (const entry of readDir(d)) {
7269
- const p2 = join(d, entry);
7270
- if (isFile(p2) && entry.endsWith(".md")) {
7295
+ const p = join(d, entry);
7296
+ if (isFile(p) && entry.endsWith(".md")) {
7271
7297
  try {
7272
- const raw = readFile(p2);
7298
+ const raw = readFile(p);
7273
7299
  const fm2 = matter2(raw).data;
7274
7300
  if (fm2.status === "done") {
7275
- const rel = p2.replace(dir + "/", "").replace(dir + "\\", "").replace(/\\/g, "/");
7301
+ const rel = p.replace(dir + "/", "").replace(dir + "\\", "").replace(/\\/g, "/");
7276
7302
  findings.push({
7277
7303
  file: rel,
7278
7304
  field: "status",
@@ -7282,8 +7308,8 @@ function analyzeMetadataHealth(dir) {
7282
7308
  }
7283
7309
  } catch {
7284
7310
  }
7285
- } else if (!isFile(p2) && !entry.startsWith(".")) {
7286
- walkWIs(p2);
7311
+ } else if (!isFile(p) && !entry.startsWith(".")) {
7312
+ walkWIs(p);
7287
7313
  }
7288
7314
  }
7289
7315
  };
@@ -7529,7 +7555,7 @@ function analyzeScopeCoverage(artifact, registeredModuleIds, frontendModuleIds)
7529
7555
 
7530
7556
  // src/commands/guard.ts
7531
7557
  import path4 from "path";
7532
- import { parse as parseYaml7 } from "yaml";
7558
+ import { parse as parseYaml8 } from "yaml";
7533
7559
 
7534
7560
  // src/plugins/prisma.ts
7535
7561
  var DESTRUCTIVE_SQL = [
@@ -7660,7 +7686,7 @@ var AVAILABLE_PLUGINS = {
7660
7686
  openapi: openapiPlugin
7661
7687
  };
7662
7688
  function resolvePlugins(enabledNames) {
7663
- return enabledNames.map((name) => AVAILABLE_PLUGINS[name]).filter((p2) => p2 !== void 0);
7689
+ return enabledNames.map((name) => AVAILABLE_PLUGINS[name]).filter((p) => p !== void 0);
7664
7690
  }
7665
7691
  function runPlugins(plugins, touchedFiles, readFile2) {
7666
7692
  const signals = [];
@@ -7674,13 +7700,13 @@ function runPlugins(plugins, touchedFiles, readFile2) {
7674
7700
  }
7675
7701
 
7676
7702
  // src/services/owners.ts
7677
- import { parse as parseYaml6 } from "yaml";
7703
+ import { parse as parseYaml7 } from "yaml";
7678
7704
  var CONFIG_PATH = ".kaddo/config.yml";
7679
7705
  function loadOwners(dir) {
7680
7706
  const configPath = join(dir, CONFIG_PATH);
7681
7707
  if (!exists(configPath)) return {};
7682
7708
  try {
7683
- const config = parseYaml6(readFile(configPath));
7709
+ const config = parseYaml7(readFile(configPath));
7684
7710
  const raw = config.owners ?? {};
7685
7711
  const result = {};
7686
7712
  for (const [domain, people] of Object.entries(raw)) {
@@ -7716,14 +7742,14 @@ import fs2 from "fs";
7716
7742
  var HISTORY_DIR = ".kaddo/history";
7717
7743
  var RUNS_PATH = `${HISTORY_DIR}/guard-runs.jsonl`;
7718
7744
  var SUMMARY_PATH = `${HISTORY_DIR}/guard-summary.json`;
7719
- function toPosix3(p2) {
7720
- return p2.replace(/\\/g, "/");
7745
+ function toPosix3(p) {
7746
+ return p.replace(/\\/g, "/");
7721
7747
  }
7722
7748
  function loadGuardRuns(dir) {
7723
- const p2 = join(dir, RUNS_PATH);
7724
- if (!exists(p2)) return [];
7749
+ const p = join(dir, RUNS_PATH);
7750
+ if (!exists(p)) return [];
7725
7751
  const out = [];
7726
- for (const line of readFile(p2).split(/\r?\n/)) {
7752
+ for (const line of readFile(p).split(/\r?\n/)) {
7727
7753
  const t = line.trim();
7728
7754
  if (!t) continue;
7729
7755
  try {
@@ -7884,10 +7910,10 @@ function parseRisks(content) {
7884
7910
  const area = areaMatch?.[1]?.trim() ?? "";
7885
7911
  const blastRadius = blastMatch?.[1]?.trim() ?? "unknown";
7886
7912
  const confidence = confMatch?.[1]?.trim() ?? "unknown";
7887
- const areaPatterns = area.split(/[,;]/).map((p2) => p2.trim()).filter((p2) => p2.length > 0).flatMap((p2) => {
7888
- if (p2.includes("*")) return [p2];
7889
- if (p2.includes("/")) return [`${p2}/**`, `${p2}*`];
7890
- return [`**/${p2}/**`, `**/${p2}*`, `**/*${p2}*`];
7913
+ const areaPatterns = area.split(/[,;]/).map((p) => p.trim()).filter((p) => p.length > 0).flatMap((p) => {
7914
+ if (p.includes("*")) return [p];
7915
+ if (p.includes("/")) return [`${p}/**`, `${p}*`];
7916
+ return [`**/${p}/**`, `**/${p}*`, `**/*${p}*`];
7891
7917
  });
7892
7918
  risks.push({ id, title, area, blastRadius, confidence, areaPatterns });
7893
7919
  }
@@ -7925,7 +7951,7 @@ function loadConfig2(dir) {
7925
7951
  const configPath = join(dir, CONFIG_PATH2);
7926
7952
  if (!exists(configPath)) return {};
7927
7953
  try {
7928
- return parseYaml7(readFile(configPath));
7954
+ return parseYaml8(readFile(configPath));
7929
7955
  } catch {
7930
7956
  return {};
7931
7957
  }
@@ -7986,12 +8012,12 @@ function printPluginSignals(signals) {
7986
8012
  }
7987
8013
  async function offerIgnore(dir, match) {
7988
8014
  const id = match.artifact.id || match.artifact.title;
7989
- const shouldIgnore = await confirm2({
8015
+ const shouldIgnore = await confirm({
7990
8016
  message: `Ignore ${id} in future guard runs?`,
7991
8017
  initialValue: false
7992
8018
  });
7993
8019
  if (!shouldIgnore) return false;
7994
- const reason = await text2({
8020
+ const reason = await text({
7995
8021
  message: "Reason for ignoring",
7996
8022
  placeholder: "e.g. This file was moved, not functionally changed",
7997
8023
  validate: (v) => v.trim().length === 0 ? "Reason is required." : void 0
@@ -8002,7 +8028,7 @@ async function offerIgnore(dir, match) {
8002
8028
  created_at: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
8003
8029
  files: match.matchedFiles
8004
8030
  });
8005
- log2.success(`${id} added to .kaddo/ignores.yml`);
8031
+ log.success(`${id} added to .kaddo/ignores.yml`);
8006
8032
  return true;
8007
8033
  }
8008
8034
  function printCIJson(dir, touchedFiles, activeMatches, ignoredCount, pluginSignals, affectedOwners, workspace, includeArchived, normalizedFiles, outsideProjectFiles) {
@@ -8070,9 +8096,9 @@ async function runGuard(opts = {}) {
8070
8096
  raw,
8071
8097
  project: normalizeTouchedPathForProject(raw, gitRoot, dir)
8072
8098
  }));
8073
- const inProjectPairs = currentPairs.filter((p2) => p2.project !== null);
8074
- const currentFiles = inProjectPairs.map((p2) => p2.project);
8075
- const outsideProjectFiles = currentPairs.filter((p2) => p2.project === null).map((p2) => p2.raw);
8099
+ const inProjectPairs = currentPairs.filter((p) => p.project !== null);
8100
+ const currentFiles = inProjectPairs.map((p) => p.project);
8101
+ const outsideProjectFiles = currentPairs.filter((p) => p.project === null).map((p) => p.raw);
8076
8102
  const untrackedFiles = opts.staged ? [] : (await getUntrackedFiles()).map((f) => normalizeTouchedPathForProject(f, gitRoot, dir)).filter((f) => f !== null);
8077
8103
  const printUntracked = () => {
8078
8104
  if (untrackedFiles.length === 0 || jsonMode) return;
@@ -8088,7 +8114,7 @@ async function runGuard(opts = {}) {
8088
8114
  }
8089
8115
  const workspaceFiles = workspaceScan ? workspaceScan.changedFiles.map((c) => c.normalizedPath) : [];
8090
8116
  const touchedFiles = [.../* @__PURE__ */ new Set([...currentFiles, ...workspaceFiles])];
8091
- const displayTouched = [.../* @__PURE__ */ new Set([...inProjectPairs.map((p2) => p2.raw), ...workspaceFiles])];
8117
+ const displayTouched = [.../* @__PURE__ */ new Set([...inProjectPairs.map((p) => p.raw), ...workspaceFiles])];
8092
8118
  if (touchedFiles.length === 0) {
8093
8119
  if (workspaceScan) printWorkspaceHeader(workspaceScan);
8094
8120
  console.log("kaddo guard: no modified files detected.");
@@ -8165,7 +8191,7 @@ async function runGuard(opts = {}) {
8165
8191
  const ownerMapCI = loadOwners(dir);
8166
8192
  const matchedDomainsCI = collectMatchedDomains(activeMatches.map((m) => m.artifact.domains));
8167
8193
  const affectedOwnersCI = resolveAffectedOwners(matchedDomainsCI, ownerMapCI);
8168
- printCIJson(dir, touchedFiles, activeMatches, alreadyIgnoredMatches.length, pluginSignals, affectedOwnersCI, workspaceScan, includeArchived, inProjectPairs.map((p2) => ({ raw_path: p2.raw, project_path: p2.project })), outsideProjectFiles);
8194
+ printCIJson(dir, touchedFiles, activeMatches, alreadyIgnoredMatches.length, pluginSignals, affectedOwnersCI, workspaceScan, includeArchived, inProjectPairs.map((p) => ({ raw_path: p.raw, project_path: p.project })), outsideProjectFiles);
8169
8195
  return;
8170
8196
  }
8171
8197
  if (result.silenced && pluginSignals.length === 0) {
@@ -8308,7 +8334,7 @@ function runIgnore(artifactId, reason) {
8308
8334
  created_at: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
8309
8335
  files: []
8310
8336
  });
8311
- log2.success(`${artifactId} added to .kaddo/ignores.yml \u2014 "${reason}"`);
8337
+ log.success(`${artifactId} added to .kaddo/ignores.yml \u2014 "${reason}"`);
8312
8338
  }
8313
8339
  function runIgnoreList() {
8314
8340
  const dir = cwd();
@@ -8330,15 +8356,15 @@ function runIgnoreRemove(artifactId) {
8330
8356
  const dir = cwd();
8331
8357
  const removed = removeIgnore(dir, artifactId);
8332
8358
  if (removed) {
8333
- log2.success(`${artifactId} removed from .kaddo/ignores.yml`);
8359
+ log.success(`${artifactId} removed from .kaddo/ignores.yml`);
8334
8360
  } else {
8335
- log2.warn(`${artifactId} was not in .kaddo/ignores.yml`);
8361
+ log.warn(`${artifactId} was not in .kaddo/ignores.yml`);
8336
8362
  }
8337
8363
  }
8338
8364
 
8339
8365
  // src/commands/explain.ts
8340
8366
  import matter6 from "gray-matter";
8341
- import { parse as parseYaml12 } from "yaml";
8367
+ import { parse as parseYaml13 } from "yaml";
8342
8368
 
8343
8369
  // src/core/delivery-phase.ts
8344
8370
  function layer(layers, name) {
@@ -8532,10 +8558,10 @@ function assessPhase(input) {
8532
8558
 
8533
8559
  // src/core/capsule.ts
8534
8560
  import matter3 from "gray-matter";
8535
- import { parse as parseYaml10, stringify as stringifyYaml5 } from "yaml";
8561
+ import { parse as parseYaml11, stringify as stringifyYaml6 } from "yaml";
8536
8562
 
8537
8563
  // src/commands/modules-map.ts
8538
- import { parse as parseYaml9, stringify as stringifyYaml4 } from "yaml";
8564
+ import { parse as parseYaml10, stringify as stringifyYaml5 } from "yaml";
8539
8565
 
8540
8566
  // src/templates/registry.ts
8541
8567
  var QUALITY = "## Quality checklist";
@@ -10076,7 +10102,7 @@ function getTemplate(id) {
10076
10102
 
10077
10103
  // src/commands/modules-discover.ts
10078
10104
  import path5 from "path";
10079
- import { parse as parseYaml8, stringify as stringifyYaml3 } from "yaml";
10105
+ import { parse as parseYaml9, stringify as stringifyYaml4 } from "yaml";
10080
10106
  var CONFIG_PATH3 = ".kaddo/config.yml";
10081
10107
  var MODULES_YML = ".kaddo/modules.yml";
10082
10108
  var MODULES_MD = "knowledge/tech/modules/modules.md";
@@ -10094,10 +10120,10 @@ var IGNORED_DIRS = /* @__PURE__ */ new Set([
10094
10120
  ".kaddo"
10095
10121
  ]);
10096
10122
  function readModulesYml(dir) {
10097
- const p2 = join(dir, MODULES_YML);
10098
- if (!exists(p2)) return { version: 1, system: "", workspace_roots: [".."], modules: [] };
10123
+ const p = join(dir, MODULES_YML);
10124
+ if (!exists(p)) return { version: 1, system: "", workspace_roots: [".."], modules: [] };
10099
10125
  try {
10100
- const parsed = parseYaml8(readFile(p2));
10126
+ const parsed = parseYaml9(readFile(p));
10101
10127
  return {
10102
10128
  version: parsed.version ?? 1,
10103
10129
  system: parsed.system ?? "",
@@ -10109,13 +10135,13 @@ function readModulesYml(dir) {
10109
10135
  }
10110
10136
  }
10111
10137
  function writeModulesYml(dir, yml) {
10112
- writeFile(join(dir, MODULES_YML), stringifyYaml3(yml));
10138
+ writeFile(join(dir, MODULES_YML), stringifyYaml4(yml));
10113
10139
  }
10114
10140
  function readRepoConfig(repoDir) {
10115
10141
  const configPath = join(repoDir, CONFIG_PATH3);
10116
10142
  if (!exists(configPath)) return null;
10117
10143
  try {
10118
- return parseYaml8(readFile(configPath));
10144
+ return parseYaml9(readFile(configPath));
10119
10145
  } catch {
10120
10146
  return null;
10121
10147
  }
@@ -10385,7 +10411,7 @@ function detectLegacyPaths(dir) {
10385
10411
  }
10386
10412
  async function runModulesDiscover(opts = {}) {
10387
10413
  const dir = cwd();
10388
- intro2("kaddo modules discover");
10414
+ intro("kaddo modules discover");
10389
10415
  const config = loadConfig(dir);
10390
10416
  if (!config) {
10391
10417
  console.error("Kaddo is not initialized. Run `kaddo init` first.");
@@ -10397,8 +10423,8 @@ async function runModulesDiscover(opts = {}) {
10397
10423
  }
10398
10424
  const discovered = discoverModules(dir);
10399
10425
  if (discovered.length === 0) {
10400
- log2.info("No sibling repositories found in workspace roots.");
10401
- outro2("Discovery complete.");
10426
+ log.info("No sibling repositories found in workspace roots.");
10427
+ outro("Discovery complete.");
10402
10428
  return;
10403
10429
  }
10404
10430
  console.log("");
@@ -10415,26 +10441,26 @@ async function runModulesDiscover(opts = {}) {
10415
10441
  const eligible = discovered.filter((d) => d.eligibleForMapping && d.status === "configured");
10416
10442
  console.log(`Eligible for mapping: ${eligible.length}`);
10417
10443
  if (eligible.length === 0) {
10418
- outro2("Discovery complete.");
10444
+ outro("Discovery complete.");
10419
10445
  return;
10420
10446
  }
10421
10447
  if (opts.apply) {
10422
- const confirmed = await confirm2({
10448
+ const confirmed = await confirm({
10423
10449
  message: `Map ${eligible.length} configured Kaddo modules?`,
10424
10450
  initialValue: true
10425
10451
  });
10426
10452
  if (!confirmed) {
10427
- outro2("No changes applied.");
10453
+ outro("No changes applied.");
10428
10454
  return;
10429
10455
  }
10430
10456
  const result = applyDiscovery(dir, discovered);
10431
- log2.success(`Mapped ${result.mapped} configured modules.`);
10432
- log2.success("Updated .kaddo/modules.yml.");
10433
- log2.success("Updated knowledge/tech/modules/modules.md.");
10434
- outro2("Discovery applied.");
10457
+ log.success(`Mapped ${result.mapped} configured modules.`);
10458
+ log.success("Updated .kaddo/modules.yml.");
10459
+ log.success("Updated knowledge/tech/modules/modules.md.");
10460
+ outro("Discovery applied.");
10435
10461
  } else {
10436
- log2.info("Run `kaddo modules discover --apply` to persist eligible modules.");
10437
- outro2("Discovery complete.");
10462
+ log.info("Run `kaddo modules discover --apply` to persist eligible modules.");
10463
+ outro("Discovery complete.");
10438
10464
  }
10439
10465
  }
10440
10466
 
@@ -10458,14 +10484,14 @@ function readModulesDescriptor(dir) {
10458
10484
  const path11 = join(dir, DESCRIPTOR_PATH2);
10459
10485
  if (!exists(path11)) return { version: 1, modules: [] };
10460
10486
  try {
10461
- const parsed = parseYaml9(readFile(path11));
10487
+ const parsed = parseYaml10(readFile(path11));
10462
10488
  return { version: parsed.version ?? 1, modules: parsed.modules ?? [] };
10463
10489
  } catch {
10464
10490
  return { version: 1, modules: [] };
10465
10491
  }
10466
10492
  }
10467
10493
  function writeModulesDescriptor(dir, descriptor) {
10468
- writeFile(join(dir, DESCRIPTOR_PATH2), stringifyYaml4(descriptor));
10494
+ writeFile(join(dir, DESCRIPTOR_PATH2), stringifyYaml5(descriptor));
10469
10495
  }
10470
10496
  function moduleDir(id) {
10471
10497
  return `knowledge/tech/modules/${id}`;
@@ -10597,7 +10623,7 @@ function mapModule(dir, input) {
10597
10623
  return { module: mod, written, skipped, alreadyRegistered };
10598
10624
  }
10599
10625
  async function runModulesMap(dir = cwd(), modulePath) {
10600
- intro2("kaddo modules map");
10626
+ intro("kaddo modules map");
10601
10627
  if (!exists(join(dir, CONFIG_PATH4))) {
10602
10628
  console.error("Kaddo is not initialized in this project.");
10603
10629
  console.error("Run `kaddo init` first.");
@@ -10607,7 +10633,7 @@ async function runModulesMap(dir = cwd(), modulePath) {
10607
10633
  if (modulePath) {
10608
10634
  repoPath = modulePath;
10609
10635
  } else {
10610
- repoPath = await text2({
10636
+ repoPath = await text({
10611
10637
  message: "Repository path (relative to this repo)",
10612
10638
  placeholder: "e.g. ../frontend",
10613
10639
  validate: (v) => v.trim().length === 0 ? "Repository path is required." : void 0
@@ -10615,21 +10641,21 @@ async function runModulesMap(dir = cwd(), modulePath) {
10615
10641
  }
10616
10642
  const targetDir = join(dir, repoPath.trim());
10617
10643
  if (!exists(targetDir)) {
10618
- log2.warn(`Path "${repoPath.trim()}" does not exist.`);
10644
+ log.warn(`Path "${repoPath.trim()}" does not exist.`);
10619
10645
  } else {
10620
10646
  const st = detectModuleStatus(dir, repoPath.trim());
10621
10647
  if (st.status === "not_configured") {
10622
- log2.warn(`${repoPath.trim()} does not have Kaddo configured. Run \`kaddo init\` inside that repository first.`);
10648
+ log.warn(`${repoPath.trim()} does not have Kaddo configured. Run \`kaddo init\` inside that repository first.`);
10623
10649
  } else if (st.status === "invalid") {
10624
- log2.warn(`${repoPath.trim()} has Kaddo but is not configured as a module.`);
10650
+ log.warn(`${repoPath.trim()} has Kaddo but is not configured as a module.`);
10625
10651
  }
10626
10652
  }
10627
- const name = await text2({
10653
+ const name = await text({
10628
10654
  message: "Module name",
10629
10655
  placeholder: "e.g. Frontend Web",
10630
10656
  validate: (v) => v.trim().length === 0 ? "Name is required." : void 0
10631
10657
  });
10632
- const type = await select2({
10658
+ const type = await select({
10633
10659
  message: "Module type",
10634
10660
  options: MODULE_TYPES.map((t) => ({ value: t, label: t }))
10635
10661
  });
@@ -10638,10 +10664,10 @@ async function runModulesMap(dir = cwd(), modulePath) {
10638
10664
  repoPath,
10639
10665
  type
10640
10666
  });
10641
- for (const p2 of result.written) log2.success(`Created ${p2}`);
10642
- for (const p2 of result.skipped) log2.info(`Kept existing ${p2}`);
10643
- log2.success(`Module "${result.module.id}" recorded in ${DESCRIPTOR_PATH2}`);
10644
- outro2("Module mapped.");
10667
+ for (const p of result.written) log.success(`Created ${p}`);
10668
+ for (const p of result.skipped) log.info(`Kept existing ${p}`);
10669
+ log.success(`Module "${result.module.id}" recorded in ${DESCRIPTOR_PATH2}`);
10670
+ outro("Module mapped.");
10645
10671
  }
10646
10672
  function runModulesList(dir = cwd()) {
10647
10673
  const yml = readModulesYml(dir);
@@ -10683,8 +10709,8 @@ function firstParagraph(md) {
10683
10709
  return "";
10684
10710
  }
10685
10711
  function readIf(dir, rel) {
10686
- const p2 = join(dir, rel);
10687
- return exists(p2) ? readFile(p2) : null;
10712
+ const p = join(dir, rel);
10713
+ return exists(p) ? readFile(p) : null;
10688
10714
  }
10689
10715
  function headings(md) {
10690
10716
  return md.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|risks|owners|out of scope)$/i.test(h));
@@ -10801,17 +10827,17 @@ function serializeCapsuleJson(c) {
10801
10827
  }
10802
10828
  var EXTERNAL_PATH = ".kaddo/external.yml";
10803
10829
  function loadExternalRegistry(dir) {
10804
- const p2 = join(dir, EXTERNAL_PATH);
10805
- if (!exists(p2)) return [];
10830
+ const p = join(dir, EXTERNAL_PATH);
10831
+ if (!exists(p)) return [];
10806
10832
  try {
10807
- const parsed = parseYaml10(readFile(p2));
10833
+ const parsed = parseYaml11(readFile(p));
10808
10834
  return Array.isArray(parsed?.external) ? parsed.external : [];
10809
10835
  } catch {
10810
10836
  return [];
10811
10837
  }
10812
10838
  }
10813
10839
  function serializeExternalRegistry(entries) {
10814
- return stringifyYaml5({ external: entries });
10840
+ return stringifyYaml6({ external: entries });
10815
10841
  }
10816
10842
  function sectionList(md, title) {
10817
10843
  const re = new RegExp(`^##\\s+${title}\\s*$`, "im");
@@ -10903,8 +10929,8 @@ var ALL_STATUSES = ["draft", "ready", "in-progress", "blocked", "completed"];
10903
10929
  function scopeStatuses(scope) {
10904
10930
  return scope === "all" ? { included: ALL_STATUSES, excluded: ["archived"] } : { included: ACTIVE_STATUSES, excluded: ["completed", "archived"] };
10905
10931
  }
10906
- function toPosix4(p2) {
10907
- return p2.replace(/\\/g, "/");
10932
+ function toPosix4(p) {
10933
+ return p.replace(/\\/g, "/");
10908
10934
  }
10909
10935
  function slug(s) {
10910
10936
  return s.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
@@ -11079,10 +11105,10 @@ function renderGraphMermaid(graph) {
11079
11105
  }
11080
11106
  var ACTIVE_WI_STATES = /* @__PURE__ */ new Set(["draft", "ready", "in-progress", "blocked"]);
11081
11107
  function loadGraphSummary(dir) {
11082
- const p2 = join(dir, ".kaddo", "graph.json");
11083
- if (!exists(p2)) return null;
11108
+ const p = join(dir, ".kaddo", "graph.json");
11109
+ if (!exists(p)) return null;
11084
11110
  try {
11085
- const graph = JSON.parse(readFile(p2));
11111
+ const graph = JSON.parse(readFile(p));
11086
11112
  const nodes = Array.isArray(graph.nodes) ? graph.nodes : [];
11087
11113
  const edges = Array.isArray(graph.edges) ? graph.edges : [];
11088
11114
  const activeWiIds = new Set(
@@ -11109,8 +11135,8 @@ function loadGraphSummary(dir) {
11109
11135
 
11110
11136
  // src/core/graph-hints.ts
11111
11137
  var KNOWLEDGE4 = "knowledge";
11112
- function toPosix5(p2) {
11113
- return p2.replace(/\\/g, "/");
11138
+ function toPosix5(p) {
11139
+ return p.replace(/\\/g, "/");
11114
11140
  }
11115
11141
  function slug2(s) {
11116
11142
  return s.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
@@ -11119,9 +11145,9 @@ function isAdr2(a) {
11119
11145
  return toPosix5(a.filePath).includes("/tech/decisions/") && Boolean(a.type);
11120
11146
  }
11121
11147
  function capabilityHeadings(dir) {
11122
- const p2 = join(dir, KNOWLEDGE4, "product", "capabilities.md");
11123
- if (!exists(p2)) return [];
11124
- 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));
11148
+ const p = join(dir, KNOWLEDGE4, "product", "capabilities.md");
11149
+ if (!exists(p)) return [];
11150
+ 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));
11125
11151
  }
11126
11152
  function humanMissing(field) {
11127
11153
  switch (field) {
@@ -11332,10 +11358,10 @@ function serializeGraphHintsJson(report) {
11332
11358
  return JSON.stringify(report, null, 2) + "\n";
11333
11359
  }
11334
11360
  function loadGraphHints(dir) {
11335
- const p2 = join(dir, ".kaddo", "graph-hints.json");
11336
- if (!exists(p2)) return null;
11361
+ const p = join(dir, ".kaddo", "graph-hints.json");
11362
+ if (!exists(p)) return null;
11337
11363
  try {
11338
- const report = JSON.parse(readFile(p2));
11364
+ const report = JSON.parse(readFile(p));
11339
11365
  const hints = Array.isArray(report.hints) ? report.hints : [];
11340
11366
  return {
11341
11367
  scope: String(report.scope ?? "active"),
@@ -11428,15 +11454,15 @@ function layerForType(type) {
11428
11454
  return null;
11429
11455
  }
11430
11456
  function layerFromPath(filePath) {
11431
- const p2 = filePath.replace(/\\/g, "/");
11432
- if (p2.includes(`/${KNOWLEDGE5}/business/`)) return "Business";
11433
- if (p2.includes(`/${KNOWLEDGE5}/product/`)) return "Product";
11434
- if (p2.includes(`/${KNOWLEDGE5}/tech/`)) return "Tech";
11435
- if (p2.includes(`/${KNOWLEDGE5}/delivery/`)) return "Delivery";
11457
+ const p = filePath.replace(/\\/g, "/");
11458
+ if (p.includes(`/${KNOWLEDGE5}/business/`)) return "Business";
11459
+ if (p.includes(`/${KNOWLEDGE5}/product/`)) return "Product";
11460
+ if (p.includes(`/${KNOWLEDGE5}/tech/`)) return "Tech";
11461
+ if (p.includes(`/${KNOWLEDGE5}/delivery/`)) return "Delivery";
11436
11462
  return null;
11437
11463
  }
11438
- function basename(p2) {
11439
- return p2.replace(/\\/g, "/").split("/").pop() ?? p2;
11464
+ function basename(p) {
11465
+ return p.replace(/\\/g, "/").split("/").pop() ?? p;
11440
11466
  }
11441
11467
  function discoverLayers(dir) {
11442
11468
  const acc = {
@@ -11566,10 +11592,10 @@ function analyzeContent(md) {
11566
11592
  return "weak";
11567
11593
  }
11568
11594
  function analyzeKnowledgeArtifact(dir, rel) {
11569
- const p2 = join(dir, rel);
11570
- if (!exists(p2)) return "missing";
11595
+ const p = join(dir, rel);
11596
+ if (!exists(p)) return "missing";
11571
11597
  try {
11572
- return analyzeContent(readFile(p2));
11598
+ return analyzeContent(readFile(p));
11573
11599
  } catch {
11574
11600
  return "missing";
11575
11601
  }
@@ -11713,8 +11739,8 @@ var IMPORTANT = [
11713
11739
  "permis",
11714
11740
  "permission"
11715
11741
  ];
11716
- function matchesAny(text3, keywords) {
11717
- return keywords.some((k) => text3.includes(k));
11742
+ function matchesAny(text2, keywords) {
11743
+ return keywords.some((k) => text2.includes(k));
11718
11744
  }
11719
11745
  function classifyQuestion(question) {
11720
11746
  const t = question.toLowerCase();
@@ -11746,8 +11772,8 @@ function extractFromMarkdown(md) {
11746
11772
  if (m) {
11747
11773
  const bullet = m[1].trim();
11748
11774
  if (!bullet || /^_.*_$/.test(bullet)) continue;
11749
- const { text: text3, resolution_status } = parseResolution(bullet);
11750
- if (text3) out.push({ text: text3, resolution_status, line: i + 1, raw: line.trim() });
11775
+ const { text: text2, resolution_status } = parseResolution(bullet);
11776
+ if (text2) out.push({ text: text2, resolution_status, line: i + 1, raw: line.trim() });
11751
11777
  }
11752
11778
  }
11753
11779
  return out;
@@ -11773,11 +11799,11 @@ function buildOpenQuestionsReport(dir, now = /* @__PURE__ */ new Date()) {
11773
11799
  const questions = [];
11774
11800
  let seq = 0;
11775
11801
  for (const source of SOURCES) {
11776
- const p2 = join(dir, source);
11777
- if (!exists(p2)) continue;
11802
+ const p = join(dir, source);
11803
+ if (!exists(p)) continue;
11778
11804
  let md;
11779
11805
  try {
11780
- md = readFile(p2);
11806
+ md = readFile(p);
11781
11807
  } catch {
11782
11808
  continue;
11783
11809
  }
@@ -11947,7 +11973,7 @@ function buildCodexAdapterContext(dir) {
11947
11973
  hasSkills: skills.length > 0,
11948
11974
  skills,
11949
11975
  hasMcpHint: detectMcpHint(dir),
11950
- knowledgePaths: KNOWLEDGE_PATHS.filter((p2) => exists(join(dir, p2))),
11976
+ knowledgePaths: KNOWLEDGE_PATHS.filter((p) => exists(join(dir, p))),
11951
11977
  generatedPaths: GENERATED_PATHS
11952
11978
  };
11953
11979
  }
@@ -12031,10 +12057,10 @@ function renderAdapterMarkdown(ctx, target) {
12031
12057
  L.push("");
12032
12058
  L.push("## Kaddo knowledge map", "");
12033
12059
  L.push("Primary knowledge lives in:", "");
12034
- for (const p2 of ctx.knowledgePaths.length > 0 ? ctx.knowledgePaths : KNOWLEDGE_PATHS) L.push(`- \`${p2}\``);
12060
+ for (const p of ctx.knowledgePaths.length > 0 ? ctx.knowledgePaths : KNOWLEDGE_PATHS) L.push(`- \`${p}\``);
12035
12061
  L.push("");
12036
12062
  L.push("Derived context (generated \u2014 do not edit by hand) lives in:", "");
12037
- for (const p2 of ctx.generatedPaths) L.push(`- \`${p2}\``);
12063
+ for (const p of ctx.generatedPaths) L.push(`- \`${p}\``);
12038
12064
  L.push("");
12039
12065
  L.push("## Operating rules", "");
12040
12066
  L.push("- Do not generate a roadmap without checking open-questions readiness.");
@@ -12158,10 +12184,10 @@ function renderKaddoBlock(ctx) {
12158
12184
  L.push("");
12159
12185
  L.push("### Kaddo knowledge map", "");
12160
12186
  L.push("Primary knowledge:");
12161
- for (const p2 of ctx.knowledgePaths.length > 0 ? ctx.knowledgePaths : KNOWLEDGE_PATHS) L.push(`- \`${p2}\``);
12187
+ for (const p of ctx.knowledgePaths.length > 0 ? ctx.knowledgePaths : KNOWLEDGE_PATHS) L.push(`- \`${p}\``);
12162
12188
  L.push("");
12163
12189
  L.push("Generated context (do not edit by hand):");
12164
- for (const p2 of ctx.generatedPaths) L.push(`- \`${p2}\``);
12190
+ for (const p of ctx.generatedPaths) L.push(`- \`${p}\``);
12165
12191
  L.push("");
12166
12192
  L.push("### Kaddo operating rules", "");
12167
12193
  L.push("- Do not generate a roadmap without checking open-questions readiness.");
@@ -12294,7 +12320,7 @@ function buildSharedFileStatuses(statuses) {
12294
12320
  }
12295
12321
 
12296
12322
  // src/core/next-step.ts
12297
- import { parse as parseYaml11 } from "yaml";
12323
+ import { parse as parseYaml12 } from "yaml";
12298
12324
 
12299
12325
  // src/core/decisions.ts
12300
12326
  var CANDIDATES_DISCOVERY = "knowledge/tech/discovery/decision-candidates.md";
@@ -12413,25 +12439,25 @@ function buildDeliveryState(dir) {
12413
12439
  }
12414
12440
  function hasRegisteredModules(modulesYmlPath) {
12415
12441
  try {
12416
- const parsed = parseYaml11(readFile(modulesYmlPath));
12442
+ const parsed = parseYaml12(readFile(modulesYmlPath));
12417
12443
  return Array.isArray(parsed?.modules) && parsed.modules.length > 0;
12418
12444
  } catch {
12419
12445
  return false;
12420
12446
  }
12421
12447
  }
12422
- function safeRead(p2) {
12448
+ function safeRead(p) {
12423
12449
  try {
12424
- return readFile(p2);
12450
+ return readFile(p);
12425
12451
  } catch {
12426
12452
  return null;
12427
12453
  }
12428
12454
  }
12429
12455
  function roadmapSignal(dir) {
12430
- const p2 = join(dir, "knowledge/delivery/roadmap.md");
12431
- if (!exists(p2)) return "missing";
12456
+ const p = join(dir, "knowledge/delivery/roadmap.md");
12457
+ if (!exists(p)) return "missing";
12432
12458
  let md;
12433
12459
  try {
12434
- md = readFile(p2);
12460
+ md = readFile(p);
12435
12461
  } catch {
12436
12462
  return "missing";
12437
12463
  }
@@ -13020,10 +13046,10 @@ function parseRoadmapCandidateQuality(md) {
13020
13046
  }
13021
13047
  function buildRoadmapQuality(dir) {
13022
13048
  let md = "";
13023
- const p2 = join(dir, ROADMAP_PATH2);
13024
- if (exists(p2)) {
13049
+ const p = join(dir, ROADMAP_PATH2);
13050
+ if (exists(p)) {
13025
13051
  try {
13026
- md = readFile(p2);
13052
+ md = readFile(p);
13027
13053
  } catch {
13028
13054
  md = "";
13029
13055
  }
@@ -14422,7 +14448,7 @@ function readConfig(dir) {
14422
14448
  const configPath = join(dir, CONFIG_PATH5);
14423
14449
  if (!exists(configPath)) return {};
14424
14450
  try {
14425
- return parseYaml12(readFile(configPath));
14451
+ return parseYaml13(readFile(configPath));
14426
14452
  } catch {
14427
14453
  return {};
14428
14454
  }
@@ -14508,7 +14534,7 @@ function explainForAgent(dir, artifacts, opts) {
14508
14534
  since: opts.since ?? null
14509
14535
  };
14510
14536
  if (knowledge) {
14511
- const firstParagraph3 = knowledge.content.trim().split("\n\n").find((p2) => p2.trim() && !p2.startsWith("#"));
14537
+ const firstParagraph3 = knowledge.content.trim().split("\n\n").find((p) => p.trim() && !p.startsWith("#"));
14512
14538
  output.knowledge_summary = firstParagraph3?.trim() ?? "";
14513
14539
  }
14514
14540
  const mappedArtifacts = artifacts.filter((a) => a.type !== "current-state" && a.type !== "roadmap").map((a) => ({
@@ -14595,14 +14621,14 @@ function readScanJson(dir) {
14595
14621
  }
14596
14622
  function firstParagraph2(markdown) {
14597
14623
  const body = matter7(markdown).content.trim();
14598
- const para = body.split("\n\n").map((p2) => p2.trim()).find((p2) => p2 && !p2.startsWith("#"));
14624
+ const para = body.split("\n\n").map((p) => p.trim()).find((p) => p && !p.startsWith("#"));
14599
14625
  return para ?? "";
14600
14626
  }
14601
14627
  function readMarkdownSummary(dir, file) {
14602
- const p2 = join(dir, ARCH_DIR6, file);
14603
- if (!exists(p2)) return null;
14628
+ const p = join(dir, ARCH_DIR6, file);
14629
+ if (!exists(p)) return null;
14604
14630
  try {
14605
- return firstParagraph2(readFile(p2));
14631
+ return firstParagraph2(readFile(p));
14606
14632
  } catch {
14607
14633
  return null;
14608
14634
  }
@@ -14705,8 +14731,8 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
14705
14731
  const roadmap = roadmapStats(exists(roadmapPath) ? readFile(roadmapPath) : null, materialized);
14706
14732
  const deliveryMix = {};
14707
14733
  for (const a of allArtifacts) {
14708
- const p2 = a.filePath.replace(/\\/g, "/");
14709
- if (!a.type || !p2.includes("/delivery/work-items/")) continue;
14734
+ const p = a.filePath.replace(/\\/g, "/");
14735
+ if (!a.type || !p.includes("/delivery/work-items/")) continue;
14710
14736
  if (!isActiveState(lifecycleStateOf({ status: a.status, filePath: a.filePath }))) continue;
14711
14737
  deliveryMix[a.type] = (deliveryMix[a.type] ?? 0) + 1;
14712
14738
  }
@@ -15240,7 +15266,7 @@ function renderContextPack(pack) {
15240
15266
  // src/commands/context.ts
15241
15267
  function runContext(opts = {}) {
15242
15268
  const dir = cwd();
15243
- intro2("kaddo context");
15269
+ intro("kaddo context");
15244
15270
  let config;
15245
15271
  try {
15246
15272
  config = loadConfig(dir);
@@ -15261,19 +15287,19 @@ function runContext(opts = {}) {
15261
15287
  if (writeJson) {
15262
15288
  const jsonPath = join(dir, ".kaddo", "context-pack.json");
15263
15289
  writeFile(jsonPath, serializeContextPackJson(pack));
15264
- log2.success("Wrote .kaddo/context-pack.json");
15290
+ log.success("Wrote .kaddo/context-pack.json");
15265
15291
  }
15266
15292
  if (writeMarkdown) {
15267
15293
  const mdPath = join(dir, ".kaddo", "context-pack.md");
15268
15294
  writeFile(mdPath, renderContextPack(pack));
15269
- log2.success("Wrote .kaddo/context-pack.md");
15295
+ log.success("Wrote .kaddo/context-pack.md");
15270
15296
  }
15271
15297
  if (pack.missing.length > 0) {
15272
- log2.warn(`Some context is missing (${pack.missing.length} item(s)) \u2014 see the pack's "Missing Context" section.`);
15298
+ log.warn(`Some context is missing (${pack.missing.length} item(s)) \u2014 see the pack's "Missing Context" section.`);
15273
15299
  }
15274
- log2.info("Paste .kaddo/context-pack.md into your LLM chat alongside a Kaddo agent prompt.");
15300
+ log.info("Paste .kaddo/context-pack.md into your LLM chat alongside a Kaddo agent prompt.");
15275
15301
  printCommandFooter("context");
15276
- outro2("Context pack ready.");
15302
+ outro("Context pack ready.");
15277
15303
  }
15278
15304
 
15279
15305
  // src/core/understand.ts
@@ -15489,7 +15515,7 @@ function renderUnderstand(plan) {
15489
15515
  parts.push("## Agent Prompts\n");
15490
15516
  if (agentPaths.length > 1) {
15491
15517
  parts.push("Use:\n");
15492
- parts.push(agentPaths.map((p2) => `- \`${p2}\``).join("\n") + "\n");
15518
+ parts.push(agentPaths.map((p) => `- \`${p}\``).join("\n") + "\n");
15493
15519
  } else {
15494
15520
  parts.push(`- \`${plan.contextPackPath}\`
15495
15521
  `);
@@ -15536,7 +15562,7 @@ function renderUnderstand(plan) {
15536
15562
  );
15537
15563
  } else if (agentPaths.length > 1) {
15538
15564
  parts.push("Paste the following into your LLM chat:\n");
15539
- parts.push(agentPaths.map((p2, i) => `${i + 1}. \`${p2}\``).join("\n") + "\n");
15565
+ parts.push(agentPaths.map((p, i) => `${i + 1}. \`${p}\``).join("\n") + "\n");
15540
15566
  if (rec?.agent) {
15541
15567
  parts.push(`Ask the LLM to follow the ${agentName(rec.agent)} instructions.
15542
15568
  `);
@@ -15671,7 +15697,7 @@ function renderUnderstandTerminal(plan) {
15671
15697
  }
15672
15698
 
15673
15699
  // src/core/delivery.ts
15674
- import { parse as parseYaml13 } from "yaml";
15700
+ import { parse as parseYaml14 } from "yaml";
15675
15701
  function slugify4(s) {
15676
15702
  return s.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
15677
15703
  }
@@ -15733,7 +15759,7 @@ function renderDeliveryLifecycle(wi) {
15733
15759
  // src/commands/understand.ts
15734
15760
  function runUnderstand() {
15735
15761
  const dir = cwd();
15736
- intro2("kaddo understand");
15762
+ intro("kaddo understand");
15737
15763
  let config;
15738
15764
  try {
15739
15765
  config = loadConfig(dir);
@@ -15749,16 +15775,16 @@ function runUnderstand() {
15749
15775
  }
15750
15776
  const scanAvailable = exists(join(dir, ".kaddo", "scan.json"));
15751
15777
  if (!scanAvailable) {
15752
- log2.warn("No scan baseline found. Run `kaddo scan` first for a richer context pack.");
15778
+ log.warn("No scan baseline found. Run `kaddo scan` first for a richer context pack.");
15753
15779
  }
15754
15780
  const pack = buildContextPack(dir, config);
15755
15781
  writeFile(join(dir, ".kaddo", "context-pack.json"), serializeContextPackJson(pack));
15756
15782
  writeFile(join(dir, ".kaddo", "context-pack.md"), renderContextPack(pack));
15757
- log2.success("Refreshed .kaddo/context-pack.md");
15783
+ log.success("Refreshed .kaddo/context-pack.md");
15758
15784
  const plan = buildUnderstandPlan(dir, config);
15759
15785
  const earlyRec = resolveNextStep(dir);
15760
15786
  if (earlyRec.id !== "bootstrap" && plan.missingAgents.length > 0) {
15761
- log2.warn(
15787
+ log.warn(
15762
15788
  `Agents are not installed (${plan.missingAgents.map((a) => a.replace(/\.md$/, "")).join(", ")}). Run \`kaddo add agents\`.`
15763
15789
  );
15764
15790
  }
@@ -15927,9 +15953,9 @@ function runUnderstand() {
15927
15953
  metadataHealth: analyzeMetadataHealth(dir)
15928
15954
  });
15929
15955
  writeFile(join(dir, ".kaddo", "understand.md"), renderUnderstand(enrichedPlan));
15930
- log2.success("Wrote .kaddo/understand.md");
15956
+ log.success("Wrote .kaddo/understand.md");
15931
15957
  printCommandFooter("understand");
15932
- outro2("Handoff ready. CLI prepares context \u2014 your LLM creates the understanding.");
15958
+ outro("Handoff ready. CLI prepares context \u2014 your LLM creates the understanding.");
15933
15959
  }
15934
15960
 
15935
15961
  // src/core/classifier.ts
@@ -15971,12 +15997,12 @@ var DEP_PATTERNS = [
15971
15997
  /^Cargo\.lock$/,
15972
15998
  /^pom\.xml$/
15973
15999
  ];
15974
- function normalizePath2(p2) {
15975
- return p2.split(path6.sep).join("/");
16000
+ function normalizePath2(p) {
16001
+ return p.split(path6.sep).join("/");
15976
16002
  }
15977
16003
  function matchesAny2(file, patterns) {
15978
16004
  const normalized = normalizePath2(file);
15979
- return patterns.some((p2) => p2.test(normalized));
16005
+ return patterns.some((p) => p.test(normalized));
15980
16006
  }
15981
16007
  function detectSignals(touchedFiles) {
15982
16008
  const signals = [];
@@ -16150,14 +16176,14 @@ async function runClassify(opts = {}) {
16150
16176
  }
16151
16177
 
16152
16178
  // src/commands/status.ts
16153
- import { parse as parseYaml14 } from "yaml";
16179
+ import { parse as parseYaml15 } from "yaml";
16154
16180
  var ARCH_DIR8 = "knowledge";
16155
16181
  var CONFIG_PATH6 = ".kaddo/config.yml";
16156
16182
  function loadConfig3(dir) {
16157
- const p2 = join(dir, CONFIG_PATH6);
16158
- if (!exists(p2)) return {};
16183
+ const p = join(dir, CONFIG_PATH6);
16184
+ if (!exists(p)) return {};
16159
16185
  try {
16160
- return parseYaml14(readFile(p2));
16186
+ return parseYaml15(readFile(p));
16161
16187
  } catch {
16162
16188
  return {};
16163
16189
  }
@@ -16260,14 +16286,14 @@ async function runLearn(artifactId, opts = {}) {
16260
16286
  console.error("No knowledge/ directory found. Run `kaddo init` first.");
16261
16287
  process.exit(1);
16262
16288
  }
16263
- intro2("kaddo learn");
16289
+ intro("kaddo learn");
16264
16290
  const artifacts = readArtifacts(join(dir, ARCH_DIR9));
16265
16291
  const closable = artifacts.filter(
16266
16292
  (a) => (a.status === "in-progress" || a.status === "completed" || a.status === "done") && a.type !== "current-state" && a.type !== "roadmap"
16267
16293
  );
16268
16294
  if (closable.length === 0) {
16269
- log2.warn("No in-progress or completed work items found.");
16270
- outro2("Nothing to close.");
16295
+ log.warn("No in-progress or completed work items found.");
16296
+ outro("Nothing to close.");
16271
16297
  return;
16272
16298
  }
16273
16299
  let targetId;
@@ -16275,9 +16301,9 @@ async function runLearn(artifactId, opts = {}) {
16275
16301
  targetId = artifactId;
16276
16302
  } else if (closable.length === 1) {
16277
16303
  targetId = closable[0].id || closable[0].title;
16278
- log2.info(`Closing: ${targetId} \u2014 ${closable[0].summary || closable[0].title}`);
16304
+ log.info(`Closing: ${targetId} \u2014 ${closable[0].summary || closable[0].title}`);
16279
16305
  } else {
16280
- const chosen = await select2({
16306
+ const chosen = await select({
16281
16307
  message: "Which work item are you closing?",
16282
16308
  options: closable.map((a) => ({
16283
16309
  value: a.id || a.title,
@@ -16288,7 +16314,7 @@ async function runLearn(artifactId, opts = {}) {
16288
16314
  }
16289
16315
  const filePath = findWorkItemFile(dir, targetId);
16290
16316
  if (!filePath) {
16291
- log2.error(`Work item "${targetId}" not found in ${WORK_ITEMS_DIR2}/`);
16317
+ log.error(`Work item "${targetId}" not found in ${WORK_ITEMS_DIR2}/`);
16292
16318
  process.exit(1);
16293
16319
  }
16294
16320
  const wiRaw = readFile(filePath);
@@ -16311,14 +16337,14 @@ async function runLearn(artifactId, opts = {}) {
16311
16337
  completionBlockers.push('Validation status is "failed".');
16312
16338
  }
16313
16339
  if (completionBlockers.length > 0) {
16314
- log2.error("Completion blocked:");
16315
- for (const b of completionBlockers) log2.error(` \u2717 ${b}`);
16316
- log2.info("Run `kaddo verify` to review evidence, or use `kaddo learn --force` to override.");
16317
- outro2("Cannot complete Work Item.");
16340
+ log.error("Completion blocked:");
16341
+ for (const b of completionBlockers) log.error(` \u2717 ${b}`);
16342
+ log.info("Run `kaddo verify` to review evidence, or use `kaddo learn --force` to override.");
16343
+ outro("Cannot complete Work Item.");
16318
16344
  return;
16319
16345
  }
16320
16346
  }
16321
- const learning = await text2({
16347
+ const learning = await text({
16322
16348
  message: "What did you learn from this change?",
16323
16349
  placeholder: "e.g. The retry logic needed a separate queue to avoid blocking the main flow",
16324
16350
  validate: (v) => v.trim().length === 0 ? "Learning is required." : void 0
@@ -16336,13 +16362,13 @@ async function runLearn(artifactId, opts = {}) {
16336
16362
  enrichedLearning += "\n\n> " + notes.join(" ");
16337
16363
  }
16338
16364
  updateWorkItemFile(filePath, enrichedLearning);
16339
- log2.success(`${targetId} marked as completed`);
16340
- log2.success(`Learning recorded in ${filePath.replace(dir + "/", "")}`);
16365
+ log.success(`${targetId} marked as completed`);
16366
+ log.success(`Learning recorded in ${filePath.replace(dir + "/", "")}`);
16341
16367
  if (hasExceptions) {
16342
- log2.warn("Learning captured from a Work Item completed with validation exceptions.");
16368
+ log.warn("Learning captured from a Work Item completed with validation exceptions.");
16343
16369
  }
16344
- log2.info("Consider updating knowledge/knowledge.md if this changes the current state.");
16345
- outro2("Work item closed.");
16370
+ log.info("Consider updating knowledge/knowledge.md if this changes the current state.");
16371
+ outro("Work item closed.");
16346
16372
  }
16347
16373
 
16348
16374
  // src/commands/history.ts
@@ -16401,13 +16427,13 @@ function runHistory(opts = {}) {
16401
16427
  }
16402
16428
 
16403
16429
  // src/commands/add.ts
16404
- import { parse as parseYaml15, stringify as stringifyYaml6 } from "yaml";
16430
+ import { parse as parseYaml16, stringify as stringifyYaml7 } from "yaml";
16405
16431
  var CONFIG_PATH7 = ".kaddo/config.yml";
16406
16432
  function readProjectState(dir) {
16407
16433
  const configPath = join(dir, CONFIG_PATH7);
16408
16434
  if (!exists(configPath)) return void 0;
16409
16435
  try {
16410
- const config = parseYaml15(readFile(configPath));
16436
+ const config = parseYaml16(readFile(configPath));
16411
16437
  return config.project?.state;
16412
16438
  } catch {
16413
16439
  return void 0;
@@ -16431,12 +16457,12 @@ function markModuleInstalled(dir, configKey, moduleName) {
16431
16457
  const configPath = join(dir, CONFIG_PATH7);
16432
16458
  if (!exists(configPath)) return;
16433
16459
  try {
16434
- const config = parseYaml15(readFile(configPath));
16460
+ const config = parseYaml16(readFile(configPath));
16435
16461
  config[configKey] = { installed: true, installed_at: (/* @__PURE__ */ new Date()).toISOString().split("T")[0] };
16436
16462
  const modules = config.modules ?? [];
16437
16463
  if (!modules.includes(moduleName)) modules.push(moduleName);
16438
16464
  config.modules = modules;
16439
- writeFile(configPath, stringifyYaml6(config));
16465
+ writeFile(configPath, stringifyYaml7(config));
16440
16466
  } catch {
16441
16467
  }
16442
16468
  }
@@ -16444,7 +16470,7 @@ function isModuleInstalled(dir, configKey) {
16444
16470
  const configPath = join(dir, CONFIG_PATH7);
16445
16471
  if (!exists(configPath)) return false;
16446
16472
  try {
16447
- const config = parseYaml15(readFile(configPath));
16473
+ const config = parseYaml16(readFile(configPath));
16448
16474
  const moduleConfig = config[configKey];
16449
16475
  return moduleConfig?.installed === true;
16450
16476
  } catch {
@@ -16467,7 +16493,7 @@ function runAdd(moduleName, opts = {}, dir = cwd()) {
16467
16493
  console.error(`Available: ${listModules().map((m) => m.name).join(", ")}`);
16468
16494
  process.exit(1);
16469
16495
  }
16470
- intro2(`kaddo add ${mod.name}`);
16496
+ intro(`kaddo add ${mod.name}`);
16471
16497
  if (!exists(join(dir, CONFIG_PATH7))) {
16472
16498
  console.error("Kaddo is not initialized in this project.");
16473
16499
  console.error("Run `kaddo init` first.");
@@ -16487,7 +16513,7 @@ function runAdd(moduleName, opts = {}, dir = cwd()) {
16487
16513
  try {
16488
16514
  const sel = selectAgentModuleFiles(mod.files, opts, readProjectState(dir));
16489
16515
  filesToInstall = sel.files;
16490
- log2.info(`Installing agents (${sel.label}).`);
16516
+ log.info(`Installing agents (${sel.label}).`);
16491
16517
  } catch (err) {
16492
16518
  console.error(err instanceof Error ? err.message : String(err));
16493
16519
  process.exit(1);
@@ -16496,7 +16522,7 @@ function runAdd(moduleName, opts = {}, dir = cwd()) {
16496
16522
  try {
16497
16523
  const sel = selectSkillModuleFiles(mod.files, opts);
16498
16524
  filesToInstall = sel.files;
16499
- log2.info(`Installing skills (${sel.label}).`);
16525
+ log.info(`Installing skills (${sel.label}).`);
16500
16526
  } catch (err) {
16501
16527
  console.error(err instanceof Error ? err.message : String(err));
16502
16528
  process.exit(1);
@@ -16513,38 +16539,38 @@ function runAdd(moduleName, opts = {}, dir = cwd()) {
16513
16539
  written.push(file.path);
16514
16540
  }
16515
16541
  }
16516
- for (const p2 of written) log2.success(`Created ${p2}`);
16517
- for (const p2 of skipped) log2.info(`Kept existing ${p2}`);
16542
+ for (const p of written) log.success(`Created ${p}`);
16543
+ for (const p of skipped) log.info(`Kept existing ${p}`);
16518
16544
  if (alreadyInstalled && written.length === 0) {
16519
- outro2(`Module "${mod.name}" is already installed. Nothing changed.`);
16545
+ outro(`Module "${mod.name}" is already installed. Nothing changed.`);
16520
16546
  return;
16521
16547
  }
16522
16548
  markModuleInstalled(dir, mod.configKey, mod.name);
16523
- log2.success(`Module "${mod.name}" installed.`);
16549
+ log.success(`Module "${mod.name}" installed.`);
16524
16550
  if (mod.name === "agents") {
16525
- log2.info("Next:");
16551
+ log.info("Next:");
16526
16552
  console.log(" 1. Run `kaddo context`");
16527
16553
  console.log(" 2. Open your preferred LLM chat");
16528
16554
  console.log(" 3. Paste `.kaddo/context-pack.md`");
16529
16555
  console.log(" 4. Use the recommended agent for your project state");
16530
- log2.info("More agents: `kaddo add agents --all` or `--group <business|product|tech|delivery|utilities>`.");
16531
- outro2("Agents installed. Kaddo prepares context \u2014 your LLM does the interpretation.");
16556
+ log.info("More agents: `kaddo add agents --all` or `--group <business|product|tech|delivery|utilities>`.");
16557
+ outro("Agents installed. Kaddo prepares context \u2014 your LLM does the interpretation.");
16532
16558
  return;
16533
16559
  }
16534
16560
  if (mod.name === "skills") {
16535
- log2.info("Skills are reusable capabilities agents apply \u2014 they never run anything.");
16536
- log2.info("More skills: `kaddo add skills --all` or `--group <delivery|tech|integration>`.");
16537
- log2.info("Read them in `knowledge/skills/` or via the Kaddo MCP server (`kaddo://skills`).");
16538
- outro2("Skills installed. Agents orchestrate; skills standardize.");
16561
+ log.info("Skills are reusable capabilities agents apply \u2014 they never run anything.");
16562
+ log.info("More skills: `kaddo add skills --all` or `--group <delivery|tech|integration>`.");
16563
+ log.info("Read them in `knowledge/skills/` or via the Kaddo MCP server (`kaddo://skills`).");
16564
+ outro("Skills installed. Agents orchestrate; skills standardize.");
16539
16565
  return;
16540
16566
  }
16541
16567
  if (mod.workItemTypes.length > 0) {
16542
- log2.info(`New work item types available:`);
16568
+ log.info(`New work item types available:`);
16543
16569
  for (const t of mod.workItemTypes) {
16544
16570
  console.log(` kaddo create ${t.name} [${t.knowledgeLevel}] \u2014 ${t.description}`);
16545
16571
  }
16546
16572
  }
16547
- outro2(`Done. Run \`kaddo create ${mod.workItemTypes[0]?.name ?? mod.name}\` to get started.`);
16573
+ outro(`Done. Run \`kaddo create ${mod.workItemTypes[0]?.name ?? mod.name}\` to get started.`);
16548
16574
  }
16549
16575
 
16550
16576
  // src/core/ownership-suggest.ts
@@ -16730,7 +16756,7 @@ function artifactLabel2(a) {
16730
16756
  async function chooseGlobs(suggested) {
16731
16757
  const chosen = [];
16732
16758
  if (suggested.length > 0) {
16733
- const picked = await multiselect2({
16759
+ const picked = await multiselect({
16734
16760
  message: "Select ownership globs (space to toggle, enter to confirm):",
16735
16761
  options: [
16736
16762
  ...suggested.map((g) => ({ value: g, label: g })),
@@ -16738,35 +16764,35 @@ async function chooseGlobs(suggested) {
16738
16764
  ],
16739
16765
  required: false
16740
16766
  });
16741
- for (const p2 of picked) {
16742
- if (p2 !== CUSTOM_GLOB) chosen.push(p2);
16767
+ for (const p of picked) {
16768
+ if (p !== CUSTOM_GLOB) chosen.push(p);
16743
16769
  }
16744
16770
  if (!picked.includes(CUSTOM_GLOB) && chosen.length > 0) return [...new Set(chosen)];
16745
16771
  }
16746
16772
  let addMore = suggested.length === 0 || chosen.length === 0;
16747
16773
  if (!addMore) {
16748
- addMore = await confirm2({ message: "Add a custom glob?", initialValue: true });
16774
+ addMore = await confirm({ message: "Add a custom glob?", initialValue: true });
16749
16775
  }
16750
16776
  while (addMore) {
16751
- const glob = await text2({
16777
+ const glob = await text({
16752
16778
  message: "Enter a code glob (e.g. src/payments/**)",
16753
16779
  placeholder: "src/payments/**",
16754
16780
  validate: (v) => v.trim().length === 0 ? "A glob is required." : void 0
16755
16781
  });
16756
16782
  const analysis = analyzeGlob(cwd(), glob);
16757
- for (const w of analysis.warnings) log2.warn(w);
16783
+ for (const w of analysis.warnings) log.warn(w);
16758
16784
  let value = analysis.normalized;
16759
16785
  if (analysis.suggestion) {
16760
- const useSuggested = await confirm2({
16786
+ const useSuggested = await confirm({
16761
16787
  message: `Use ${analysis.suggestion} instead?`,
16762
16788
  initialValue: true
16763
16789
  });
16764
16790
  if (useSuggested) value = analysis.suggestion;
16765
16791
  } else if (analysis.normalized !== glob.trim()) {
16766
- log2.info(`Normalized to ${analysis.normalized}`);
16792
+ log.info(`Normalized to ${analysis.normalized}`);
16767
16793
  }
16768
16794
  chosen.push(value);
16769
- addMore = await confirm2({ message: "Add another glob?", initialValue: false });
16795
+ addMore = await confirm({ message: "Add another glob?", initialValue: false });
16770
16796
  }
16771
16797
  return [...new Set(chosen)];
16772
16798
  }
@@ -16776,28 +16802,28 @@ async function runOwnersSuggest() {
16776
16802
  console.error("No .kaddo/config.yml found. Run `kaddo init` first.");
16777
16803
  process.exit(1);
16778
16804
  }
16779
- intro2("kaddo owners suggest");
16805
+ intro("kaddo owners suggest");
16780
16806
  const artifacts = findWorkItemArtifacts(dir);
16781
16807
  if (artifacts.length === 0) {
16782
- log2.warn(
16808
+ log.warn(
16783
16809
  "No Work Items found under knowledge/delivery/work-items/ (searched recursively, including draft/ ready/ in-progress/ \u2026)."
16784
16810
  );
16785
- log2.info("Create one with `kaddo create` or `kaddo create --from roadmap`.");
16786
- outro2("Nothing to do.");
16811
+ log.info("Create one with `kaddo create` or `kaddo create --from roadmap`.");
16812
+ outro("Nothing to do.");
16787
16813
  return;
16788
16814
  }
16789
16815
  const missing = artifactsMissingOwnership(artifacts);
16790
16816
  if (missing.length === 0) {
16791
- log2.success(
16817
+ log.success(
16792
16818
  `Found ${artifacts.length} Work Item${artifacts.length === 1 ? "" : "s"}; all already declare code ownership.`
16793
16819
  );
16794
- outro2("Nothing to do.");
16820
+ outro("Nothing to do.");
16795
16821
  return;
16796
16822
  }
16797
- log2.info(
16823
+ log.info(
16798
16824
  `Found ${artifacts.length} Work Item${artifacts.length === 1 ? "" : "s"}; ${missing.length} missing code ownership.`
16799
16825
  );
16800
- const relPath = missing.length === 1 ? missing[0].relPath : await select2({
16826
+ const relPath = missing.length === 1 ? missing[0].relPath : await select({
16801
16827
  message: "Which artifact needs ownership?",
16802
16828
  options: missing.map((a) => ({
16803
16829
  value: a.relPath,
@@ -16808,18 +16834,18 @@ async function runOwnersSuggest() {
16808
16834
  const artifact = missing.find((a) => a.relPath === relPath);
16809
16835
  const signals = loadScanSignals2(dir);
16810
16836
  if (!signals) {
16811
- log2.warn("No .kaddo/scan.json found \u2014 run `kaddo scan` for suggestions. You can enter globs manually.");
16837
+ log.warn("No .kaddo/scan.json found \u2014 run `kaddo scan` for suggestions. You can enter globs manually.");
16812
16838
  }
16813
16839
  const suggested = suggestGlobs(artifact, signals);
16814
16840
  const globs = await chooseGlobs(suggested);
16815
16841
  if (globs.length === 0) {
16816
- log2.warn("No globs selected. Nothing was changed.");
16817
- outro2("Cancelled.");
16842
+ log.warn("No globs selected. Nothing was changed.");
16843
+ outro("Cancelled.");
16818
16844
  return;
16819
16845
  }
16820
16846
  let mode = "replace";
16821
16847
  if (artifact.codeGlobs.length > 0) {
16822
- mode = await select2({
16848
+ mode = await select({
16823
16849
  message: `${artifact.id || artifact.relPath} already declares code globs. Append or replace?`,
16824
16850
  options: [
16825
16851
  { value: "append", label: "Append to existing globs" },
@@ -16827,24 +16853,24 @@ async function runOwnersSuggest() {
16827
16853
  ]
16828
16854
  });
16829
16855
  }
16830
- log2.info(`Preview:
16856
+ log.info(`Preview:
16831
16857
 
16832
16858
  code:
16833
16859
  ${globs.map((g) => ` - ${g}`).join("\n")}`);
16834
- const ok = await confirm2({
16860
+ const ok = await confirm({
16835
16861
  message: `Update ${artifact.relPath}?`,
16836
16862
  initialValue: true
16837
16863
  });
16838
16864
  if (!ok) {
16839
- log2.warn("No changes written.");
16840
- outro2("Cancelled.");
16865
+ log.warn("No changes written.");
16866
+ outro("Cancelled.");
16841
16867
  return;
16842
16868
  }
16843
16869
  const updated = applyOwnership(readFile(artifact.filePath), globs, mode);
16844
16870
  writeFile(artifact.filePath, updated);
16845
- log2.success(`Updated ${artifact.relPath}`);
16846
- log2.info("Run `kaddo guard` after changing related code to detect possible knowledge drift.");
16847
- outro2("Ownership declared.");
16871
+ log.success(`Updated ${artifact.relPath}`);
16872
+ log.info("Run `kaddo guard` after changing related code to detect possible knowledge drift.");
16873
+ outro("Ownership declared.");
16848
16874
  }
16849
16875
 
16850
16876
  // src/core/bootstrap-templates.ts
@@ -17334,7 +17360,7 @@ function bootstrap(dir) {
17334
17360
  return { state, written, skipped, createdDirs };
17335
17361
  }
17336
17362
  async function runBootstrap(dir = cwd()) {
17337
- intro2("kaddo bootstrap");
17363
+ intro("kaddo bootstrap");
17338
17364
  if (!exists(join(dir, CONFIG_PATH9))) {
17339
17365
  console.error("Kaddo is not initialized in this project.");
17340
17366
  console.error("Run `kaddo init` first.");
@@ -17349,27 +17375,27 @@ async function runBootstrap(dir = cwd()) {
17349
17375
  process.exit(1);
17350
17376
  }
17351
17377
  const stateLabel3 = state === "pre-ai" ? "pre-ai" : state;
17352
- log2.info(`Project state: ${stateLabel3}`);
17353
- log2.info(`Creating ${stateLabel3} knowledge baseline.`);
17354
- log2.info("Existing files will not be overwritten.");
17378
+ log.info(`Project state: ${stateLabel3}`);
17379
+ log.info(`Creating ${stateLabel3} knowledge baseline.`);
17380
+ log.info("Existing files will not be overwritten.");
17355
17381
  const result = bootstrap(dir);
17356
17382
  console.log("");
17357
17383
  if (result.written.length > 0 || result.createdDirs.length > 0) {
17358
17384
  console.log("Created:");
17359
- for (const p2 of result.written) console.log(` - ${p2}`);
17385
+ for (const p of result.written) console.log(` - ${p}`);
17360
17386
  for (const d of result.createdDirs) console.log(` - ${d}`);
17361
17387
  }
17362
17388
  if (result.skipped.length > 0) {
17363
17389
  console.log("");
17364
17390
  console.log("Skipped (kept existing):");
17365
- for (const p2 of result.skipped) console.log(` - ${p2}`);
17391
+ for (const p of result.skipped) console.log(` - ${p}`);
17366
17392
  }
17367
17393
  console.log("");
17368
- log2.info(
17394
+ log.info(
17369
17395
  "When you pass the context pack to your LLM/coding agent, it must never commit, push or merge without your confirmation \u2014 and create a branch before implementing."
17370
17396
  );
17371
17397
  printCommandFooter("bootstrap");
17372
- outro2(
17398
+ outro(
17373
17399
  `${stateLabel3} knowledge baseline ready. Next: \`kaddo add agents\` (then \`kaddo add skills\`), and refine the knowledge with the relevant agents.`
17374
17400
  );
17375
17401
  }
@@ -17381,7 +17407,7 @@ function slug3(s) {
17381
17407
  function runCapsuleExport(opts = {}) {
17382
17408
  const dir = cwd();
17383
17409
  const config = requireConfig(dir);
17384
- intro2("kaddo capsule export");
17410
+ intro("kaddo capsule export");
17385
17411
  let capsule;
17386
17412
  let name;
17387
17413
  if (opts.module) {
@@ -17402,16 +17428,16 @@ function runCapsuleExport(opts = {}) {
17402
17428
  const jsonPath = join(".kaddo", "exports", `${name}.capsule.json`);
17403
17429
  writeFile(join(dir, mdPath), renderCapsuleMarkdown(capsule));
17404
17430
  writeFile(join(dir, jsonPath), serializeCapsuleJson(capsule));
17405
- log2.success(`Wrote ${mdPath}`);
17406
- log2.success(`Wrote ${jsonPath}`);
17407
- log2.info("Refine it with the capsule-agent before sharing \u2014 and never include secrets or source code.");
17431
+ log.success(`Wrote ${mdPath}`);
17432
+ log.success(`Wrote ${jsonPath}`);
17433
+ log.info("Refine it with the capsule-agent before sharing \u2014 and never include secrets or source code.");
17408
17434
  printCommandFooter("capsule export");
17409
- outro2("Knowledge Capsule exported.");
17435
+ outro("Knowledge Capsule exported.");
17410
17436
  }
17411
17437
  function runCapsuleAdd(srcPath) {
17412
17438
  const dir = cwd();
17413
17439
  requireConfig(dir);
17414
- intro2("kaddo capsule add");
17440
+ intro("kaddo capsule add");
17415
17441
  if (!srcPath) {
17416
17442
  console.error("Usage: kaddo capsule add <path-to-capsule.md>");
17417
17443
  process.exit(1);
@@ -17424,20 +17450,20 @@ function runCapsuleAdd(srcPath) {
17424
17450
  }
17425
17451
  const result = addExternalCapsule(dir, source);
17426
17452
  if (!result.isCapsuleType) {
17427
- log2.warn("This file is not marked as a knowledge-capsule (front matter `type: knowledge-capsule`).");
17453
+ log.warn("This file is not marked as a knowledge-capsule (front matter `type: knowledge-capsule`).");
17428
17454
  }
17429
- log2.success(`Imported capsule "${result.id}" \u2192 ${result.destRel}`);
17430
- log2.success("Registered in .kaddo/external.yml");
17431
- log2.info('Run `kaddo context` \u2014 the pack now includes an "External Knowledge" section.');
17455
+ log.success(`Imported capsule "${result.id}" \u2192 ${result.destRel}`);
17456
+ log.success("Registered in .kaddo/external.yml");
17457
+ log.info('Run `kaddo context` \u2014 the pack now includes an "External Knowledge" section.');
17432
17458
  printCommandFooter("capsule add");
17433
- outro2("External capsule registered.");
17459
+ outro("External capsule registered.");
17434
17460
  }
17435
17461
 
17436
17462
  // src/commands/graph.ts
17437
17463
  function runGraphExport(opts = {}) {
17438
17464
  const dir = cwd();
17439
17465
  const config = requireConfig(dir);
17440
- intro2("kaddo graph export");
17466
+ intro("kaddo graph export");
17441
17467
  const scope = opts.scope === "all" ? "all" : "active";
17442
17468
  const format = opts.format;
17443
17469
  const writeJson = format !== "mermaid";
@@ -17458,30 +17484,30 @@ function runGraphExport(opts = {}) {
17458
17484
  writeFile(join(dir, ".kaddo", "graph-hints.md"), renderGraphHintsMarkdown(hints));
17459
17485
  writeFile(join(dir, ".kaddo", "graph-hints.json"), serializeGraphHintsJson(hints));
17460
17486
  written.push(".kaddo/graph-hints.md", ".kaddo/graph-hints.json");
17461
- log2.success(`Knowledge graph exported with ${scope} scope.`);
17462
- log2.info(`Scope: ${scope} \xB7 Nodes: ${graph.nodes.length} \xB7 Edges: ${graph.edges.length}`);
17463
- log2.info(`Relationship quality: ${hints.quality}`);
17487
+ log.success(`Knowledge graph exported with ${scope} scope.`);
17488
+ log.info(`Scope: ${scope} \xB7 Nodes: ${graph.nodes.length} \xB7 Edges: ${graph.edges.length}`);
17489
+ log.info(`Relationship quality: ${hints.quality}`);
17464
17490
  const hasWorkItemNodes = graph.nodes.some((n) => n.type === "work-item");
17465
17491
  if (scope === "active" && !hasWorkItemNodes) {
17466
- log2.warn("No active Work Items found.");
17467
- log2.info("The active graph only includes knowledge layers.");
17468
- log2.info("Run `kaddo graph export --scope all` to include completed Work Items.");
17492
+ log.warn("No active Work Items found.");
17493
+ log.info("The active graph only includes knowledge layers.");
17494
+ log.info("Run `kaddo graph export --scope all` to include completed Work Items.");
17469
17495
  }
17470
17496
  if (hints.hints.length > 0) {
17471
17497
  const shown = hints.hints.slice(0, 5);
17472
- log2.warn(`${hints.hints.length} metadata hint(s) available:`);
17473
- for (const h of shown) log2.info(`- ${h.message}`);
17498
+ log.warn(`${hints.hints.length} metadata hint(s) available:`);
17499
+ for (const h of shown) log.info(`- ${h.message}`);
17474
17500
  if (hints.hints.length > shown.length) {
17475
- log2.info(`\u2026and ${hints.hints.length - shown.length} more \u2014 see .kaddo/graph-hints.md`);
17501
+ log.info(`\u2026and ${hints.hints.length - shown.length} more \u2014 see .kaddo/graph-hints.md`);
17476
17502
  }
17477
17503
  }
17478
- for (const f of written) log2.info(`- ${f}`);
17504
+ for (const f of written) log.info(`- ${f}`);
17479
17505
  printCommandFooter("graph export");
17480
- outro2("Knowledge graph ready.");
17506
+ outro("Knowledge graph ready.");
17481
17507
  }
17482
17508
 
17483
17509
  // src/core/system-topology.ts
17484
- import { parse as parseYaml16, stringify as stringifyYaml7 } from "yaml";
17510
+ import { parse as parseYaml17, stringify as stringifyYaml8 } from "yaml";
17485
17511
  import fs3 from "fs";
17486
17512
  import path7 from "path";
17487
17513
  import crypto from "crypto";
@@ -17513,8 +17539,8 @@ var TECHNICAL_RELATIONSHIP_TYPES = /* @__PURE__ */ new Set([
17513
17539
  "implemented-by"
17514
17540
  ]);
17515
17541
  var PROVENANCE = /* @__PURE__ */ new Set(["declared", "derived", "agent-reviewed"]);
17516
- function isRelative(p2) {
17517
- return typeof p2 === "string" && p2.trim() !== "" && !/^([a-zA-Z]:[\\/]|\/)/.test(p2) && !p2.includes("..");
17542
+ function isRelative(p) {
17543
+ return typeof p === "string" && p.trim() !== "" && !/^([a-zA-Z]:[\\/]|\/)/.test(p) && !p.includes("..");
17518
17544
  }
17519
17545
  function strList(v) {
17520
17546
  return Array.isArray(v) ? v.map((x) => typeof x === "string" ? x.trim() : "").filter(Boolean) : [];
@@ -17528,7 +17554,7 @@ function loadSystemTopology(dir) {
17528
17554
  function parseTopologyContent(raw, dir) {
17529
17555
  let parsed;
17530
17556
  try {
17531
- parsed = parseYaml16(raw) ?? {};
17557
+ parsed = parseYaml17(raw) ?? {};
17532
17558
  } catch {
17533
17559
  return { entities: [], relationships: [], findings: [{ level: "blocking", message: "The topology could not be parsed." }] };
17534
17560
  }
@@ -17557,9 +17583,9 @@ function parseTopologyContent(raw, dir) {
17557
17583
  const moduleRaw = typeof e.module === "string" ? e.module.trim() : void 0;
17558
17584
  if (moduleRaw && !validModules.has(moduleRaw)) findings.push({ level: "warning", message: `Entity "${id}" references unregistered module "${moduleRaw}".` });
17559
17585
  const rawImpl = e.implementation ?? e.implementation_refs;
17560
- const implementation = strList(rawImpl).filter((p2) => {
17561
- if (isRelative(p2)) return true;
17562
- findings.push({ level: "warning", message: `Entity "${id}" implementation ref "${p2}" is not a safe relative path and was dropped.` });
17586
+ const implementation = strList(rawImpl).filter((p) => {
17587
+ if (isRelative(p)) return true;
17588
+ findings.push({ level: "warning", message: `Entity "${id}" implementation ref "${p}" is not a safe relative path and was dropped.` });
17563
17589
  return false;
17564
17590
  });
17565
17591
  const prov = e.provenance;
@@ -17646,7 +17672,7 @@ function serializeTopology(entities, relationships) {
17646
17672
  })),
17647
17673
  relationships: relationships.map((r) => ({ from: r.from, to: r.to, type: r.type, ...r.evidence.length ? { evidence: r.evidence } : {} }))
17648
17674
  };
17649
- return stringifyYaml7(doc);
17675
+ return stringifyYaml8(doc);
17650
17676
  }
17651
17677
  function atomicWrite(filePath, content) {
17652
17678
  fs3.mkdirSync(path7.dirname(filePath), { recursive: true });
@@ -17697,64 +17723,64 @@ function applyTopologyProposal(dir, proposalYaml, expectedRevision) {
17697
17723
  // src/commands/topology.ts
17698
17724
  function requireProject(dir) {
17699
17725
  if (!loadConfig(dir)) {
17700
- log2.error("No Kaddo project was found in the current directory.");
17726
+ log.error("No Kaddo project was found in the current directory.");
17701
17727
  process.exit(1);
17702
17728
  }
17703
17729
  }
17704
17730
  function readProposal(dir, file) {
17705
17731
  const abs = join(dir, file);
17706
17732
  if (!exists(abs) && !exists(file)) {
17707
- log2.error(`Proposal file not found: ${file}`);
17733
+ log.error(`Proposal file not found: ${file}`);
17708
17734
  process.exit(1);
17709
17735
  }
17710
17736
  return readFile(exists(abs) ? abs : file);
17711
17737
  }
17712
17738
  function printFindings(v) {
17713
- log2.info(`${v.entityCount} entities \xB7 ${v.relationshipCount} relationships`);
17714
- log2.info(`${v.blocking} blocking \xB7 ${v.warning} warning`);
17739
+ log.info(`${v.entityCount} entities \xB7 ${v.relationshipCount} relationships`);
17740
+ log.info(`${v.blocking} blocking \xB7 ${v.warning} warning`);
17715
17741
  for (const f of v.findings) {
17716
17742
  const line = `[${f.level}] ${f.message}`;
17717
- if (f.level === "blocking") log2.error(line);
17718
- else log2.warn(line);
17743
+ if (f.level === "blocking") log.error(line);
17744
+ else log.warn(line);
17719
17745
  }
17720
17746
  }
17721
17747
  async function runTopologyValidate(file) {
17722
17748
  const dir = cwd();
17723
17749
  requireProject(dir);
17724
- intro2("kaddo topology validate");
17750
+ intro("kaddo topology validate");
17725
17751
  const proposal = readProposal(dir, file);
17726
17752
  const v = validateTopologyProposal(dir, proposal);
17727
17753
  printFindings(v);
17728
- if (v.canApply) outro2("Proposal is valid. Apply it with `kaddo topology apply`.");
17754
+ if (v.canApply) outro("Proposal is valid. Apply it with `kaddo topology apply`.");
17729
17755
  else {
17730
- outro2("Proposal has blocking findings and cannot be applied.");
17756
+ outro("Proposal has blocking findings and cannot be applied.");
17731
17757
  process.exit(1);
17732
17758
  }
17733
17759
  }
17734
17760
  async function runTopologyApply(file, opts = {}) {
17735
17761
  const dir = cwd();
17736
17762
  requireProject(dir);
17737
- intro2("kaddo topology apply");
17763
+ intro("kaddo topology apply");
17738
17764
  const proposal = readProposal(dir, file);
17739
17765
  const v = validateTopologyProposal(dir, proposal);
17740
17766
  printFindings(v);
17741
17767
  if (!v.canApply) {
17742
- cancel2("Cannot apply: the proposal has blocking findings.");
17768
+ cancel("Cannot apply: the proposal has blocking findings.");
17743
17769
  process.exit(1);
17744
17770
  }
17745
17771
  if (!opts.yes) {
17746
- const ok = await confirm2({ message: `Apply this topology enrichment to ${join("", "knowledge/tech/system-topology.yml")}? (writes the project artifact; no Git commit is created)` });
17772
+ const ok = await confirm({ message: `Apply this topology enrichment to ${join("", "knowledge/tech/system-topology.yml")}? (writes the project artifact; no Git commit is created)` });
17747
17773
  if (!ok) {
17748
- cancel2("Apply cancelled.");
17774
+ cancel("Apply cancelled.");
17749
17775
  process.exit(0);
17750
17776
  }
17751
17777
  }
17752
17778
  try {
17753
17779
  const result = applyTopologyProposal(dir, proposal, topologyRevision(dir));
17754
- outro2(`Applied. ${result.entitiesNew} new / ${result.entitiesUpdated} updated entities, ${result.relationshipsNew} new relationships.`);
17780
+ outro(`Applied. ${result.entitiesNew} new / ${result.entitiesUpdated} updated entities, ${result.relationshipsNew} new relationships.`);
17755
17781
  } catch (err) {
17756
17782
  if (err instanceof TopologyWriteError) {
17757
- cancel2(err.message);
17783
+ cancel(err.message);
17758
17784
  process.exit(1);
17759
17785
  }
17760
17786
  throw err;
@@ -17763,7 +17789,7 @@ async function runTopologyApply(file, opts = {}) {
17763
17789
 
17764
17790
  // src/services/integrations.ts
17765
17791
  import matter11 from "gray-matter";
17766
- import { parse as parseYaml17, stringify as stringifyYaml8 } from "yaml";
17792
+ import { parse as parseYaml18, stringify as stringifyYaml9 } from "yaml";
17767
17793
 
17768
17794
  // src/core/work-item-write.ts
17769
17795
  import fs4 from "fs";
@@ -18827,7 +18853,7 @@ function loadRaw(dir) {
18827
18853
  const abs = join(dir, INTEGRATIONS_FILE);
18828
18854
  if (!exists(abs)) return { integrations: [] };
18829
18855
  try {
18830
- return parseYaml17(readFile(abs)) ?? { integrations: [] };
18856
+ return parseYaml18(readFile(abs)) ?? { integrations: [] };
18831
18857
  } catch {
18832
18858
  return { integrations: [] };
18833
18859
  }
@@ -19007,7 +19033,7 @@ ${item.description}` : item.title;
19007
19033
  // src/commands/integrations.ts
19008
19034
  function requireProject2(dir) {
19009
19035
  if (!loadConfig(dir)) {
19010
- log2.error("No Kaddo project was found in the current directory.");
19036
+ log.error("No Kaddo project was found in the current directory.");
19011
19037
  process.exit(1);
19012
19038
  }
19013
19039
  }
@@ -19015,26 +19041,26 @@ function printJson(value) {
19015
19041
  console.log(JSON.stringify(value, null, 2));
19016
19042
  }
19017
19043
  function fail(err) {
19018
- if (err instanceof IntegrationError) log2.error(`[${err.code}] ${err.safeMessage}`);
19019
- else if (err instanceof IntegrationServiceError) log2.error(`[${err.code}] ${err.message}`);
19020
- else log2.error("The integration operation failed.");
19044
+ if (err instanceof IntegrationError) log.error(`[${err.code}] ${err.safeMessage}`);
19045
+ else if (err instanceof IntegrationServiceError) log.error(`[${err.code}] ${err.message}`);
19046
+ else log.error("The integration operation failed.");
19021
19047
  process.exit(1);
19022
19048
  }
19023
19049
  function runIntegrationsList(dir, opts) {
19024
19050
  requireProject2(dir);
19025
19051
  const items = listIntegrations(dir);
19026
19052
  if (opts.json) return printJson(items.map((i) => ({ id: i.id, adapter: i.adapter, enabled: i.enabled, status: i.status, capabilities: i.capabilities })));
19027
- intro2("Kaddo integrations");
19053
+ intro("Kaddo integrations");
19028
19054
  if (items.length === 0) {
19029
- log2.info("No integrations are configured. Add them to .kaddo/integrations.yml.");
19030
- return outro2("Done.");
19055
+ log.info("No integrations are configured. Add them to .kaddo/integrations.yml.");
19056
+ return outro("Done.");
19031
19057
  }
19032
19058
  for (const i of items) {
19033
- log2.info(`${i.id} \xB7 adapter ${i.adapter} \xB7 ${i.status}${i.enabled ? "" : " (disabled)"}`);
19034
- if (i.capabilities) log2.message(` read: ${i.capabilities.workItems.read ? "\u2713" : "\u2717"} list: ${i.capabilities.workItems.list ? "\u2713" : "\u2717"} import: ${i.capabilities.workItems.import ? "\u2713" : "\u2717"}`);
19035
- for (const f of i.findings) log2.warn(` [${f.level}] ${f.message}`);
19059
+ log.info(`${i.id} \xB7 adapter ${i.adapter} \xB7 ${i.status}${i.enabled ? "" : " (disabled)"}`);
19060
+ if (i.capabilities) log.message(` read: ${i.capabilities.workItems.read ? "\u2713" : "\u2717"} list: ${i.capabilities.workItems.list ? "\u2713" : "\u2717"} import: ${i.capabilities.workItems.import ? "\u2713" : "\u2717"}`);
19061
+ for (const f of i.findings) log.warn(` [${f.level}] ${f.message}`);
19036
19062
  }
19037
- outro2("Done.");
19063
+ outro("Done.");
19038
19064
  }
19039
19065
  async function runIntegrationsStatus(dir, opts) {
19040
19066
  requireProject2(dir);
@@ -19049,25 +19075,25 @@ async function runIntegrationsStatus(dir, opts) {
19049
19075
  }
19050
19076
  }));
19051
19077
  if (opts.json) return printJson(results);
19052
- intro2("Integration status");
19078
+ intro("Integration status");
19053
19079
  for (const r of results) {
19054
19080
  const line = `${r.id} \xB7 ${r.status}${r.message ? ` \u2014 ${r.message}` : ""}`;
19055
- if (r.status === "available" || r.status === "configured") log2.info(line);
19056
- else log2.warn(line);
19081
+ if (r.status === "available" || r.status === "configured") log.info(line);
19082
+ else log.warn(line);
19057
19083
  }
19058
- outro2("Done.");
19084
+ outro("Done.");
19059
19085
  }
19060
19086
  async function runIntegrationsVerify(dir, id, opts) {
19061
19087
  requireProject2(dir);
19062
19088
  try {
19063
19089
  const v = await verifyIntegration(dir, id);
19064
19090
  if (opts.json) return printJson({ id: v.id, status: v.status, message: v.message, missingCredentials: v.missingCredentials });
19065
- intro2(`Verify ${id}`);
19091
+ intro(`Verify ${id}`);
19066
19092
  const line = `Status: ${v.status}${v.message ? ` \u2014 ${v.message}` : ""}`;
19067
- if (v.status === "available") log2.info(line);
19068
- else log2.warn(line);
19069
- if (v.missingCredentials.length) log2.warn(`Missing credentials: ${v.missingCredentials.join(", ")}`);
19070
- outro2("Done.");
19093
+ if (v.status === "available") log.info(line);
19094
+ else log.warn(line);
19095
+ if (v.missingCredentials.length) log.warn(`Missing credentials: ${v.missingCredentials.join(", ")}`);
19096
+ outro("Done.");
19071
19097
  } catch (err) {
19072
19098
  fail(err);
19073
19099
  }
@@ -19084,10 +19110,10 @@ async function runIntegrationsWorkItems(dir, id, opts) {
19084
19110
  filters
19085
19111
  });
19086
19112
  if (opts.json) return printJson(page);
19087
- intro2(`External work items \xB7 ${id}`);
19088
- for (const it of page.items) log2.info(`${it.externalId} \xB7 ${it.title}${it.status ? ` [${it.status}]` : ""}`);
19089
- if (page.hasMore) log2.message(`More available \u2014 next cursor: ${page.nextCursor}`);
19090
- outro2(`${page.items.length} item(s).`);
19113
+ intro(`External work items \xB7 ${id}`);
19114
+ for (const it of page.items) log.info(`${it.externalId} \xB7 ${it.title}${it.status ? ` [${it.status}]` : ""}`);
19115
+ if (page.hasMore) log.message(`More available \u2014 next cursor: ${page.nextCursor}`);
19116
+ outro(`${page.items.length} item(s).`);
19091
19117
  } catch (err) {
19092
19118
  fail(err);
19093
19119
  }
@@ -19097,18 +19123,18 @@ async function runIntegrationsWorkItem(dir, id, externalId, opts) {
19097
19123
  try {
19098
19124
  const item = await getExternalWorkItem(dir, id, externalId);
19099
19125
  if (!item) {
19100
- log2.error(`External work item "${externalId}" was not found.`);
19126
+ log.error(`External work item "${externalId}" was not found.`);
19101
19127
  process.exit(1);
19102
19128
  }
19103
19129
  if (opts.json) return printJson(item);
19104
- intro2(`${item.provider} \xB7 ${item.externalId}`);
19105
- log2.info(item.title);
19106
- if (item.status) log2.message(`Status: ${item.status}`);
19107
- if (item.type) log2.message(`Type: ${item.type}`);
19108
- if (item.url) log2.message(`URL: ${item.url}`);
19109
- if (item.description) log2.message(`
19130
+ intro(`${item.provider} \xB7 ${item.externalId}`);
19131
+ log.info(item.title);
19132
+ if (item.status) log.message(`Status: ${item.status}`);
19133
+ if (item.type) log.message(`Type: ${item.type}`);
19134
+ if (item.url) log.message(`URL: ${item.url}`);
19135
+ if (item.description) log.message(`
19110
19136
  ${item.description}`);
19111
- outro2("Done.");
19137
+ outro("Done.");
19112
19138
  } catch (err) {
19113
19139
  fail(err);
19114
19140
  }
@@ -19117,36 +19143,36 @@ async function runIntegrationsImport(dir, id, externalId, opts) {
19117
19143
  requireProject2(dir);
19118
19144
  try {
19119
19145
  const { preview, duplicate } = await previewImport(dir, id, externalId, { type: opts.type });
19120
- intro2("Import external work item");
19146
+ intro("Import external work item");
19121
19147
  if (duplicate) {
19122
- log2.warn(`Already imported as ${duplicate.workItemId} \u2014 "${duplicate.title}".`);
19123
- outro2("No duplicate was created.");
19148
+ log.warn(`Already imported as ${duplicate.workItemId} \u2014 "${duplicate.title}".`);
19149
+ outro("No duplicate was created.");
19124
19150
  return;
19125
19151
  }
19126
- log2.info(`Source: ${preview.source.provider} \xB7 ${preview.source.externalId}`);
19127
- log2.message(`Captured intent: ${preview.capturedIntent}`);
19128
- log2.message("Will create: a Draft Work Item (needs refinement).");
19129
- if (preview.externalType) log2.message(`External type: ${preview.externalType} (Kaddo type is chosen, never inferred)`);
19130
- log2.message("No project files have been modified yet.");
19152
+ log.info(`Source: ${preview.source.provider} \xB7 ${preview.source.externalId}`);
19153
+ log.message(`Captured intent: ${preview.capturedIntent}`);
19154
+ log.message("Will create: a Draft Work Item (needs refinement).");
19155
+ if (preview.externalType) log.message(`External type: ${preview.externalType} (Kaddo type is chosen, never inferred)`);
19156
+ log.message("No project files have been modified yet.");
19131
19157
  if (!opts.type) {
19132
- log2.error("A Kaddo Work Item type is required. Re-run with --type <feature|fix|chore|\u2026>.");
19158
+ log.error("A Kaddo Work Item type is required. Re-run with --type <feature|fix|chore|\u2026>.");
19133
19159
  process.exit(1);
19134
19160
  }
19135
19161
  if (!opts.yes) {
19136
- const ok = await confirm2({ message: `Import ${preview.source.displayKey} as a Draft ${opts.type} Work Item?` });
19162
+ const ok = await confirm({ message: `Import ${preview.source.displayKey} as a Draft ${opts.type} Work Item?` });
19137
19163
  if (ok !== true) {
19138
- cancel2("Import cancelled. No files were changed.");
19164
+ cancel("Import cancelled. No files were changed.");
19139
19165
  process.exit(0);
19140
19166
  }
19141
19167
  }
19142
19168
  const result = await importExternalWorkItem(dir, id, externalId, { type: opts.type });
19143
19169
  if (!result.created) {
19144
- log2.warn(`Already imported as ${result.duplicateOf}.`);
19145
- outro2("No duplicate was created.");
19170
+ log.warn(`Already imported as ${result.duplicateOf}.`);
19171
+ outro("No duplicate was created.");
19146
19172
  return;
19147
19173
  }
19148
- log2.info(`Created ${result.workItemId} (Draft, needs refinement).`);
19149
- outro2("Done. Refine it next with the Work Item refinement handoff.");
19174
+ log.info(`Created ${result.workItemId} (Draft, needs refinement).`);
19175
+ outro("Done. Refine it next with the Work Item refinement handoff.");
19150
19176
  } catch (err) {
19151
19177
  fail(err);
19152
19178
  }
@@ -19587,19 +19613,19 @@ function runReportImpact(opts = {}) {
19587
19613
  const report = buildImpactReport(dir, { scope });
19588
19614
  const content = opts.json ? serializeImpactJson(report) : renderImpactMarkdown(report);
19589
19615
  if (opts.output) {
19590
- intro2("kaddo report impact");
19616
+ intro("kaddo report impact");
19591
19617
  const rel = opts.output;
19592
19618
  writeFile(join(dir, rel), content);
19593
- log2.success(`Wrote ${rel.replace(/\\/g, "/")}`);
19619
+ log.success(`Wrote ${rel.replace(/\\/g, "/")}`);
19594
19620
  printCommandFooter("report impact");
19595
- outro2("Impact report written.");
19621
+ outro("Impact report written.");
19596
19622
  return;
19597
19623
  }
19598
19624
  console.log(content);
19599
19625
  }
19600
19626
 
19601
19627
  // src/core/savings.ts
19602
- import { parse as parseYaml18 } from "yaml";
19628
+ import { parse as parseYaml19 } from "yaml";
19603
19629
  var DEFAULT_ASSUMPTIONS = {
19604
19630
  currency: "USD",
19605
19631
  hourly_cost: 40,
@@ -19614,10 +19640,10 @@ var DEFAULT_ASSUMPTIONS = {
19614
19640
  };
19615
19641
  var SAVINGS_PATH = ".kaddo/savings.yml";
19616
19642
  function loadAssumptions(dir) {
19617
- const p2 = join(dir, SAVINGS_PATH);
19618
- if (!exists(p2)) return { assumptions: { ...DEFAULT_ASSUMPTIONS }, source: "default" };
19643
+ const p = join(dir, SAVINGS_PATH);
19644
+ if (!exists(p)) return { assumptions: { ...DEFAULT_ASSUMPTIONS }, source: "default" };
19619
19645
  try {
19620
- const raw = parseYaml18(readFile(p2));
19646
+ const raw = parseYaml19(readFile(p));
19621
19647
  const a = raw?.assumptions ?? {};
19622
19648
  const t = raw?.team ?? {};
19623
19649
  const num = (v, d) => typeof v === "number" && Number.isFinite(v) ? v : d;
@@ -19871,11 +19897,11 @@ function runSavings(opts = {}) {
19871
19897
  const report = buildSavingsReport(dir, { scope });
19872
19898
  const content = opts.json ? serializeSavingsJson(report) : renderSavingsMarkdown(report);
19873
19899
  if (opts.output) {
19874
- intro2("kaddo savings");
19900
+ intro("kaddo savings");
19875
19901
  writeFile(join(dir, opts.output), content);
19876
- log2.success(`Wrote ${opts.output.replace(/\\/g, "/")}`);
19902
+ log.success(`Wrote ${opts.output.replace(/\\/g, "/")}`);
19877
19903
  printCommandFooter("savings");
19878
- outro2("Savings report written.");
19904
+ outro("Savings report written.");
19879
19905
  return;
19880
19906
  }
19881
19907
  console.log(content);
@@ -19883,18 +19909,18 @@ function runSavings(opts = {}) {
19883
19909
  function runSavingsInit(opts = {}) {
19884
19910
  const dir = cwd();
19885
19911
  requireConfig(dir);
19886
- intro2("kaddo savings init");
19912
+ intro("kaddo savings init");
19887
19913
  const rel = ".kaddo/savings.yml";
19888
19914
  const full = join(dir, rel);
19889
19915
  if (exists(full) && !opts.force) {
19890
- log2.warn(`${rel} already exists. Use --force to overwrite.`);
19891
- outro2("Nothing changed.");
19916
+ log.warn(`${rel} already exists. Use --force to overwrite.`);
19917
+ outro("Nothing changed.");
19892
19918
  return;
19893
19919
  }
19894
19920
  writeFile(full, savingsTemplate());
19895
- log2.success(`Wrote ${rel}`);
19896
- log2.info("Edit the assumptions, then run `kaddo savings`.");
19897
- outro2("Savings assumptions ready.");
19921
+ log.success(`Wrote ${rel}`);
19922
+ log.info("Edit the assumptions, then run `kaddo savings`.");
19923
+ outro("Savings assumptions ready.");
19898
19924
  }
19899
19925
 
19900
19926
  // src/core/drift-report.ts
@@ -20016,11 +20042,11 @@ function runDrift(opts = {}) {
20016
20042
  const report = buildDriftReport(dir);
20017
20043
  const content = opts.json ? serializeDriftJson(report) : renderDriftMarkdown(report);
20018
20044
  if (opts.output) {
20019
- intro2("kaddo drift");
20045
+ intro("kaddo drift");
20020
20046
  writeFile(join(dir, opts.output), content);
20021
- log2.success(`Wrote ${opts.output.replace(/\\/g, "/")}`);
20047
+ log.success(`Wrote ${opts.output.replace(/\\/g, "/")}`);
20022
20048
  printCommandFooter("drift");
20023
- outro2("Drift report written.");
20049
+ outro("Drift report written.");
20024
20050
  return;
20025
20051
  }
20026
20052
  console.log(content);
@@ -20033,11 +20059,11 @@ function runQuestions(opts = {}) {
20033
20059
  const es = projectLanguage(config) === "es";
20034
20060
  const report = buildOpenQuestionsReport(dir);
20035
20061
  if (opts.output) {
20036
- intro2("kaddo questions");
20062
+ intro("kaddo questions");
20037
20063
  writeFile(join(dir, opts.output), opts.json ? serializeOpenQuestionsJson(report) : renderOpenQuestionsMarkdown(report));
20038
- log2.success(`Wrote ${opts.output.replace(/\\/g, "/")}`);
20064
+ log.success(`Wrote ${opts.output.replace(/\\/g, "/")}`);
20039
20065
  printCommandFooter("questions");
20040
- outro2("Questions report written.");
20066
+ outro("Questions report written.");
20041
20067
  return;
20042
20068
  }
20043
20069
  if (opts.json) {
@@ -20138,12 +20164,12 @@ function runAdaptersInstall(adapter, opts = {}) {
20138
20164
  return;
20139
20165
  }
20140
20166
  if (state === "generated_by_kaddo") {
20141
- intro2(`${cmd} --inject`);
20142
- log2.warn(`${rel} is already fully generated by Kaddo.`);
20143
- log2.info("Nothing injected to avoid duplicated Kaddo guidance.");
20144
- log2.info(`Use \`${cmd} --force\` to regenerate the full file.`);
20145
- log2.info(`\`--inject\` is for team-owned files: keep your own ${rel} and run \`${cmd} --inject\` to add the Kaddo block.`);
20146
- outro2("Nothing changed.");
20167
+ intro(`${cmd} --inject`);
20168
+ log.warn(`${rel} is already fully generated by Kaddo.`);
20169
+ log.info("Nothing injected to avoid duplicated Kaddo guidance.");
20170
+ log.info(`Use \`${cmd} --force\` to regenerate the full file.`);
20171
+ log.info(`\`--inject\` is for team-owned files: keep your own ${rel} and run \`${cmd} --inject\` to add the Kaddo block.`);
20172
+ outro("Nothing changed.");
20147
20173
  return;
20148
20174
  }
20149
20175
  if (existing === null) {
@@ -20153,11 +20179,11 @@ function runAdaptersInstall(adapter, opts = {}) {
20153
20179
  console.log(content2);
20154
20180
  return;
20155
20181
  }
20156
- intro2(`${cmd} --inject`);
20182
+ intro(`${cmd} --inject`);
20157
20183
  writeFile(full, content2);
20158
- log2.success(`Created ${rel} for ${spec.label}.`);
20184
+ log.success(`Created ${rel} for ${spec.label}.`);
20159
20185
  printCommandFooter("adapters install codex");
20160
- outro2(`${rel} ready.`);
20186
+ outro(`${rel} ready.`);
20161
20187
  return;
20162
20188
  }
20163
20189
  const merged = injectKaddoBlock(existing, ctx);
@@ -20166,16 +20192,16 @@ function runAdaptersInstall(adapter, opts = {}) {
20166
20192
  console.log(merged.content);
20167
20193
  return;
20168
20194
  }
20169
- intro2(`${cmd} --inject`);
20195
+ intro(`${cmd} --inject`);
20170
20196
  writeFile(full, merged.content);
20171
20197
  if (merged.status === "updated") {
20172
- log2.success(`Updated existing Kaddo guidance block in ${rel}.`);
20198
+ log.success(`Updated existing Kaddo guidance block in ${rel}.`);
20173
20199
  } else {
20174
- log2.success(`Injected Kaddo guidance block into ${rel}.`);
20200
+ log.success(`Injected Kaddo guidance block into ${rel}.`);
20175
20201
  }
20176
- log2.info("Content outside the Kaddo markers was preserved.");
20202
+ log.info("Content outside the Kaddo markers was preserved.");
20177
20203
  printCommandFooter("adapters install codex");
20178
- outro2(`${rel} ready.`);
20204
+ outro(`${rel} ready.`);
20179
20205
  return;
20180
20206
  }
20181
20207
  const content = renderAdapterMarkdown(ctx, spec.id);
@@ -20184,19 +20210,19 @@ function runAdaptersInstall(adapter, opts = {}) {
20184
20210
  console.log(content);
20185
20211
  return;
20186
20212
  }
20187
- intro2(cmd);
20213
+ intro(cmd);
20188
20214
  if (existed && !opts.force) {
20189
- log2.warn(`${rel} already exists.`);
20190
- if (spec.supportsInject) log2.info("Use `--inject` to add or update only the Kaddo block,");
20191
- log2.info(`Use \`--force\` to overwrite, or \`--dry-run\` to preview.`);
20192
- outro2("Nothing changed.");
20215
+ log.warn(`${rel} already exists.`);
20216
+ if (spec.supportsInject) log.info("Use `--inject` to add or update only the Kaddo block,");
20217
+ log.info(`Use \`--force\` to overwrite, or \`--dry-run\` to preview.`);
20218
+ outro("Nothing changed.");
20193
20219
  return;
20194
20220
  }
20195
20221
  writeFile(full, content);
20196
- log2.success(`${existed ? "Overwrote" : "Created"} ${rel} for ${spec.label}.`);
20197
- log2.info("Source: Kaddo project knowledge. Regenerate it instead of editing by hand.");
20222
+ log.success(`${existed ? "Overwrote" : "Created"} ${rel} for ${spec.label}.`);
20223
+ log.info("Source: Kaddo project knowledge. Regenerate it instead of editing by hand.");
20198
20224
  printCommandFooter("adapters install codex");
20199
- outro2(`${rel} ready.`);
20225
+ outro(`${rel} ready.`);
20200
20226
  }
20201
20227
  function runAdaptersList(opts = {}) {
20202
20228
  if (opts.json) {
@@ -20304,7 +20330,7 @@ var DISCOVERY_FILES = ["architecture-notes.md", "decision-candidates.md"];
20304
20330
  var DISCOVERY_DIR = "knowledge/tech/discovery";
20305
20331
  function runTechOrganize(dir = cwd()) {
20306
20332
  requireConfig(dir);
20307
- intro2("kaddo tech organize");
20333
+ intro("kaddo tech organize");
20308
20334
  const moved = [];
20309
20335
  const skipped = [];
20310
20336
  for (const file of DISCOVERY_FILES) {
@@ -20320,17 +20346,17 @@ function runTechOrganize(dir = cwd()) {
20320
20346
  moved.push(`knowledge/tech/${file} \u2192 ${DISCOVERY_DIR}/${file}`);
20321
20347
  }
20322
20348
  if (moved.length > 0) {
20323
- log2.success("Moved:");
20349
+ log.success("Moved:");
20324
20350
  for (const m of moved) console.log(` - ${m}`);
20325
20351
  }
20326
20352
  for (const file of skipped) {
20327
- log2.warn(`Cannot move ${file} because knowledge/tech/discovery/${file} already exists. Review both files manually.`);
20353
+ log.warn(`Cannot move ${file} because knowledge/tech/discovery/${file} already exists. Review both files manually.`);
20328
20354
  }
20329
20355
  if (moved.length === 0 && skipped.length === 0) {
20330
- log2.info("Nothing to organize \u2014 no discovery files in the legacy `knowledge/tech/` root.");
20356
+ log.info("Nothing to organize \u2014 no discovery files in the legacy `knowledge/tech/` root.");
20331
20357
  }
20332
20358
  printCommandFooter("tech organize");
20333
- outro2("Tech knowledge organized.");
20359
+ outro("Tech knowledge organized.");
20334
20360
  }
20335
20361
 
20336
20362
  // src/commands/assets.ts
@@ -20367,7 +20393,7 @@ function runAssetsStatus(kind, opts = {}) {
20367
20393
  function runAssetsUpdate(kind, opts = {}) {
20368
20394
  const dir = cwd();
20369
20395
  requireConfig(dir);
20370
- intro2(`kaddo ${kind}s update`);
20396
+ intro(`kaddo ${kind}s update`);
20371
20397
  const summary = assetStatus(dir, kind);
20372
20398
  const catalog = kind === "agent" ? canonicalAgents() : canonicalSkills();
20373
20399
  const byPath = new Map(catalog.map((a) => [a.path, a.content]));
@@ -20386,15 +20412,15 @@ function runAssetsUpdate(kind, opts = {}) {
20386
20412
  }
20387
20413
  }
20388
20414
  if (updated.length > 0) {
20389
- log2.success("Updated:");
20415
+ log.success("Updated:");
20390
20416
  for (const u of updated) console.log(` - ${u}`);
20391
20417
  } else {
20392
- log2.info(`No ${kind}s to update.`);
20418
+ log.info(`No ${kind}s to update.`);
20393
20419
  }
20394
- for (const s of skipped) log2.warn(`Skipped ${s}`);
20395
- if (summary.missing > 0) log2.info(`${summary.missing} ${kind}(s) not installed \u2014 run \`kaddo add ${kind}s\` to add them.`);
20420
+ for (const s of skipped) log.warn(`Skipped ${s}`);
20421
+ if (summary.missing > 0) log.info(`${summary.missing} ${kind}(s) not installed \u2014 run \`kaddo add ${kind}s\` to add them.`);
20396
20422
  printCommandFooter(`${kind}s status`);
20397
- outro2(`${LABEL[kind]} update complete.`);
20423
+ outro(`${LABEL[kind]} update complete.`);
20398
20424
  }
20399
20425
 
20400
20426
  // src/commands/ready.ts
@@ -20448,8 +20474,8 @@ function extractSection(body, headerPattern) {
20448
20474
  }
20449
20475
  return capture ? result.join("\n").trim() : null;
20450
20476
  }
20451
- function isResolvedSection(text3) {
20452
- const t = text3.trim().toLowerCase();
20477
+ function isResolvedSection(text2) {
20478
+ const t = text2.trim().toLowerCase();
20453
20479
  return t === "" || /^(none|ninguna|resolved|resueltas|deferred|diferidas)\.?$/i.test(t);
20454
20480
  }
20455
20481
  function transitionToReady(filePath) {
@@ -20475,58 +20501,58 @@ function findWorkItem(dir, id) {
20475
20501
  }
20476
20502
  async function runReady(id, opts = {}) {
20477
20503
  const dir = process.cwd();
20478
- intro2("kaddo ready " + id);
20504
+ intro("kaddo ready " + id);
20479
20505
  const config = loadConfig(dir);
20480
20506
  if (!config) {
20481
- log2.error("Kaddo is not initialized. Run `kaddo init` first.");
20507
+ log.error("Kaddo is not initialized. Run `kaddo init` first.");
20482
20508
  process.exit(1);
20483
20509
  }
20484
20510
  const wi = findWorkItem(dir, id);
20485
20511
  if (!wi) {
20486
- log2.error(`Work Item ${id} not found.`);
20487
- log2.info("Run `kaddo history` or check knowledge/delivery/work-items/ for available IDs.");
20512
+ log.error(`Work Item ${id} not found.`);
20513
+ log.info("Run `kaddo history` or check knowledge/delivery/work-items/ for available IDs.");
20488
20514
  process.exit(1);
20489
20515
  }
20490
20516
  if (wi.lifecycle === "ready") {
20491
- log2.info(`Work Item ${wi.id} is already ready.`);
20492
- log2.info("Suggested next: kaddo context && kaddo understand");
20493
- outro2("Nothing to do.");
20517
+ log.info(`Work Item ${wi.id} is already ready.`);
20518
+ log.info("Suggested next: kaddo context && kaddo understand");
20519
+ outro("Nothing to do.");
20494
20520
  return;
20495
20521
  }
20496
20522
  if (wi.lifecycle !== "draft") {
20497
- log2.error(`Work Item ${wi.id} is in state "${wi.lifecycle}", not "draft". Only draft Work Items can be marked as ready.`);
20523
+ log.error(`Work Item ${wi.id} is in state "${wi.lifecycle}", not "draft". Only draft Work Items can be marked as ready.`);
20498
20524
  process.exit(1);
20499
20525
  }
20500
20526
  const raw = readFile(wi.filePath);
20501
20527
  const { data } = matter13(raw);
20502
20528
  const source = parseWorkItemSource(data);
20503
20529
  const warnings = validateReadiness(raw, data);
20504
- log2.info(`Work Item found:`);
20505
- log2.info(` ${wi.id} \u2014 ${wi.title}`);
20506
- log2.info("");
20507
- log2.info(` Status: draft \u2192 ready`);
20508
- log2.info(` Type: ${wi.type}`);
20509
- log2.info(` Knowledge level: ${wi.knowledgeLevel || "unset"}`);
20510
- log2.info(` Domains: ${wi.domains.length > 0 ? wi.domains.join(", ") : "none"}`);
20511
- log2.info(` Source: ${renderSourceCompact(source)}`);
20530
+ log.info(`Work Item found:`);
20531
+ log.info(` ${wi.id} \u2014 ${wi.title}`);
20532
+ log.info("");
20533
+ log.info(` Status: draft \u2192 ready`);
20534
+ log.info(` Type: ${wi.type}`);
20535
+ log.info(` Knowledge level: ${wi.knowledgeLevel || "unset"}`);
20536
+ log.info(` Domains: ${wi.domains.length > 0 ? wi.domains.join(", ") : "none"}`);
20537
+ log.info(` Source: ${renderSourceCompact(source)}`);
20512
20538
  if (wi.codeGlobs.length > 0) {
20513
- log2.info(` Code ownership:`);
20514
- for (const g of wi.codeGlobs) log2.info(` - ${g}`);
20539
+ log.info(` Code ownership:`);
20540
+ for (const g of wi.codeGlobs) log.info(` - ${g}`);
20515
20541
  } else {
20516
- log2.info(` Code ownership: none`);
20542
+ log.info(` Code ownership: none`);
20517
20543
  }
20518
20544
  if (warnings.length > 0) {
20519
- log2.warn("");
20520
- log2.warn("This Work Item may not be ready:");
20545
+ log.warn("");
20546
+ log.warn("This Work Item may not be ready:");
20521
20547
  for (const w of warnings) {
20522
- log2.warn(` - ${w.message}`);
20548
+ log.warn(` - ${w.message}`);
20523
20549
  }
20524
20550
  }
20525
20551
  if (!opts.yes) {
20526
- log2.info("");
20527
- const proceed = await confirm2({ message: "Mark this Work Item as ready for implementation?" });
20552
+ log.info("");
20553
+ const proceed = await confirm({ message: "Mark this Work Item as ready for implementation?" });
20528
20554
  if (!proceed) {
20529
- cancel2("Cancelled.");
20555
+ cancel("Cancelled.");
20530
20556
  return;
20531
20557
  }
20532
20558
  }
@@ -20534,17 +20560,17 @@ async function runReady(id, opts = {}) {
20534
20560
  if (newPath !== wi.filePath) {
20535
20561
  writeFile(newPath, newContent);
20536
20562
  fs6.unlinkSync(wi.filePath);
20537
- log2.success(`Updated status: ready`);
20538
- log2.success(`Moved file:`);
20539
- log2.info(` ${path9.relative(dir, wi.filePath)}`);
20540
- log2.info(` \u2192 ${path9.relative(dir, newPath)}`);
20563
+ log.success(`Updated status: ready`);
20564
+ log.success(`Moved file:`);
20565
+ log.info(` ${path9.relative(dir, wi.filePath)}`);
20566
+ log.info(` \u2192 ${path9.relative(dir, newPath)}`);
20541
20567
  } else {
20542
20568
  writeFile(wi.filePath, newContent);
20543
- log2.success(`Updated status: ready`);
20569
+ log.success(`Updated status: ready`);
20544
20570
  }
20545
- log2.info("");
20546
- log2.info("Run `kaddo context && kaddo understand` to refresh the handoff.");
20547
- outro2(`Work Item ${wi.id} is ready.`);
20571
+ log.info("");
20572
+ log.info("Run `kaddo context && kaddo understand` to refresh the handoff.");
20573
+ outro(`Work Item ${wi.id} is ready.`);
20548
20574
  }
20549
20575
 
20550
20576
  // src/commands/admin.ts
@@ -20829,8 +20855,8 @@ function splitSections(body) {
20829
20855
  flush2();
20830
20856
  return sections;
20831
20857
  }
20832
- function isPlaceholder(text3) {
20833
- const t = text3.trim();
20858
+ function isPlaceholder(text2) {
20859
+ const t = text2.trim();
20834
20860
  if (!t) return true;
20835
20861
  if (/^tbd$/i.test(t)) return true;
20836
20862
  if (/^_[^_]*_$/.test(t) && !t.includes("\n")) return true;
@@ -20857,15 +20883,15 @@ function extractBullets(body) {
20857
20883
  for (const line of body.split(/\r?\n/)) {
20858
20884
  const m = line.match(/^\s*[-*+]\s+(.*)$/);
20859
20885
  if (!m) continue;
20860
- let text3 = m[1].trim();
20886
+ let text2 = m[1].trim();
20861
20887
  let checked = null;
20862
- const cb = text3.match(/^\[([ xX])\]\s*(.*)$/);
20888
+ const cb = text2.match(/^\[([ xX])\]\s*(.*)$/);
20863
20889
  if (cb) {
20864
20890
  checked = cb[1].toLowerCase() === "x";
20865
- text3 = cb[2].trim();
20891
+ text2 = cb[2].trim();
20866
20892
  }
20867
- if (!text3 || isPlaceholder(text3)) continue;
20868
- out.push({ text: text3, checked });
20893
+ if (!text2 || isPlaceholder(text2)) continue;
20894
+ out.push({ text: text2, checked });
20869
20895
  }
20870
20896
  return out;
20871
20897
  }
@@ -21484,7 +21510,7 @@ var ImportError = class extends Error {
21484
21510
  // src/commands/work-item.ts
21485
21511
  function requireProject3(dir) {
21486
21512
  if (!loadConfig(dir)) {
21487
- log2.error("No Kaddo project was found in the current directory.");
21513
+ log.error("No Kaddo project was found in the current directory.");
21488
21514
  process.exit(1);
21489
21515
  }
21490
21516
  }
@@ -21495,12 +21521,12 @@ async function runWorkItemImport(dir, fileOrText, opts) {
21495
21521
  content = opts.text;
21496
21522
  } else if (fileOrText) {
21497
21523
  if (!exists(fileOrText)) {
21498
- log2.error(`File not found: ${fileOrText}`);
21524
+ log.error(`File not found: ${fileOrText}`);
21499
21525
  process.exit(1);
21500
21526
  }
21501
21527
  content = readFile(fileOrText) ?? void 0;
21502
21528
  if (!content?.trim()) {
21503
- log2.error(`File is empty: ${fileOrText}`);
21529
+ log.error(`File is empty: ${fileOrText}`);
21504
21530
  process.exit(1);
21505
21531
  }
21506
21532
  } else if (!process.stdin.isTTY) {
@@ -21509,28 +21535,28 @@ async function runWorkItemImport(dir, fileOrText, opts) {
21509
21535
  content = Buffer.concat(chunks).toString("utf-8");
21510
21536
  }
21511
21537
  if (!content?.trim()) {
21512
- log2.error("No content provided. Use a file path, --text, or pipe content via stdin.");
21538
+ log.error("No content provided. Use a file path, --text, or pipe content via stdin.");
21513
21539
  process.exit(1);
21514
21540
  }
21515
21541
  try {
21516
- intro2("Import external Work Item");
21542
+ intro("Import external Work Item");
21517
21543
  const parsed = parseContent(content);
21518
21544
  const hash = computeContentHash(content);
21519
21545
  const duplicate = findDuplicateByHash(dir, hash);
21520
21546
  if (duplicate) {
21521
- log2.warn(`Already imported as ${duplicate.workItemId}.`);
21522
- outro2("No duplicate was created.");
21547
+ log.warn(`Already imported as ${duplicate.workItemId}.`);
21548
+ outro("No duplicate was created.");
21523
21549
  return;
21524
21550
  }
21525
- log2.info(`Format: ${parsed.format}`);
21526
- log2.info(`Title: ${parsed.title}`);
21527
- log2.message(`Type: ${opts.type ?? parsed.type ?? "feature"}`);
21528
- log2.message("Will create: a Draft Work Item (needs refinement).");
21529
- log2.message("No project files have been modified yet.");
21551
+ log.info(`Format: ${parsed.format}`);
21552
+ log.info(`Title: ${parsed.title}`);
21553
+ log.message(`Type: ${opts.type ?? parsed.type ?? "feature"}`);
21554
+ log.message("Will create: a Draft Work Item (needs refinement).");
21555
+ log.message("No project files have been modified yet.");
21530
21556
  if (!opts.yes) {
21531
- const ok = await confirm2({ message: "Import this content as a Draft Work Item?" });
21557
+ const ok = await confirm({ message: "Import this content as a Draft Work Item?" });
21532
21558
  if (ok !== true) {
21533
- cancel2("Import cancelled. No files were changed.");
21559
+ cancel("Import cancelled. No files were changed.");
21534
21560
  process.exit(0);
21535
21561
  }
21536
21562
  }
@@ -21542,8 +21568,8 @@ async function runWorkItemImport(dir, fileOrText, opts) {
21542
21568
  });
21543
21569
  if (result.conflict) {
21544
21570
  const { importedId, existingPath } = result.conflict;
21545
- log2.warn(`The imported content has id "${importedId}" which already exists at ${existingPath}.`);
21546
- const resolution = await select2({
21571
+ log.warn(`The imported content has id "${importedId}" which already exists at ${existingPath}.`);
21572
+ const resolution = await select({
21547
21573
  message: `How should Kaddo handle this conflict?`,
21548
21574
  options: [
21549
21575
  { value: "new-id", label: "Assign a new consecutive ID", hint: "keeps the existing Work Item intact" },
@@ -21560,30 +21586,30 @@ async function runWorkItemImport(dir, fileOrText, opts) {
21560
21586
  }
21561
21587
  if (!result.created) {
21562
21588
  if (result.duplicateOf) {
21563
- log2.warn(`Already imported as ${result.duplicateOf}.`);
21564
- outro2("No duplicate was created.");
21589
+ log.warn(`Already imported as ${result.duplicateOf}.`);
21590
+ outro("No duplicate was created.");
21565
21591
  }
21566
21592
  return;
21567
21593
  }
21568
- log2.info(`Created ${result.workItemId} (Draft, needs refinement).`);
21569
- log2.info(`Path: ${result.path}`);
21594
+ log.info(`Created ${result.workItemId} (Draft, needs refinement).`);
21595
+ log.info(`Path: ${result.path}`);
21570
21596
  if (result.replacedWorkItem) {
21571
- log2.warn(`Replaced existing Work Item ${result.replacedWorkItem}.`);
21597
+ log.warn(`Replaced existing Work Item ${result.replacedWorkItem}.`);
21572
21598
  }
21573
21599
  if (result.discardedFields?.length) {
21574
- log2.warn(`Lifecycle fields discarded from import: ${result.discardedFields.join(", ")}`);
21575
- log2.message("Kaddo always generates its own id and status \u2014 external values are ignored.");
21600
+ log.warn(`Lifecycle fields discarded from import: ${result.discardedFields.join(", ")}`);
21601
+ log.message("Kaddo always generates its own id and status \u2014 external values are ignored.");
21576
21602
  }
21577
- log2.message("executed = false \u2014 the Work Item has NOT been implemented.");
21603
+ log.message("executed = false \u2014 the Work Item has NOT been implemented.");
21578
21604
  if (result.refinementHandoff) {
21579
- log2.step("Refinement handoff");
21580
- log2.message(`Agent: ${result.refinementHandoff.recommendedAgent}`);
21581
- log2.message(`Skill: ${result.refinementHandoff.recommendedSkill}`);
21605
+ log.step("Refinement handoff");
21606
+ log.message(`Agent: ${result.refinementHandoff.recommendedAgent}`);
21607
+ log.message(`Skill: ${result.refinementHandoff.recommendedSkill}`);
21582
21608
  }
21583
- outro2("Done. Refine it next with the Work Item refinement handoff.");
21609
+ outro("Done. Refine it next with the Work Item refinement handoff.");
21584
21610
  } catch (err) {
21585
- if (err instanceof ImportError) log2.error(`[${err.code}] ${err.message}`);
21586
- else log2.error("The import operation failed.");
21611
+ if (err instanceof ImportError) log.error(`[${err.code}] ${err.message}`);
21612
+ else log.error("The import operation failed.");
21587
21613
  process.exit(1);
21588
21614
  }
21589
21615
  }
@@ -21613,7 +21639,7 @@ var SECRET_PATTERNS = [
21613
21639
  /\.pfx$/i
21614
21640
  ];
21615
21641
  function filterSecretPaths(paths) {
21616
- return paths.filter((p2) => !SECRET_PATTERNS.some((re) => re.test(p2)));
21642
+ return paths.filter((p) => !SECRET_PATTERNS.some((re) => re.test(p)));
21617
21643
  }
21618
21644
  function collectImplementationEvidence(dir, workItemId, input) {
21619
21645
  const artifacts = discoverWorkItems(dir);
@@ -21829,9 +21855,9 @@ function extractACsFromBody(body) {
21829
21855
  if (inAC) {
21830
21856
  const m = line.match(/^\s*[-*+]\s+(?:\[[ xX]\]\s*)?(.+)$/);
21831
21857
  if (m) {
21832
- const text3 = m[1].trim();
21833
- if (text3 && !/^_.*_$/.test(text3) && !/^tbd$/i.test(text3)) {
21834
- acs.push(text3);
21858
+ const text2 = m[1].trim();
21859
+ if (text2 && !/^_.*_$/.test(text2) && !/^tbd$/i.test(text2)) {
21860
+ acs.push(text2);
21835
21861
  }
21836
21862
  }
21837
21863
  }
@@ -21844,14 +21870,14 @@ async function runVerify(workItemId, opts = {}) {
21844
21870
  console.error("No knowledge/ directory found. Run `kaddo init` first.");
21845
21871
  process.exit(1);
21846
21872
  }
21847
- if (!opts.json) intro2("kaddo verify");
21873
+ if (!opts.json) intro("kaddo verify");
21848
21874
  const artifacts = discoverWorkItems(dir);
21849
21875
  const match = artifacts.find((a) => (a.id || a.title) === workItemId);
21850
21876
  if (!match) {
21851
21877
  if (opts.json) {
21852
21878
  console.log(JSON.stringify({ error: `Work Item "${workItemId}" not found.` }));
21853
21879
  } else {
21854
- log2.error(`Work Item "${workItemId}" not found.`);
21880
+ log.error(`Work Item "${workItemId}" not found.`);
21855
21881
  }
21856
21882
  process.exit(1);
21857
21883
  }
@@ -21860,7 +21886,7 @@ async function runVerify(workItemId, opts = {}) {
21860
21886
  if (opts.json) {
21861
21887
  console.log(JSON.stringify({ error: `Work Item "${workItemId}" is "${lifecycle}", expected "in-progress".` }));
21862
21888
  } else {
21863
- log2.error(`Work Item "${workItemId}" is "${lifecycle}". Only in-progress Work Items can be verified.`);
21889
+ log.error(`Work Item "${workItemId}" is "${lifecycle}". Only in-progress Work Items can be verified.`);
21864
21890
  }
21865
21891
  process.exit(1);
21866
21892
  }
@@ -21906,7 +21932,7 @@ async function runVerify(workItemId, opts = {}) {
21906
21932
  if (opts.json) {
21907
21933
  console.log(JSON.stringify({ error: e.message }));
21908
21934
  } else {
21909
- log2.error(e.message);
21935
+ log.error(e.message);
21910
21936
  }
21911
21937
  process.exit(1);
21912
21938
  }
@@ -21917,10 +21943,10 @@ async function runVerify(workItemId, opts = {}) {
21917
21943
  console.log(JSON.stringify({ verification, evaluation }, null, 2));
21918
21944
  return;
21919
21945
  }
21920
- log2.info(`Work Item: ${workItemId}`);
21921
- log2.info(`Lifecycle: ${verification.lifecycle}`);
21922
- log2.info(`Implementation: ${verification.implementationStatus}`);
21923
- log2.info(`Validation: ${verification.validationStatus}`);
21946
+ log.info(`Work Item: ${workItemId}`);
21947
+ log.info(`Lifecycle: ${verification.lifecycle}`);
21948
+ log.info(`Implementation: ${verification.implementationStatus}`);
21949
+ log.info(`Validation: ${verification.validationStatus}`);
21924
21950
  console.log("");
21925
21951
  if (verification.acVerifications.length > 0) {
21926
21952
  console.log("Acceptance Criteria:");
@@ -21976,7 +22002,7 @@ async function runVerify(workItemId, opts = {}) {
21976
22002
  for (const w of evaluation.warnings) console.log(` ! ${w}`);
21977
22003
  }
21978
22004
  console.log("");
21979
- const shouldPersist = opts.yes || await confirm2({
22005
+ const shouldPersist = opts.yes || await confirm({
21980
22006
  message: "Update Work Item frontmatter with verification evidence?",
21981
22007
  initialValue: true
21982
22008
  });
@@ -21991,9 +22017,9 @@ async function runVerify(workItemId, opts = {}) {
21991
22017
  data.verified_at = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
21992
22018
  const newRaw = matter16.stringify(wiParsed.content, data);
21993
22019
  writeFile(filePath, newRaw);
21994
- log2.success("Work Item frontmatter updated with verification evidence.");
22020
+ log.success("Work Item frontmatter updated with verification evidence.");
21995
22021
  }
21996
- if (!opts.json) outro2("Verification complete.");
22022
+ if (!opts.json) outro("Verification complete.");
21997
22023
  }
21998
22024
 
21999
22025
  // src/core/telemetry.ts
@@ -22007,10 +22033,10 @@ function identityPath(dir) {
22007
22033
  return join(dir, TELEMETRY_DIR, IDENTITY_FILE);
22008
22034
  }
22009
22035
  function loadIdentity(dir) {
22010
- const p2 = identityPath(dir);
22011
- if (!exists(p2)) return null;
22036
+ const p = identityPath(dir);
22037
+ if (!exists(p)) return null;
22012
22038
  try {
22013
- return JSON.parse(readFile(p2));
22039
+ return JSON.parse(readFile(p));
22014
22040
  } catch {
22015
22041
  return null;
22016
22042
  }
@@ -22074,10 +22100,10 @@ function bufferPath(dir) {
22074
22100
  return join(dir, TELEMETRY_DIR2, BUFFER_FILE);
22075
22101
  }
22076
22102
  function readBuffer(dir) {
22077
- const p2 = bufferPath(dir);
22078
- if (!exists(p2)) return [];
22103
+ const p = bufferPath(dir);
22104
+ if (!exists(p)) return [];
22079
22105
  try {
22080
- const data = JSON.parse(readFile(p2));
22106
+ const data = JSON.parse(readFile(p));
22081
22107
  return Array.isArray(data) ? data : [];
22082
22108
  } catch {
22083
22109
  return [];
@@ -22090,8 +22116,8 @@ function enqueue(dir, events) {
22090
22116
  writeFile(bufferPath(dir), JSON.stringify(combined, null, 2));
22091
22117
  }
22092
22118
  function clearBuffer(dir) {
22093
- const p2 = bufferPath(dir);
22094
- if (exists(p2)) writeFile(p2, "[]");
22119
+ const p = bufferPath(dir);
22120
+ if (exists(p)) writeFile(p, "[]");
22095
22121
  }
22096
22122
  function bufferSize(dir) {
22097
22123
  return readBuffer(dir).length;
@@ -22104,15 +22130,15 @@ var REGISTRATION_PATH = "/v1/installations";
22104
22130
  var REQUEST_TIMEOUT_MS = 5e3;
22105
22131
  var MAX_BATCH_SIZE = 25;
22106
22132
  function isEnabled(config) {
22107
- if (!config) return false;
22108
- const t = config.telemetry;
22109
- return t?.enabled === true;
22133
+ return getConsentState(config) === "enabled";
22110
22134
  }
22111
22135
  function getStatus(dir) {
22112
22136
  const config = loadConfig(dir);
22113
- const enabled = isEnabled(config);
22137
+ const consent = getConsentState(config);
22138
+ const enabled = consent === "enabled";
22114
22139
  const identity = loadIdentity(dir);
22115
22140
  return {
22141
+ consent,
22116
22142
  enabled,
22117
22143
  registered: identity?.registered ?? false,
22118
22144
  pendingEvents: enabled ? bufferSize(dir) : 0,
@@ -22129,8 +22155,8 @@ async function httpPost(url, body, headers) {
22129
22155
  body,
22130
22156
  signal: controller.signal
22131
22157
  });
22132
- const text3 = await res.text();
22133
- return { status: res.status, body: text3 };
22158
+ const text2 = await res.text();
22159
+ return { status: res.status, body: text2 };
22134
22160
  } finally {
22135
22161
  clearTimeout(timeout);
22136
22162
  }
@@ -22230,52 +22256,40 @@ async function flush(dir) {
22230
22256
  }
22231
22257
 
22232
22258
  // src/commands/telemetry.ts
22233
- import { parse as parseYaml19, stringify as stringifyYaml9 } from "yaml";
22234
22259
  function runTelemetryStatus() {
22235
22260
  const dir = process.cwd();
22236
- intro2("kaddo telemetry status");
22261
+ intro("kaddo telemetry status");
22237
22262
  const config = loadConfig(dir);
22238
22263
  if (!config) {
22239
- log2.error("Kaddo is not initialized. Run `kaddo init` first.");
22264
+ log.error("Kaddo is not initialized. Run `kaddo init` first.");
22240
22265
  process.exit(1);
22241
22266
  }
22242
22267
  const status = getStatus(dir);
22243
- log2.info(` Enabled: ${status.enabled}`);
22244
- log2.info(` Registered: ${status.registered}`);
22245
- log2.info(` Pending events: ${status.pendingEvents}`);
22246
- if (!status.enabled) {
22247
- log2.info("");
22248
- log2.info("Enable with: kaddo telemetry enable");
22268
+ log.info(` Consent: ${status.consent}`);
22269
+ log.info(` Registered: ${status.registered}`);
22270
+ log.info(` Pending events: ${status.pendingEvents}`);
22271
+ if (status.consent === "unset") {
22272
+ log.info("");
22273
+ log.info("Enable with: kaddo telemetry enable");
22249
22274
  }
22250
- outro2("Telemetry status.");
22275
+ outro("Telemetry status.");
22251
22276
  }
22252
22277
  function runTelemetryEnable() {
22253
22278
  const dir = process.cwd();
22254
- intro2("kaddo telemetry enable");
22255
- setTelemetryEnabled(dir, true);
22256
- log2.success("Telemetry enabled.");
22257
- log2.info("Kaddo will send anonymous usage metadata to telemetry.kaddo.org.");
22258
- log2.info("No project content, source code, prompts or PII is ever transmitted.");
22259
- outro2("Run `kaddo telemetry status` to check the current state.");
22279
+ intro("kaddo telemetry enable");
22280
+ persistConsent(dir, "enabled");
22281
+ log.success("Telemetry enabled.");
22282
+ log.info("Kaddo will send anonymous usage metadata to telemetry.kaddo.org.");
22283
+ log.info("No project content, source code, prompts or PII is ever transmitted.");
22284
+ outro("Run `kaddo telemetry status` to check the current state.");
22260
22285
  }
22261
22286
  function runTelemetryDisable() {
22262
22287
  const dir = process.cwd();
22263
- intro2("kaddo telemetry disable");
22264
- setTelemetryEnabled(dir, false);
22265
- log2.success("Telemetry disabled.");
22266
- log2.info("No telemetry requests will be made.");
22267
- outro2("Run `kaddo telemetry enable` to re-enable.");
22268
- }
22269
- function setTelemetryEnabled(dir, enabled) {
22270
- const configPath = join(dir, ".kaddo", "config.yml");
22271
- if (!exists(configPath)) {
22272
- log2.error("Kaddo is not initialized. Run `kaddo init` first.");
22273
- process.exit(1);
22274
- }
22275
- const raw = readFile(configPath);
22276
- const doc = parseYaml19(raw) ?? {};
22277
- doc.telemetry = { ...doc.telemetry ?? {}, enabled };
22278
- writeFile(configPath, stringifyYaml9(doc));
22288
+ intro("kaddo telemetry disable");
22289
+ persistConsent(dir, "disabled");
22290
+ log.success("Telemetry disabled.");
22291
+ log.info("No telemetry requests will be made.");
22292
+ outro("Run `kaddo telemetry enable` to re-enable.");
22279
22293
  }
22280
22294
 
22281
22295
  // src/index.ts
@@ -22478,6 +22492,18 @@ var CAPSULE_EVENTS = {
22478
22492
  export: "capsule_exported",
22479
22493
  add: "capsule_imported"
22480
22494
  };
22495
+ var CONSENT_SKIP_COMMANDS = /* @__PURE__ */ new Set(["status", "enable", "disable"]);
22496
+ program.hook("preAction", async (_thisCommand, actionCommand) => {
22497
+ const name = actionCommand.name();
22498
+ const parent = actionCommand.parent?.name();
22499
+ if (parent === "telemetry" && CONSENT_SKIP_COMMANDS.has(name)) return;
22500
+ try {
22501
+ const dir = cwd();
22502
+ const config = loadConfig(dir);
22503
+ if (config) await ensureTelemetryConsent(dir, config);
22504
+ } catch {
22505
+ }
22506
+ });
22481
22507
  var commandStart = Date.now();
22482
22508
  program.hook("postAction", (_thisCommand, actionCommand) => {
22483
22509
  const name = actionCommand.name();