@kaddo/cli 3.114.0 → 3.115.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin-dist/assets/{architectureDiagram-3BPJPVTR-eYr0CQIi.js → architectureDiagram-3BPJPVTR-YcMJYo0g.js} +1 -1
- package/dist/admin-dist/assets/{chunk-727SXJPM-DrnpGnui.js → chunk-727SXJPM-BVnKaPXl.js} +1 -1
- package/dist/admin-dist/assets/{chunk-AQP2D5EJ-CEGy8SpK.js → chunk-AQP2D5EJ-D_Hcj3zm.js} +1 -1
- package/dist/admin-dist/assets/{classDiagram-v2-Q7XG4LA2-DA001cdf.js → classDiagram-4FO5ZUOK-C1j2IJF8.js} +1 -1
- package/dist/admin-dist/assets/{classDiagram-4FO5ZUOK-DA001cdf.js → classDiagram-v2-Q7XG4LA2-C1j2IJF8.js} +1 -1
- package/dist/admin-dist/assets/{dagre-BM42HDAG-BRJ0nXQb.js → dagre-BM42HDAG-ADdKf6j1.js} +1 -1
- package/dist/admin-dist/assets/{diagram-2AECGRRQ-xd6Livp4.js → diagram-2AECGRRQ-Z_xeHBlY.js} +1 -1
- package/dist/admin-dist/assets/{diagram-5GNKFQAL-o9d2ix0l.js → diagram-5GNKFQAL-Wgzw55l3.js} +1 -1
- package/dist/admin-dist/assets/{diagram-LMA3HP47-DcnWjF35.js → diagram-LMA3HP47-Dj6c7SSM.js} +1 -1
- package/dist/admin-dist/assets/{diagram-OG6HWLK6-Cw5XQicu.js → diagram-OG6HWLK6-hHqRSSZr.js} +1 -1
- package/dist/admin-dist/assets/{erDiagram-TEJ5UH35-DRxLZQPp.js → erDiagram-TEJ5UH35-BTGBIaZr.js} +1 -1
- package/dist/admin-dist/assets/{flowDiagram-I6XJVG4X-Pb5MivY8.js → flowDiagram-I6XJVG4X-RZJDjzR6.js} +1 -1
- package/dist/admin-dist/assets/{ganttDiagram-6RSMTGT7-Cm7UHfMW.js → ganttDiagram-6RSMTGT7-DI5Lr-xB.js} +1 -1
- package/dist/admin-dist/assets/{index-M8TdCEku.js → index-RwMAZcWr.js} +4 -4
- package/dist/admin-dist/assets/{infoDiagram-5YYISTIA-Bwq-Ae1z.js → infoDiagram-5YYISTIA-T5KZWjTy.js} +1 -1
- package/dist/admin-dist/assets/{ishikawaDiagram-YF4QCWOH-CN8u3lkW.js → ishikawaDiagram-YF4QCWOH-C6Gyb7TQ.js} +1 -1
- package/dist/admin-dist/assets/{kanban-definition-UN3LZRKU-DFp13Kfy.js → kanban-definition-UN3LZRKU-Dg8kSuqH.js} +1 -1
- package/dist/admin-dist/assets/{linear-sB0c581b.js → linear-NG3wfuct.js} +1 -1
- package/dist/admin-dist/assets/{mindmap-definition-RKZ34NQL-Ds_AH-UF.js → mindmap-definition-RKZ34NQL-B1dMo93T.js} +1 -1
- package/dist/admin-dist/assets/{pieDiagram-4H26LBE5-CT6aVbJD.js → pieDiagram-4H26LBE5-iIbw9aCq.js} +1 -1
- package/dist/admin-dist/assets/{quadrantDiagram-W4KKPZXB-QacGkpjr.js → quadrantDiagram-W4KKPZXB-CBsaVubF.js} +1 -1
- package/dist/admin-dist/assets/{requirementDiagram-4Y6WPE33-UjzvMQAY.js → requirementDiagram-4Y6WPE33-CobNACNF.js} +1 -1
- package/dist/admin-dist/assets/{sequenceDiagram-3UESZ5HK-Drii4Z9H.js → sequenceDiagram-3UESZ5HK-CpE56jux.js} +1 -1
- package/dist/admin-dist/assets/{stateDiagram-AJRCARHV-Cu5M1jgm.js → stateDiagram-AJRCARHV-pSzN5IAu.js} +1 -1
- package/dist/admin-dist/assets/{stateDiagram-v2-BHNVJYJU-Dnkqr8wc.js → stateDiagram-v2-BHNVJYJU-LhQFrdKp.js} +1 -1
- package/dist/admin-dist/assets/{timeline-definition-PNZ67QCA-BmCLa1NQ.js → timeline-definition-PNZ67QCA-q4yUdZjI.js} +1 -1
- package/dist/admin-dist/assets/{vennDiagram-CIIHVFJN-BhHRtC9_.js → vennDiagram-CIIHVFJN-D5DxPuNK.js} +1 -1
- package/dist/admin-dist/assets/{wardleyDiagram-YWT4CUSO-BzHZzKlk.js → wardleyDiagram-YWT4CUSO-451b1uEN.js} +1 -1
- package/dist/admin-dist/assets/{xychartDiagram-2RQKCTM6-uU2Utuv0.js → xychartDiagram-2RQKCTM6-DnOwq6Mk.js} +1 -1
- package/dist/admin-dist/index.html +1 -1
- package/dist/admin-server/index.js +2 -0
- package/dist/core.js +228 -37
- package/dist/index.js +262 -45
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -1844,8 +1844,130 @@ function suggestInitiativesForExternalItem(dir, integration, externalId) {
|
|
|
1844
1844
|
);
|
|
1845
1845
|
}
|
|
1846
1846
|
|
|
1847
|
+
// src/core/resources.ts
|
|
1848
|
+
import matter4 from "gray-matter";
|
|
1849
|
+
var RESOURCE_ARTIFACT_TYPE = "project-resource";
|
|
1850
|
+
var RESOURCE_TYPES = [
|
|
1851
|
+
"database",
|
|
1852
|
+
"cloud",
|
|
1853
|
+
"api",
|
|
1854
|
+
"queue",
|
|
1855
|
+
"storage",
|
|
1856
|
+
"repository",
|
|
1857
|
+
"platform",
|
|
1858
|
+
"service",
|
|
1859
|
+
"other"
|
|
1860
|
+
];
|
|
1861
|
+
var INTERFACE_TYPES = ["cli", "mcp", "api", "sql", "sdk", "iac", "console", "other"];
|
|
1862
|
+
var RESOURCE_ROLES = ["affected", "implementation", "validation", "delivery"];
|
|
1863
|
+
function str(v) {
|
|
1864
|
+
return typeof v === "string" && v.trim() ? v.trim() : null;
|
|
1865
|
+
}
|
|
1866
|
+
function strArray(v) {
|
|
1867
|
+
if (Array.isArray(v)) return v.map((x) => String(x).trim()).filter(Boolean);
|
|
1868
|
+
if (typeof v === "string" && v.trim()) return [v.trim()];
|
|
1869
|
+
return [];
|
|
1870
|
+
}
|
|
1871
|
+
function parseInterfaces(v) {
|
|
1872
|
+
if (!Array.isArray(v)) return [];
|
|
1873
|
+
const out = [];
|
|
1874
|
+
for (const raw of v) {
|
|
1875
|
+
if (!raw || typeof raw !== "object") continue;
|
|
1876
|
+
const o = raw;
|
|
1877
|
+
const type = str(o.type);
|
|
1878
|
+
if (!type) continue;
|
|
1879
|
+
out.push({
|
|
1880
|
+
type,
|
|
1881
|
+
tool: str(o.tool),
|
|
1882
|
+
provider: str(o.provider),
|
|
1883
|
+
purpose: str(o.purpose),
|
|
1884
|
+
operations: strArray(o.operations),
|
|
1885
|
+
environments: strArray(o.environments),
|
|
1886
|
+
constraints: str(o.constraints)
|
|
1887
|
+
});
|
|
1888
|
+
}
|
|
1889
|
+
return out;
|
|
1890
|
+
}
|
|
1891
|
+
function parseBoundaries(v) {
|
|
1892
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return {};
|
|
1893
|
+
const out = {};
|
|
1894
|
+
for (const [env, val] of Object.entries(v)) {
|
|
1895
|
+
const list2 = strArray(val);
|
|
1896
|
+
if (list2.length > 0) out[env] = list2;
|
|
1897
|
+
}
|
|
1898
|
+
return out;
|
|
1899
|
+
}
|
|
1900
|
+
function parseAuth(v) {
|
|
1901
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return { mode: null, refs: [] };
|
|
1902
|
+
const o = v;
|
|
1903
|
+
const refs = strArray(o.refs).filter((r) => !r.includes("=") && /^[A-Za-z0-9_.-]+$/.test(r));
|
|
1904
|
+
return { mode: str(o.mode), refs };
|
|
1905
|
+
}
|
|
1906
|
+
function toDetail(filePath, relPath, raw) {
|
|
1907
|
+
const parsed = matter4(raw);
|
|
1908
|
+
const fm = parsed.data ?? {};
|
|
1909
|
+
const body = parsed.content.trim();
|
|
1910
|
+
const id = str(fm.id) ?? "";
|
|
1911
|
+
return {
|
|
1912
|
+
id,
|
|
1913
|
+
title: str(fm.title) ?? id,
|
|
1914
|
+
resourceType: str(fm.resource_type),
|
|
1915
|
+
provider: str(fm.provider),
|
|
1916
|
+
environments: strArray(fm.environments),
|
|
1917
|
+
path: relPath,
|
|
1918
|
+
purpose: str(fm.purpose),
|
|
1919
|
+
interfaces: parseInterfaces(fm.access_interfaces),
|
|
1920
|
+
boundaries: parseBoundaries(fm.access_boundaries),
|
|
1921
|
+
...(() => {
|
|
1922
|
+
const a = parseAuth(fm.authentication);
|
|
1923
|
+
return { authRefs: a.refs, authMode: a.mode };
|
|
1924
|
+
})(),
|
|
1925
|
+
markdownBody: body
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
function getResources(dir) {
|
|
1929
|
+
return discoverKnowledge(dir).filter((a) => a.type === RESOURCE_ARTIFACT_TYPE).map((a) => {
|
|
1930
|
+
const fm = a.rawFrontmatter;
|
|
1931
|
+
return {
|
|
1932
|
+
id: a.id || str(fm.id) || a.title,
|
|
1933
|
+
title: a.title || str(fm.title) || a.id,
|
|
1934
|
+
resourceType: str(fm.resource_type),
|
|
1935
|
+
provider: str(fm.provider),
|
|
1936
|
+
environments: strArray(fm.environments),
|
|
1937
|
+
path: a.relPath
|
|
1938
|
+
};
|
|
1939
|
+
}).sort((x, y) => x.id.localeCompare(y.id));
|
|
1940
|
+
}
|
|
1941
|
+
function getResource(dir, id) {
|
|
1942
|
+
const match = discoverKnowledge(dir).find(
|
|
1943
|
+
(a) => a.type === RESOURCE_ARTIFACT_TYPE && (a.id === id || a.title === id)
|
|
1944
|
+
);
|
|
1945
|
+
if (!match) return null;
|
|
1946
|
+
const raw = readFile(match.filePath);
|
|
1947
|
+
return toDetail(match.filePath, match.relPath, raw);
|
|
1948
|
+
}
|
|
1949
|
+
function parseWorkItemResources(fm) {
|
|
1950
|
+
const v = fm.resources;
|
|
1951
|
+
if (!Array.isArray(v)) return [];
|
|
1952
|
+
const out = [];
|
|
1953
|
+
for (const raw of v) {
|
|
1954
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
|
|
1955
|
+
const o = raw;
|
|
1956
|
+
const id = str(o.id);
|
|
1957
|
+
if (!id) continue;
|
|
1958
|
+
out.push({ id, role: str(o.role) ?? "affected" });
|
|
1959
|
+
}
|
|
1960
|
+
return out;
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1847
1963
|
// src/core/graph.ts
|
|
1848
1964
|
var KNOWLEDGE2 = "knowledge";
|
|
1965
|
+
var RESOURCE_ROLE_EDGE = {
|
|
1966
|
+
affected: "affects",
|
|
1967
|
+
implementation: "uses",
|
|
1968
|
+
validation: "validates_with",
|
|
1969
|
+
delivery: "delivers_through"
|
|
1970
|
+
};
|
|
1849
1971
|
var ACTIVE_STATUSES = ["draft", "ready", "in-progress", "blocked"];
|
|
1850
1972
|
var ALL_STATUSES = ["draft", "ready", "in-progress", "blocked", "completed"];
|
|
1851
1973
|
function scopeStatuses(scope) {
|
|
@@ -1924,6 +2046,16 @@ function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
1924
2046
|
if (cand.materializedAs) addEdge(candId, `wi:${cand.materializedAs}`, "materialized_as");
|
|
1925
2047
|
}
|
|
1926
2048
|
}
|
|
2049
|
+
const resourceTitleById = /* @__PURE__ */ new Map();
|
|
2050
|
+
for (const r of getResources(dir)) {
|
|
2051
|
+
resourceTitleById.set(r.id, r.title);
|
|
2052
|
+
addNode({
|
|
2053
|
+
id: `resource:${r.id}`,
|
|
2054
|
+
type: "project-resource",
|
|
2055
|
+
label: r.title ? `${r.id} ${r.title}`.trim() : r.id,
|
|
2056
|
+
path: r.path
|
|
2057
|
+
});
|
|
2058
|
+
}
|
|
1927
2059
|
for (const wi of selectedWIs) {
|
|
1928
2060
|
const id = wi.id || wi.title;
|
|
1929
2061
|
if (!id || !id.trim()) continue;
|
|
@@ -1948,6 +2080,12 @@ function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
1948
2080
|
addNode({ id: capId, type: "capability", label: cap });
|
|
1949
2081
|
addEdge(wiNodeId, capId, "implements");
|
|
1950
2082
|
}
|
|
2083
|
+
for (const rel of parseWorkItemResources(wi.rawFrontmatter)) {
|
|
2084
|
+
const resId = `resource:${rel.id}`;
|
|
2085
|
+
const title = resourceTitleById.get(rel.id);
|
|
2086
|
+
addNode({ id: resId, type: "project-resource", label: title ? `${rel.id} ${title}`.trim() : rel.id });
|
|
2087
|
+
addEdge(wiNodeId, resId, RESOURCE_ROLE_EDGE[rel.role] ?? "uses");
|
|
2088
|
+
}
|
|
1951
2089
|
for (const dec of wi.decisions) {
|
|
1952
2090
|
if (!dec || !dec.trim()) continue;
|
|
1953
2091
|
const adrId = `adr:${dec}`;
|
|
@@ -2222,7 +2360,7 @@ function loadGraphHints(dir) {
|
|
|
2222
2360
|
}
|
|
2223
2361
|
|
|
2224
2362
|
// src/services/installed-skills.ts
|
|
2225
|
-
import
|
|
2363
|
+
import matter5 from "gray-matter";
|
|
2226
2364
|
var SKILLS_DIR = join("knowledge", "skills");
|
|
2227
2365
|
function discoverInstalledSkills(dir) {
|
|
2228
2366
|
const base = join(dir, SKILLS_DIR);
|
|
@@ -2232,7 +2370,7 @@ function discoverInstalledSkills(dir) {
|
|
|
2232
2370
|
const skillFile = join(base, entry, "skill.md");
|
|
2233
2371
|
if (!isFile(skillFile)) continue;
|
|
2234
2372
|
try {
|
|
2235
|
-
const { data } =
|
|
2373
|
+
const { data } = matter5(readFile(skillFile));
|
|
2236
2374
|
if (data.type && String(data.type) !== "skill") continue;
|
|
2237
2375
|
const id = String(data.id ?? entry);
|
|
2238
2376
|
out.push({
|
|
@@ -3743,7 +3881,7 @@ function deriveDeliveryCompletedStatus(dir) {
|
|
|
3743
3881
|
}
|
|
3744
3882
|
|
|
3745
3883
|
// src/core/assets.ts
|
|
3746
|
-
import
|
|
3884
|
+
import matter6 from "gray-matter";
|
|
3747
3885
|
|
|
3748
3886
|
// src/core/version.ts
|
|
3749
3887
|
import { fileURLToPath } from "url";
|
|
@@ -3898,8 +4036,13 @@ dependencies.
|
|
|
3898
4036
|
flags, content/copy, authentication/authorization, notifications, analytics, documentation,
|
|
3899
4037
|
operations/release \u2014 as affected, reviewed-not-affected, unknown, or not-applicable.
|
|
3900
4038
|
4. **Module review** \u2014 for multirepo, evaluate each mapped module with the same statuses.
|
|
3901
|
-
5. **
|
|
3902
|
-
|
|
4039
|
+
5. **Resource review** \u2014 ask: does this change need to observe, modify, validate or deliver against a
|
|
4040
|
+
known external resource of the project (a Project Resource under \`knowledge/tech/resources/\` \u2014
|
|
4041
|
+
database, cloud, API, queue, storage\u2026)? If so, declare it in the WI front matter \`resources:\` with
|
|
4042
|
+
a role (\`affected\`, \`implementation\`, \`validation\`, \`delivery\`). Resources are external systems,
|
|
4043
|
+
distinct from \`affected_modules\` (code). Not every WI needs resources (e.g. a CSS change does not).
|
|
4044
|
+
6. **Completeness review** \u2014 confirm: outcome covered, journey covered, modules assessed, resources
|
|
4045
|
+
assessed, unknowns visible, acceptance criteria end-to-end, scope and out-of-scope coherent.
|
|
3903
4046
|
|
|
3904
4047
|
## Rules
|
|
3905
4048
|
|
|
@@ -3910,6 +4053,8 @@ dependencies.
|
|
|
3910
4053
|
- Include at least one end-to-end acceptance criterion for user-facing changes.
|
|
3911
4054
|
- Do not reduce a product intent to the first technical implementation found.
|
|
3912
4055
|
- Evaluate surfaces and modules before proposing files.
|
|
4056
|
+
- Consider Project Resources when the scope justifies it; never invent resources not backed by
|
|
4057
|
+
project knowledge, and keep \`resources\` (external systems) separate from \`affected_modules\` (code).
|
|
3913
4058
|
- This skill refines scope and acceptance criteria but does not approve implementation readiness.
|
|
3914
4059
|
Readiness requires human confirmation through \`kaddo ready\` or the MCP \`mark_work_item_ready\` action.
|
|
3915
4060
|
|
|
@@ -6949,7 +7094,7 @@ function canonicalSkills() {
|
|
|
6949
7094
|
}
|
|
6950
7095
|
function versionOf(content) {
|
|
6951
7096
|
try {
|
|
6952
|
-
const v =
|
|
7097
|
+
const v = matter6(content).data.version;
|
|
6953
7098
|
return v === void 0 || v === null ? null : String(v);
|
|
6954
7099
|
} catch {
|
|
6955
7100
|
return null;
|
|
@@ -7640,7 +7785,7 @@ function buildProjectRoute(dir) {
|
|
|
7640
7785
|
}
|
|
7641
7786
|
|
|
7642
7787
|
// src/core/metadata-health.ts
|
|
7643
|
-
import
|
|
7788
|
+
import matter7 from "gray-matter";
|
|
7644
7789
|
var KNOWLEDGE_FILES2 = [
|
|
7645
7790
|
"knowledge/business/business.md",
|
|
7646
7791
|
"knowledge/product/product.md",
|
|
@@ -7660,7 +7805,7 @@ function analyzeMetadataHealth(dir) {
|
|
|
7660
7805
|
let data;
|
|
7661
7806
|
try {
|
|
7662
7807
|
const raw = readFile(p);
|
|
7663
|
-
data =
|
|
7808
|
+
data = matter7(raw).data;
|
|
7664
7809
|
} catch {
|
|
7665
7810
|
continue;
|
|
7666
7811
|
}
|
|
@@ -7692,7 +7837,7 @@ function analyzeMetadataHealth(dir) {
|
|
|
7692
7837
|
if (isFile(p) && entry.endsWith(".md")) {
|
|
7693
7838
|
try {
|
|
7694
7839
|
const raw = readFile(p);
|
|
7695
|
-
const fm =
|
|
7840
|
+
const fm = matter7(raw).data;
|
|
7696
7841
|
if (fm.status === "done") {
|
|
7697
7842
|
const rel = p.replace(dir + "/", "").replace(dir + "\\", "").replace(/\\/g, "/");
|
|
7698
7843
|
findings.push({
|
|
@@ -8289,7 +8434,7 @@ function analyzeCrossRepoEvidence(input) {
|
|
|
8289
8434
|
}
|
|
8290
8435
|
|
|
8291
8436
|
// src/core/work-items.ts
|
|
8292
|
-
import
|
|
8437
|
+
import matter8 from "gray-matter";
|
|
8293
8438
|
|
|
8294
8439
|
// src/core/system-topology.ts
|
|
8295
8440
|
import { parse as parseYaml8, stringify as stringifyYaml4 } from "yaml";
|
|
@@ -8659,6 +8804,8 @@ function getWorkItem(dir, workItemId) {
|
|
|
8659
8804
|
path: match.relPath,
|
|
8660
8805
|
// Faithful source of truth: the artifact body already read above, not reconstructed (WI-025).
|
|
8661
8806
|
markdownBody: body.trim(),
|
|
8807
|
+
// External systems this WI relates to (WI-030), separate from affectedModules (code).
|
|
8808
|
+
resources: parseWorkItemResources(fm),
|
|
8662
8809
|
...parseSystemImpact(dir, fm)
|
|
8663
8810
|
};
|
|
8664
8811
|
return { ...detail, refinement: computeRefinementStatus(detail) };
|
|
@@ -8723,7 +8870,7 @@ function parseOriginalSnapshot(fm) {
|
|
|
8723
8870
|
function readBody(filePath) {
|
|
8724
8871
|
try {
|
|
8725
8872
|
const raw = readFile(filePath);
|
|
8726
|
-
return
|
|
8873
|
+
return matter8(raw).content;
|
|
8727
8874
|
} catch {
|
|
8728
8875
|
return "";
|
|
8729
8876
|
}
|
|
@@ -8890,7 +9037,7 @@ function parseRelatedKnowledge(fm, knowledgeById) {
|
|
|
8890
9037
|
import fs3 from "fs";
|
|
8891
9038
|
import path3 from "path";
|
|
8892
9039
|
import crypto2 from "crypto";
|
|
8893
|
-
import
|
|
9040
|
+
import matter9 from "gray-matter";
|
|
8894
9041
|
|
|
8895
9042
|
// src/core/knowledge-levels.ts
|
|
8896
9043
|
var WORK_ITEM_TYPES2 = ["feature", "bugfix", "hotfix", "spike", "chore"];
|
|
@@ -9297,7 +9444,7 @@ function applyFrontmatter(data, input) {
|
|
|
9297
9444
|
return next;
|
|
9298
9445
|
}
|
|
9299
9446
|
function serialize(data, body) {
|
|
9300
|
-
return
|
|
9447
|
+
return matter9.stringify(`
|
|
9301
9448
|
${body.trim()}
|
|
9302
9449
|
`, data);
|
|
9303
9450
|
}
|
|
@@ -9356,7 +9503,7 @@ function toInput(data, content) {
|
|
|
9356
9503
|
function getWorkItemForEdit(dir, id) {
|
|
9357
9504
|
const { filePath, relPath } = findArtifact(dir, id);
|
|
9358
9505
|
const raw = readFile(filePath);
|
|
9359
|
-
const { data, content } =
|
|
9506
|
+
const { data, content } = matter9(raw);
|
|
9360
9507
|
const status = lifecycleStateOf({ status: String(data.status ?? ""), filePath });
|
|
9361
9508
|
const input = toInput(data, content);
|
|
9362
9509
|
const editable = EDITABLE_STATES.includes(status);
|
|
@@ -9449,7 +9596,7 @@ function updateWorkItem(dir, id, input, expectedRevision) {
|
|
|
9449
9596
|
if (revisionOf(raw) !== expectedRevision) {
|
|
9450
9597
|
throw new WorkItemWriteError("WORK_ITEM_CONFLICT", "This Work Item changed outside Kaddo Admin. Reload the latest version before saving.");
|
|
9451
9598
|
}
|
|
9452
|
-
const { data, content } =
|
|
9599
|
+
const { data, content } = matter9(raw);
|
|
9453
9600
|
const status = lifecycleStateOf({ status: String(data.status ?? ""), filePath });
|
|
9454
9601
|
if (!EDITABLE_STATES.includes(status)) {
|
|
9455
9602
|
throw new WorkItemWriteError("WORK_ITEM_NOT_EDITABLE", `A ${status} Work Item cannot be edited. Reopen it as Draft first.`);
|
|
@@ -9463,7 +9610,7 @@ function updateWorkItem(dir, id, input, expectedRevision) {
|
|
|
9463
9610
|
function validateWorkItem(dir, id) {
|
|
9464
9611
|
const { filePath } = findArtifact(dir, id);
|
|
9465
9612
|
const raw = readFile(filePath);
|
|
9466
|
-
const { data, content } =
|
|
9613
|
+
const { data, content } = matter9(raw);
|
|
9467
9614
|
const input = toInput(data, content);
|
|
9468
9615
|
const findings = [];
|
|
9469
9616
|
const modules = validModuleIds(dir);
|
|
@@ -9516,7 +9663,7 @@ function transitionWorkItem(dir, id, to, expectedRevision) {
|
|
|
9516
9663
|
if (revisionOf(raw) !== expectedRevision) {
|
|
9517
9664
|
throw new WorkItemWriteError("WORK_ITEM_CONFLICT", "This Work Item changed outside Kaddo Admin. Reload the latest version before continuing.");
|
|
9518
9665
|
}
|
|
9519
|
-
const { data, content } =
|
|
9666
|
+
const { data, content } = matter9(raw);
|
|
9520
9667
|
const from = lifecycleStateOf({ status: String(data.status ?? ""), filePath });
|
|
9521
9668
|
if (!(ALLOWED[from] ?? []).includes(to)) {
|
|
9522
9669
|
throw new WorkItemWriteError("INVALID_TRANSITION", `Cannot transition a ${from} Work Item to ${to}.`);
|
|
@@ -10013,6 +10160,7 @@ function buildImplementationHandoff(dir, workItemId) {
|
|
|
10013
10160
|
const affectedModules = match.affectedModules;
|
|
10014
10161
|
const domains = match.domains;
|
|
10015
10162
|
const scopeConfidence = match.scopeConfidence;
|
|
10163
|
+
const wiResources = parseWorkItemResources(match.rawFrontmatter);
|
|
10016
10164
|
const lines = [
|
|
10017
10165
|
`Implement Work Item ${wiId} \u2014 "${wiTitle}" \u2014 in project "${projectName}" using Kaddo.`,
|
|
10018
10166
|
"",
|
|
@@ -10102,6 +10250,41 @@ function buildImplementationHandoff(dir, workItemId) {
|
|
|
10102
10250
|
"Do not copy all legacy knowledge \u2014 assemble proportionally to scope."
|
|
10103
10251
|
);
|
|
10104
10252
|
}
|
|
10253
|
+
if (wiResources.length > 0) {
|
|
10254
|
+
lines.push(
|
|
10255
|
+
"",
|
|
10256
|
+
"--- Relevant Resources ---",
|
|
10257
|
+
"",
|
|
10258
|
+
"This Work Item relates to external project resources. The handoff INFORMS you about them \u2014 it",
|
|
10259
|
+
"never connects to them, runs any interface, or reveals credential values. Respect each boundary."
|
|
10260
|
+
);
|
|
10261
|
+
for (const rel of wiResources) {
|
|
10262
|
+
const res = getResource(dir, rel.id);
|
|
10263
|
+
if (!res) {
|
|
10264
|
+
lines.push("", `- ${rel.id} (role: ${rel.role}) \u2014 definition not found under knowledge/tech/resources/.`);
|
|
10265
|
+
continue;
|
|
10266
|
+
}
|
|
10267
|
+
lines.push("", `- ${res.id} \u2014 ${res.title} (role: ${rel.role})`);
|
|
10268
|
+
if (res.resourceType || res.provider) {
|
|
10269
|
+
lines.push(` type: ${res.resourceType ?? "\u2014"}${res.provider ? ` \xB7 provider: ${res.provider}` : ""}`);
|
|
10270
|
+
}
|
|
10271
|
+
if (res.purpose) lines.push(` purpose: ${res.purpose}`);
|
|
10272
|
+
if (res.environments.length > 0) lines.push(` environments: ${res.environments.join(", ")}`);
|
|
10273
|
+
if (res.interfaces.length > 0) {
|
|
10274
|
+
const ifaces = res.interfaces.map((i) => i.tool || i.provider ? `${i.type} (${i.tool ?? i.provider})` : i.type);
|
|
10275
|
+
lines.push(` interfaces: ${ifaces.join(", ")}`);
|
|
10276
|
+
}
|
|
10277
|
+
for (const [env, ops] of Object.entries(res.boundaries)) {
|
|
10278
|
+
lines.push(` boundary (${env}): ${ops.join(", ")}`);
|
|
10279
|
+
}
|
|
10280
|
+
if (res.authRefs.length > 0) lines.push(` auth references (names only): ${res.authRefs.join(", ")}`);
|
|
10281
|
+
}
|
|
10282
|
+
lines.push(
|
|
10283
|
+
"",
|
|
10284
|
+
"Treat these as knowledge, not availability: an interface being declared does not mean it is",
|
|
10285
|
+
"installed or connected. Do not execute any interface or migration without explicit human confirmation."
|
|
10286
|
+
);
|
|
10287
|
+
}
|
|
10105
10288
|
lines.push(
|
|
10106
10289
|
"",
|
|
10107
10290
|
"--- Implementation Plan ---",
|
|
@@ -10122,6 +10305,7 @@ function buildImplementationHandoff(dir, workItemId) {
|
|
|
10122
10305
|
projectName,
|
|
10123
10306
|
lifecycle,
|
|
10124
10307
|
affectedModules,
|
|
10308
|
+
resources: wiResources,
|
|
10125
10309
|
domains,
|
|
10126
10310
|
scopeConfidence,
|
|
10127
10311
|
hasUnmaterializedDecisions: unmaterialized,
|
|
@@ -10358,7 +10542,7 @@ function deriveImplementationStatus(repos) {
|
|
|
10358
10542
|
// src/core/work-item-import.ts
|
|
10359
10543
|
import crypto3 from "crypto";
|
|
10360
10544
|
import fs4 from "fs";
|
|
10361
|
-
import
|
|
10545
|
+
import matter10 from "gray-matter";
|
|
10362
10546
|
var MAX_INPUT_BYTES = 102400;
|
|
10363
10547
|
var LIFECYCLE_FIELDS = /* @__PURE__ */ new Set([
|
|
10364
10548
|
"id",
|
|
@@ -10380,7 +10564,7 @@ function detectFormat(raw) {
|
|
|
10380
10564
|
if (!trimmed) throw new ImportError("EMPTY_INPUT", "Import content is empty.");
|
|
10381
10565
|
if (trimmed.startsWith("---")) {
|
|
10382
10566
|
try {
|
|
10383
|
-
const { data } =
|
|
10567
|
+
const { data } = matter10(trimmed);
|
|
10384
10568
|
if (data && typeof data === "object" && Object.keys(data).length > 0) {
|
|
10385
10569
|
const d = data;
|
|
10386
10570
|
if (d.type === "work-item" || d.id && typeof d.id === "string" && /^WI-\d+/.test(d.id)) {
|
|
@@ -10402,7 +10586,7 @@ function parseContent(raw) {
|
|
|
10402
10586
|
let bodyText = trimmed;
|
|
10403
10587
|
if (format === "kaddo-frontmatter" || format === "markdown-frontmatter") {
|
|
10404
10588
|
try {
|
|
10405
|
-
const parsed =
|
|
10589
|
+
const parsed = matter10(trimmed);
|
|
10406
10590
|
frontmatterFields = parsed.data ?? {};
|
|
10407
10591
|
bodyText = parsed.content.trim();
|
|
10408
10592
|
} catch {
|
|
@@ -10499,7 +10683,7 @@ function findDuplicateByHash(dir, hash) {
|
|
|
10499
10683
|
const raw = readFile(item.filePath);
|
|
10500
10684
|
if (!raw) continue;
|
|
10501
10685
|
try {
|
|
10502
|
-
const { data } =
|
|
10686
|
+
const { data } = matter10(raw);
|
|
10503
10687
|
const source = data?.source;
|
|
10504
10688
|
if (source && typeof source === "object" && !Array.isArray(source)) {
|
|
10505
10689
|
const s = source;
|
|
@@ -10608,7 +10792,7 @@ var ImportError = class extends Error {
|
|
|
10608
10792
|
};
|
|
10609
10793
|
|
|
10610
10794
|
// src/services/integrations.ts
|
|
10611
|
-
import
|
|
10795
|
+
import matter11 from "gray-matter";
|
|
10612
10796
|
import { parse as parseYaml9, stringify as stringifyYaml5 } from "yaml";
|
|
10613
10797
|
|
|
10614
10798
|
// ../integrations/src/errors.ts
|
|
@@ -11950,7 +12134,7 @@ function findLinkedWorkItem(dir, integrationId, externalId) {
|
|
|
11950
12134
|
for (const art of discoverWorkItems(dir)) {
|
|
11951
12135
|
let data;
|
|
11952
12136
|
try {
|
|
11953
|
-
data =
|
|
12137
|
+
data = matter11(readFile(art.filePath)).data;
|
|
11954
12138
|
} catch {
|
|
11955
12139
|
continue;
|
|
11956
12140
|
}
|
|
@@ -11966,7 +12150,7 @@ function buildImportIndex(dir) {
|
|
|
11966
12150
|
for (const art of discoverWorkItems(dir)) {
|
|
11967
12151
|
let data;
|
|
11968
12152
|
try {
|
|
11969
|
-
data =
|
|
12153
|
+
data = matter11(readFile(art.filePath)).data;
|
|
11970
12154
|
} catch {
|
|
11971
12155
|
continue;
|
|
11972
12156
|
}
|
|
@@ -12142,7 +12326,7 @@ function getStatus(dir) {
|
|
|
12142
12326
|
}
|
|
12143
12327
|
|
|
12144
12328
|
// src/core/initiative-write.ts
|
|
12145
|
-
import
|
|
12329
|
+
import matter12 from "gray-matter";
|
|
12146
12330
|
var WORK_ITEMS_DIR2 = "knowledge/delivery/work-items";
|
|
12147
12331
|
var DRAFT_DIR = `${WORK_ITEMS_DIR2}/draft`;
|
|
12148
12332
|
var ROADMAP_PATH2 = "knowledge/delivery/roadmap.md";
|
|
@@ -12255,7 +12439,7 @@ function buildInitiativeContent(id, input) {
|
|
|
12255
12439
|
if (input.priority) data.priority = input.priority;
|
|
12256
12440
|
if (input.source) data.source = input.source;
|
|
12257
12441
|
if (input.sourceId) data.source_id = input.sourceId;
|
|
12258
|
-
return
|
|
12442
|
+
return matter12.stringify("\n" + (input.body ?? defaultBody(input.title.trim())), data);
|
|
12259
12443
|
}
|
|
12260
12444
|
function createInitiative(dir, input) {
|
|
12261
12445
|
if (!input.title?.trim()) throw new InitiativeWriteError("Initiative title is required.");
|
|
@@ -12279,10 +12463,10 @@ function transitionInitiative(dir, id, to) {
|
|
|
12279
12463
|
throw new InitiativeWriteError(`Invalid transition ${ini.status} \u2192 ${to}.`);
|
|
12280
12464
|
}
|
|
12281
12465
|
const raw = readFile(ini.filePath);
|
|
12282
|
-
const { data, content } =
|
|
12466
|
+
const { data, content } = matter12(raw, {});
|
|
12283
12467
|
data.status = to;
|
|
12284
12468
|
if (to === "completed") data.completed_at = today();
|
|
12285
|
-
const newContent =
|
|
12469
|
+
const newContent = matter12.stringify(content, data);
|
|
12286
12470
|
writeFile(ini.filePath, newContent);
|
|
12287
12471
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
12288
12472
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after transition.");
|
|
@@ -12292,7 +12476,7 @@ function addCandidate(dir, id, candidate) {
|
|
|
12292
12476
|
const ini = getInitiative(dir, id);
|
|
12293
12477
|
if (!ini) throw new InitiativeWriteError(`Initiative ${id} not found.`);
|
|
12294
12478
|
const raw = readFile(ini.filePath);
|
|
12295
|
-
const { data, content } =
|
|
12479
|
+
const { data, content } = matter12(raw, {});
|
|
12296
12480
|
const existing = Array.isArray(data.candidates) ? data.candidates : [];
|
|
12297
12481
|
const fallbackId = `WI-CANDIDATE-${String(existing.length + 1).padStart(3, "0")}`;
|
|
12298
12482
|
const normalized = normalizeCandidate(candidate, fallbackId);
|
|
@@ -12300,7 +12484,7 @@ function addCandidate(dir, id, candidate) {
|
|
|
12300
12484
|
throw new InitiativeWriteError(`Candidate ${normalized.id} already exists in ${id}.`);
|
|
12301
12485
|
}
|
|
12302
12486
|
data.candidates = [...existing, candidateToData(normalized)];
|
|
12303
|
-
const newContent =
|
|
12487
|
+
const newContent = matter12.stringify(content, data);
|
|
12304
12488
|
writeFile(ini.filePath, newContent);
|
|
12305
12489
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
12306
12490
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after adding a candidate.");
|
|
@@ -12310,7 +12494,7 @@ function updateInitiative(dir, id, patch) {
|
|
|
12310
12494
|
const ini = getInitiative(dir, id);
|
|
12311
12495
|
if (!ini) throw new InitiativeWriteError(`Initiative ${id} not found.`);
|
|
12312
12496
|
const raw = readFile(ini.filePath);
|
|
12313
|
-
const { data, content } =
|
|
12497
|
+
const { data, content } = matter12(raw, {});
|
|
12314
12498
|
if (patch.title !== void 0) {
|
|
12315
12499
|
if (!patch.title.trim()) throw new InitiativeWriteError("Initiative title cannot be empty.");
|
|
12316
12500
|
data.title = patch.title.trim();
|
|
@@ -12320,7 +12504,7 @@ function updateInitiative(dir, id, patch) {
|
|
|
12320
12504
|
if (patch.knowledgeLevel !== void 0) data.knowledge_level = patch.knowledgeLevel;
|
|
12321
12505
|
if (patch.domains !== void 0) data.domains = patch.domains;
|
|
12322
12506
|
if (patch.relatedCapabilities !== void 0) data.related_capabilities = patch.relatedCapabilities;
|
|
12323
|
-
const newContent =
|
|
12507
|
+
const newContent = matter12.stringify(content, data);
|
|
12324
12508
|
writeFile(ini.filePath, newContent);
|
|
12325
12509
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
12326
12510
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after update.");
|
|
@@ -12338,10 +12522,10 @@ function addExternalLink(dir, id, link) {
|
|
|
12338
12522
|
throw new InitiativeWriteError(`External link ${link.integration}:${link.externalId} already exists on ${id}.`);
|
|
12339
12523
|
}
|
|
12340
12524
|
const raw = readFile(ini.filePath);
|
|
12341
|
-
const { data, content } =
|
|
12525
|
+
const { data, content } = matter12(raw, {});
|
|
12342
12526
|
const existing = Array.isArray(data.external_links) ? data.external_links : [];
|
|
12343
12527
|
data.external_links = [...existing, externalLinkToData(link)];
|
|
12344
|
-
const newContent =
|
|
12528
|
+
const newContent = matter12.stringify(content, data);
|
|
12345
12529
|
writeFile(ini.filePath, newContent);
|
|
12346
12530
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
12347
12531
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after adding an external link.");
|
|
@@ -12410,7 +12594,7 @@ function buildWorkItemContent(wiId, iniId, candidate) {
|
|
|
12410
12594
|
"_What did we learn? Update after completion._",
|
|
12411
12595
|
""
|
|
12412
12596
|
].join("\n");
|
|
12413
|
-
return
|
|
12597
|
+
return matter12.stringify("\n" + body, data);
|
|
12414
12598
|
}
|
|
12415
12599
|
function materializeCandidate(dir, id, candidateId) {
|
|
12416
12600
|
const ini = getInitiative(dir, id);
|
|
@@ -12427,13 +12611,13 @@ function materializeCandidate(dir, id, candidateId) {
|
|
|
12427
12611
|
ensureDir(join(dir, DRAFT_DIR));
|
|
12428
12612
|
writeFile(join(dir, DRAFT_DIR, fileName), buildWorkItemContent(wiId, ini.id, candidate));
|
|
12429
12613
|
const raw = readFile(ini.filePath);
|
|
12430
|
-
const { data, content } =
|
|
12614
|
+
const { data, content } = matter12(raw, {});
|
|
12431
12615
|
const cands = Array.isArray(data.candidates) ? data.candidates : [];
|
|
12432
12616
|
for (const c of cands) {
|
|
12433
12617
|
if (c && typeof c === "object" && String(c.id) === candidateId) c.materialized_as = wiId;
|
|
12434
12618
|
}
|
|
12435
12619
|
data.candidates = cands;
|
|
12436
|
-
const newContent =
|
|
12620
|
+
const newContent = matter12.stringify(content, data);
|
|
12437
12621
|
writeFile(ini.filePath, newContent);
|
|
12438
12622
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
12439
12623
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after materialization.");
|
|
@@ -12586,10 +12770,14 @@ export {
|
|
|
12586
12770
|
INITIATIVE_STATES,
|
|
12587
12771
|
INITIATIVE_TRANSITIONS,
|
|
12588
12772
|
INTEGRATIONS_FILE,
|
|
12773
|
+
INTERFACE_TYPES,
|
|
12589
12774
|
ImportError,
|
|
12590
12775
|
InitiativeWriteError,
|
|
12591
12776
|
IntegrationError,
|
|
12592
12777
|
IntegrationServiceError,
|
|
12778
|
+
RESOURCE_ARTIFACT_TYPE,
|
|
12779
|
+
RESOURCE_ROLES,
|
|
12780
|
+
RESOURCE_TYPES,
|
|
12593
12781
|
TOPOLOGY_FILE,
|
|
12594
12782
|
TopologyWriteError,
|
|
12595
12783
|
WorkItemNotFoundError,
|
|
@@ -12645,6 +12833,8 @@ export {
|
|
|
12645
12833
|
getIntegration,
|
|
12646
12834
|
getIntegrationFilters,
|
|
12647
12835
|
getIntegrationSecretStatus,
|
|
12836
|
+
getResource,
|
|
12837
|
+
getResources,
|
|
12648
12838
|
getSystemMapProjection,
|
|
12649
12839
|
getSystemNeighbors,
|
|
12650
12840
|
getSystemNodeContext,
|
|
@@ -12679,6 +12869,7 @@ export {
|
|
|
12679
12869
|
parseContent,
|
|
12680
12870
|
parseInitiative,
|
|
12681
12871
|
parseSuccessCriteria,
|
|
12872
|
+
parseWorkItemResources,
|
|
12682
12873
|
persistConsent,
|
|
12683
12874
|
previewImport,
|
|
12684
12875
|
readFile,
|