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