@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/core.js
CHANGED
|
@@ -350,12 +350,12 @@ function classifyLayer(posixPath) {
|
|
|
350
350
|
return "unknown";
|
|
351
351
|
}
|
|
352
352
|
function enrich(dir, a) {
|
|
353
|
-
const
|
|
353
|
+
const posix2 = toPosix(a.filePath);
|
|
354
354
|
const isWi = isWorkItemArtifact(a);
|
|
355
355
|
return {
|
|
356
356
|
...a,
|
|
357
357
|
relPath: relativeTo(dir, a.filePath),
|
|
358
|
-
layer: classifyLayer(
|
|
358
|
+
layer: classifyLayer(posix2),
|
|
359
359
|
isWorkItem: isWi,
|
|
360
360
|
lifecycle: isWi ? lifecycleStateOf({ status: a.status, filePath: a.filePath }) : void 0
|
|
361
361
|
};
|
|
@@ -3069,8 +3069,8 @@ function buildOpenQuestionsReport(dir, now = /* @__PURE__ */ new Date()) {
|
|
|
3069
3069
|
const project = loadConfig(dir)?.project.name ?? "unknown";
|
|
3070
3070
|
const questions = [];
|
|
3071
3071
|
let seq = 0;
|
|
3072
|
-
for (const
|
|
3073
|
-
const p = join(dir,
|
|
3072
|
+
for (const source2 of SOURCES) {
|
|
3073
|
+
const p = join(dir, source2);
|
|
3074
3074
|
if (!exists(p)) continue;
|
|
3075
3075
|
let md;
|
|
3076
3076
|
try {
|
|
@@ -3083,8 +3083,8 @@ function buildOpenQuestionsReport(dir, now = /* @__PURE__ */ new Date()) {
|
|
|
3083
3083
|
const { classification, reason } = classifyQuestion(eq.text);
|
|
3084
3084
|
questions.push({
|
|
3085
3085
|
id: `OQ-${String(seq).padStart(3, "0")}`,
|
|
3086
|
-
source,
|
|
3087
|
-
sourcePath:
|
|
3086
|
+
source: source2,
|
|
3087
|
+
sourcePath: source2,
|
|
3088
3088
|
line: eq.line,
|
|
3089
3089
|
raw: eq.raw,
|
|
3090
3090
|
section: "Open Questions",
|
|
@@ -3447,6 +3447,146 @@ function readPocSummary(dir) {
|
|
|
3447
3447
|
};
|
|
3448
3448
|
}
|
|
3449
3449
|
|
|
3450
|
+
// src/core/poc-report.ts
|
|
3451
|
+
import { createHash } from "crypto";
|
|
3452
|
+
import matter6 from "gray-matter";
|
|
3453
|
+
var POC_REPORT_PREFIX = "poc-report-v";
|
|
3454
|
+
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;
|
|
3455
|
+
var reportName = /^poc-report-v(\d{3,})\.md$/;
|
|
3456
|
+
function sha(value) {
|
|
3457
|
+
return createHash("sha256").update(value).digest("hex");
|
|
3458
|
+
}
|
|
3459
|
+
function posix(value) {
|
|
3460
|
+
return value.replace(/\\/g, "/");
|
|
3461
|
+
}
|
|
3462
|
+
function redactSecrets(value) {
|
|
3463
|
+
return value.split(/\r?\n/).map((line) => {
|
|
3464
|
+
if (!SECRET_LINE.test(line)) return line;
|
|
3465
|
+
return line.replace(/([:=]\s*)\S+.*/, "$1[redacted]");
|
|
3466
|
+
}).join("\n");
|
|
3467
|
+
}
|
|
3468
|
+
function source(dir, path5, kind) {
|
|
3469
|
+
const absolute = join(dir, path5);
|
|
3470
|
+
if (!exists(absolute)) return null;
|
|
3471
|
+
const raw = readFile(absolute);
|
|
3472
|
+
return { path: posix(path5), kind, digest: sha(raw), content: redactSecrets(raw) };
|
|
3473
|
+
}
|
|
3474
|
+
function reportFiles(dir) {
|
|
3475
|
+
const delivery = join(dir, "knowledge", "delivery");
|
|
3476
|
+
return readDir(delivery).flatMap((name) => {
|
|
3477
|
+
const match = name.match(reportName);
|
|
3478
|
+
if (!match) return [];
|
|
3479
|
+
try {
|
|
3480
|
+
const parsed = matter6(readFile(join(delivery, name)));
|
|
3481
|
+
const fingerprint = typeof parsed.data.source_fingerprint === "string" ? parsed.data.source_fingerprint : "";
|
|
3482
|
+
const manifest = parsed.data.source_manifest;
|
|
3483
|
+
const sourceManifest = manifest && typeof manifest === "object" && !Array.isArray(manifest) ? Object.fromEntries(Object.entries(manifest).filter(([, digest]) => typeof digest === "string")) : {};
|
|
3484
|
+
return [{ path: `knowledge/delivery/${name}`, version: Number(match[1]), sourceFingerprint: fingerprint, sourceManifest }];
|
|
3485
|
+
} catch {
|
|
3486
|
+
return [];
|
|
3487
|
+
}
|
|
3488
|
+
}).sort((a, b) => b.version - a.version);
|
|
3489
|
+
}
|
|
3490
|
+
function reportPath(version) {
|
|
3491
|
+
return `knowledge/delivery/${POC_REPORT_PREFIX}${String(version).padStart(3, "0")}.md`;
|
|
3492
|
+
}
|
|
3493
|
+
function buildPocReportContext(dir) {
|
|
3494
|
+
const poc = readPocSummary(dir);
|
|
3495
|
+
const reports = reportFiles(dir);
|
|
3496
|
+
const latestReport = reports[0] ?? null;
|
|
3497
|
+
const nextPath = reportPath((latestReport?.version ?? 0) + 1);
|
|
3498
|
+
if (!poc.exists || poc.conclusion === "pending") {
|
|
3499
|
+
return {
|
|
3500
|
+
eligible: false,
|
|
3501
|
+
conclusion: poc.conclusion,
|
|
3502
|
+
status: latestReport ? "stale" : "missing",
|
|
3503
|
+
latestReport,
|
|
3504
|
+
nextPath,
|
|
3505
|
+
sourceFingerprint: "",
|
|
3506
|
+
sources: [],
|
|
3507
|
+
changesSinceLatest: [],
|
|
3508
|
+
handoff: "POC conclusion is still pending. Record validated, rejected, or inconclusive before generating a final report."
|
|
3509
|
+
};
|
|
3510
|
+
}
|
|
3511
|
+
const sources = [];
|
|
3512
|
+
const add = (path5, kind) => {
|
|
3513
|
+
if (sources.some((item2) => item2.path === posix(path5))) return;
|
|
3514
|
+
const item = source(dir, path5, kind);
|
|
3515
|
+
if (item) sources.push(item);
|
|
3516
|
+
};
|
|
3517
|
+
add(POC_ARTIFACT_PATH, "poc");
|
|
3518
|
+
const pocText = readFile(join(dir, POC_ARTIFACT_PATH));
|
|
3519
|
+
const knowledge = discoverKnowledge(dir);
|
|
3520
|
+
const workItems = discoverWorkItems(dir);
|
|
3521
|
+
const referencedWorkItems = workItems.filter((wi) => wi.lifecycle === "completed" && wi.id && new RegExp(`\\b${wi.id}\\b`).test(pocText));
|
|
3522
|
+
const resourceIds = /* @__PURE__ */ new Set();
|
|
3523
|
+
const decisionIds = /* @__PURE__ */ new Set();
|
|
3524
|
+
for (const wi of referencedWorkItems) {
|
|
3525
|
+
add(wi.relPath, "work-item");
|
|
3526
|
+
for (const resource of parseWorkItemResources(wi.rawFrontmatter)) resourceIds.add(resource.id);
|
|
3527
|
+
const decisions = wi.rawFrontmatter.decisions;
|
|
3528
|
+
if (Array.isArray(decisions)) decisions.forEach((id) => decisionIds.add(String(id)));
|
|
3529
|
+
}
|
|
3530
|
+
for (const id of resourceIds) {
|
|
3531
|
+
const resource = getResource(dir, id);
|
|
3532
|
+
if (resource) add(resource.path, "resource");
|
|
3533
|
+
}
|
|
3534
|
+
for (const artifact of knowledge) {
|
|
3535
|
+
if (artifact.isWorkItem || !artifact.id) continue;
|
|
3536
|
+
if (decisionIds.has(artifact.id) || referencedWorkItems.some((wi) => new RegExp(`\\b${artifact.id}\\b`).test(readFile(wi.filePath)))) add(artifact.relPath, "knowledge");
|
|
3537
|
+
}
|
|
3538
|
+
sources.sort((a, b) => a.path.localeCompare(b.path));
|
|
3539
|
+
const sourceFingerprint = sha(sources.map((item) => `${item.path}\0${item.digest}`).join("\n"));
|
|
3540
|
+
const status = !latestReport ? "missing" : latestReport.sourceFingerprint === sourceFingerprint ? "current" : "stale";
|
|
3541
|
+
const currentManifest = Object.fromEntries(sources.map((item) => [item.path, item.digest]));
|
|
3542
|
+
const changesSinceLatest = status === "stale" ? [.../* @__PURE__ */ new Set([...Object.keys(currentManifest), ...Object.keys(latestReport?.sourceManifest ?? {})])].filter((path5) => currentManifest[path5] !== latestReport?.sourceManifest[path5]).sort() : [];
|
|
3543
|
+
const sourceList = sources.map((item) => `- ${item.path} (${item.kind})`).join("\n") || "- No sources selected.";
|
|
3544
|
+
return {
|
|
3545
|
+
eligible: true,
|
|
3546
|
+
conclusion: poc.conclusion,
|
|
3547
|
+
status,
|
|
3548
|
+
latestReport,
|
|
3549
|
+
nextPath,
|
|
3550
|
+
sourceFingerprint,
|
|
3551
|
+
sources,
|
|
3552
|
+
changesSinceLatest,
|
|
3553
|
+
handoff: [
|
|
3554
|
+
"Create a POC Final Report from the supplied sources only. Do not explore the repository.",
|
|
3555
|
+
`Canonical conclusion: ${poc.conclusion}. Do not contradict it.`,
|
|
3556
|
+
"Use the 15 canonical sections. Mark missing evidence as Not evaluated, Not applicable, or No evidence available.",
|
|
3557
|
+
"Distinguish measured, calculated, estimated, and projected values. Never include secret values.",
|
|
3558
|
+
"",
|
|
3559
|
+
"Selected sources:",
|
|
3560
|
+
sourceList
|
|
3561
|
+
].join("\n")
|
|
3562
|
+
};
|
|
3563
|
+
}
|
|
3564
|
+
function canonicalReport(context, proposal) {
|
|
3565
|
+
const supersedes = context.latestReport?.path.split("/").pop();
|
|
3566
|
+
const data = {
|
|
3567
|
+
type: "poc-report",
|
|
3568
|
+
report_version: Number(context.nextPath.match(/v(\d+)\.md$/)?.[1] ?? 1),
|
|
3569
|
+
generated_at: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
3570
|
+
poc_conclusion: context.conclusion,
|
|
3571
|
+
source_fingerprint: context.sourceFingerprint,
|
|
3572
|
+
sources: context.sources.map((item) => item.path),
|
|
3573
|
+
source_manifest: Object.fromEntries(context.sources.map((item) => [item.path, item.digest]))
|
|
3574
|
+
};
|
|
3575
|
+
if (supersedes) data.supersedes = supersedes;
|
|
3576
|
+
return matter6.stringify(redactSecrets(proposal).trimEnd() + "\n", data);
|
|
3577
|
+
}
|
|
3578
|
+
function persistPocReport(dir, proposal, opts = {}) {
|
|
3579
|
+
const context = buildPocReportContext(dir);
|
|
3580
|
+
if (!context.eligible) throw new Error(context.handoff);
|
|
3581
|
+
if (context.status === "current" && !opts.force) return { status: "current", path: context.latestReport.path, message: "The current POC report already represents the latest evidence." };
|
|
3582
|
+
if (!opts.confirm) return { status: "needs_confirmation", path: context.nextPath, content: canonicalReport(context, proposal), message: "Review the proposed report and confirm persistence." };
|
|
3583
|
+
const output = join(dir, context.nextPath);
|
|
3584
|
+
if (exists(output)) throw new Error(`POC report already exists: ${context.nextPath}`);
|
|
3585
|
+
const content = canonicalReport(context, proposal);
|
|
3586
|
+
writeFile(output, content);
|
|
3587
|
+
return { status: "persisted", path: context.nextPath, content };
|
|
3588
|
+
}
|
|
3589
|
+
|
|
3450
3590
|
// src/core/next-step.ts
|
|
3451
3591
|
function buildDeliveryState(dir) {
|
|
3452
3592
|
const wis = discoverWorkItems(dir);
|
|
@@ -3563,7 +3703,11 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
|
|
|
3563
3703
|
if (poc.conclusion === "pending") {
|
|
3564
3704
|
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." };
|
|
3565
3705
|
}
|
|
3566
|
-
|
|
3706
|
+
const report = buildPocReportContext(dir);
|
|
3707
|
+
if (report.status !== "current") {
|
|
3708
|
+
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." };
|
|
3709
|
+
}
|
|
3710
|
+
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." };
|
|
3567
3711
|
}
|
|
3568
3712
|
const q = (rel) => analyzeKnowledgeArtifact(dir, rel);
|
|
3569
3713
|
const resolveAgent = (agent) => {
|
|
@@ -4001,7 +4145,7 @@ function deriveDeliveryCompletedStatus(dir) {
|
|
|
4001
4145
|
}
|
|
4002
4146
|
|
|
4003
4147
|
// src/core/assets.ts
|
|
4004
|
-
import
|
|
4148
|
+
import matter7 from "gray-matter";
|
|
4005
4149
|
|
|
4006
4150
|
// src/core/version.ts
|
|
4007
4151
|
import { fileURLToPath } from "url";
|
|
@@ -4677,6 +4821,50 @@ their intersection with the affected areas, and recommended actions.
|
|
|
4677
4821
|
- The assessment is proportional \u2014 a small change gets a brief assessment.
|
|
4678
4822
|
`
|
|
4679
4823
|
);
|
|
4824
|
+
var POC_REPORT_WRITING = skill(
|
|
4825
|
+
"poc-report-writing",
|
|
4826
|
+
"POC Final Report Writing Skill",
|
|
4827
|
+
"delivery",
|
|
4828
|
+
["implementation-agent", "work-item-agent"],
|
|
4829
|
+
`
|
|
4830
|
+
# POC Final Report Writing Skill
|
|
4831
|
+
|
|
4832
|
+
## Purpose
|
|
4833
|
+
|
|
4834
|
+
Turn a supplied deterministic POC report context into a concise, traceable final report.
|
|
4835
|
+
|
|
4836
|
+
## When to use
|
|
4837
|
+
|
|
4838
|
+
After a POC has a canonical conclusion and Core has prepared its deterministic report context.
|
|
4839
|
+
|
|
4840
|
+
## Rules
|
|
4841
|
+
|
|
4842
|
+
- Use only the supplied context; do not scan the repository or infer missing results.
|
|
4843
|
+
- Treat \`poc.md\` as canonical for the conclusion. Never contradict it.
|
|
4844
|
+
- Keep facts, measurements, calculations, estimates, and recommendations distinct.
|
|
4845
|
+
- Never include credential values, tokens, private keys, passwords, or connection strings.
|
|
4846
|
+
- Use \`Not evaluated in this POC.\`, \`Not applicable.\`, or \`No evidence available.\` when sources do not support a section.
|
|
4847
|
+
- Return a proposal for human review; Core persists it only after confirmation.
|
|
4848
|
+
|
|
4849
|
+
## Required structure
|
|
4850
|
+
|
|
4851
|
+
1. Executive Summary
|
|
4852
|
+
2. Problem and Objective
|
|
4853
|
+
3. Hypothesis and Success Criteria
|
|
4854
|
+
4. Scope, Constraints and Non-goals
|
|
4855
|
+
5. Technical Approach and Architecture
|
|
4856
|
+
6. Infrastructure and Project Resources
|
|
4857
|
+
7. Implementation and Relevant Technical Decisions
|
|
4858
|
+
8. Experiments and Validation
|
|
4859
|
+
9. Results and Measurements
|
|
4860
|
+
10. Cost and Efficiency Analysis
|
|
4861
|
+
11. Observability and Operational Findings
|
|
4862
|
+
12. Findings, Learnings, Limitations and Risks
|
|
4863
|
+
13. Conclusion
|
|
4864
|
+
14. Recommendation and Next Steps
|
|
4865
|
+
15. Traceability and Sources
|
|
4866
|
+
`
|
|
4867
|
+
);
|
|
4680
4868
|
var SKILLS = [
|
|
4681
4869
|
ADR_WRITING,
|
|
4682
4870
|
WORK_ITEM_REFINEMENT,
|
|
@@ -4687,10 +4875,11 @@ var SKILLS = [
|
|
|
4687
4875
|
IMPLEMENTATION_PLANNING,
|
|
4688
4876
|
MODULE_CONTEXT_REFINEMENT,
|
|
4689
4877
|
EVIDENCE_VERIFICATION,
|
|
4690
|
-
LEGACY_RISK_ASSESSMENT
|
|
4878
|
+
LEGACY_RISK_ASSESSMENT,
|
|
4879
|
+
POC_REPORT_WRITING
|
|
4691
4880
|
];
|
|
4692
4881
|
var SKILL_GROUPS = {
|
|
4693
|
-
delivery: ["work-item-refinement", "implementation-planning", "learning-capture", "evidence-verification", "legacy-risk-assessment"],
|
|
4882
|
+
delivery: ["work-item-refinement", "implementation-planning", "learning-capture", "evidence-verification", "legacy-risk-assessment", "poc-report-writing"],
|
|
4694
4883
|
tech: ["adr-writing", "ownership-suggestion", "graph-metadata-review", "module-context-refinement"],
|
|
4695
4884
|
integration: ["capsule-writing"]
|
|
4696
4885
|
};
|
|
@@ -7224,7 +7413,7 @@ function canonicalSkills() {
|
|
|
7224
7413
|
}
|
|
7225
7414
|
function versionOf(content) {
|
|
7226
7415
|
try {
|
|
7227
|
-
const v =
|
|
7416
|
+
const v = matter7(content).data.version;
|
|
7228
7417
|
return v === void 0 || v === null ? null : String(v);
|
|
7229
7418
|
} catch {
|
|
7230
7419
|
return null;
|
|
@@ -7828,7 +8017,17 @@ var concludePoc = {
|
|
|
7828
8017
|
return conclusion === "pending" ? { status: "pending", reason: "Record validated, rejected, or inconclusive from the evidence." } : { status: "done", evidence: [POC_ARTIFACT_PATH], reason: `Conclusion: ${conclusion}.` };
|
|
7829
8018
|
}
|
|
7830
8019
|
};
|
|
7831
|
-
var
|
|
8020
|
+
var finalPocReport = {
|
|
8021
|
+
id: "poc-final-report",
|
|
8022
|
+
label: "Generate final report (optional)",
|
|
8023
|
+
evaluate: (ctx) => {
|
|
8024
|
+
const report = buildPocReportContext(ctx.dir);
|
|
8025
|
+
if (!report.eligible) return { status: "optional", reason: "Available after recording a POC conclusion." };
|
|
8026
|
+
if (report.status === "current") return { status: "done", evidence: [report.latestReport.path] };
|
|
8027
|
+
return { status: "optional", command: "kaddo poc report", reason: report.status === "stale" ? "Latest report is stale." : "A final report is optional." };
|
|
8028
|
+
}
|
|
8029
|
+
};
|
|
8030
|
+
var POC_STEPS = [enableKaddo, ensurePocArtifact, definePocHypothesis, definePocCriteria, describePocTech, identifyPocResources, createPocExperiment, capturePocEvidence, concludePoc, finalPocReport];
|
|
7832
8031
|
function stepsForState(state) {
|
|
7833
8032
|
switch (state) {
|
|
7834
8033
|
case "new":
|
|
@@ -7932,6 +8131,7 @@ function mapNextStepId(id) {
|
|
|
7932
8131
|
"poc-resources": "poc-resources",
|
|
7933
8132
|
"poc-create-experiment": "poc-create-experiment",
|
|
7934
8133
|
"poc-evaluate": "poc-evaluate",
|
|
8134
|
+
"poc-final-report": "poc-final-report",
|
|
7935
8135
|
"poc-complete": "poc-evaluate"
|
|
7936
8136
|
};
|
|
7937
8137
|
return MAP[id] ?? id;
|
|
@@ -7946,7 +8146,7 @@ function buildProjectRoute(dir) {
|
|
|
7946
8146
|
return { id: d.id, label: d.label, ...result };
|
|
7947
8147
|
});
|
|
7948
8148
|
for (const s of steps) {
|
|
7949
|
-
if (s.id === ctx.nextStepId && s.status !== "done") {
|
|
8149
|
+
if (s.id === ctx.nextStepId && s.status !== "done" && s.status !== "optional") {
|
|
7950
8150
|
s.status = "current";
|
|
7951
8151
|
}
|
|
7952
8152
|
}
|
|
@@ -7958,8 +8158,8 @@ function buildProjectRoute(dir) {
|
|
|
7958
8158
|
break;
|
|
7959
8159
|
}
|
|
7960
8160
|
}
|
|
7961
|
-
const completed = steps.filter((s) => s.status === "done").length;
|
|
7962
|
-
const total = steps.length;
|
|
8161
|
+
const completed = steps.filter((s) => s.status === "done" && s.status !== "optional").length;
|
|
8162
|
+
const total = steps.filter((s) => s.status !== "optional").length;
|
|
7963
8163
|
const progressPercent = total > 0 ? Math.round(completed / total * 100) : 0;
|
|
7964
8164
|
return {
|
|
7965
8165
|
type: state,
|
|
@@ -7972,7 +8172,7 @@ function buildProjectRoute(dir) {
|
|
|
7972
8172
|
}
|
|
7973
8173
|
|
|
7974
8174
|
// src/core/metadata-health.ts
|
|
7975
|
-
import
|
|
8175
|
+
import matter8 from "gray-matter";
|
|
7976
8176
|
var KNOWLEDGE_FILES2 = [
|
|
7977
8177
|
"knowledge/business/business.md",
|
|
7978
8178
|
"knowledge/product/product.md",
|
|
@@ -7992,7 +8192,7 @@ function analyzeMetadataHealth(dir) {
|
|
|
7992
8192
|
let data;
|
|
7993
8193
|
try {
|
|
7994
8194
|
const raw = readFile(p);
|
|
7995
|
-
data =
|
|
8195
|
+
data = matter8(raw).data;
|
|
7996
8196
|
} catch {
|
|
7997
8197
|
continue;
|
|
7998
8198
|
}
|
|
@@ -8024,7 +8224,7 @@ function analyzeMetadataHealth(dir) {
|
|
|
8024
8224
|
if (isFile(p) && entry.endsWith(".md")) {
|
|
8025
8225
|
try {
|
|
8026
8226
|
const raw = readFile(p);
|
|
8027
|
-
const fm =
|
|
8227
|
+
const fm = matter8(raw).data;
|
|
8028
8228
|
if (fm.status === "done") {
|
|
8029
8229
|
const rel = p.replace(dir + "/", "").replace(dir + "\\", "").replace(/\\/g, "/");
|
|
8030
8230
|
findings.push({
|
|
@@ -8388,7 +8588,7 @@ function buildProjectExplanation(dir) {
|
|
|
8388
8588
|
// src/core/resource-write.ts
|
|
8389
8589
|
import fs2 from "fs";
|
|
8390
8590
|
import path2 from "path";
|
|
8391
|
-
import
|
|
8591
|
+
import matter9 from "gray-matter";
|
|
8392
8592
|
var RESOURCES_DIR = "knowledge/tech/resources";
|
|
8393
8593
|
var ResourceWriteError = class extends Error {
|
|
8394
8594
|
constructor(code, message) {
|
|
@@ -8468,7 +8668,7 @@ function buildFrontmatter(id, input, base = {}) {
|
|
|
8468
8668
|
return data;
|
|
8469
8669
|
}
|
|
8470
8670
|
function serialize(data, body) {
|
|
8471
|
-
return
|
|
8671
|
+
return matter9.stringify(`
|
|
8472
8672
|
${body.trim()}
|
|
8473
8673
|
`, data);
|
|
8474
8674
|
}
|
|
@@ -8508,7 +8708,7 @@ function updateResource(dir, id, input) {
|
|
|
8508
8708
|
throw new ResourceWriteError("VALIDATION_FAILED", findings.filter((f) => f.level === "error").map((f) => f.message).join("; "));
|
|
8509
8709
|
}
|
|
8510
8710
|
const raw = readFile(match.filePath);
|
|
8511
|
-
const parsed =
|
|
8711
|
+
const parsed = matter9(raw);
|
|
8512
8712
|
const base = parsed.data ?? {};
|
|
8513
8713
|
const data = buildFrontmatter(match.id || id, input, base);
|
|
8514
8714
|
let body = parsed.content.trim();
|
|
@@ -8779,7 +8979,7 @@ function analyzeCrossRepoEvidence(input) {
|
|
|
8779
8979
|
}
|
|
8780
8980
|
|
|
8781
8981
|
// src/core/work-items.ts
|
|
8782
|
-
import
|
|
8982
|
+
import matter10 from "gray-matter";
|
|
8783
8983
|
|
|
8784
8984
|
// src/core/system-topology.ts
|
|
8785
8985
|
import { parse as parseYaml8, stringify as stringifyYaml5 } from "yaml";
|
|
@@ -9215,7 +9415,7 @@ function parseOriginalSnapshot(fm) {
|
|
|
9215
9415
|
function readBody(filePath) {
|
|
9216
9416
|
try {
|
|
9217
9417
|
const raw = readFile(filePath);
|
|
9218
|
-
return
|
|
9418
|
+
return matter10(raw).content;
|
|
9219
9419
|
} catch {
|
|
9220
9420
|
return "";
|
|
9221
9421
|
}
|
|
@@ -9382,7 +9582,7 @@ function parseRelatedKnowledge(fm, knowledgeById) {
|
|
|
9382
9582
|
import fs4 from "fs";
|
|
9383
9583
|
import path4 from "path";
|
|
9384
9584
|
import crypto2 from "crypto";
|
|
9385
|
-
import
|
|
9585
|
+
import matter11 from "gray-matter";
|
|
9386
9586
|
|
|
9387
9587
|
// src/core/knowledge-levels.ts
|
|
9388
9588
|
var WORK_ITEM_TYPES2 = ["feature", "bugfix", "hotfix", "spike", "chore"];
|
|
@@ -9789,7 +9989,7 @@ function applyFrontmatter(data, input) {
|
|
|
9789
9989
|
return next;
|
|
9790
9990
|
}
|
|
9791
9991
|
function serialize2(data, body) {
|
|
9792
|
-
return
|
|
9992
|
+
return matter11.stringify(`
|
|
9793
9993
|
${body.trim()}
|
|
9794
9994
|
`, data);
|
|
9795
9995
|
}
|
|
@@ -9848,7 +10048,7 @@ function toInput(data, content) {
|
|
|
9848
10048
|
function getWorkItemForEdit(dir, id) {
|
|
9849
10049
|
const { filePath, relPath } = findArtifact(dir, id);
|
|
9850
10050
|
const raw = readFile(filePath);
|
|
9851
|
-
const { data, content } =
|
|
10051
|
+
const { data, content } = matter11(raw);
|
|
9852
10052
|
const status = lifecycleStateOf({ status: String(data.status ?? ""), filePath });
|
|
9853
10053
|
const input = toInput(data, content);
|
|
9854
10054
|
const editable = EDITABLE_STATES.includes(status);
|
|
@@ -9893,7 +10093,7 @@ function createWorkItem(dir, opts) {
|
|
|
9893
10093
|
const title = intent.split(/\r?\n/)[0].trim().slice(0, 120);
|
|
9894
10094
|
const today2 = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
9895
10095
|
const summary = opts.summary?.trim() || intent;
|
|
9896
|
-
const
|
|
10096
|
+
const source2 = opts.source ? { ...opts.source, inferred: false } : { type: "manual", inferred: false };
|
|
9897
10097
|
const data = {
|
|
9898
10098
|
type,
|
|
9899
10099
|
id,
|
|
@@ -9901,7 +10101,7 @@ function createWorkItem(dir, opts) {
|
|
|
9901
10101
|
status: "draft",
|
|
9902
10102
|
work_type: type,
|
|
9903
10103
|
created_at: today2,
|
|
9904
|
-
source,
|
|
10104
|
+
source: source2,
|
|
9905
10105
|
generated_by: "kaddo-admin",
|
|
9906
10106
|
affected_modules: [],
|
|
9907
10107
|
summary
|
|
@@ -9941,7 +10141,7 @@ function updateWorkItem(dir, id, input, expectedRevision) {
|
|
|
9941
10141
|
if (revisionOf(raw) !== expectedRevision) {
|
|
9942
10142
|
throw new WorkItemWriteError("WORK_ITEM_CONFLICT", "This Work Item changed outside Kaddo Admin. Reload the latest version before saving.");
|
|
9943
10143
|
}
|
|
9944
|
-
const { data, content } =
|
|
10144
|
+
const { data, content } = matter11(raw);
|
|
9945
10145
|
const status = lifecycleStateOf({ status: String(data.status ?? ""), filePath });
|
|
9946
10146
|
if (!EDITABLE_STATES.includes(status)) {
|
|
9947
10147
|
throw new WorkItemWriteError("WORK_ITEM_NOT_EDITABLE", `A ${status} Work Item cannot be edited. Reopen it as Draft first.`);
|
|
@@ -9955,7 +10155,7 @@ function updateWorkItem(dir, id, input, expectedRevision) {
|
|
|
9955
10155
|
function validateWorkItem(dir, id) {
|
|
9956
10156
|
const { filePath } = findArtifact(dir, id);
|
|
9957
10157
|
const raw = readFile(filePath);
|
|
9958
|
-
const { data, content } =
|
|
10158
|
+
const { data, content } = matter11(raw);
|
|
9959
10159
|
const input = toInput(data, content);
|
|
9960
10160
|
const findings = [];
|
|
9961
10161
|
const modules = validModuleIds(dir);
|
|
@@ -10008,7 +10208,7 @@ function transitionWorkItem(dir, id, to, expectedRevision) {
|
|
|
10008
10208
|
if (revisionOf(raw) !== expectedRevision) {
|
|
10009
10209
|
throw new WorkItemWriteError("WORK_ITEM_CONFLICT", "This Work Item changed outside Kaddo Admin. Reload the latest version before continuing.");
|
|
10010
10210
|
}
|
|
10011
|
-
const { data, content } =
|
|
10211
|
+
const { data, content } = matter11(raw);
|
|
10012
10212
|
const from = lifecycleStateOf({ status: String(data.status ?? ""), filePath });
|
|
10013
10213
|
if (!(ALLOWED[from] ?? []).includes(to)) {
|
|
10014
10214
|
throw new WorkItemWriteError("INVALID_TRANSITION", `Cannot transition a ${from} Work Item to ${to}.`);
|
|
@@ -10263,10 +10463,10 @@ function getSystemNeighbors(dir, nodeId, opts = {}) {
|
|
|
10263
10463
|
}
|
|
10264
10464
|
return { seed: nodeId, nodes, relationships: rels, truncated };
|
|
10265
10465
|
}
|
|
10266
|
-
function findSystemPaths(dir,
|
|
10466
|
+
function findSystemPaths(dir, source2, target, opts = {}) {
|
|
10267
10467
|
const projection = getSystemMapProjection(dir);
|
|
10268
10468
|
const byId = new Map(projection.nodes.map((n) => [n.id, n]));
|
|
10269
|
-
if (!byId.has(
|
|
10469
|
+
if (!byId.has(source2) || !byId.has(target)) return [];
|
|
10270
10470
|
const maxDepth = Math.max(1, opts.maxDepth ?? 4);
|
|
10271
10471
|
const out = /* @__PURE__ */ new Map();
|
|
10272
10472
|
for (const r of projection.relationships) {
|
|
@@ -10286,7 +10486,7 @@ function findSystemPaths(dir, source, target, opts = {}) {
|
|
|
10286
10486
|
walk(nxt, [...path5, nxt]);
|
|
10287
10487
|
}
|
|
10288
10488
|
};
|
|
10289
|
-
walk(
|
|
10489
|
+
walk(source2, [source2]);
|
|
10290
10490
|
return paths;
|
|
10291
10491
|
}
|
|
10292
10492
|
function getImpactCandidates(dir, seedIds, opts = {}) {
|
|
@@ -10887,7 +11087,7 @@ function deriveImplementationStatus(repos) {
|
|
|
10887
11087
|
// src/core/work-item-import.ts
|
|
10888
11088
|
import crypto3 from "crypto";
|
|
10889
11089
|
import fs5 from "fs";
|
|
10890
|
-
import
|
|
11090
|
+
import matter12 from "gray-matter";
|
|
10891
11091
|
var MAX_INPUT_BYTES = 102400;
|
|
10892
11092
|
var LIFECYCLE_FIELDS = /* @__PURE__ */ new Set([
|
|
10893
11093
|
"id",
|
|
@@ -10909,7 +11109,7 @@ function detectFormat(raw) {
|
|
|
10909
11109
|
if (!trimmed) throw new ImportError("EMPTY_INPUT", "Import content is empty.");
|
|
10910
11110
|
if (trimmed.startsWith("---")) {
|
|
10911
11111
|
try {
|
|
10912
|
-
const { data } =
|
|
11112
|
+
const { data } = matter12(trimmed);
|
|
10913
11113
|
if (data && typeof data === "object" && Object.keys(data).length > 0) {
|
|
10914
11114
|
const d = data;
|
|
10915
11115
|
if (d.type === "work-item" || d.id && typeof d.id === "string" && /^WI-\d+/.test(d.id)) {
|
|
@@ -10931,7 +11131,7 @@ function parseContent(raw) {
|
|
|
10931
11131
|
let bodyText = trimmed;
|
|
10932
11132
|
if (format === "kaddo-frontmatter" || format === "markdown-frontmatter") {
|
|
10933
11133
|
try {
|
|
10934
|
-
const parsed =
|
|
11134
|
+
const parsed = matter12(trimmed);
|
|
10935
11135
|
frontmatterFields = parsed.data ?? {};
|
|
10936
11136
|
bodyText = parsed.content.trim();
|
|
10937
11137
|
} catch {
|
|
@@ -11003,12 +11203,12 @@ function normalizeImportFields(parsed, opts) {
|
|
|
11003
11203
|
const intent = parsed.title;
|
|
11004
11204
|
const body = hasRealBody ? parsed.body : void 0;
|
|
11005
11205
|
const summary = hasRealBody ? deriveShortSummary(parsed) : parsed.title;
|
|
11006
|
-
const
|
|
11206
|
+
const source2 = {
|
|
11007
11207
|
type: opts.importSource === "chat" ? "chat" : "external",
|
|
11008
11208
|
imported_at: (/* @__PURE__ */ new Date()).toISOString().split("T")[0]
|
|
11009
11209
|
};
|
|
11010
|
-
|
|
11011
|
-
|
|
11210
|
+
source2.source_format = opts.sourceFormat;
|
|
11211
|
+
source2.source_hash = opts.sourceHash;
|
|
11012
11212
|
const snapshot = { title: parsed.title };
|
|
11013
11213
|
if (summary !== parsed.title) snapshot.description = summary;
|
|
11014
11214
|
if (typeof parsed.candidateFields.type === "string") snapshot.type = parsed.candidateFields.type;
|
|
@@ -11017,7 +11217,7 @@ function normalizeImportFields(parsed, opts) {
|
|
|
11017
11217
|
const labels = parsed.candidateFields.labels.filter((l) => typeof l === "string");
|
|
11018
11218
|
if (labels.length > 0) snapshot.labels = labels;
|
|
11019
11219
|
}
|
|
11020
|
-
return { type, intent, summary, body, source, snapshot, discardedFields };
|
|
11220
|
+
return { type, intent, summary, body, source: source2, snapshot, discardedFields };
|
|
11021
11221
|
}
|
|
11022
11222
|
function computeContentHash(raw) {
|
|
11023
11223
|
return crypto3.createHash("sha256").update(raw.trim(), "utf-8").digest("hex");
|
|
@@ -11028,10 +11228,10 @@ function findDuplicateByHash(dir, hash) {
|
|
|
11028
11228
|
const raw = readFile(item.filePath);
|
|
11029
11229
|
if (!raw) continue;
|
|
11030
11230
|
try {
|
|
11031
|
-
const { data } =
|
|
11032
|
-
const
|
|
11033
|
-
if (
|
|
11034
|
-
const s =
|
|
11231
|
+
const { data } = matter12(raw);
|
|
11232
|
+
const source2 = data?.source;
|
|
11233
|
+
if (source2 && typeof source2 === "object" && !Array.isArray(source2)) {
|
|
11234
|
+
const s = source2;
|
|
11035
11235
|
if (s.source_hash === hash) {
|
|
11036
11236
|
return { workItemId: data.id ?? item.id ?? item.title, path: item.relPath };
|
|
11037
11237
|
}
|
|
@@ -11137,7 +11337,7 @@ var ImportError = class extends Error {
|
|
|
11137
11337
|
};
|
|
11138
11338
|
|
|
11139
11339
|
// src/services/integrations.ts
|
|
11140
|
-
import
|
|
11340
|
+
import matter13 from "gray-matter";
|
|
11141
11341
|
import { parse as parseYaml9, stringify as stringifyYaml6 } from "yaml";
|
|
11142
11342
|
|
|
11143
11343
|
// ../integrations/src/errors.ts
|
|
@@ -12479,12 +12679,12 @@ function findLinkedWorkItem(dir, integrationId, externalId) {
|
|
|
12479
12679
|
for (const art of discoverWorkItems(dir)) {
|
|
12480
12680
|
let data;
|
|
12481
12681
|
try {
|
|
12482
|
-
data =
|
|
12682
|
+
data = matter13(readFile(art.filePath)).data;
|
|
12483
12683
|
} catch {
|
|
12484
12684
|
continue;
|
|
12485
12685
|
}
|
|
12486
|
-
const
|
|
12487
|
-
if (
|
|
12686
|
+
const source2 = parseWorkItemSource(data);
|
|
12687
|
+
if (source2.integration === integrationId && source2.id === externalId) {
|
|
12488
12688
|
return { workItemId: String(data.id ?? ""), title: String(data.title ?? "") };
|
|
12489
12689
|
}
|
|
12490
12690
|
}
|
|
@@ -12495,13 +12695,13 @@ function buildImportIndex(dir) {
|
|
|
12495
12695
|
for (const art of discoverWorkItems(dir)) {
|
|
12496
12696
|
let data;
|
|
12497
12697
|
try {
|
|
12498
|
-
data =
|
|
12698
|
+
data = matter13(readFile(art.filePath)).data;
|
|
12499
12699
|
} catch {
|
|
12500
12700
|
continue;
|
|
12501
12701
|
}
|
|
12502
|
-
const
|
|
12503
|
-
if (
|
|
12504
|
-
index.set(`${
|
|
12702
|
+
const source2 = parseWorkItemSource(data);
|
|
12703
|
+
if (source2.type === "external" && source2.integration && source2.id) {
|
|
12704
|
+
index.set(`${source2.integration}#${source2.id}`, { workItemId: String(data.id ?? ""), title: String(data.title ?? "") });
|
|
12505
12705
|
}
|
|
12506
12706
|
}
|
|
12507
12707
|
return index;
|
|
@@ -12671,7 +12871,7 @@ function getStatus(dir) {
|
|
|
12671
12871
|
}
|
|
12672
12872
|
|
|
12673
12873
|
// src/core/initiative-write.ts
|
|
12674
|
-
import
|
|
12874
|
+
import matter14 from "gray-matter";
|
|
12675
12875
|
var WORK_ITEMS_DIR2 = "knowledge/delivery/work-items";
|
|
12676
12876
|
var DRAFT_DIR = `${WORK_ITEMS_DIR2}/draft`;
|
|
12677
12877
|
var ROADMAP_PATH2 = "knowledge/delivery/roadmap.md";
|
|
@@ -12784,7 +12984,7 @@ function buildInitiativeContent(id, input) {
|
|
|
12784
12984
|
if (input.priority) data.priority = input.priority;
|
|
12785
12985
|
if (input.source) data.source = input.source;
|
|
12786
12986
|
if (input.sourceId) data.source_id = input.sourceId;
|
|
12787
|
-
return
|
|
12987
|
+
return matter14.stringify("\n" + (input.body ?? defaultBody(input.title.trim())), data);
|
|
12788
12988
|
}
|
|
12789
12989
|
function createInitiative(dir, input) {
|
|
12790
12990
|
if (!input.title?.trim()) throw new InitiativeWriteError("Initiative title is required.");
|
|
@@ -12808,10 +13008,10 @@ function transitionInitiative(dir, id, to) {
|
|
|
12808
13008
|
throw new InitiativeWriteError(`Invalid transition ${ini.status} \u2192 ${to}.`);
|
|
12809
13009
|
}
|
|
12810
13010
|
const raw = readFile(ini.filePath);
|
|
12811
|
-
const { data, content } =
|
|
13011
|
+
const { data, content } = matter14(raw, {});
|
|
12812
13012
|
data.status = to;
|
|
12813
13013
|
if (to === "completed") data.completed_at = today();
|
|
12814
|
-
const newContent =
|
|
13014
|
+
const newContent = matter14.stringify(content, data);
|
|
12815
13015
|
writeFile(ini.filePath, newContent);
|
|
12816
13016
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
12817
13017
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after transition.");
|
|
@@ -12821,7 +13021,7 @@ function addCandidate(dir, id, candidate) {
|
|
|
12821
13021
|
const ini = getInitiative(dir, id);
|
|
12822
13022
|
if (!ini) throw new InitiativeWriteError(`Initiative ${id} not found.`);
|
|
12823
13023
|
const raw = readFile(ini.filePath);
|
|
12824
|
-
const { data, content } =
|
|
13024
|
+
const { data, content } = matter14(raw, {});
|
|
12825
13025
|
const existing = Array.isArray(data.candidates) ? data.candidates : [];
|
|
12826
13026
|
const fallbackId = `WI-CANDIDATE-${String(existing.length + 1).padStart(3, "0")}`;
|
|
12827
13027
|
const normalized = normalizeCandidate(candidate, fallbackId);
|
|
@@ -12829,7 +13029,7 @@ function addCandidate(dir, id, candidate) {
|
|
|
12829
13029
|
throw new InitiativeWriteError(`Candidate ${normalized.id} already exists in ${id}.`);
|
|
12830
13030
|
}
|
|
12831
13031
|
data.candidates = [...existing, candidateToData(normalized)];
|
|
12832
|
-
const newContent =
|
|
13032
|
+
const newContent = matter14.stringify(content, data);
|
|
12833
13033
|
writeFile(ini.filePath, newContent);
|
|
12834
13034
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
12835
13035
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after adding a candidate.");
|
|
@@ -12839,7 +13039,7 @@ function updateInitiative(dir, id, patch) {
|
|
|
12839
13039
|
const ini = getInitiative(dir, id);
|
|
12840
13040
|
if (!ini) throw new InitiativeWriteError(`Initiative ${id} not found.`);
|
|
12841
13041
|
const raw = readFile(ini.filePath);
|
|
12842
|
-
const { data, content } =
|
|
13042
|
+
const { data, content } = matter14(raw, {});
|
|
12843
13043
|
if (patch.title !== void 0) {
|
|
12844
13044
|
if (!patch.title.trim()) throw new InitiativeWriteError("Initiative title cannot be empty.");
|
|
12845
13045
|
data.title = patch.title.trim();
|
|
@@ -12849,7 +13049,7 @@ function updateInitiative(dir, id, patch) {
|
|
|
12849
13049
|
if (patch.knowledgeLevel !== void 0) data.knowledge_level = patch.knowledgeLevel;
|
|
12850
13050
|
if (patch.domains !== void 0) data.domains = patch.domains;
|
|
12851
13051
|
if (patch.relatedCapabilities !== void 0) data.related_capabilities = patch.relatedCapabilities;
|
|
12852
|
-
const newContent =
|
|
13052
|
+
const newContent = matter14.stringify(content, data);
|
|
12853
13053
|
writeFile(ini.filePath, newContent);
|
|
12854
13054
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
12855
13055
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after update.");
|
|
@@ -12867,10 +13067,10 @@ function addExternalLink(dir, id, link) {
|
|
|
12867
13067
|
throw new InitiativeWriteError(`External link ${link.integration}:${link.externalId} already exists on ${id}.`);
|
|
12868
13068
|
}
|
|
12869
13069
|
const raw = readFile(ini.filePath);
|
|
12870
|
-
const { data, content } =
|
|
13070
|
+
const { data, content } = matter14(raw, {});
|
|
12871
13071
|
const existing = Array.isArray(data.external_links) ? data.external_links : [];
|
|
12872
13072
|
data.external_links = [...existing, externalLinkToData(link)];
|
|
12873
|
-
const newContent =
|
|
13073
|
+
const newContent = matter14.stringify(content, data);
|
|
12874
13074
|
writeFile(ini.filePath, newContent);
|
|
12875
13075
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
12876
13076
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after adding an external link.");
|
|
@@ -12939,7 +13139,7 @@ function buildWorkItemContent(wiId, iniId, candidate) {
|
|
|
12939
13139
|
"_What did we learn? Update after completion._",
|
|
12940
13140
|
""
|
|
12941
13141
|
].join("\n");
|
|
12942
|
-
return
|
|
13142
|
+
return matter14.stringify("\n" + body, data);
|
|
12943
13143
|
}
|
|
12944
13144
|
function materializeCandidate(dir, id, candidateId) {
|
|
12945
13145
|
const ini = getInitiative(dir, id);
|
|
@@ -12956,13 +13156,13 @@ function materializeCandidate(dir, id, candidateId) {
|
|
|
12956
13156
|
ensureDir(join(dir, DRAFT_DIR));
|
|
12957
13157
|
writeFile(join(dir, DRAFT_DIR, fileName), buildWorkItemContent(wiId, ini.id, candidate));
|
|
12958
13158
|
const raw = readFile(ini.filePath);
|
|
12959
|
-
const { data, content } =
|
|
13159
|
+
const { data, content } = matter14(raw, {});
|
|
12960
13160
|
const cands = Array.isArray(data.candidates) ? data.candidates : [];
|
|
12961
13161
|
for (const c of cands) {
|
|
12962
13162
|
if (c && typeof c === "object" && String(c.id) === candidateId) c.materialized_as = wiId;
|
|
12963
13163
|
}
|
|
12964
13164
|
data.candidates = cands;
|
|
12965
|
-
const newContent =
|
|
13165
|
+
const newContent = matter14.stringify(content, data);
|
|
12966
13166
|
writeFile(ini.filePath, newContent);
|
|
12967
13167
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
12968
13168
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after materialization.");
|
|
@@ -13121,6 +13321,7 @@ export {
|
|
|
13121
13321
|
IntegrationError,
|
|
13122
13322
|
IntegrationServiceError,
|
|
13123
13323
|
POC_ARTIFACT_PATH,
|
|
13324
|
+
POC_REPORT_PREFIX,
|
|
13124
13325
|
RESOURCE_ARTIFACT_TYPE,
|
|
13125
13326
|
RESOURCE_ROLES,
|
|
13126
13327
|
RESOURCE_TYPES,
|
|
@@ -13140,6 +13341,7 @@ export {
|
|
|
13140
13341
|
associatedWorkItems,
|
|
13141
13342
|
buildImplementationHandoff,
|
|
13142
13343
|
buildImportIndex,
|
|
13344
|
+
buildPocReportContext,
|
|
13143
13345
|
buildProjectExplanation,
|
|
13144
13346
|
buildProjectRoute,
|
|
13145
13347
|
buildReadinessReport,
|
|
@@ -13222,10 +13424,12 @@ export {
|
|
|
13222
13424
|
parseSuccessCriteria,
|
|
13223
13425
|
parseWorkItemResources,
|
|
13224
13426
|
persistConsent,
|
|
13427
|
+
persistPocReport,
|
|
13225
13428
|
previewImport,
|
|
13226
13429
|
projectMode,
|
|
13227
13430
|
readFile,
|
|
13228
13431
|
readPocSummary,
|
|
13432
|
+
redactSecrets,
|
|
13229
13433
|
removeIntegrationSecret,
|
|
13230
13434
|
searchSystemNodes,
|
|
13231
13435
|
setIntegrationSecret,
|