groundwork-mcp 0.0.0-stage → 0.1.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/index.js ADDED
@@ -0,0 +1,181 @@
1
+ import {
2
+ COLLECTIONS,
3
+ COLLECTION_KEYS,
4
+ COLLECTION_KIND,
5
+ CONFIG_FILE,
6
+ ConfigError,
7
+ DIR,
8
+ EXPERIMENT_STATUS,
9
+ FINDING_CONFIDENCE,
10
+ HYPOTHESIS_STATUS,
11
+ ID_PREFIX,
12
+ INSTRUCTIONS,
13
+ KIND,
14
+ LOCAL_ID,
15
+ METHOD,
16
+ PRIORITY,
17
+ REQUIREMENT_KIND,
18
+ REQUIREMENT_ORIGIN,
19
+ SCHEMA_VERSION,
20
+ SENTIMENT,
21
+ SOURCE,
22
+ assignIds,
23
+ buildServer,
24
+ canObsolete,
25
+ canSendToDelivery,
26
+ canUpdateInPlace,
27
+ composeKnowWhen,
28
+ composeStatement,
29
+ computeVerdict,
30
+ configPath,
31
+ configSchema,
32
+ defaultConfig,
33
+ describeSuccess,
34
+ diffCollections,
35
+ emptyCollections,
36
+ findRoot,
37
+ fmtMetric,
38
+ hasSuccessMetric,
39
+ isInitialized,
40
+ isObsolete,
41
+ kindOf,
42
+ load,
43
+ localId,
44
+ localSchemas,
45
+ makeSchemas,
46
+ metricPasses,
47
+ ops_exports,
48
+ parseItem,
49
+ readConfig,
50
+ renderItem,
51
+ resolveActor,
52
+ save,
53
+ targetLabel,
54
+ validate,
55
+ writeConfig
56
+ } from "./chunk-3W4X6WV2.js";
57
+
58
+ // src/core/trace.ts
59
+ function trailForRequirement(r, g) {
60
+ const stakeholderRequirements = g.requirements.filter((x) => r.stakeholderIds?.includes(x.id));
61
+ const findings = g.findings.filter((f) => r.findingIds.includes(f.id));
62
+ const experiments = g.experiments.filter((e) => findings.some((f) => f.experimentIds.includes(e.id)));
63
+ const hypIds = /* @__PURE__ */ new Set([
64
+ ...findings.flatMap((f) => f.hypothesisIds),
65
+ ...experiments.map((e) => e.hypothesisId),
66
+ ...r.hypothesisIds ?? []
67
+ ]);
68
+ const hypotheses = g.hypotheses.filter((h) => hypIds.has(h.id));
69
+ const insIds = /* @__PURE__ */ new Set([
70
+ ...findings.flatMap((f) => f.insightIds),
71
+ ...hypotheses.flatMap((h) => h.insightIds),
72
+ ...r.insightIds ?? []
73
+ ]);
74
+ const insights = g.insights.filter((i) => insIds.has(i.id));
75
+ return { stakeholderRequirements, findings, experiments, hypotheses, insights };
76
+ }
77
+ function connectedIds(id, g) {
78
+ const edges = [];
79
+ g.hypotheses.forEach((h) => h.insightIds.forEach((i) => edges.push([i, h.id])));
80
+ g.experiments.forEach((e) => edges.push([e.hypothesisId, e.id]));
81
+ g.findings.forEach((f) => {
82
+ f.experimentIds.forEach((e) => edges.push([e, f.id]));
83
+ if (!f.experimentIds.length) f.hypothesisIds.forEach((h) => edges.push([h, f.id]));
84
+ });
85
+ g.requirements.forEach((r) => {
86
+ r.findingIds.forEach((f) => edges.push([f, r.id]));
87
+ r.insightIds?.forEach((i) => edges.push([i, r.id]));
88
+ r.hypothesisIds?.forEach((h) => edges.push([h, r.id]));
89
+ r.stakeholderIds?.forEach((s) => edges.push([s, r.id]));
90
+ });
91
+ const result = /* @__PURE__ */ new Set([id]);
92
+ const up = [id];
93
+ while (up.length) {
94
+ const cur = up.pop();
95
+ edges.forEach(([a, b]) => {
96
+ if (b === cur && !result.has(a)) {
97
+ result.add(a);
98
+ up.push(a);
99
+ }
100
+ });
101
+ }
102
+ const down = [id];
103
+ const seenDown = /* @__PURE__ */ new Set([id]);
104
+ while (down.length) {
105
+ const cur = down.pop();
106
+ edges.forEach(([a, b]) => {
107
+ if (a === cur && !seenDown.has(b)) {
108
+ seenDown.add(b);
109
+ result.add(b);
110
+ down.push(b);
111
+ }
112
+ });
113
+ }
114
+ return result;
115
+ }
116
+ function evidenceStrength(t) {
117
+ const validated = t.experiments.filter((e) => e.verdict === "validated").length;
118
+ const invalidated = t.experiments.filter((e) => e.verdict === "invalidated").length;
119
+ const score = Math.min(100, t.insights.length * 8 + validated * 35 + invalidated * 20 + t.findings.length * 10);
120
+ return { score, label: score >= 70 ? "Strong" : score >= 40 ? "Moderate" : "Weak" };
121
+ }
122
+ export {
123
+ COLLECTIONS,
124
+ COLLECTION_KEYS,
125
+ COLLECTION_KIND,
126
+ CONFIG_FILE,
127
+ ConfigError,
128
+ DIR,
129
+ EXPERIMENT_STATUS,
130
+ FINDING_CONFIDENCE,
131
+ HYPOTHESIS_STATUS,
132
+ ID_PREFIX,
133
+ INSTRUCTIONS,
134
+ KIND,
135
+ LOCAL_ID,
136
+ METHOD,
137
+ PRIORITY,
138
+ REQUIREMENT_KIND,
139
+ REQUIREMENT_ORIGIN,
140
+ SCHEMA_VERSION,
141
+ SENTIMENT,
142
+ SOURCE,
143
+ assignIds,
144
+ buildServer,
145
+ canObsolete,
146
+ canSendToDelivery,
147
+ canUpdateInPlace,
148
+ composeKnowWhen,
149
+ composeStatement,
150
+ computeVerdict,
151
+ configPath,
152
+ configSchema,
153
+ connectedIds,
154
+ defaultConfig,
155
+ describeSuccess,
156
+ diffCollections,
157
+ emptyCollections,
158
+ evidenceStrength,
159
+ findRoot,
160
+ fmtMetric,
161
+ hasSuccessMetric,
162
+ isInitialized,
163
+ isObsolete,
164
+ kindOf,
165
+ load,
166
+ localId,
167
+ localSchemas,
168
+ makeSchemas,
169
+ metricPasses,
170
+ ops_exports as ops,
171
+ parseItem,
172
+ readConfig,
173
+ renderItem,
174
+ resolveActor,
175
+ save,
176
+ targetLabel,
177
+ trailForRequirement,
178
+ validate,
179
+ writeConfig
180
+ };
181
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/trace.ts"],"sourcesContent":["import type { Experiment, Finding, Hypothesis, Insight, Requirement } from \"./types\";\n\nexport interface Graph {\n insights: Insight[];\n hypotheses: Hypothesis[];\n experiments: Experiment[];\n findings: Finding[];\n requirements: Requirement[];\n}\n\nexport interface Trail {\n /** Solution requirements: the stakeholder requirements they help meet. */\n stakeholderRequirements: Requirement[];\n findings: Finding[];\n experiments: Experiment[];\n hypotheses: Hypothesis[];\n insights: Insight[];\n}\n\n/** Walk a requirement back to every piece of evidence behind it. */\nexport function trailForRequirement(r: Requirement, g: Graph): Trail {\n const stakeholderRequirements = g.requirements.filter((x) => r.stakeholderIds?.includes(x.id));\n const findings = g.findings.filter((f) => r.findingIds.includes(f.id));\n const experiments = g.experiments.filter((e) => findings.some((f) => f.experimentIds.includes(e.id)));\n const hypIds = new Set([\n ...findings.flatMap((f) => f.hypothesisIds),\n ...experiments.map((e) => e.hypothesisId),\n ...(r.hypothesisIds ?? []),\n ]);\n const hypotheses = g.hypotheses.filter((h) => hypIds.has(h.id));\n const insIds = new Set([\n ...findings.flatMap((f) => f.insightIds),\n ...hypotheses.flatMap((h) => h.insightIds),\n ...(r.insightIds ?? []),\n ]);\n const insights = g.insights.filter((i) => insIds.has(i.id));\n return { stakeholderRequirements, findings, experiments, hypotheses, insights };\n}\n\n/** All node ids connected (upstream and downstream) to a given node. */\nexport function connectedIds(id: string, g: Graph): Set<string> {\n const edges: [string, string][] = [];\n g.hypotheses.forEach((h) => h.insightIds.forEach((i) => edges.push([i, h.id])));\n g.experiments.forEach((e) => edges.push([e.hypothesisId, e.id]));\n g.findings.forEach((f) => {\n f.experimentIds.forEach((e) => edges.push([e, f.id]));\n if (!f.experimentIds.length) f.hypothesisIds.forEach((h) => edges.push([h, f.id]));\n });\n g.requirements.forEach((r) => {\n r.findingIds.forEach((f) => edges.push([f, r.id]));\n // Directly created requirements link straight to their evidence and source hypotheses.\n r.insightIds?.forEach((i) => edges.push([i, r.id]));\n r.hypothesisIds?.forEach((h) => edges.push([h, r.id]));\n // Solution requirements meet stakeholder requirements.\n r.stakeholderIds?.forEach((s) => edges.push([s, r.id]));\n });\n\n const result = new Set<string>([id]);\n // upstream\n const up = [id];\n while (up.length) {\n const cur = up.pop()!;\n edges.forEach(([a, b]) => {\n if (b === cur && !result.has(a)) {\n result.add(a);\n up.push(a);\n }\n });\n }\n // downstream\n const down = [id];\n const seenDown = new Set([id]);\n while (down.length) {\n const cur = down.pop()!;\n edges.forEach(([a, b]) => {\n if (a === cur && !seenDown.has(b)) {\n seenDown.add(b);\n result.add(b);\n down.push(b);\n }\n });\n }\n return result;\n}\n\nexport function evidenceStrength(t: Trail): { score: number; label: \"Strong\" | \"Moderate\" | \"Weak\" } {\n const validated = t.experiments.filter((e) => e.verdict === \"validated\").length;\n const invalidated = t.experiments.filter((e) => e.verdict === \"invalidated\").length;\n const score = Math.min(100, t.insights.length * 8 + validated * 35 + invalidated * 20 + t.findings.length * 10);\n return { score, label: score >= 70 ? \"Strong\" : score >= 40 ? \"Moderate\" : \"Weak\" };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBO,SAAS,oBAAoB,GAAgB,GAAiB;AACnE,QAAM,0BAA0B,EAAE,aAAa,OAAO,CAAC,MAAM,EAAE,gBAAgB,SAAS,EAAE,EAAE,CAAC;AAC7F,QAAM,WAAW,EAAE,SAAS,OAAO,CAAC,MAAM,EAAE,WAAW,SAAS,EAAE,EAAE,CAAC;AACrE,QAAM,cAAc,EAAE,YAAY,OAAO,CAAC,MAAM,SAAS,KAAK,CAAC,MAAM,EAAE,cAAc,SAAS,EAAE,EAAE,CAAC,CAAC;AACpG,QAAM,SAAS,oBAAI,IAAI;AAAA,IACrB,GAAG,SAAS,QAAQ,CAAC,MAAM,EAAE,aAAa;AAAA,IAC1C,GAAG,YAAY,IAAI,CAAC,MAAM,EAAE,YAAY;AAAA,IACxC,GAAI,EAAE,iBAAiB,CAAC;AAAA,EAC1B,CAAC;AACD,QAAM,aAAa,EAAE,WAAW,OAAO,CAAC,MAAM,OAAO,IAAI,EAAE,EAAE,CAAC;AAC9D,QAAM,SAAS,oBAAI,IAAI;AAAA,IACrB,GAAG,S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AAI,IAAY,CAAC,EAAE,CAAC;AAEnC,QAAM,KAAK,CAAC,EAAE;AACd,SAAO,GAAG,QAAQ;AAChB,UAAM,MAAM,GAAG,IAAI;AACnB,UAAM,QAAQ,CAAC,CAAC,GAAG,CAAC,MAAM;AACxB,UAAI,MAAM,OAAO,CAAC,OAAO,IAAI,CAAC,GAAG;AAC/B,eAAO,IAAI,CAAC;AACZ,WAAG,KAAK,CAAC;AAAA,MACX;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,OAAO,CAAC,EAAE;AAChB,QAAM,WAAW,oBAAI,IAAI,CAAC,EAAE,CAAC;AAC7B,SAAO,KAAK,QAAQ;AAClB,UAAM,MAAM,KAAK,IAAI;AACrB,UAAM,QAAQ,CAAC,CAAC,GAAG,CAAC,MAAM;AACxB,UAAI,MAAM,OAAO,CAAC,SAAS,IAAI,CAAC,GAAG;AACjC,iBAAS,IAAI,CAAC;AACd,eAAO,IAAI,CAAC;AACZ,aAAK,KAAK,CAAC;AAAA,MACb;AAAA,IACF,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAEO,SAAS,iBAAiB,GAAoE;AACnG,QAAM,YAAY,EAAE,YAAY,OAAO,CAAC,MAAM,EAAE,YAAY,WAAW,EAAE;AACzE,QAAM,cAAc,EAAE,YAAY,OAAO,CAAC,MAAM,EAAE,YAAY,aAAa,EAAE;AAC7E,QAAM,QAAQ,KAAK,IAAI,KAAK,EAAE,SAAS,SAAS,IAAI,YAAY,KAAK,cAAc,KAAK,EAAE,SAAS,SAAS,EAAE;AAC9G,SAAO,EAAE,OAAO,OAAO,SAAS,KAAK,WAAW,SAAS,KAAK,aAAa,OAAO;AACpF;","names":[]}
package/dist/mcp.js ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ runMcp
4
+ } from "./chunk-NRKF6WRA.js";
5
+ import "./chunk-3W4X6WV2.js";
6
+
7
+ // src/mcp/main.ts
8
+ runMcp().catch((e) => {
9
+ console.error("groundwork-mcp:", e);
10
+ process.exit(1);
11
+ });
12
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/mcp/main.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { runMcp } from \"./run\";\n\nrunMcp().catch((e) => {\n console.error(\"groundwork-mcp:\", e);\n process.exit(1);\n});\n"],"mappings":";;;;;;;AAGA,OAAO,EAAE,MAAM,CAAC,MAAM;AACpB,UAAQ,MAAM,mBAAmB,CAAC;AAClC,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
2
  "name": "groundwork-mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Keep product evidence (insights, hypotheses, experiments, findings, requirements) as linked Markdown files in your repo, written by your own coding agent over MCP.",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "bin": {
8
+ "groundwork-mcp": "dist/mcp.js",
9
+ "groundwork": "dist/cli.js"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "SPEC.md",
20
+ "NOTICE"
21
+ ],
22
+ "engines": {
23
+ "node": ">=20"
24
+ },
25
+ "keywords": [
26
+ "mcp",
27
+ "model-context-protocol",
28
+ "claude-code",
29
+ "product-management",
30
+ "product-discovery",
31
+ "requirements",
32
+ "traceability",
33
+ "hypotheses",
34
+ "experiments"
35
+ ],
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/ganjilive/groundwork.git"
39
+ },
40
+ "homepage": "https://github.com/ganjilive/groundwork#readme",
41
+ "bugs": "https://github.com/ganjilive/groundwork/issues",
42
+ "scripts": {
43
+ "build": "tsup",
44
+ "dev": "tsup --watch",
45
+ "typecheck": "tsc --noEmit",
46
+ "test": "vitest run",
47
+ "prepublishOnly": "npm run typecheck && npm test && npm run build"
48
+ },
49
+ "dependencies": {
50
+ "@modelcontextprotocol/sdk": "^1.32.2",
51
+ "yaml": "^2.9.1",
52
+ "zod": "^4.6.7"
53
+ },
54
+ "devDependencies": {
55
+ "@types/node": "^20.19.43",
56
+ "tsup": "^8.5.1",
57
+ "typescript": "^5.9.3",
58
+ "vitest": "^3.2.7"
59
+ }
60
+ }