@kylewadegrove/cutline-mcp-cli-staging 0.6.0 → 0.7.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.
|
@@ -1827,19 +1827,57 @@ async function extractConstraintsFromDoc(docId, text, generateFn, options = {})
|
|
|
1827
1827
|
return convertExtractedToNodes(docId, extracted, options);
|
|
1828
1828
|
}
|
|
1829
1829
|
|
|
1830
|
+
// ../mcp/dist/mcp/src/context-graph/types.js
|
|
1831
|
+
var ENTITY_TYPES = [
|
|
1832
|
+
"feature",
|
|
1833
|
+
"component",
|
|
1834
|
+
"data_type",
|
|
1835
|
+
"cause",
|
|
1836
|
+
"requirement"
|
|
1837
|
+
];
|
|
1838
|
+
var EDGE_TYPES = [
|
|
1839
|
+
"REQUIRES",
|
|
1840
|
+
// Feature -> Component|Requirement
|
|
1841
|
+
"HANDLES",
|
|
1842
|
+
// Component -> DataType
|
|
1843
|
+
"GOVERNED_BY",
|
|
1844
|
+
// DataType -> Constraint
|
|
1845
|
+
"BOUNDED_BY",
|
|
1846
|
+
// Component|Feature -> Constraint
|
|
1847
|
+
"DEPENDS_ON",
|
|
1848
|
+
// Component -> Component
|
|
1849
|
+
"CAUSES"
|
|
1850
|
+
// Cause -> Feature
|
|
1851
|
+
];
|
|
1852
|
+
function isEntityType(value) {
|
|
1853
|
+
return ENTITY_TYPES.includes(value);
|
|
1854
|
+
}
|
|
1855
|
+
function isEdgeType(value) {
|
|
1856
|
+
return EDGE_TYPES.includes(value);
|
|
1857
|
+
}
|
|
1858
|
+
function normalizeEntityType(value, fallback = "component") {
|
|
1859
|
+
return isEntityType(value) ? value : fallback;
|
|
1860
|
+
}
|
|
1861
|
+
function normalizeEdgeType(value, fallback = "DEPENDS_ON") {
|
|
1862
|
+
return isEdgeType(value) ? value : fallback;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1830
1865
|
// ../mcp/dist/mcp/src/adapters/requirements-adapter.js
|
|
1831
1866
|
var EXTRACTION_SYSTEM_PROMPT2 = `You are a requirements graph extractor. Given product requirements (PRD, user stories, specs), extract a structured graph of entities, relationships, and non-functional requirements.
|
|
1832
1867
|
|
|
1833
1868
|
Extract three things:
|
|
1834
1869
|
|
|
1835
1870
|
1. **Entities** \u2014 the nouns of the system:
|
|
1871
|
+
- "cause": Why a behavior/guardrail is needed (risk source, incident class, business driver)
|
|
1836
1872
|
- "feature": User-facing capabilities (e.g., "Document Upload", "User Authentication")
|
|
1873
|
+
- "requirement": Verifiable obligations that must hold (functional or non-functional)
|
|
1837
1874
|
- "component": Technical building blocks (e.g., "API Gateway", "User Database", "S3 Storage")
|
|
1838
1875
|
- "data_type": Data categories with compliance implications (e.g., "PII", "Financial Document", "Session Token")
|
|
1839
1876
|
Give each entity a concise name, type, optional description, and aliases (alternate names).
|
|
1840
1877
|
|
|
1841
1878
|
2. **Relationships** between entities:
|
|
1842
|
-
-
|
|
1879
|
+
- CAUSES: Cause -> Feature (e.g., "Credential stuffing risk" CAUSES "Adaptive login controls")
|
|
1880
|
+
- REQUIRES: Feature -> Requirement or Feature -> Component
|
|
1843
1881
|
- HANDLES: Component -> DataType (e.g., "User Database" HANDLES "PII")
|
|
1844
1882
|
- DEPENDS_ON: Component -> Component (e.g., "API Gateway" DEPENDS_ON "Auth Service")
|
|
1845
1883
|
|
|
@@ -1860,7 +1898,7 @@ var EXTRACTION_SCHEMA2 = {
|
|
|
1860
1898
|
type: "object",
|
|
1861
1899
|
properties: {
|
|
1862
1900
|
name: { type: "string" },
|
|
1863
|
-
type: { type: "string", enum: ["feature", "component", "data_type"] },
|
|
1901
|
+
type: { type: "string", enum: ["feature", "component", "data_type", "cause", "requirement"] },
|
|
1864
1902
|
description: { type: "string" },
|
|
1865
1903
|
aliases: { type: "array", items: { type: "string" } }
|
|
1866
1904
|
},
|
|
@@ -1874,7 +1912,7 @@ var EXTRACTION_SCHEMA2 = {
|
|
|
1874
1912
|
properties: {
|
|
1875
1913
|
source_name: { type: "string" },
|
|
1876
1914
|
target_name: { type: "string" },
|
|
1877
|
-
relationship: { type: "string", enum: ["REQUIRES", "HANDLES", "DEPENDS_ON"] }
|
|
1915
|
+
relationship: { type: "string", enum: ["CAUSES", "REQUIRES", "HANDLES", "DEPENDS_ON"] }
|
|
1878
1916
|
},
|
|
1879
1917
|
required: ["source_name", "target_name", "relationship"]
|
|
1880
1918
|
}
|
|
@@ -1968,7 +2006,7 @@ function buildGraph(sourceId, extracted, existing = []) {
|
|
|
1968
2006
|
resolved.set(ext.name.toLowerCase(), id);
|
|
1969
2007
|
return {
|
|
1970
2008
|
id,
|
|
1971
|
-
type: ext.type,
|
|
2009
|
+
type: normalizeEntityType(ext.type, "component"),
|
|
1972
2010
|
name: ext.name,
|
|
1973
2011
|
aliases: ext.aliases ?? [],
|
|
1974
2012
|
description: ext.description,
|
|
@@ -1994,10 +2032,10 @@ function buildGraph(sourceId, extracted, existing = []) {
|
|
|
1994
2032
|
edges.push({
|
|
1995
2033
|
id: `${sourceId}_edge_${slugify(rel.source_name)}_${rel.relationship}_${slugify(rel.target_name)}`,
|
|
1996
2034
|
source_id: srcId,
|
|
1997
|
-
source_type: srcEntity?.type ?? "component",
|
|
2035
|
+
source_type: normalizeEntityType(srcEntity?.type ?? "component", "component"),
|
|
1998
2036
|
target_id: tgtId,
|
|
1999
|
-
target_type: tgtEntity?.type ?? "component",
|
|
2000
|
-
edge_type: rel.relationship
|
|
2037
|
+
target_type: normalizeEntityType(tgtEntity?.type ?? "component", "component"),
|
|
2038
|
+
edge_type: normalizeEdgeType(rel.relationship, "DEPENDS_ON")
|
|
2001
2039
|
});
|
|
2002
2040
|
}
|
|
2003
2041
|
const constraints = [];
|
|
@@ -2033,10 +2071,10 @@ function buildGraph(sourceId, extracted, existing = []) {
|
|
|
2033
2071
|
edges.push({
|
|
2034
2072
|
id: `${sourceId}_nfr_edge_${i}_${slugify(targetName)}`,
|
|
2035
2073
|
source_id: targetId,
|
|
2036
|
-
source_type: targetEntity?.type ?? "component",
|
|
2074
|
+
source_type: normalizeEntityType(targetEntity?.type ?? "component", "component"),
|
|
2037
2075
|
target_id: constraintId,
|
|
2038
2076
|
target_type: "constraint",
|
|
2039
|
-
edge_type: nfr.relationship
|
|
2077
|
+
edge_type: normalizeEdgeType(nfr.relationship, "BOUNDED_BY")
|
|
2040
2078
|
});
|
|
2041
2079
|
}
|
|
2042
2080
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kylewadegrove/cutline-mcp-cli-staging",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "CLI and MCP servers for Cutline — authenticate, then run constraint-aware MCP servers in Cursor or any MCP client.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|