@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.
- package/LICENSE +21 -0
- package/README.md +328 -0
- package/dist/local/agentWorkflow.js +81 -0
- package/dist/local/aiGraph/links.js +635 -0
- package/dist/local/analyze/analyzer.js +2129 -0
- package/dist/local/analyze/behaviorContracts.js +169 -0
- package/dist/local/analyze/boilerplate.js +42 -0
- package/dist/local/analyze/callGraph.js +458 -0
- package/dist/local/analyze/classify.js +219 -0
- package/dist/local/analyze/clustering.js +357 -0
- package/dist/local/analyze/confirm.js +2422 -0
- package/dist/local/analyze/coverage.js +518 -0
- package/dist/local/analyze/coverageArtifacts.js +607 -0
- package/dist/local/analyze/frameworks.js +115 -0
- package/dist/local/analyze/linkage/conventions.js +160 -0
- package/dist/local/analyze/parseCache.js +164 -0
- package/dist/local/analyze/selfAssert.js +53 -0
- package/dist/local/analyze/symbols.js +430 -0
- package/dist/local/analyze/testLayer.js +135 -0
- package/dist/local/analyze/treeSitter/engine.js +1253 -0
- package/dist/local/analyze/treeSitter/languages.js +101 -0
- package/dist/local/autoProve.js +620 -0
- package/dist/local/cli.js +1468 -0
- package/dist/local/cliArgs.js +112 -0
- package/dist/local/corpusScope.js +162 -0
- package/dist/local/enrich/csv.js +348 -0
- package/dist/local/enrich/index.js +43 -0
- package/dist/local/enrich/markdown.js +193 -0
- package/dist/local/explain/explain.js +91 -0
- package/dist/local/exportCli.js +26 -0
- package/dist/local/flows/flowWalker.js +215 -0
- package/dist/local/flows/llmFlowDiscovery.js +567 -0
- package/dist/local/freshness/changed.js +280 -0
- package/dist/local/freshness/manifest.js +35 -0
- package/dist/local/freshness/status.js +30 -0
- package/dist/local/gaps/gaps.js +114 -0
- package/dist/local/generate/buckets.js +73 -0
- package/dist/local/generate/compareJudge.js +124 -0
- package/dist/local/generate/compareReport.js +538 -0
- package/dist/local/generate/compareScore.js +105 -0
- package/dist/local/generate/deriveImports.js +91 -0
- package/dist/local/generate/generator.js +2586 -0
- package/dist/local/generate/prompt.js +144 -0
- package/dist/local/generate/promptV5.js +438 -0
- package/dist/local/generate/providers.js +400 -0
- package/dist/local/generate/runHints.js +304 -0
- package/dist/local/graph/citations.js +73 -0
- package/dist/local/graph/confirmable.js +72 -0
- package/dist/local/graph/factories.js +210 -0
- package/dist/local/graph/ontology.js +18 -0
- package/dist/local/interactive.js +53 -0
- package/dist/local/jobs/jobStore.js +80 -0
- package/dist/local/jobs/notify.js +29 -0
- package/dist/local/jobs/runner.js +75 -0
- package/dist/local/ledger.js +117 -0
- package/dist/local/localConfig.js +112 -0
- package/dist/local/mcp.js +548 -0
- package/dist/local/operations.js +1749 -0
- package/dist/local/pack/coverageReport.js +192 -0
- package/dist/local/pack/exporter.js +195 -0
- package/dist/local/pack/schema.js +128 -0
- package/dist/local/pack/summary.js +127 -0
- package/dist/local/pack/validate.js +25 -0
- package/dist/local/proofRunnability.js +366 -0
- package/dist/local/recipe/dbSqljs.js +255 -0
- package/dist/local/reprove/paths.js +13 -0
- package/dist/local/reprove/scoped.js +136 -0
- package/dist/local/resolve/barrelWalker.js +178 -0
- package/dist/local/resolve/exportIndex.js +270 -0
- package/dist/local/resolve/importGraph.js +347 -0
- package/dist/local/resolve/resolver.js +122 -0
- package/dist/local/resolve/resolverCache.js +117 -0
- package/dist/local/rtm.js +413 -0
- package/dist/local/score/coverage.js +99 -0
- package/dist/local/score/doctor.js +67 -0
- package/dist/local/score/risk.js +362 -0
- package/dist/local/score/score.js +182 -0
- package/dist/local/types.js +1 -0
- package/dist/local/util/hash.js +16 -0
- package/dist/local/util/ids.js +16 -0
- package/dist/local/util/progress.js +8 -0
- package/dist/local/util/redact.js +39 -0
- package/dist/local/util/time.js +1 -0
- package/dist/local/util/walk.js +174 -0
- package/dist/local/viz/behaviorReportData.js +367 -0
- package/dist/local/viz/behaviorReportHtml.js +664 -0
- package/dist/local/viz/d3.bundle.js +3 -0
- package/dist/local/viz/html.js +1152 -0
- package/dist/local/viz/payload.js +525 -0
- package/dist/local/workspace.js +99 -0
- package/docs/agent-workflow.md +167 -0
- package/docs/agents/claude-code.md +43 -0
- package/docs/agents/codex.md +52 -0
- package/docs/agents/cursor.md +39 -0
- package/docs/agents/opencode.md +43 -0
- package/docs/agents/vscode.md +34 -0
- package/docs/local-proof-kit.md +269 -0
- package/package.json +92 -0
- package/scripts/spikes/dynamic-proof-jest-reporter.cjs +66 -0
- package/scripts/spikes/dynamic-proof-mocha-reporter.cjs +105 -0
- package/scripts/spikes/dynamic-proof-spike.mjs +2335 -0
- package/scripts/spikes/dynamic-proof-vitest-reporter.mjs +81 -0
- package/scripts/spikes/failure-summary.mjs +29 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { writeFileSync } from "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
|
+
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 collectAssertions(task, ancestors = []) {
|
|
42
|
+
const children = Array.isArray(task?.tasks) ? task.tasks : [];
|
|
43
|
+
if (children.length > 0) {
|
|
44
|
+
return children.flatMap(child => collectAssertions(child, [...ancestors, task.name].filter(Boolean)));
|
|
45
|
+
}
|
|
46
|
+
const errors = Array.isArray(task?.result?.errors) ? task.result.errors : [];
|
|
47
|
+
const state = task?.result?.state;
|
|
48
|
+
return [{
|
|
49
|
+
ancestorTitles: ancestors,
|
|
50
|
+
fullName: [...ancestors, task?.name].filter(Boolean).join(" "),
|
|
51
|
+
status: state === "fail" ? "failed" : state === "pass" ? "passed" : "pending",
|
|
52
|
+
title: task?.name ?? "",
|
|
53
|
+
failureMessages: errors.map(failureMessage),
|
|
54
|
+
failureDetails: errors.map(serializeError)
|
|
55
|
+
}];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default class DynamicProofReporter {
|
|
59
|
+
writeReport(files) {
|
|
60
|
+
const report = {
|
|
61
|
+
testResults: files.map(file => ({
|
|
62
|
+
name: file.filepath ?? file.name ?? file.task?.file?.filepath ?? file.task?.file?.name ?? "",
|
|
63
|
+
assertionResults: collectAssertions(file.task ?? file)
|
|
64
|
+
}))
|
|
65
|
+
};
|
|
66
|
+
const body = `${JSON.stringify(report, null, 2)}\n`;
|
|
67
|
+
if (process.env.OPRO_DYNAMIC_PROOF_REPORT) {
|
|
68
|
+
writeFileSync(process.env.OPRO_DYNAMIC_PROOF_REPORT, body);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
process.stdout.write(body);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
onFinished(files) {
|
|
75
|
+
this.writeReport(files);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
onTestRunEnd(modules) {
|
|
79
|
+
this.writeReport(Array.from(modules ?? []));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Pick the reportable line from a baseline/mutant failure blob (a runner suite message,
|
|
2
|
+
// an assertion failure message, or captured stderr).
|
|
3
|
+
//
|
|
4
|
+
// Why: build tools (esbuild / Vite / Rollup) print NON-FATAL warnings — e.g.
|
|
5
|
+
// `[MIXED_EXPORTS]`, esbuild's `▲ [WARNING]`, Rollup's `(!) ...` prefix — to stderr
|
|
6
|
+
// BEFORE the fatal error that actually failed the baseline. Grabbing the first line then
|
|
7
|
+
// surfaced the warning (Medplum reported `[MIXED_EXPORTS]` instead of its real blocker),
|
|
8
|
+
// which also starved the R-1 classifier of the true error. This skips known build-tool
|
|
9
|
+
// warning lines and surfaces the first line that reads like the real failure.
|
|
10
|
+
//
|
|
11
|
+
// DIAGNOSTIC ONLY: the returned line feeds the report + classifier reason. It NEVER
|
|
12
|
+
// affects the proof judgment (baseline_green / mutant_failed_assertion / target_not_mocked
|
|
13
|
+
// are computed from exit codes + assertion results, not this string). Fail-safe: if every
|
|
14
|
+
// line looks like a warning (or there is nothing better), it returns the first line — the
|
|
15
|
+
// prior behaviour — so it can never hide a failure, only sharpen the label.
|
|
16
|
+
const BUILD_WARNING_LINE =
|
|
17
|
+
/^(?:\(!\)|▲\s*\[WARNING\]|\[(?:MIXED_EXPORTS|CIRCULAR_DEPENDENCY|UNUSED_EXTERNAL_IMPORT|PLUGIN_WARNING|THIS_IS_UNDEFINED|EVAL|SOURCEMAP_ERROR|INVALID_ANNOTATION|EMPTY_BUNDLE)\]|\(node:\d+\)\s+ExperimentalWarning:|--import 'data:text\/javascript,import \{ register \} from "node:module"|\(Use `node --trace-warnings)/;
|
|
18
|
+
|
|
19
|
+
export function pickReportableFailureLine(text) {
|
|
20
|
+
const lines = String(text ?? "")
|
|
21
|
+
.split(/\r?\n/)
|
|
22
|
+
.map(line => line.trim())
|
|
23
|
+
.filter(Boolean);
|
|
24
|
+
if (lines.length === 0) {
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
const fatal = lines.find(line => !BUILD_WARNING_LINE.test(line));
|
|
28
|
+
return fatal ?? lines[0];
|
|
29
|
+
}
|