@orangepro/orangepro-mcp 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.
Files changed (103) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +328 -0
  3. package/dist/local/agentWorkflow.js +81 -0
  4. package/dist/local/aiGraph/links.js +635 -0
  5. package/dist/local/analyze/analyzer.js +2129 -0
  6. package/dist/local/analyze/behaviorContracts.js +169 -0
  7. package/dist/local/analyze/boilerplate.js +42 -0
  8. package/dist/local/analyze/callGraph.js +458 -0
  9. package/dist/local/analyze/classify.js +219 -0
  10. package/dist/local/analyze/clustering.js +357 -0
  11. package/dist/local/analyze/confirm.js +2422 -0
  12. package/dist/local/analyze/coverage.js +518 -0
  13. package/dist/local/analyze/coverageArtifacts.js +607 -0
  14. package/dist/local/analyze/frameworks.js +115 -0
  15. package/dist/local/analyze/linkage/conventions.js +160 -0
  16. package/dist/local/analyze/parseCache.js +164 -0
  17. package/dist/local/analyze/selfAssert.js +53 -0
  18. package/dist/local/analyze/symbols.js +430 -0
  19. package/dist/local/analyze/testLayer.js +135 -0
  20. package/dist/local/analyze/treeSitter/engine.js +1253 -0
  21. package/dist/local/analyze/treeSitter/languages.js +101 -0
  22. package/dist/local/autoProve.js +620 -0
  23. package/dist/local/cli.js +1468 -0
  24. package/dist/local/cliArgs.js +112 -0
  25. package/dist/local/corpusScope.js +162 -0
  26. package/dist/local/enrich/csv.js +348 -0
  27. package/dist/local/enrich/index.js +43 -0
  28. package/dist/local/enrich/markdown.js +193 -0
  29. package/dist/local/explain/explain.js +91 -0
  30. package/dist/local/exportCli.js +26 -0
  31. package/dist/local/flows/flowWalker.js +215 -0
  32. package/dist/local/flows/llmFlowDiscovery.js +567 -0
  33. package/dist/local/freshness/changed.js +280 -0
  34. package/dist/local/freshness/manifest.js +35 -0
  35. package/dist/local/freshness/status.js +30 -0
  36. package/dist/local/gaps/gaps.js +114 -0
  37. package/dist/local/generate/buckets.js +73 -0
  38. package/dist/local/generate/compareJudge.js +124 -0
  39. package/dist/local/generate/compareReport.js +538 -0
  40. package/dist/local/generate/compareScore.js +105 -0
  41. package/dist/local/generate/deriveImports.js +91 -0
  42. package/dist/local/generate/generator.js +2586 -0
  43. package/dist/local/generate/prompt.js +144 -0
  44. package/dist/local/generate/promptV5.js +438 -0
  45. package/dist/local/generate/providers.js +400 -0
  46. package/dist/local/generate/runHints.js +304 -0
  47. package/dist/local/graph/citations.js +73 -0
  48. package/dist/local/graph/confirmable.js +72 -0
  49. package/dist/local/graph/factories.js +210 -0
  50. package/dist/local/graph/ontology.js +18 -0
  51. package/dist/local/interactive.js +53 -0
  52. package/dist/local/jobs/jobStore.js +80 -0
  53. package/dist/local/jobs/notify.js +29 -0
  54. package/dist/local/jobs/runner.js +75 -0
  55. package/dist/local/ledger.js +117 -0
  56. package/dist/local/localConfig.js +112 -0
  57. package/dist/local/mcp.js +548 -0
  58. package/dist/local/operations.js +1749 -0
  59. package/dist/local/pack/coverageReport.js +192 -0
  60. package/dist/local/pack/exporter.js +195 -0
  61. package/dist/local/pack/schema.js +128 -0
  62. package/dist/local/pack/summary.js +127 -0
  63. package/dist/local/pack/validate.js +25 -0
  64. package/dist/local/proofRunnability.js +366 -0
  65. package/dist/local/recipe/dbSqljs.js +255 -0
  66. package/dist/local/reprove/paths.js +13 -0
  67. package/dist/local/reprove/scoped.js +136 -0
  68. package/dist/local/resolve/barrelWalker.js +178 -0
  69. package/dist/local/resolve/exportIndex.js +270 -0
  70. package/dist/local/resolve/importGraph.js +347 -0
  71. package/dist/local/resolve/resolver.js +122 -0
  72. package/dist/local/resolve/resolverCache.js +117 -0
  73. package/dist/local/rtm.js +413 -0
  74. package/dist/local/score/coverage.js +99 -0
  75. package/dist/local/score/doctor.js +67 -0
  76. package/dist/local/score/risk.js +362 -0
  77. package/dist/local/score/score.js +182 -0
  78. package/dist/local/types.js +1 -0
  79. package/dist/local/util/hash.js +16 -0
  80. package/dist/local/util/ids.js +16 -0
  81. package/dist/local/util/progress.js +8 -0
  82. package/dist/local/util/redact.js +39 -0
  83. package/dist/local/util/time.js +1 -0
  84. package/dist/local/util/walk.js +174 -0
  85. package/dist/local/viz/behaviorReportData.js +367 -0
  86. package/dist/local/viz/behaviorReportHtml.js +664 -0
  87. package/dist/local/viz/d3.bundle.js +3 -0
  88. package/dist/local/viz/html.js +1152 -0
  89. package/dist/local/viz/payload.js +525 -0
  90. package/dist/local/workspace.js +99 -0
  91. package/docs/agent-workflow.md +167 -0
  92. package/docs/agents/claude-code.md +43 -0
  93. package/docs/agents/codex.md +52 -0
  94. package/docs/agents/cursor.md +39 -0
  95. package/docs/agents/opencode.md +43 -0
  96. package/docs/agents/vscode.md +34 -0
  97. package/docs/local-proof-kit.md +269 -0
  98. package/package.json +92 -0
  99. package/scripts/spikes/dynamic-proof-jest-reporter.cjs +66 -0
  100. package/scripts/spikes/dynamic-proof-mocha-reporter.cjs +105 -0
  101. package/scripts/spikes/dynamic-proof-spike.mjs +2335 -0
  102. package/scripts/spikes/dynamic-proof-vitest-reporter.mjs +81 -0
  103. package/scripts/spikes/failure-summary.mjs +29 -0
package/package.json ADDED
@@ -0,0 +1,92 @@
1
+ {
2
+ "name": "@orangepro/orangepro-mcp",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "description": "OrangePro (`opro`) — a local-first, BYOK CLI + MCP server that builds an evidence graph from a local checkout, ingests runtime coverage, and generates grounded tests. Metadata-only exports; no source upload; no repo writes.",
6
+ "license": "MIT",
7
+ "author": "OrangePro (OrangeproAI)",
8
+ "homepage": "https://github.com/OrangeproAI/orangepro-mcp#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/OrangeproAI/orangepro-mcp.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/OrangeproAI/orangepro-mcp/issues"
15
+ },
16
+ "keywords": [
17
+ "mcp",
18
+ "model-context-protocol",
19
+ "test-generation",
20
+ "qa",
21
+ "orangepro",
22
+ "evidence-graph",
23
+ "byok",
24
+ "ai-testing"
25
+ ],
26
+ "files": [
27
+ "dist/local",
28
+ "scripts/spikes/dynamic-proof-spike.mjs",
29
+ "scripts/spikes/failure-summary.mjs",
30
+ "scripts/spikes/dynamic-proof-vitest-reporter.mjs",
31
+ "scripts/spikes/dynamic-proof-jest-reporter.cjs",
32
+ "scripts/spikes/dynamic-proof-mocha-reporter.cjs",
33
+ "README.md",
34
+ "LICENSE",
35
+ "docs/agents",
36
+ "docs/agent-workflow.md",
37
+ "docs/local-proof-kit.md"
38
+ ],
39
+ "type": "module",
40
+ "bin": {
41
+ "opro": "dist/local/cli.js",
42
+ "orangepro-local": "dist/local/cli.js"
43
+ },
44
+ "scripts": {
45
+ "prebuild": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
46
+ "build": "tsc -p tsconfig.build.json",
47
+ "postbuild": "node -e \"require('fs').chmodSync('dist/local/cli.js', 0o755)\"",
48
+ "dev": "tsx src/index.ts",
49
+ "local": "tsx src/local/cli.ts",
50
+ "start": "node dist/index.js",
51
+ "test": "npm run test:rest && npm run test:spike:core && npm run test:spike:mono",
52
+ "test:rest": "vitest run --exclude '**/dynamicProofSpike.test.ts'",
53
+ "test:spike:core": "npm run test:spike:core:main && npm run test:spike:core:runner",
54
+ "test:spike:core:main": "vitest run tests/local/dynamicProofSpike.test.ts -t \"^(?!.*(M-[123]|Mocha|free-function mutator)).*\" --pool=forks --poolOptions.forks.maxForks=1",
55
+ "test:spike:core:runner": "vitest run tests/local/dynamicProofSpike.test.ts -t \"Mocha|free-function mutator\" --pool=forks --poolOptions.forks.maxForks=1",
56
+ "test:spike:mono": "vitest run tests/local/dynamicProofSpike.test.ts -t \"M-[123]\" --pool=forks --poolOptions.forks.maxForks=1",
57
+ "typecheck": "tsc -p tsconfig.json --noEmit",
58
+ "smoke:gap-fill": "npm run build && node scripts/smoke-gap-fill-loop.mjs",
59
+ "smoke:generate-prove": "npm run build && node scripts/smoke-generate-prove-e2e.mjs",
60
+ "smoke:db-sqljs": "npm run build && node scripts/smoke-db-sqljs-prove.mjs",
61
+ "prepublishOnly": "npm run build && npm test"
62
+ },
63
+ "engines": {
64
+ "node": ">=20"
65
+ },
66
+ "publishConfig": {
67
+ "access": "public"
68
+ },
69
+ "dependencies": {
70
+ "@modelcontextprotocol/sdk": "^1.16.0",
71
+ "tree-sitter-wasms": "^0.1.13",
72
+ "typescript": "^5.8.0",
73
+ "web-tree-sitter": "^0.25.10",
74
+ "zod": "^3.25.76"
75
+ },
76
+ "devDependencies": {
77
+ "@nestjs/common": "^10.4.22",
78
+ "@nestjs/core": "^10.4.22",
79
+ "@nestjs/testing": "^10.4.22",
80
+ "@nestjs/typeorm": "^10.0.2",
81
+ "@swc/core": "^1.15.43",
82
+ "@types/node": "^20.19.0",
83
+ "mocha": "^11.7.6",
84
+ "reflect-metadata": "^0.2.2",
85
+ "rxjs": "^7.8.2",
86
+ "sql.js": "^1.14.1",
87
+ "tsx": "^4.20.0",
88
+ "typeorm": "^0.3.30",
89
+ "unplugin-swc": "^1.5.9",
90
+ "vitest": "^3.2.0"
91
+ }
92
+ }
@@ -0,0 +1,66 @@
1
+ const { writeFileSync } = require("node:fs");
2
+
3
+ function safeValue(value) {
4
+ if (value === undefined) {
5
+ return undefined;
6
+ }
7
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null) {
8
+ return value;
9
+ }
10
+ try {
11
+ return JSON.parse(JSON.stringify(value));
12
+ } catch {
13
+ return String(value);
14
+ }
15
+ }
16
+
17
+ function serializeError(error) {
18
+ const detail = {
19
+ name: error?.name ?? null,
20
+ constructorName: error?.constructor?.name ?? null,
21
+ message: error?.message ?? null,
22
+ stack: error?.stack ?? null
23
+ };
24
+ for (const key of ["actual", "expected", "operator", "showDiff", "ok", "diff"]) {
25
+ if (Object.prototype.hasOwnProperty.call(error ?? {}, key)) {
26
+ detail[key] = safeValue(error[key]);
27
+ }
28
+ }
29
+ if (Object.prototype.hasOwnProperty.call(error ?? {}, "matcherResult")) {
30
+ detail.matcherResult = safeValue(error.matcherResult);
31
+ }
32
+ return detail;
33
+ }
34
+
35
+ function normalizeAssertion(assertion) {
36
+ const details = Array.isArray(assertion.failureDetails)
37
+ ? assertion.failureDetails.map(serializeError)
38
+ : [];
39
+ return {
40
+ ancestorTitles: assertion.ancestorTitles ?? [],
41
+ fullName: assertion.fullName ?? assertion.title ?? "",
42
+ status: assertion.status ?? "pending",
43
+ title: assertion.title ?? "",
44
+ failureMessages: Array.isArray(assertion.failureMessages) ? assertion.failureMessages : [],
45
+ failureDetails: details
46
+ };
47
+ }
48
+
49
+ class DynamicProofJestReporter {
50
+ onRunComplete(_, results) {
51
+ const report = {
52
+ testResults: (results.testResults ?? []).map(file => ({
53
+ name: file.testFilePath ?? file.name ?? "",
54
+ assertionResults: (file.testResults ?? file.assertionResults ?? []).map(normalizeAssertion)
55
+ }))
56
+ };
57
+ const body = `${JSON.stringify(report, null, 2)}\n`;
58
+ if (process.env.OPRO_DYNAMIC_PROOF_REPORT) {
59
+ writeFileSync(process.env.OPRO_DYNAMIC_PROOF_REPORT, body);
60
+ return;
61
+ }
62
+ process.stdout.write(body);
63
+ }
64
+ }
65
+
66
+ module.exports = DynamicProofJestReporter;
@@ -0,0 +1,105 @@
1
+ const { writeFileSync } = require("node:fs");
2
+
3
+ function safeValue(value) {
4
+ if (value === undefined) {
5
+ return undefined;
6
+ }
7
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null) {
8
+ return value;
9
+ }
10
+ try {
11
+ return JSON.parse(JSON.stringify(value));
12
+ } catch {
13
+ return String(value);
14
+ }
15
+ }
16
+
17
+ function serializeError(error) {
18
+ const detail = {
19
+ name: error?.name ?? null,
20
+ constructorName: error?.constructor?.name ?? null,
21
+ message: error?.message ?? null,
22
+ stack: error?.stack ?? null
23
+ };
24
+ for (const key of ["actual", "expected", "operator", "showDiff", "ok", "diff", "generatedMessage", "code"]) {
25
+ if (error && key in error) {
26
+ detail[key] = safeValue(error[key]);
27
+ }
28
+ }
29
+ return detail;
30
+ }
31
+
32
+ function failureMessage(error) {
33
+ if (typeof error?.stack === "string" && error.stack.trim()) {
34
+ return error.stack;
35
+ }
36
+ const name = error?.name ?? "Error";
37
+ const message = error?.message ?? String(error);
38
+ return `${name}: ${message}`;
39
+ }
40
+
41
+ function ancestorTitles(test) {
42
+ const titles = [];
43
+ let parent = test?.parent;
44
+ while (parent) {
45
+ if (parent.title) {
46
+ titles.unshift(parent.title);
47
+ }
48
+ parent = parent.parent;
49
+ }
50
+ return titles;
51
+ }
52
+
53
+ function isHookFailure(test) {
54
+ const type = String(test?.type ?? "");
55
+ const title = String(test?.title ?? "");
56
+ return type === "hook" || /^(?:"?(?:before|after)(?: each| all)?)/i.test(title);
57
+ }
58
+
59
+ class DynamicProofMochaReporter {
60
+ constructor(runner) {
61
+ const files = new Map();
62
+
63
+ function bucket(test) {
64
+ const file = test?.file ?? "";
65
+ if (!files.has(file)) {
66
+ files.set(file, { name: file, assertionResults: [] });
67
+ }
68
+ return files.get(file);
69
+ }
70
+
71
+ runner.on("pass", test => {
72
+ bucket(test).assertionResults.push({
73
+ ancestorTitles: ancestorTitles(test),
74
+ fullName: typeof test?.fullTitle === "function" ? test.fullTitle() : test?.title ?? "",
75
+ status: "passed",
76
+ title: test?.title ?? "",
77
+ failureMessages: [],
78
+ failureDetails: []
79
+ });
80
+ });
81
+
82
+ runner.on("fail", (test, error) => {
83
+ bucket(test).assertionResults.push({
84
+ ancestorTitles: ancestorTitles(test),
85
+ fullName: typeof test?.fullTitle === "function" ? test.fullTitle() : test?.title ?? "",
86
+ status: "failed",
87
+ title: test?.title ?? "",
88
+ failurePhase: isHookFailure(test) ? "hook" : "test",
89
+ failureMessages: [failureMessage(error)],
90
+ failureDetails: [serializeError(error)]
91
+ });
92
+ });
93
+
94
+ runner.once("end", () => {
95
+ const body = `${JSON.stringify({ testResults: Array.from(files.values()) }, null, 2)}\n`;
96
+ if (process.env.OPRO_DYNAMIC_PROOF_REPORT) {
97
+ writeFileSync(process.env.OPRO_DYNAMIC_PROOF_REPORT, body);
98
+ return;
99
+ }
100
+ process.stdout.write(body);
101
+ });
102
+ }
103
+ }
104
+
105
+ module.exports = DynamicProofMochaReporter;