@kaddo/cli 3.118.0 → 3.120.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/admin-dist/assets/{architectureDiagram-3BPJPVTR-VNE4N202.js → architectureDiagram-3BPJPVTR-DIMrrmB9.js} +1 -1
- package/dist/admin-dist/assets/{chunk-727SXJPM-Dycfm5kx.js → chunk-727SXJPM-Dqr01pM2.js} +1 -1
- package/dist/admin-dist/assets/{chunk-AQP2D5EJ-CZfRVDeZ.js → chunk-AQP2D5EJ-Cq-Ux2er.js} +1 -1
- package/dist/admin-dist/assets/{classDiagram-v2-Q7XG4LA2-ZqEUMLi9.js → classDiagram-4FO5ZUOK-ggXfKatP.js} +1 -1
- package/dist/admin-dist/assets/{classDiagram-4FO5ZUOK-ZqEUMLi9.js → classDiagram-v2-Q7XG4LA2-ggXfKatP.js} +1 -1
- package/dist/admin-dist/assets/{dagre-BM42HDAG-BPoktDQ7.js → dagre-BM42HDAG-C6oD5ML4.js} +1 -1
- package/dist/admin-dist/assets/{diagram-2AECGRRQ-DX6VsCIO.js → diagram-2AECGRRQ-hUz_WSJC.js} +1 -1
- package/dist/admin-dist/assets/{diagram-5GNKFQAL-DaVO8tr4.js → diagram-5GNKFQAL-ChltTKxS.js} +1 -1
- package/dist/admin-dist/assets/{diagram-LMA3HP47-C7OMxYl7.js → diagram-LMA3HP47-DD3kd-Zq.js} +1 -1
- package/dist/admin-dist/assets/{diagram-OG6HWLK6-Ba7L6sdv.js → diagram-OG6HWLK6-BKHyHHw0.js} +1 -1
- package/dist/admin-dist/assets/{erDiagram-TEJ5UH35-B8GR6jN8.js → erDiagram-TEJ5UH35-BE5PDGjy.js} +1 -1
- package/dist/admin-dist/assets/{flowDiagram-I6XJVG4X-GnYF-YSu.js → flowDiagram-I6XJVG4X-lxFDGYVc.js} +1 -1
- package/dist/admin-dist/assets/{ganttDiagram-6RSMTGT7-Ci5gXlfB.js → ganttDiagram-6RSMTGT7-BPeceg0v.js} +1 -1
- package/dist/admin-dist/assets/index-B7GhDkjv.js +92 -0
- package/dist/admin-dist/assets/{infoDiagram-5YYISTIA-CXCqRy3V.js → infoDiagram-5YYISTIA-Boe5ho81.js} +1 -1
- package/dist/admin-dist/assets/{ishikawaDiagram-YF4QCWOH-CHnyKPlH.js → ishikawaDiagram-YF4QCWOH-3T8K6hMf.js} +1 -1
- package/dist/admin-dist/assets/{kanban-definition-UN3LZRKU-DZ2E5eRA.js → kanban-definition-UN3LZRKU-BW97uUmp.js} +1 -1
- package/dist/admin-dist/assets/{linear-CBbecos1.js → linear-BGHTsNfG.js} +1 -1
- package/dist/admin-dist/assets/{mindmap-definition-RKZ34NQL-C_PLO1RL.js → mindmap-definition-RKZ34NQL-B-LmLGip.js} +1 -1
- package/dist/admin-dist/assets/{pieDiagram-4H26LBE5-Bnzx1mbG.js → pieDiagram-4H26LBE5-BS0ysj7T.js} +1 -1
- package/dist/admin-dist/assets/{quadrantDiagram-W4KKPZXB-vDV6emR-.js → quadrantDiagram-W4KKPZXB-CJbpr-VT.js} +1 -1
- package/dist/admin-dist/assets/{requirementDiagram-4Y6WPE33-BS-WaBoL.js → requirementDiagram-4Y6WPE33-CTEMRVel.js} +1 -1
- package/dist/admin-dist/assets/{sequenceDiagram-3UESZ5HK-DHBKXsre.js → sequenceDiagram-3UESZ5HK-ff_IANYV.js} +1 -1
- package/dist/admin-dist/assets/{stateDiagram-AJRCARHV-Cvrc0x1G.js → stateDiagram-AJRCARHV-DCJ7-my6.js} +1 -1
- package/dist/admin-dist/assets/{stateDiagram-v2-BHNVJYJU-B9k2LCWQ.js → stateDiagram-v2-BHNVJYJU-tCHje_1l.js} +1 -1
- package/dist/admin-dist/assets/{timeline-definition-PNZ67QCA-BPg3zrWH.js → timeline-definition-PNZ67QCA-DMT8_Cuq.js} +1 -1
- package/dist/admin-dist/assets/{vennDiagram-CIIHVFJN-Cr5_ruRl.js → vennDiagram-CIIHVFJN-DRtPPFKO.js} +1 -1
- package/dist/admin-dist/assets/{wardleyDiagram-YWT4CUSO-CCFwsa6d.js → wardleyDiagram-YWT4CUSO-CDN0fFvU.js} +1 -1
- package/dist/admin-dist/assets/{xychartDiagram-2RQKCTM6-zM8ePcPG.js → xychartDiagram-2RQKCTM6-e4oyuMDO.js} +1 -1
- package/dist/admin-dist/index.html +1 -1
- package/dist/admin-server/index.js +41 -3
- package/dist/core.js +270 -66
- package/dist/index.js +294 -90
- package/package.json +1 -1
- package/dist/admin-dist/assets/index-BQS_UR2v.js +0 -92
package/dist/index.js
CHANGED
|
@@ -3189,6 +3189,50 @@ their intersection with the affected areas, and recommended actions.
|
|
|
3189
3189
|
- The assessment is proportional \u2014 a small change gets a brief assessment.
|
|
3190
3190
|
`
|
|
3191
3191
|
);
|
|
3192
|
+
var POC_REPORT_WRITING = skill(
|
|
3193
|
+
"poc-report-writing",
|
|
3194
|
+
"POC Final Report Writing Skill",
|
|
3195
|
+
"delivery",
|
|
3196
|
+
["implementation-agent", "work-item-agent"],
|
|
3197
|
+
`
|
|
3198
|
+
# POC Final Report Writing Skill
|
|
3199
|
+
|
|
3200
|
+
## Purpose
|
|
3201
|
+
|
|
3202
|
+
Turn a supplied deterministic POC report context into a concise, traceable final report.
|
|
3203
|
+
|
|
3204
|
+
## When to use
|
|
3205
|
+
|
|
3206
|
+
After a POC has a canonical conclusion and Core has prepared its deterministic report context.
|
|
3207
|
+
|
|
3208
|
+
## Rules
|
|
3209
|
+
|
|
3210
|
+
- Use only the supplied context; do not scan the repository or infer missing results.
|
|
3211
|
+
- Treat \`poc.md\` as canonical for the conclusion. Never contradict it.
|
|
3212
|
+
- Keep facts, measurements, calculations, estimates, and recommendations distinct.
|
|
3213
|
+
- Never include credential values, tokens, private keys, passwords, or connection strings.
|
|
3214
|
+
- Use \`Not evaluated in this POC.\`, \`Not applicable.\`, or \`No evidence available.\` when sources do not support a section.
|
|
3215
|
+
- Return a proposal for human review; Core persists it only after confirmation.
|
|
3216
|
+
|
|
3217
|
+
## Required structure
|
|
3218
|
+
|
|
3219
|
+
1. Executive Summary
|
|
3220
|
+
2. Problem and Objective
|
|
3221
|
+
3. Hypothesis and Success Criteria
|
|
3222
|
+
4. Scope, Constraints and Non-goals
|
|
3223
|
+
5. Technical Approach and Architecture
|
|
3224
|
+
6. Infrastructure and Project Resources
|
|
3225
|
+
7. Implementation and Relevant Technical Decisions
|
|
3226
|
+
8. Experiments and Validation
|
|
3227
|
+
9. Results and Measurements
|
|
3228
|
+
10. Cost and Efficiency Analysis
|
|
3229
|
+
11. Observability and Operational Findings
|
|
3230
|
+
12. Findings, Learnings, Limitations and Risks
|
|
3231
|
+
13. Conclusion
|
|
3232
|
+
14. Recommendation and Next Steps
|
|
3233
|
+
15. Traceability and Sources
|
|
3234
|
+
`
|
|
3235
|
+
);
|
|
3192
3236
|
var SKILLS = [
|
|
3193
3237
|
ADR_WRITING,
|
|
3194
3238
|
WORK_ITEM_REFINEMENT,
|
|
@@ -3199,10 +3243,11 @@ var SKILLS = [
|
|
|
3199
3243
|
IMPLEMENTATION_PLANNING,
|
|
3200
3244
|
MODULE_CONTEXT_REFINEMENT,
|
|
3201
3245
|
EVIDENCE_VERIFICATION,
|
|
3202
|
-
LEGACY_RISK_ASSESSMENT
|
|
3246
|
+
LEGACY_RISK_ASSESSMENT,
|
|
3247
|
+
POC_REPORT_WRITING
|
|
3203
3248
|
];
|
|
3204
3249
|
var SKILL_GROUPS = {
|
|
3205
|
-
delivery: ["work-item-refinement", "implementation-planning", "learning-capture", "evidence-verification", "legacy-risk-assessment"],
|
|
3250
|
+
delivery: ["work-item-refinement", "implementation-planning", "learning-capture", "evidence-verification", "legacy-risk-assessment", "poc-report-writing"],
|
|
3206
3251
|
tech: ["adr-writing", "ownership-suggestion", "graph-metadata-review", "module-context-refinement"],
|
|
3207
3252
|
integration: ["capsule-writing"]
|
|
3208
3253
|
};
|
|
@@ -7136,12 +7181,12 @@ function classifyLayer(posixPath) {
|
|
|
7136
7181
|
return "unknown";
|
|
7137
7182
|
}
|
|
7138
7183
|
function enrich(dir, a) {
|
|
7139
|
-
const
|
|
7184
|
+
const posix2 = toPosix(a.filePath);
|
|
7140
7185
|
const isWi = isWorkItemArtifact(a);
|
|
7141
7186
|
return {
|
|
7142
7187
|
...a,
|
|
7143
7188
|
relPath: relativeTo(dir, a.filePath),
|
|
7144
|
-
layer: classifyLayer(
|
|
7189
|
+
layer: classifyLayer(posix2),
|
|
7145
7190
|
isWorkItem: isWi,
|
|
7146
7191
|
lifecycle: isWi ? lifecycleStateOf({ status: a.status, filePath: a.filePath }) : void 0
|
|
7147
7192
|
};
|
|
@@ -8549,7 +8594,7 @@ function runIgnoreRemove(artifactId) {
|
|
|
8549
8594
|
}
|
|
8550
8595
|
|
|
8551
8596
|
// src/commands/explain.ts
|
|
8552
|
-
import
|
|
8597
|
+
import matter9 from "gray-matter";
|
|
8553
8598
|
import { parse as parseYaml13 } from "yaml";
|
|
8554
8599
|
|
|
8555
8600
|
// src/core/delivery-phase.ts
|
|
@@ -12347,8 +12392,8 @@ function buildOpenQuestionsReport(dir, now = /* @__PURE__ */ new Date()) {
|
|
|
12347
12392
|
const project = loadConfig(dir)?.project.name ?? "unknown";
|
|
12348
12393
|
const questions = [];
|
|
12349
12394
|
let seq = 0;
|
|
12350
|
-
for (const
|
|
12351
|
-
const p = join(dir,
|
|
12395
|
+
for (const source2 of SOURCES) {
|
|
12396
|
+
const p = join(dir, source2);
|
|
12352
12397
|
if (!exists(p)) continue;
|
|
12353
12398
|
let md;
|
|
12354
12399
|
try {
|
|
@@ -12361,8 +12406,8 @@ function buildOpenQuestionsReport(dir, now = /* @__PURE__ */ new Date()) {
|
|
|
12361
12406
|
const { classification, reason } = classifyQuestion(eq.text);
|
|
12362
12407
|
questions.push({
|
|
12363
12408
|
id: `OQ-${String(seq).padStart(3, "0")}`,
|
|
12364
|
-
source,
|
|
12365
|
-
sourcePath:
|
|
12409
|
+
source: source2,
|
|
12410
|
+
sourcePath: source2,
|
|
12366
12411
|
line: eq.line,
|
|
12367
12412
|
raw: eq.raw,
|
|
12368
12413
|
section: "Open Questions",
|
|
@@ -12957,6 +13002,121 @@ function buildTechDecisions(dir) {
|
|
|
12957
13002
|
};
|
|
12958
13003
|
}
|
|
12959
13004
|
|
|
13005
|
+
// src/core/poc-report.ts
|
|
13006
|
+
import { createHash } from "crypto";
|
|
13007
|
+
import matter7 from "gray-matter";
|
|
13008
|
+
var POC_REPORT_PREFIX = "poc-report-v";
|
|
13009
|
+
var SECRET_LINE = /(^|\s)(?:[A-Z][A-Z0-9_]*(?:TOKEN|SECRET|PASSWORD|API_KEY|PRIVATE_KEY)|(?:token|secret|password|api[_-]?key))\s*[:=]\s*\S+/i;
|
|
13010
|
+
var reportName = /^poc-report-v(\d{3,})\.md$/;
|
|
13011
|
+
function sha(value) {
|
|
13012
|
+
return createHash("sha256").update(value).digest("hex");
|
|
13013
|
+
}
|
|
13014
|
+
function posix(value) {
|
|
13015
|
+
return value.replace(/\\/g, "/");
|
|
13016
|
+
}
|
|
13017
|
+
function redactSecrets(value) {
|
|
13018
|
+
return value.split(/\r?\n/).map((line) => {
|
|
13019
|
+
if (!SECRET_LINE.test(line)) return line;
|
|
13020
|
+
return line.replace(/([:=]\s*)\S+.*/, "$1[redacted]");
|
|
13021
|
+
}).join("\n");
|
|
13022
|
+
}
|
|
13023
|
+
function source(dir, path13, kind) {
|
|
13024
|
+
const absolute = join(dir, path13);
|
|
13025
|
+
if (!exists(absolute)) return null;
|
|
13026
|
+
const raw = readFile(absolute);
|
|
13027
|
+
return { path: posix(path13), kind, digest: sha(raw), content: redactSecrets(raw) };
|
|
13028
|
+
}
|
|
13029
|
+
function reportFiles(dir) {
|
|
13030
|
+
const delivery = join(dir, "knowledge", "delivery");
|
|
13031
|
+
return readDir(delivery).flatMap((name) => {
|
|
13032
|
+
const match = name.match(reportName);
|
|
13033
|
+
if (!match) return [];
|
|
13034
|
+
try {
|
|
13035
|
+
const parsed = matter7(readFile(join(delivery, name)));
|
|
13036
|
+
const fingerprint = typeof parsed.data.source_fingerprint === "string" ? parsed.data.source_fingerprint : "";
|
|
13037
|
+
const manifest = parsed.data.source_manifest;
|
|
13038
|
+
const sourceManifest = manifest && typeof manifest === "object" && !Array.isArray(manifest) ? Object.fromEntries(Object.entries(manifest).filter(([, digest]) => typeof digest === "string")) : {};
|
|
13039
|
+
return [{ path: `knowledge/delivery/${name}`, version: Number(match[1]), sourceFingerprint: fingerprint, sourceManifest }];
|
|
13040
|
+
} catch {
|
|
13041
|
+
return [];
|
|
13042
|
+
}
|
|
13043
|
+
}).sort((a, b) => b.version - a.version);
|
|
13044
|
+
}
|
|
13045
|
+
function reportPath(version2) {
|
|
13046
|
+
return `knowledge/delivery/${POC_REPORT_PREFIX}${String(version2).padStart(3, "0")}.md`;
|
|
13047
|
+
}
|
|
13048
|
+
function buildPocReportContext(dir) {
|
|
13049
|
+
const poc = readPocSummary(dir);
|
|
13050
|
+
const reports = reportFiles(dir);
|
|
13051
|
+
const latestReport = reports[0] ?? null;
|
|
13052
|
+
const nextPath = reportPath((latestReport?.version ?? 0) + 1);
|
|
13053
|
+
if (!poc.exists || poc.conclusion === "pending") {
|
|
13054
|
+
return {
|
|
13055
|
+
eligible: false,
|
|
13056
|
+
conclusion: poc.conclusion,
|
|
13057
|
+
status: latestReport ? "stale" : "missing",
|
|
13058
|
+
latestReport,
|
|
13059
|
+
nextPath,
|
|
13060
|
+
sourceFingerprint: "",
|
|
13061
|
+
sources: [],
|
|
13062
|
+
changesSinceLatest: [],
|
|
13063
|
+
handoff: "POC conclusion is still pending. Record validated, rejected, or inconclusive before generating a final report."
|
|
13064
|
+
};
|
|
13065
|
+
}
|
|
13066
|
+
const sources = [];
|
|
13067
|
+
const add = (path13, kind) => {
|
|
13068
|
+
if (sources.some((item2) => item2.path === posix(path13))) return;
|
|
13069
|
+
const item = source(dir, path13, kind);
|
|
13070
|
+
if (item) sources.push(item);
|
|
13071
|
+
};
|
|
13072
|
+
add(POC_ARTIFACT_PATH, "poc");
|
|
13073
|
+
const pocText = readFile(join(dir, POC_ARTIFACT_PATH));
|
|
13074
|
+
const knowledge = discoverKnowledge(dir);
|
|
13075
|
+
const workItems = discoverWorkItems(dir);
|
|
13076
|
+
const referencedWorkItems = workItems.filter((wi) => wi.lifecycle === "completed" && wi.id && new RegExp(`\\b${wi.id}\\b`).test(pocText));
|
|
13077
|
+
const resourceIds = /* @__PURE__ */ new Set();
|
|
13078
|
+
const decisionIds = /* @__PURE__ */ new Set();
|
|
13079
|
+
for (const wi of referencedWorkItems) {
|
|
13080
|
+
add(wi.relPath, "work-item");
|
|
13081
|
+
for (const resource of parseWorkItemResources(wi.rawFrontmatter)) resourceIds.add(resource.id);
|
|
13082
|
+
const decisions = wi.rawFrontmatter.decisions;
|
|
13083
|
+
if (Array.isArray(decisions)) decisions.forEach((id) => decisionIds.add(String(id)));
|
|
13084
|
+
}
|
|
13085
|
+
for (const id of resourceIds) {
|
|
13086
|
+
const resource = getResource(dir, id);
|
|
13087
|
+
if (resource) add(resource.path, "resource");
|
|
13088
|
+
}
|
|
13089
|
+
for (const artifact of knowledge) {
|
|
13090
|
+
if (artifact.isWorkItem || !artifact.id) continue;
|
|
13091
|
+
if (decisionIds.has(artifact.id) || referencedWorkItems.some((wi) => new RegExp(`\\b${artifact.id}\\b`).test(readFile(wi.filePath)))) add(artifact.relPath, "knowledge");
|
|
13092
|
+
}
|
|
13093
|
+
sources.sort((a, b) => a.path.localeCompare(b.path));
|
|
13094
|
+
const sourceFingerprint = sha(sources.map((item) => `${item.path}\0${item.digest}`).join("\n"));
|
|
13095
|
+
const status = !latestReport ? "missing" : latestReport.sourceFingerprint === sourceFingerprint ? "current" : "stale";
|
|
13096
|
+
const currentManifest = Object.fromEntries(sources.map((item) => [item.path, item.digest]));
|
|
13097
|
+
const changesSinceLatest = status === "stale" ? [.../* @__PURE__ */ new Set([...Object.keys(currentManifest), ...Object.keys(latestReport?.sourceManifest ?? {})])].filter((path13) => currentManifest[path13] !== latestReport?.sourceManifest[path13]).sort() : [];
|
|
13098
|
+
const sourceList = sources.map((item) => `- ${item.path} (${item.kind})`).join("\n") || "- No sources selected.";
|
|
13099
|
+
return {
|
|
13100
|
+
eligible: true,
|
|
13101
|
+
conclusion: poc.conclusion,
|
|
13102
|
+
status,
|
|
13103
|
+
latestReport,
|
|
13104
|
+
nextPath,
|
|
13105
|
+
sourceFingerprint,
|
|
13106
|
+
sources,
|
|
13107
|
+
changesSinceLatest,
|
|
13108
|
+
handoff: [
|
|
13109
|
+
"Create a POC Final Report from the supplied sources only. Do not explore the repository.",
|
|
13110
|
+
`Canonical conclusion: ${poc.conclusion}. Do not contradict it.`,
|
|
13111
|
+
"Use the 15 canonical sections. Mark missing evidence as Not evaluated, Not applicable, or No evidence available.",
|
|
13112
|
+
"Distinguish measured, calculated, estimated, and projected values. Never include secret values.",
|
|
13113
|
+
"",
|
|
13114
|
+
"Selected sources:",
|
|
13115
|
+
sourceList
|
|
13116
|
+
].join("\n")
|
|
13117
|
+
};
|
|
13118
|
+
}
|
|
13119
|
+
|
|
12960
13120
|
// src/core/next-step.ts
|
|
12961
13121
|
function buildDeliveryState(dir) {
|
|
12962
13122
|
const wis = discoverWorkItems(dir);
|
|
@@ -13073,7 +13233,11 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
|
|
|
13073
13233
|
if (poc.conclusion === "pending") {
|
|
13074
13234
|
return { id: "poc-evaluate", phase: "Evaluation", label: "Evaluate the experiment evidence and record the POC conclusion.", target: POC_ARTIFACT_PATH, reason: "Experiment Work Items are complete but the POC conclusion is pending." };
|
|
13075
13235
|
}
|
|
13076
|
-
|
|
13236
|
+
const report = buildPocReportContext(dir);
|
|
13237
|
+
if (report.status !== "current") {
|
|
13238
|
+
return { id: "poc-final-report", phase: "Conclusion", label: `POC concluded: ${poc.conclusion}. Generate a final report if it would help communicate the result.`, command: "kaddo poc report", target: POC_ARTIFACT_PATH, reason: report.status === "stale" ? "The latest final report is stale after source changes." : "A final report is optional and has not been generated." };
|
|
13239
|
+
}
|
|
13240
|
+
return { id: "poc-complete", phase: "Conclusion", label: `POC concluded: ${poc.conclusion}. Decide whether to graduate it to standard delivery.`, target: POC_ARTIFACT_PATH, reason: "The POC conclusion and final report are current." };
|
|
13077
13241
|
}
|
|
13078
13242
|
const q = (rel) => analyzeKnowledgeArtifact(dir, rel);
|
|
13079
13243
|
const resolveAgent = (agent) => {
|
|
@@ -13511,7 +13675,7 @@ function deriveDeliveryCompletedStatus(dir) {
|
|
|
13511
13675
|
}
|
|
13512
13676
|
|
|
13513
13677
|
// src/core/assets.ts
|
|
13514
|
-
import
|
|
13678
|
+
import matter8 from "gray-matter";
|
|
13515
13679
|
function canonicalAgents() {
|
|
13516
13680
|
return AGENT_PROMPTS.map((a) => ({
|
|
13517
13681
|
name: a.fileName.replace(/\.md$/, ""),
|
|
@@ -13524,7 +13688,7 @@ function canonicalSkills() {
|
|
|
13524
13688
|
}
|
|
13525
13689
|
function versionOf(content) {
|
|
13526
13690
|
try {
|
|
13527
|
-
const v =
|
|
13691
|
+
const v = matter8(content).data.version;
|
|
13528
13692
|
return v === void 0 || v === null ? null : String(v);
|
|
13529
13693
|
} catch {
|
|
13530
13694
|
return null;
|
|
@@ -13749,9 +13913,9 @@ function parseWorkItemSource(frontmatter) {
|
|
|
13749
13913
|
reason: "No source metadata found."
|
|
13750
13914
|
};
|
|
13751
13915
|
}
|
|
13752
|
-
function renderSourceCompact(
|
|
13753
|
-
const parts = [
|
|
13754
|
-
if (
|
|
13916
|
+
function renderSourceCompact(source2) {
|
|
13917
|
+
const parts = [source2.type];
|
|
13918
|
+
if (source2.id) parts.push(source2.id);
|
|
13755
13919
|
return parts.join(" \xB7 ");
|
|
13756
13920
|
}
|
|
13757
13921
|
function optStr2(v) {
|
|
@@ -14128,7 +14292,17 @@ var concludePoc = {
|
|
|
14128
14292
|
return conclusion === "pending" ? { status: "pending", reason: "Record validated, rejected, or inconclusive from the evidence." } : { status: "done", evidence: [POC_ARTIFACT_PATH], reason: `Conclusion: ${conclusion}.` };
|
|
14129
14293
|
}
|
|
14130
14294
|
};
|
|
14131
|
-
var
|
|
14295
|
+
var finalPocReport = {
|
|
14296
|
+
id: "poc-final-report",
|
|
14297
|
+
label: "Generate final report (optional)",
|
|
14298
|
+
evaluate: (ctx) => {
|
|
14299
|
+
const report = buildPocReportContext(ctx.dir);
|
|
14300
|
+
if (!report.eligible) return { status: "optional", reason: "Available after recording a POC conclusion." };
|
|
14301
|
+
if (report.status === "current") return { status: "done", evidence: [report.latestReport.path] };
|
|
14302
|
+
return { status: "optional", command: "kaddo poc report", reason: report.status === "stale" ? "Latest report is stale." : "A final report is optional." };
|
|
14303
|
+
}
|
|
14304
|
+
};
|
|
14305
|
+
var POC_STEPS = [enableKaddo, ensurePocArtifact2, definePocHypothesis, definePocCriteria, describePocTech, identifyPocResources, createPocExperiment, capturePocEvidence, concludePoc, finalPocReport];
|
|
14132
14306
|
function stepsForState(state) {
|
|
14133
14307
|
switch (state) {
|
|
14134
14308
|
case "new":
|
|
@@ -14232,6 +14406,7 @@ function mapNextStepId(id) {
|
|
|
14232
14406
|
"poc-resources": "poc-resources",
|
|
14233
14407
|
"poc-create-experiment": "poc-create-experiment",
|
|
14234
14408
|
"poc-evaluate": "poc-evaluate",
|
|
14409
|
+
"poc-final-report": "poc-final-report",
|
|
14235
14410
|
"poc-complete": "poc-evaluate"
|
|
14236
14411
|
};
|
|
14237
14412
|
return MAP[id] ?? id;
|
|
@@ -14246,7 +14421,7 @@ function buildProjectRoute(dir) {
|
|
|
14246
14421
|
return { id: d.id, label: d.label, ...result };
|
|
14247
14422
|
});
|
|
14248
14423
|
for (const s of steps) {
|
|
14249
|
-
if (s.id === ctx.nextStepId && s.status !== "done") {
|
|
14424
|
+
if (s.id === ctx.nextStepId && s.status !== "done" && s.status !== "optional") {
|
|
14250
14425
|
s.status = "current";
|
|
14251
14426
|
}
|
|
14252
14427
|
}
|
|
@@ -14258,8 +14433,8 @@ function buildProjectRoute(dir) {
|
|
|
14258
14433
|
break;
|
|
14259
14434
|
}
|
|
14260
14435
|
}
|
|
14261
|
-
const completed = steps.filter((s) => s.status === "done").length;
|
|
14262
|
-
const total = steps.length;
|
|
14436
|
+
const completed = steps.filter((s) => s.status === "done" && s.status !== "optional").length;
|
|
14437
|
+
const total = steps.filter((s) => s.status !== "optional").length;
|
|
14263
14438
|
const progressPercent = total > 0 ? Math.round(completed / total * 100) : 0;
|
|
14264
14439
|
return {
|
|
14265
14440
|
type: state,
|
|
@@ -15064,7 +15239,7 @@ function readKnowledge(dir) {
|
|
|
15064
15239
|
if (!exists(knowledgePath)) return null;
|
|
15065
15240
|
try {
|
|
15066
15241
|
const raw = readFile(knowledgePath);
|
|
15067
|
-
const { data, content } =
|
|
15242
|
+
const { data, content } = matter9(raw);
|
|
15068
15243
|
return { content, data };
|
|
15069
15244
|
} catch {
|
|
15070
15245
|
return null;
|
|
@@ -15075,7 +15250,7 @@ function readRoadmap(dir) {
|
|
|
15075
15250
|
if (!exists(roadmapPath)) return null;
|
|
15076
15251
|
try {
|
|
15077
15252
|
const raw = readFile(roadmapPath);
|
|
15078
|
-
const { content } =
|
|
15253
|
+
const { content } = matter9(raw);
|
|
15079
15254
|
return content.trim();
|
|
15080
15255
|
} catch {
|
|
15081
15256
|
return null;
|
|
@@ -15244,7 +15419,7 @@ function runExplain(opts) {
|
|
|
15244
15419
|
}
|
|
15245
15420
|
|
|
15246
15421
|
// src/core/context-pack.ts
|
|
15247
|
-
import
|
|
15422
|
+
import matter10 from "gray-matter";
|
|
15248
15423
|
var CONTEXT_PACK_VERSION = "1";
|
|
15249
15424
|
var ARCH_DIR6 = "knowledge";
|
|
15250
15425
|
function readScanJson(dir) {
|
|
@@ -15257,7 +15432,7 @@ function readScanJson(dir) {
|
|
|
15257
15432
|
}
|
|
15258
15433
|
}
|
|
15259
15434
|
function firstParagraph2(markdown) {
|
|
15260
|
-
const body =
|
|
15435
|
+
const body = matter10(markdown).content.trim();
|
|
15261
15436
|
const para = body.split("\n\n").map((p) => p.trim()).find((p) => p && !p.startsWith("#"));
|
|
15262
15437
|
return para ?? "";
|
|
15263
15438
|
}
|
|
@@ -16906,12 +17081,12 @@ function runStatus() {
|
|
|
16906
17081
|
// src/commands/learn.ts
|
|
16907
17082
|
import fs3 from "fs";
|
|
16908
17083
|
import path7 from "path";
|
|
16909
|
-
import
|
|
17084
|
+
import matter11 from "gray-matter";
|
|
16910
17085
|
var ARCH_DIR9 = "knowledge";
|
|
16911
17086
|
var WORK_ITEMS_DIR2 = "knowledge/delivery/work-items";
|
|
16912
17087
|
function completedPathFor(filePath) {
|
|
16913
|
-
const
|
|
16914
|
-
const m =
|
|
17088
|
+
const posix2 = filePath.replace(/\\/g, "/");
|
|
17089
|
+
const m = posix2.match(/\/work-items\/(draft|ready|in-progress|blocked)\//);
|
|
16915
17090
|
if (!m) return filePath;
|
|
16916
17091
|
const completedDir = path7.dirname(filePath).replace(
|
|
16917
17092
|
new RegExp(`[/\\\\]${m[1]}$`),
|
|
@@ -16921,7 +17096,7 @@ function completedPathFor(filePath) {
|
|
|
16921
17096
|
}
|
|
16922
17097
|
function updateWorkItemFile(filePath, learning) {
|
|
16923
17098
|
const raw = readFile(filePath);
|
|
16924
|
-
const { data, content } =
|
|
17099
|
+
const { data, content } = matter11(raw);
|
|
16925
17100
|
data.status = "completed";
|
|
16926
17101
|
data.completed_at = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
16927
17102
|
let updatedContent = content;
|
|
@@ -16946,7 +17121,7 @@ ${learning.trim()}
|
|
|
16946
17121
|
${learning.trim()}
|
|
16947
17122
|
`;
|
|
16948
17123
|
}
|
|
16949
|
-
const newRaw =
|
|
17124
|
+
const newRaw = matter11.stringify(updatedContent, data);
|
|
16950
17125
|
const newPath = completedPathFor(filePath);
|
|
16951
17126
|
if (newPath !== filePath) {
|
|
16952
17127
|
ensureDir(path7.dirname(newPath));
|
|
@@ -16998,7 +17173,7 @@ async function runLearn(artifactId, opts = {}) {
|
|
|
16998
17173
|
process.exit(1);
|
|
16999
17174
|
}
|
|
17000
17175
|
const wiRaw = readFile(filePath);
|
|
17001
|
-
const wiData =
|
|
17176
|
+
const wiData = matter11(wiRaw).data;
|
|
17002
17177
|
if (!opts.force) {
|
|
17003
17178
|
const completionBlockers = [];
|
|
17004
17179
|
const releaseGates = Array.isArray(wiData.release_gates) ? wiData.release_gates : [];
|
|
@@ -17254,7 +17429,7 @@ function runAdd(moduleName, opts = {}, dir = cwd()) {
|
|
|
17254
17429
|
}
|
|
17255
17430
|
|
|
17256
17431
|
// src/core/ownership-suggest.ts
|
|
17257
|
-
import
|
|
17432
|
+
import matter12 from "gray-matter";
|
|
17258
17433
|
var SCAN_PATH = ".kaddo/scan.json";
|
|
17259
17434
|
function normalizeGlob(input) {
|
|
17260
17435
|
let g = input.trim().replace(/\\/g, "/");
|
|
@@ -17376,11 +17551,11 @@ function suggestGlobs(artifact, signals) {
|
|
|
17376
17551
|
return [...new Set(out)];
|
|
17377
17552
|
}
|
|
17378
17553
|
function applyOwnership(raw, globs, mode = "replace") {
|
|
17379
|
-
const parsed =
|
|
17554
|
+
const parsed = matter12(raw);
|
|
17380
17555
|
const existing = toStringArray3(parsed.data.code);
|
|
17381
17556
|
const next = mode === "append" ? [.../* @__PURE__ */ new Set([...existing, ...globs])] : [...new Set(globs)];
|
|
17382
17557
|
const data = { ...parsed.data, code: next };
|
|
17383
|
-
return
|
|
17558
|
+
return matter12.stringify(parsed.content, data);
|
|
17384
17559
|
}
|
|
17385
17560
|
|
|
17386
17561
|
// src/commands/owners.ts
|
|
@@ -18283,12 +18458,12 @@ function runCapsuleAdd(srcPath) {
|
|
|
18283
18458
|
process.exit(1);
|
|
18284
18459
|
}
|
|
18285
18460
|
const abs = join(dir, srcPath);
|
|
18286
|
-
const
|
|
18287
|
-
if (!exists(
|
|
18461
|
+
const source2 = exists(abs) ? abs : srcPath;
|
|
18462
|
+
if (!exists(source2)) {
|
|
18288
18463
|
console.error(`Capsule not found: ${srcPath}`);
|
|
18289
18464
|
process.exit(1);
|
|
18290
18465
|
}
|
|
18291
|
-
const result = addExternalCapsule(dir,
|
|
18466
|
+
const result = addExternalCapsule(dir, source2);
|
|
18292
18467
|
if (!result.isCapsuleType) {
|
|
18293
18468
|
log.warn("This file is not marked as a knowledge-capsule (front matter `type: knowledge-capsule`).");
|
|
18294
18469
|
}
|
|
@@ -18630,7 +18805,7 @@ async function runTopologyApply(file, opts = {}) {
|
|
|
18630
18805
|
// src/core/resource-write.ts
|
|
18631
18806
|
import fs5 from "fs";
|
|
18632
18807
|
import path9 from "path";
|
|
18633
|
-
import
|
|
18808
|
+
import matter13 from "gray-matter";
|
|
18634
18809
|
var RESOURCES_DIR = "knowledge/tech/resources";
|
|
18635
18810
|
var ResourceWriteError = class extends Error {
|
|
18636
18811
|
constructor(code, message) {
|
|
@@ -18710,7 +18885,7 @@ function buildFrontmatter(id, input, base = {}) {
|
|
|
18710
18885
|
return data;
|
|
18711
18886
|
}
|
|
18712
18887
|
function serialize(data, body) {
|
|
18713
|
-
return
|
|
18888
|
+
return matter13.stringify(`
|
|
18714
18889
|
${body.trim()}
|
|
18715
18890
|
`, data);
|
|
18716
18891
|
}
|
|
@@ -18750,7 +18925,7 @@ function updateResource(dir, id, input) {
|
|
|
18750
18925
|
throw new ResourceWriteError("VALIDATION_FAILED", findings.filter((f) => f.level === "error").map((f) => f.message).join("; "));
|
|
18751
18926
|
}
|
|
18752
18927
|
const raw = readFile(match.filePath);
|
|
18753
|
-
const parsed =
|
|
18928
|
+
const parsed = matter13(raw);
|
|
18754
18929
|
const base = parsed.data ?? {};
|
|
18755
18930
|
const data = buildFrontmatter(match.id || id, input, base);
|
|
18756
18931
|
let body = parsed.content.trim();
|
|
@@ -18985,14 +19160,14 @@ async function runResourcesDelete(id, opts = {}, dir = cwd()) {
|
|
|
18985
19160
|
}
|
|
18986
19161
|
|
|
18987
19162
|
// src/services/integrations.ts
|
|
18988
|
-
import
|
|
19163
|
+
import matter15 from "gray-matter";
|
|
18989
19164
|
import { parse as parseYaml18, stringify as stringifyYaml10 } from "yaml";
|
|
18990
19165
|
|
|
18991
19166
|
// src/core/work-item-write.ts
|
|
18992
19167
|
import fs6 from "fs";
|
|
18993
19168
|
import path10 from "path";
|
|
18994
19169
|
import crypto2 from "crypto";
|
|
18995
|
-
import
|
|
19170
|
+
import matter14 from "gray-matter";
|
|
18996
19171
|
var WORK_ITEMS_DIR3 = "knowledge/delivery/work-items";
|
|
18997
19172
|
var WorkItemWriteError = class extends Error {
|
|
18998
19173
|
constructor(code, message) {
|
|
@@ -19096,7 +19271,7 @@ function ensureH1(body, title) {
|
|
|
19096
19271
|
${trimmed}`;
|
|
19097
19272
|
}
|
|
19098
19273
|
function serialize2(data, body) {
|
|
19099
|
-
return
|
|
19274
|
+
return matter14.stringify(`
|
|
19100
19275
|
${body.trim()}
|
|
19101
19276
|
`, data);
|
|
19102
19277
|
}
|
|
@@ -19131,7 +19306,7 @@ function createWorkItem(dir, opts) {
|
|
|
19131
19306
|
const title = intent.split(/\r?\n/)[0].trim().slice(0, 120);
|
|
19132
19307
|
const today3 = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
19133
19308
|
const summary = opts.summary?.trim() || intent;
|
|
19134
|
-
const
|
|
19309
|
+
const source2 = opts.source ? { ...opts.source, inferred: false } : { type: "manual", inferred: false };
|
|
19135
19310
|
const data = {
|
|
19136
19311
|
type,
|
|
19137
19312
|
id,
|
|
@@ -19139,7 +19314,7 @@ function createWorkItem(dir, opts) {
|
|
|
19139
19314
|
status: "draft",
|
|
19140
19315
|
work_type: type,
|
|
19141
19316
|
created_at: today3,
|
|
19142
|
-
source,
|
|
19317
|
+
source: source2,
|
|
19143
19318
|
generated_by: "kaddo-admin",
|
|
19144
19319
|
affected_modules: [],
|
|
19145
19320
|
summary
|
|
@@ -20173,12 +20348,12 @@ function findLinkedWorkItem(dir, integrationId, externalId) {
|
|
|
20173
20348
|
for (const art of discoverWorkItems(dir)) {
|
|
20174
20349
|
let data;
|
|
20175
20350
|
try {
|
|
20176
|
-
data =
|
|
20351
|
+
data = matter15(readFile(art.filePath)).data;
|
|
20177
20352
|
} catch {
|
|
20178
20353
|
continue;
|
|
20179
20354
|
}
|
|
20180
|
-
const
|
|
20181
|
-
if (
|
|
20355
|
+
const source2 = parseWorkItemSource(data);
|
|
20356
|
+
if (source2.integration === integrationId && source2.id === externalId) {
|
|
20182
20357
|
return { workItemId: String(data.id ?? ""), title: String(data.title ?? "") };
|
|
20183
20358
|
}
|
|
20184
20359
|
}
|
|
@@ -20386,7 +20561,7 @@ async function runIntegrationsImport(dir, id, externalId, opts) {
|
|
|
20386
20561
|
}
|
|
20387
20562
|
|
|
20388
20563
|
// src/core/impact-report.ts
|
|
20389
|
-
import
|
|
20564
|
+
import matter16 from "gray-matter";
|
|
20390
20565
|
function isBroadGlob(glob) {
|
|
20391
20566
|
if (!glob.endsWith("/**")) return false;
|
|
20392
20567
|
const prefix = glob.slice(0, -3);
|
|
@@ -20455,7 +20630,7 @@ function buildImpactReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
20455
20630
|
}
|
|
20456
20631
|
}
|
|
20457
20632
|
try {
|
|
20458
|
-
const body =
|
|
20633
|
+
const body = matter16(readFile(wi.filePath)).content;
|
|
20459
20634
|
if (hasSection(body, /acceptance|criterios de aceptaci/i)) withAcceptance++;
|
|
20460
20635
|
else gaps.missing_acceptance_criteria.push(gapItem(wi, "Add an `## Acceptance Criteria` section."));
|
|
20461
20636
|
if (hasSection(body, /definition of done|^#{1,6}\s*dod\b|definici[oó]n de (terminado|hecho)/i)) withDoD++;
|
|
@@ -20904,7 +21079,7 @@ function parseRatioNumerator(s) {
|
|
|
20904
21079
|
}
|
|
20905
21080
|
var SAVINGS_DISCLAIMER = "These are evidence-based estimates, not exact ROI. Adjust assumptions with real team data.";
|
|
20906
21081
|
function buildSavingsReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
20907
|
-
const { assumptions: a, source } = loadAssumptions(dir);
|
|
21082
|
+
const { assumptions: a, source: source2 } = loadAssumptions(dir);
|
|
20908
21083
|
const impact = buildImpactReport(dir, { scope: opts.scope, scopeSource: opts.scopeSource }, now);
|
|
20909
21084
|
const completed = impact.traceability.completed_work_items;
|
|
20910
21085
|
const wiWithOwnership = parseRatioNumerator(impact.traceability.work_items_connected_to_code);
|
|
@@ -20944,7 +21119,7 @@ function buildSavingsReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
20944
21119
|
if (impact.score === null || impact.score < 60 || graphQuality === "empty") {
|
|
20945
21120
|
level = "Low";
|
|
20946
21121
|
reasons.push("Impact score is low or the knowledge graph is empty.");
|
|
20947
|
-
} else if (impact.score >= 85 && graphQuality === "good" &&
|
|
21122
|
+
} else if (impact.score >= 85 && graphQuality === "good" && source2 === "file" && guard.available && guard.resolved > 0) {
|
|
20948
21123
|
level = "High";
|
|
20949
21124
|
reasons.push("Strong evidence, custom assumptions and recorded drift resolution.");
|
|
20950
21125
|
} else {
|
|
@@ -20958,9 +21133,9 @@ function buildSavingsReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
20958
21133
|
} else {
|
|
20959
21134
|
reasons.push("Guard history available, but no resolved drift warnings have been recorded yet.");
|
|
20960
21135
|
}
|
|
20961
|
-
reasons.push(
|
|
21136
|
+
reasons.push(source2 === "file" ? "Assumptions come from `.kaddo/savings.yml`." : "Savings assumptions are defaults and should be calibrated.");
|
|
20962
21137
|
const actions = [];
|
|
20963
|
-
if (
|
|
21138
|
+
if (source2 === "default") actions.push("Run `kaddo savings init` to customize assumptions.");
|
|
20964
21139
|
actions.push("Calibrate hourly cost and team assumptions with real team data.");
|
|
20965
21140
|
actions.push("Run `kaddo impact` to verify the underlying evidence quality.");
|
|
20966
21141
|
actions.push("Use this report as directional evidence, not accounting data.");
|
|
@@ -20978,7 +21153,7 @@ function buildSavingsReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
20978
21153
|
scope: impact.scope,
|
|
20979
21154
|
currency: a.currency,
|
|
20980
21155
|
disclaimer: SAVINGS_DISCLAIMER,
|
|
20981
|
-
assumptions_source:
|
|
21156
|
+
assumptions_source: source2,
|
|
20982
21157
|
assumptions: {
|
|
20983
21158
|
hourly_cost: a.hourly_cost,
|
|
20984
21159
|
context_preparation_minutes_saved_per_work_item: a.context_preparation_minutes_saved_per_work_item,
|
|
@@ -21633,7 +21808,7 @@ function runAssetsUpdate(kind, opts = {}) {
|
|
|
21633
21808
|
// src/commands/ready.ts
|
|
21634
21809
|
import fs8 from "fs";
|
|
21635
21810
|
import path11 from "path";
|
|
21636
|
-
import
|
|
21811
|
+
import matter17 from "gray-matter";
|
|
21637
21812
|
function validateReadiness(content, frontmatter) {
|
|
21638
21813
|
const warnings = [];
|
|
21639
21814
|
const body = content.replace(/^---[\s\S]*?---/, "").trim();
|
|
@@ -21687,14 +21862,14 @@ function isResolvedSection(text2) {
|
|
|
21687
21862
|
}
|
|
21688
21863
|
function transitionToReady(filePath) {
|
|
21689
21864
|
const raw = readFile(filePath);
|
|
21690
|
-
const { data, content } =
|
|
21865
|
+
const { data, content } = matter17(raw);
|
|
21691
21866
|
const today3 = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
21692
21867
|
data.status = "ready";
|
|
21693
21868
|
data.ready_at = today3;
|
|
21694
|
-
const newContent =
|
|
21695
|
-
const
|
|
21869
|
+
const newContent = matter17.stringify(content, data);
|
|
21870
|
+
const posix2 = filePath.replace(/\\/g, "/");
|
|
21696
21871
|
let newPath = filePath;
|
|
21697
|
-
if (
|
|
21872
|
+
if (posix2.includes("/work-items/draft/")) {
|
|
21698
21873
|
const readyDir = path11.dirname(filePath).replace(/[/\\]draft$/, path11.sep + "ready");
|
|
21699
21874
|
ensureDir(readyDir);
|
|
21700
21875
|
const fileName = path11.basename(filePath);
|
|
@@ -21731,8 +21906,8 @@ async function runReady(id, opts = {}) {
|
|
|
21731
21906
|
process.exit(1);
|
|
21732
21907
|
}
|
|
21733
21908
|
const raw = readFile(wi.filePath);
|
|
21734
|
-
const { data } =
|
|
21735
|
-
const
|
|
21909
|
+
const { data } = matter17(raw);
|
|
21910
|
+
const source2 = parseWorkItemSource(data);
|
|
21736
21911
|
const warnings = validateReadiness(raw, data);
|
|
21737
21912
|
log.info(`Work Item found:`);
|
|
21738
21913
|
log.info(` ${wi.id} \u2014 ${wi.title}`);
|
|
@@ -21741,7 +21916,7 @@ async function runReady(id, opts = {}) {
|
|
|
21741
21916
|
log.info(` Type: ${wi.type}`);
|
|
21742
21917
|
log.info(` Knowledge level: ${wi.knowledgeLevel || "unset"}`);
|
|
21743
21918
|
log.info(` Domains: ${wi.domains.length > 0 ? wi.domains.join(", ") : "none"}`);
|
|
21744
|
-
log.info(` Source: ${renderSourceCompact(
|
|
21919
|
+
log.info(` Source: ${renderSourceCompact(source2)}`);
|
|
21745
21920
|
if (wi.codeGlobs.length > 0) {
|
|
21746
21921
|
log.info(` Code ownership:`);
|
|
21747
21922
|
for (const g of wi.codeGlobs) log.info(` - ${g}`);
|
|
@@ -21907,10 +22082,10 @@ async function runAdmin(opts = {}) {
|
|
|
21907
22082
|
// src/core/work-item-import.ts
|
|
21908
22083
|
import crypto3 from "crypto";
|
|
21909
22084
|
import fs9 from "fs";
|
|
21910
|
-
import
|
|
22085
|
+
import matter19 from "gray-matter";
|
|
21911
22086
|
|
|
21912
22087
|
// src/core/work-items.ts
|
|
21913
|
-
import
|
|
22088
|
+
import matter18 from "gray-matter";
|
|
21914
22089
|
function computeRefinementStatus(wi) {
|
|
21915
22090
|
const aspects = {
|
|
21916
22091
|
outcome: Boolean(wi.currentBehavior?.trim() || wi.targetBehavior?.trim()),
|
|
@@ -22044,7 +22219,7 @@ function parseOriginalSnapshot(fm2) {
|
|
|
22044
22219
|
function readBody(filePath) {
|
|
22045
22220
|
try {
|
|
22046
22221
|
const raw = readFile(filePath);
|
|
22047
|
-
return
|
|
22222
|
+
return matter18(raw).content;
|
|
22048
22223
|
} catch {
|
|
22049
22224
|
return "";
|
|
22050
22225
|
}
|
|
@@ -22503,7 +22678,7 @@ function detectFormat(raw) {
|
|
|
22503
22678
|
if (!trimmed) throw new ImportError("EMPTY_INPUT", "Import content is empty.");
|
|
22504
22679
|
if (trimmed.startsWith("---")) {
|
|
22505
22680
|
try {
|
|
22506
|
-
const { data } =
|
|
22681
|
+
const { data } = matter19(trimmed);
|
|
22507
22682
|
if (data && typeof data === "object" && Object.keys(data).length > 0) {
|
|
22508
22683
|
const d = data;
|
|
22509
22684
|
if (d.type === "work-item" || d.id && typeof d.id === "string" && /^WI-\d+/.test(d.id)) {
|
|
@@ -22525,7 +22700,7 @@ function parseContent(raw) {
|
|
|
22525
22700
|
let bodyText = trimmed;
|
|
22526
22701
|
if (format === "kaddo-frontmatter" || format === "markdown-frontmatter") {
|
|
22527
22702
|
try {
|
|
22528
|
-
const parsed =
|
|
22703
|
+
const parsed = matter19(trimmed);
|
|
22529
22704
|
frontmatterFields = parsed.data ?? {};
|
|
22530
22705
|
bodyText = parsed.content.trim();
|
|
22531
22706
|
} catch {
|
|
@@ -22597,12 +22772,12 @@ function normalizeImportFields(parsed, opts) {
|
|
|
22597
22772
|
const intent = parsed.title;
|
|
22598
22773
|
const body = hasRealBody ? parsed.body : void 0;
|
|
22599
22774
|
const summary = hasRealBody ? deriveShortSummary(parsed) : parsed.title;
|
|
22600
|
-
const
|
|
22775
|
+
const source2 = {
|
|
22601
22776
|
type: opts.importSource === "chat" ? "chat" : "external",
|
|
22602
22777
|
imported_at: (/* @__PURE__ */ new Date()).toISOString().split("T")[0]
|
|
22603
22778
|
};
|
|
22604
|
-
|
|
22605
|
-
|
|
22779
|
+
source2.source_format = opts.sourceFormat;
|
|
22780
|
+
source2.source_hash = opts.sourceHash;
|
|
22606
22781
|
const snapshot = { title: parsed.title };
|
|
22607
22782
|
if (summary !== parsed.title) snapshot.description = summary;
|
|
22608
22783
|
if (typeof parsed.candidateFields.type === "string") snapshot.type = parsed.candidateFields.type;
|
|
@@ -22611,7 +22786,7 @@ function normalizeImportFields(parsed, opts) {
|
|
|
22611
22786
|
const labels = parsed.candidateFields.labels.filter((l) => typeof l === "string");
|
|
22612
22787
|
if (labels.length > 0) snapshot.labels = labels;
|
|
22613
22788
|
}
|
|
22614
|
-
return { type, intent, summary, body, source, snapshot, discardedFields };
|
|
22789
|
+
return { type, intent, summary, body, source: source2, snapshot, discardedFields };
|
|
22615
22790
|
}
|
|
22616
22791
|
function computeContentHash(raw) {
|
|
22617
22792
|
return crypto3.createHash("sha256").update(raw.trim(), "utf-8").digest("hex");
|
|
@@ -22622,10 +22797,10 @@ function findDuplicateByHash(dir, hash) {
|
|
|
22622
22797
|
const raw = readFile(item.filePath);
|
|
22623
22798
|
if (!raw) continue;
|
|
22624
22799
|
try {
|
|
22625
|
-
const { data } =
|
|
22626
|
-
const
|
|
22627
|
-
if (
|
|
22628
|
-
const s =
|
|
22800
|
+
const { data } = matter19(raw);
|
|
22801
|
+
const source2 = data?.source;
|
|
22802
|
+
if (source2 && typeof source2 === "object" && !Array.isArray(source2)) {
|
|
22803
|
+
const s = source2;
|
|
22629
22804
|
if (s.source_hash === hash) {
|
|
22630
22805
|
return { workItemId: data.id ?? item.id ?? item.title, path: item.relPath };
|
|
22631
22806
|
}
|
|
@@ -22837,8 +23012,33 @@ async function runWorkItemImport(dir, fileOrText, opts) {
|
|
|
22837
23012
|
}
|
|
22838
23013
|
}
|
|
22839
23014
|
|
|
23015
|
+
// src/commands/poc.ts
|
|
23016
|
+
function runPocReport(opts = {}) {
|
|
23017
|
+
const report = buildPocReportContext(cwd());
|
|
23018
|
+
if (opts.json) {
|
|
23019
|
+
console.log(JSON.stringify(report, null, 2));
|
|
23020
|
+
return;
|
|
23021
|
+
}
|
|
23022
|
+
console.log("");
|
|
23023
|
+
console.log(`POC conclusion: ${report.conclusion}`);
|
|
23024
|
+
console.log(`Final report: ${report.status}`);
|
|
23025
|
+
if (!report.eligible) {
|
|
23026
|
+
console.log(`
|
|
23027
|
+
${report.handoff}
|
|
23028
|
+
`);
|
|
23029
|
+
process.exitCode = 1;
|
|
23030
|
+
return;
|
|
23031
|
+
}
|
|
23032
|
+
if (report.latestReport) console.log(`Latest report: v${report.latestReport.version} (${report.latestReport.path})`);
|
|
23033
|
+
console.log(`Next report: ${report.nextPath}`);
|
|
23034
|
+
console.log(`Sources: ${report.sources.length}`);
|
|
23035
|
+
console.log(`
|
|
23036
|
+
${report.handoff}
|
|
23037
|
+
`);
|
|
23038
|
+
}
|
|
23039
|
+
|
|
22840
23040
|
// src/commands/verify.ts
|
|
22841
|
-
import
|
|
23041
|
+
import matter20 from "gray-matter";
|
|
22842
23042
|
|
|
22843
23043
|
// src/core/implementation-evidence.ts
|
|
22844
23044
|
var WorkItemNotInProgressError = class extends Error {
|
|
@@ -23115,7 +23315,7 @@ async function runVerify(workItemId, opts = {}) {
|
|
|
23115
23315
|
}
|
|
23116
23316
|
const changedPaths = await getModifiedFiles("head");
|
|
23117
23317
|
const raw = readFile(match.filePath);
|
|
23118
|
-
const parsed =
|
|
23318
|
+
const parsed = matter20(raw);
|
|
23119
23319
|
const fm2 = parsed.data;
|
|
23120
23320
|
const acs = extractACsFromBody(parsed.content);
|
|
23121
23321
|
const existingEvidence = fm2.implementation_evidence;
|
|
@@ -23232,13 +23432,13 @@ async function runVerify(workItemId, opts = {}) {
|
|
|
23232
23432
|
if (shouldPersist) {
|
|
23233
23433
|
const filePath = match.filePath;
|
|
23234
23434
|
const wiRaw = readFile(filePath);
|
|
23235
|
-
const wiParsed =
|
|
23435
|
+
const wiParsed = matter20(wiRaw);
|
|
23236
23436
|
const data = wiParsed.data;
|
|
23237
23437
|
data.implementation_evidence = verification.implementationEvidence;
|
|
23238
23438
|
data.implementation_status = verification.implementationStatus;
|
|
23239
23439
|
data.validation_status = verification.validationStatus;
|
|
23240
23440
|
data.verified_at = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
23241
|
-
const newRaw =
|
|
23441
|
+
const newRaw = matter20.stringify(wiParsed.content, data);
|
|
23242
23442
|
writeFile(filePath, newRaw);
|
|
23243
23443
|
log.success("Work Item frontmatter updated with verification evidence.");
|
|
23244
23444
|
}
|
|
@@ -23303,14 +23503,14 @@ ${bodySha256}`;
|
|
|
23303
23503
|
|
|
23304
23504
|
// src/core/telemetry-events.ts
|
|
23305
23505
|
import crypto5 from "crypto";
|
|
23306
|
-
function createEvent(name, installationId,
|
|
23506
|
+
function createEvent(name, installationId, source2, properties) {
|
|
23307
23507
|
return {
|
|
23308
23508
|
schemaVersion: "1.0",
|
|
23309
23509
|
id: crypto5.randomUUID(),
|
|
23310
23510
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23311
23511
|
event: name,
|
|
23312
23512
|
installationId,
|
|
23313
|
-
source,
|
|
23513
|
+
source: source2,
|
|
23314
23514
|
properties
|
|
23315
23515
|
};
|
|
23316
23516
|
}
|
|
@@ -23421,7 +23621,7 @@ async function deliverBatch(identity, events) {
|
|
|
23421
23621
|
return false;
|
|
23422
23622
|
}
|
|
23423
23623
|
}
|
|
23424
|
-
async function emit(dir, name,
|
|
23624
|
+
async function emit(dir, name, source2, properties) {
|
|
23425
23625
|
try {
|
|
23426
23626
|
const config = loadConfig(dir);
|
|
23427
23627
|
if (!isEnabled(config)) return;
|
|
@@ -23430,12 +23630,12 @@ async function emit(dir, name, source, properties) {
|
|
|
23430
23630
|
const ok2 = await registerInstallation(identity);
|
|
23431
23631
|
if (ok2) markRegistered(dir, identity);
|
|
23432
23632
|
else {
|
|
23433
|
-
const event2 = createEvent(name, identity.installationId,
|
|
23633
|
+
const event2 = createEvent(name, identity.installationId, source2, properties);
|
|
23434
23634
|
enqueue(dir, [event2]);
|
|
23435
23635
|
return;
|
|
23436
23636
|
}
|
|
23437
23637
|
}
|
|
23438
|
-
const event = createEvent(name, identity.installationId,
|
|
23638
|
+
const event = createEvent(name, identity.installationId, source2, properties);
|
|
23439
23639
|
const buffered = readBuffer(dir);
|
|
23440
23640
|
const batch = [...buffered, event].slice(0, MAX_BATCH_SIZE);
|
|
23441
23641
|
const ok = await deliverBatch(identity, batch);
|
|
@@ -23516,7 +23716,7 @@ function runTelemetryDisable() {
|
|
|
23516
23716
|
}
|
|
23517
23717
|
|
|
23518
23718
|
// src/core/initiative-write.ts
|
|
23519
|
-
import
|
|
23719
|
+
import matter21 from "gray-matter";
|
|
23520
23720
|
var WORK_ITEMS_DIR4 = "knowledge/delivery/work-items";
|
|
23521
23721
|
var DRAFT_DIR2 = `${WORK_ITEMS_DIR4}/draft`;
|
|
23522
23722
|
var InitiativeWriteError = class extends Error {
|
|
@@ -23628,7 +23828,7 @@ function buildInitiativeContent(id, input) {
|
|
|
23628
23828
|
if (input.priority) data.priority = input.priority;
|
|
23629
23829
|
if (input.source) data.source = input.source;
|
|
23630
23830
|
if (input.sourceId) data.source_id = input.sourceId;
|
|
23631
|
-
return
|
|
23831
|
+
return matter21.stringify("\n" + (input.body ?? defaultBody(input.title.trim())), data);
|
|
23632
23832
|
}
|
|
23633
23833
|
function createInitiative(dir, input) {
|
|
23634
23834
|
if (!input.title?.trim()) throw new InitiativeWriteError("Initiative title is required.");
|
|
@@ -23652,10 +23852,10 @@ function transitionInitiative(dir, id, to) {
|
|
|
23652
23852
|
throw new InitiativeWriteError(`Invalid transition ${ini.status} \u2192 ${to}.`);
|
|
23653
23853
|
}
|
|
23654
23854
|
const raw = readFile(ini.filePath);
|
|
23655
|
-
const { data, content } =
|
|
23855
|
+
const { data, content } = matter21(raw, {});
|
|
23656
23856
|
data.status = to;
|
|
23657
23857
|
if (to === "completed") data.completed_at = today2();
|
|
23658
|
-
const newContent =
|
|
23858
|
+
const newContent = matter21.stringify(content, data);
|
|
23659
23859
|
writeFile(ini.filePath, newContent);
|
|
23660
23860
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
23661
23861
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after transition.");
|
|
@@ -23724,7 +23924,7 @@ function buildWorkItemContent(wiId, iniId, candidate) {
|
|
|
23724
23924
|
"_What did we learn? Update after completion._",
|
|
23725
23925
|
""
|
|
23726
23926
|
].join("\n");
|
|
23727
|
-
return
|
|
23927
|
+
return matter21.stringify("\n" + body, data);
|
|
23728
23928
|
}
|
|
23729
23929
|
function materializeCandidate(dir, id, candidateId) {
|
|
23730
23930
|
const ini = getInitiative(dir, id);
|
|
@@ -23741,13 +23941,13 @@ function materializeCandidate(dir, id, candidateId) {
|
|
|
23741
23941
|
ensureDir(join(dir, DRAFT_DIR2));
|
|
23742
23942
|
writeFile(join(dir, DRAFT_DIR2, fileName), buildWorkItemContent(wiId, ini.id, candidate));
|
|
23743
23943
|
const raw = readFile(ini.filePath);
|
|
23744
|
-
const { data, content } =
|
|
23944
|
+
const { data, content } = matter21(raw, {});
|
|
23745
23945
|
const cands = Array.isArray(data.candidates) ? data.candidates : [];
|
|
23746
23946
|
for (const c of cands) {
|
|
23747
23947
|
if (c && typeof c === "object" && String(c.id) === candidateId) c.materialized_as = wiId;
|
|
23748
23948
|
}
|
|
23749
23949
|
data.candidates = cands;
|
|
23750
|
-
const newContent =
|
|
23950
|
+
const newContent = matter21.stringify(content, data);
|
|
23751
23951
|
writeFile(ini.filePath, newContent);
|
|
23752
23952
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
23753
23953
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after materialization.");
|
|
@@ -24101,6 +24301,10 @@ program.command("create [type]").description("Create a work item (feature, bugfi
|
|
|
24101
24301
|
program.command("ready <id>").description("Mark a draft Work Item as ready for implementation after human review").option("--yes", "Skip confirmation prompt").action(async (id, opts) => {
|
|
24102
24302
|
await runReady(id, opts);
|
|
24103
24303
|
});
|
|
24304
|
+
var pocCmd = program.command("poc").description("Proof of Concept lifecycle helpers");
|
|
24305
|
+
pocCmd.command("report").description("Prepare a deterministic final POC report handoff (no LLM call, no write)").option("--json", "Output the report context as JSON").action((opts) => {
|
|
24306
|
+
runPocReport(opts);
|
|
24307
|
+
});
|
|
24104
24308
|
var capsuleCmd = program.command("capsule").description("Export this project as a Knowledge Capsule, or import an external one as context");
|
|
24105
24309
|
capsuleCmd.command("export").description("Write a Knowledge Capsule about this project to .kaddo/exports/").option("--scope <scope>", 'Export scope: "system" includes all mapped modules').option("--module <id>", "Export a capsule for a specific mapped module").action((opts) => {
|
|
24106
24310
|
runCapsuleExport(opts);
|