@praneeth_54/agentdoctor 0.3.0-beta → 1.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/CHANGELOG.md +105 -1
- package/README.md +64 -31
- package/dist/agents/inspect.js +58 -51
- package/dist/cli/commands/brain-mcp.d.ts +9 -0
- package/dist/cli/commands/brain-mcp.js +38 -0
- package/dist/cli/commands/explain.js +1 -1
- package/dist/cli/commands/fix.js +22 -6
- package/dist/cli/commands/scan.d.ts +5 -0
- package/dist/cli/commands/scan.js +25 -6
- package/dist/cli/commands/verify.d.ts +6 -0
- package/dist/cli/commands/verify.js +25 -11
- package/dist/cli/program.js +61 -7
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/core/fix/apply.d.ts +5 -1
- package/dist/core/fix/apply.js +34 -14
- package/dist/core/fix/plan.d.ts +1 -1
- package/dist/core/fix/plan.js +110 -3
- package/dist/core/fix/render.d.ts +2 -0
- package/dist/core/fix/render.js +57 -9
- package/dist/core/fix/run.js +5 -1
- package/dist/core/fix/types.d.ts +1 -1
- package/dist/core/fix/types.js +5 -1
- package/dist/core/fix/writers/claude-settings.d.ts +16 -0
- package/dist/core/fix/writers/claude-settings.js +100 -0
- package/dist/core/fix/writers/codex-config.d.ts +22 -0
- package/dist/core/fix/writers/codex-config.js +183 -0
- package/dist/core/fix/writers/cursorignore.js +2 -8
- package/dist/core/path-resolution/index.d.ts +5 -0
- package/dist/core/path-resolution/index.js +5 -0
- package/dist/core/path-resolution/prepare.d.ts +33 -0
- package/dist/core/path-resolution/prepare.js +98 -0
- package/dist/core/policy/evaluate.d.ts +44 -0
- package/dist/core/policy/evaluate.js +120 -0
- package/dist/core/rules/claude-deny.d.ts +8 -0
- package/dist/core/rules/claude-deny.js +39 -0
- package/dist/core/rules/codex-deny.d.ts +5 -0
- package/dist/core/rules/codex-deny.js +42 -0
- package/dist/core/rules/context/generated-directory.js +43 -9
- package/dist/core/rules/context/large-log-file.js +27 -10
- package/dist/core/rules/ignore.js +2 -5
- package/dist/core/rules/instructions/missing-path-reference.d.ts +5 -1
- package/dist/core/rules/instructions/missing-path-reference.js +24 -6
- package/dist/core/rules/path-kind.d.ts +15 -2
- package/dist/core/rules/path-kind.js +113 -10
- package/dist/core/rules/security/env-file-exposure.js +9 -24
- package/dist/core/rules/text-cache.js +46 -40
- package/dist/core/understanding/architecture/index.d.ts +4 -0
- package/dist/core/understanding/architecture/index.js +3 -0
- package/dist/core/understanding/architecture/infer.d.ts +6 -0
- package/dist/core/understanding/architecture/infer.js +39 -0
- package/dist/core/understanding/architecture/models.d.ts +23 -0
- package/dist/core/understanding/architecture/models.js +127 -0
- package/dist/core/understanding/architecture/patterns/distribution.d.ts +2 -0
- package/dist/core/understanding/architecture/patterns/distribution.js +115 -0
- package/dist/core/understanding/architecture/patterns/index.d.ts +2 -0
- package/dist/core/understanding/architecture/patterns/index.js +8 -0
- package/dist/core/understanding/architecture/patterns/layered.d.ts +2 -0
- package/dist/core/understanding/architecture/patterns/layered.js +279 -0
- package/dist/core/understanding/architecture/patterns/structural.d.ts +2 -0
- package/dist/core/understanding/architecture/patterns/structural.js +197 -0
- package/dist/core/understanding/architecture/rules.d.ts +4 -0
- package/dist/core/understanding/architecture/rules.js +6 -0
- package/dist/core/understanding/architecture/types.d.ts +52 -0
- package/dist/core/understanding/architecture/types.js +1 -0
- package/dist/core/understanding/brain/build.d.ts +13 -0
- package/dist/core/understanding/brain/build.js +158 -0
- package/dist/core/understanding/brain/claims/index.d.ts +3 -0
- package/dist/core/understanding/brain/claims/index.js +2 -0
- package/dist/core/understanding/brain/claims/lifecycle.d.ts +16 -0
- package/dist/core/understanding/brain/claims/lifecycle.js +78 -0
- package/dist/core/understanding/brain/claims/types.d.ts +32 -0
- package/dist/core/understanding/brain/claims/types.js +25 -0
- package/dist/core/understanding/brain/components/index.d.ts +17 -0
- package/dist/core/understanding/brain/components/index.js +97 -0
- package/dist/core/understanding/brain/components/types.d.ts +16 -0
- package/dist/core/understanding/brain/components/types.js +8 -0
- package/dist/core/understanding/brain/confidence.d.ts +19 -0
- package/dist/core/understanding/brain/confidence.js +39 -0
- package/dist/core/understanding/brain/contract.d.ts +17 -0
- package/dist/core/understanding/brain/contract.js +100 -0
- package/dist/core/understanding/brain/contradictions/index.d.ts +12 -0
- package/dist/core/understanding/brain/contradictions/index.js +57 -0
- package/dist/core/understanding/brain/contradictions/types.d.ts +12 -0
- package/dist/core/understanding/brain/contradictions/types.js +8 -0
- package/dist/core/understanding/brain/delta.d.ts +25 -0
- package/dist/core/understanding/brain/delta.js +116 -0
- package/dist/core/understanding/brain/evidence/index.d.ts +3 -0
- package/dist/core/understanding/brain/evidence/index.js +2 -0
- package/dist/core/understanding/brain/evidence/redact.d.ts +4 -0
- package/dist/core/understanding/brain/evidence/redact.js +36 -0
- package/dist/core/understanding/brain/evidence/types.d.ts +34 -0
- package/dist/core/understanding/brain/evidence/types.js +35 -0
- package/dist/core/understanding/brain/explain.d.ts +17 -0
- package/dist/core/understanding/brain/explain.js +33 -0
- package/dist/core/understanding/brain/index.d.ts +28 -0
- package/dist/core/understanding/brain/index.js +16 -0
- package/dist/core/understanding/brain/migrate.d.ts +21 -0
- package/dist/core/understanding/brain/migrate.js +47 -0
- package/dist/core/understanding/brain/query.d.ts +60 -0
- package/dist/core/understanding/brain/query.js +92 -0
- package/dist/core/understanding/brain/security.d.ts +3 -0
- package/dist/core/understanding/brain/security.js +43 -0
- package/dist/core/understanding/brain/storage/index.d.ts +2 -0
- package/dist/core/understanding/brain/storage/index.js +1 -0
- package/dist/core/understanding/brain/storage/store.d.ts +53 -0
- package/dist/core/understanding/brain/storage/store.js +305 -0
- package/dist/core/understanding/brain/trace.d.ts +24 -0
- package/dist/core/understanding/brain/trace.js +207 -0
- package/dist/core/understanding/brain/types.d.ts +32 -0
- package/dist/core/understanding/brain/types.js +8 -0
- package/dist/core/understanding/brain/version.d.ts +13 -0
- package/dist/core/understanding/brain/version.js +7 -0
- package/dist/core/understanding/delta/compare.d.ts +26 -0
- package/dist/core/understanding/delta/compare.js +74 -0
- package/dist/core/understanding/delta/index.d.ts +2 -0
- package/dist/core/understanding/delta/index.js +1 -0
- package/dist/core/understanding/dependencies/discover.d.ts +7 -0
- package/dist/core/understanding/dependencies/discover.js +550 -0
- package/dist/core/understanding/dependencies/extract.d.ts +10 -0
- package/dist/core/understanding/dependencies/extract.js +189 -0
- package/dist/core/understanding/dependencies/index.d.ts +4 -0
- package/dist/core/understanding/dependencies/index.js +3 -0
- package/dist/core/understanding/dependencies/models.d.ts +12 -0
- package/dist/core/understanding/dependencies/models.js +125 -0
- package/dist/core/understanding/dependencies/types.d.ts +27 -0
- package/dist/core/understanding/dependencies/types.js +1 -0
- package/dist/core/understanding/domain/discover.d.ts +14 -0
- package/dist/core/understanding/domain/discover.js +90 -0
- package/dist/core/understanding/domain/index.d.ts +2 -0
- package/dist/core/understanding/domain/index.js +1 -0
- package/dist/core/understanding/entrypoints/discover.d.ts +6 -0
- package/dist/core/understanding/entrypoints/discover.js +62 -0
- package/dist/core/understanding/entrypoints/extract.d.ts +19 -0
- package/dist/core/understanding/entrypoints/extract.js +43 -0
- package/dist/core/understanding/entrypoints/index.d.ts +4 -0
- package/dist/core/understanding/entrypoints/index.js +3 -0
- package/dist/core/understanding/entrypoints/models.d.ts +26 -0
- package/dist/core/understanding/entrypoints/models.js +216 -0
- package/dist/core/understanding/entrypoints/types.d.ts +20 -0
- package/dist/core/understanding/entrypoints/types.js +1 -0
- package/dist/core/understanding/index.d.ts +32 -0
- package/dist/core/understanding/index.js +18 -0
- package/dist/core/understanding/mind/build.d.ts +16 -0
- package/dist/core/understanding/mind/build.js +134 -0
- package/dist/core/understanding/mind/index.d.ts +6 -0
- package/dist/core/understanding/mind/index.js +3 -0
- package/dist/core/understanding/mind/query.d.ts +33 -0
- package/dist/core/understanding/mind/query.js +39 -0
- package/dist/core/understanding/mind/types.d.ts +24 -0
- package/dist/core/understanding/mind/types.js +7 -0
- package/dist/core/understanding/model/builder.d.ts +9 -0
- package/dist/core/understanding/model/builder.js +209 -0
- package/dist/core/understanding/model/ids.d.ts +7 -0
- package/dist/core/understanding/model/ids.js +48 -0
- package/dist/core/understanding/model/index.d.ts +7 -0
- package/dist/core/understanding/model/index.js +6 -0
- package/dist/core/understanding/model/schema.d.ts +12 -0
- package/dist/core/understanding/model/schema.js +33 -0
- package/dist/core/understanding/model/serializer.d.ts +9 -0
- package/dist/core/understanding/model/serializer.js +46 -0
- package/dist/core/understanding/model/types.d.ts +110 -0
- package/dist/core/understanding/model/types.js +1 -0
- package/dist/core/understanding/model/validator.d.ts +5 -0
- package/dist/core/understanding/model/validator.js +126 -0
- package/dist/core/understanding/model/version.d.ts +9 -0
- package/dist/core/understanding/model/version.js +7 -0
- package/dist/core/understanding/ownership/discover.d.ts +12 -0
- package/dist/core/understanding/ownership/discover.js +242 -0
- package/dist/core/understanding/ownership/index.d.ts +2 -0
- package/dist/core/understanding/ownership/index.js +1 -0
- package/dist/core/understanding/ownership/types.d.ts +23 -0
- package/dist/core/understanding/ownership/types.js +1 -0
- package/dist/core/understanding/query/engine.d.ts +24 -0
- package/dist/core/understanding/query/engine.js +35 -0
- package/dist/core/understanding/query/errors.d.ts +13 -0
- package/dist/core/understanding/query/errors.js +26 -0
- package/dist/core/understanding/query/executor.d.ts +8 -0
- package/dist/core/understanding/query/executor.js +34 -0
- package/dist/core/understanding/query/index.d.ts +7 -0
- package/dist/core/understanding/query/index.js +5 -0
- package/dist/core/understanding/query/models.d.ts +102 -0
- package/dist/core/understanding/query/models.js +1 -0
- package/dist/core/understanding/query/query.d.ts +68 -0
- package/dist/core/understanding/query/query.js +145 -0
- package/dist/core/understanding/query/registry.d.ts +8 -0
- package/dist/core/understanding/query/registry.js +340 -0
- package/dist/core/understanding/query/types.d.ts +63 -0
- package/dist/core/understanding/query/types.js +1 -0
- package/dist/core/understanding/relationships/discover.d.ts +11 -0
- package/dist/core/understanding/relationships/discover.js +517 -0
- package/dist/core/understanding/relationships/extract.d.ts +14 -0
- package/dist/core/understanding/relationships/extract.js +165 -0
- package/dist/core/understanding/relationships/index.d.ts +4 -0
- package/dist/core/understanding/relationships/index.js +3 -0
- package/dist/core/understanding/relationships/models.d.ts +21 -0
- package/dist/core/understanding/relationships/models.js +185 -0
- package/dist/core/understanding/relationships/types.d.ts +42 -0
- package/dist/core/understanding/relationships/types.js +1 -0
- package/dist/core/understanding/risks/discover.d.ts +8 -0
- package/dist/core/understanding/risks/discover.js +155 -0
- package/dist/core/understanding/risks/index.d.ts +2 -0
- package/dist/core/understanding/risks/index.js +1 -0
- package/dist/core/understanding/risks/types.d.ts +26 -0
- package/dist/core/understanding/risks/types.js +1 -0
- package/dist/core/understanding/shared/domain-lexicon.d.ts +9 -0
- package/dist/core/understanding/shared/domain-lexicon.js +107 -0
- package/dist/core/understanding/shared/index.d.ts +2 -0
- package/dist/core/understanding/shared/index.js +2 -0
- package/dist/core/understanding/shared/tokens.d.ts +7 -0
- package/dist/core/understanding/shared/tokens.js +141 -0
- package/dist/core/understanding/snapshot/identity.d.ts +24 -0
- package/dist/core/understanding/snapshot/identity.js +79 -0
- package/dist/core/understanding/snapshot/index.d.ts +2 -0
- package/dist/core/understanding/snapshot/index.js +1 -0
- package/dist/core/understanding/types/index.d.ts +22 -0
- package/dist/core/understanding/types/index.js +1 -0
- package/dist/core/understanding/understand/formatter.d.ts +10 -0
- package/dist/core/understanding/understand/formatter.js +115 -0
- package/dist/core/understanding/understand/index.d.ts +4 -0
- package/dist/core/understanding/understand/index.js +3 -0
- package/dist/core/understanding/understand/service.d.ts +17 -0
- package/dist/core/understanding/understand/service.js +76 -0
- package/dist/core/understanding/understand/summary.d.ts +14 -0
- package/dist/core/understanding/understand/summary.js +39 -0
- package/dist/core/understanding/understand/types.d.ts +31 -0
- package/dist/core/understanding/understand/types.js +1 -0
- package/dist/discovery/files.js +7 -2
- package/dist/discovery/log-like.d.ts +2 -0
- package/dist/discovery/log-like.js +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/mcp/brain/compile.d.ts +9 -0
- package/dist/mcp/brain/compile.js +42 -0
- package/dist/mcp/brain/errors.d.ts +12 -0
- package/dist/mcp/brain/errors.js +23 -0
- package/dist/mcp/brain/index.d.ts +11 -0
- package/dist/mcp/brain/index.js +8 -0
- package/dist/mcp/brain/provenance.d.ts +29 -0
- package/dist/mcp/brain/provenance.js +59 -0
- package/dist/mcp/brain/schemas.d.ts +13 -0
- package/dist/mcp/brain/schemas.js +105 -0
- package/dist/mcp/brain/security/root.d.ts +6 -0
- package/dist/mcp/brain/security/root.js +66 -0
- package/dist/mcp/brain/server.d.ts +12 -0
- package/dist/mcp/brain/server.js +46 -0
- package/dist/mcp/brain/session.d.ts +33 -0
- package/dist/mcp/brain/session.js +117 -0
- package/dist/mcp/brain/tools/handlers.d.ts +13 -0
- package/dist/mcp/brain/tools/handlers.js +483 -0
- package/dist/mcp/brain/tools/registry.d.ts +9 -0
- package/dist/mcp/brain/tools/registry.js +191 -0
- package/dist/reporters/github/annotations.d.ts +8 -0
- package/dist/reporters/github/annotations.js +42 -0
- package/dist/reporters/github/emit.d.ts +23 -0
- package/dist/reporters/github/emit.js +31 -0
- package/dist/reporters/github/summary.d.ts +20 -0
- package/dist/reporters/github/summary.js +111 -0
- package/dist/reporters/terminal/report.d.ts +5 -0
- package/dist/reporters/terminal/report.js +68 -5
- package/dist/reporters/verify/terminal.d.ts +4 -0
- package/dist/reporters/verify/terminal.js +26 -0
- package/dist/utils/fs.d.ts +5 -0
- package/dist/utils/fs.js +34 -0
- package/dist/utils/path.d.ts +5 -0
- package/dist/utils/path.js +16 -0
- package/package.json +15 -1
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
function basename(relativePath) {
|
|
2
|
+
const parts = relativePath.split("/");
|
|
3
|
+
return parts[parts.length - 1] ?? relativePath;
|
|
4
|
+
}
|
|
5
|
+
function posix(relativePath) {
|
|
6
|
+
return relativePath.replace(/\\/g, "/");
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Deterministic entrypoint models. Order matters for stable multi-match preference
|
|
10
|
+
* when the same file could qualify under multiple frameworks (NestJS before Node).
|
|
11
|
+
*/
|
|
12
|
+
export const ENTRYPOINT_MODELS = [
|
|
13
|
+
{
|
|
14
|
+
framework: "Flutter",
|
|
15
|
+
pathTest: (p) => {
|
|
16
|
+
const path = posix(p);
|
|
17
|
+
return (path === "lib/main.dart" ||
|
|
18
|
+
path.endsWith("/lib/main.dart") ||
|
|
19
|
+
basename(path) === "main.dart");
|
|
20
|
+
},
|
|
21
|
+
signals: [
|
|
22
|
+
{ label: "runApp()", pattern: /\brunApp\s*\(/ },
|
|
23
|
+
{ label: "MaterialApp", pattern: /\bMaterialApp\b/ },
|
|
24
|
+
{ label: "CupertinoApp", pattern: /\bCupertinoApp\b/ },
|
|
25
|
+
{ label: "GoRouter", pattern: /\bGoRouter\b/ },
|
|
26
|
+
],
|
|
27
|
+
pathConfidence: 0.7,
|
|
28
|
+
signalBoost: 0.1,
|
|
29
|
+
requireSignal: false,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
framework: "Laravel",
|
|
33
|
+
pathTest: (p) => {
|
|
34
|
+
const path = posix(p);
|
|
35
|
+
return (path === "routes/web.php" ||
|
|
36
|
+
path === "routes/api.php" ||
|
|
37
|
+
path.endsWith("/routes/web.php") ||
|
|
38
|
+
path.endsWith("/routes/api.php") ||
|
|
39
|
+
basename(path) === "artisan" ||
|
|
40
|
+
path === "bootstrap/app.php" ||
|
|
41
|
+
path.endsWith("/bootstrap/app.php"));
|
|
42
|
+
},
|
|
43
|
+
signals: [
|
|
44
|
+
{ label: "Route::", pattern: /\bRoute\s*::/ },
|
|
45
|
+
{ label: "Illuminate\\", pattern: /Illuminate\\/ },
|
|
46
|
+
{ label: "Application::configure", pattern: /Application\s*::\s*configure/ },
|
|
47
|
+
],
|
|
48
|
+
pathConfidence: 0.85,
|
|
49
|
+
signalBoost: 0.05,
|
|
50
|
+
requireSignal: false,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
framework: "Next.js",
|
|
54
|
+
pathTest: (p) => {
|
|
55
|
+
const path = posix(p);
|
|
56
|
+
const base = basename(path);
|
|
57
|
+
const inApp = /(^|\/)app\//.test(path) &&
|
|
58
|
+
(base === "layout.tsx" ||
|
|
59
|
+
base === "layout.jsx" ||
|
|
60
|
+
base === "layout.js" ||
|
|
61
|
+
base === "page.tsx" ||
|
|
62
|
+
base === "page.jsx" ||
|
|
63
|
+
base === "page.js");
|
|
64
|
+
const inPages = /(^|\/)pages\//.test(path) &&
|
|
65
|
+
(base === "_app.tsx" ||
|
|
66
|
+
base === "_app.jsx" ||
|
|
67
|
+
base === "_app.js" ||
|
|
68
|
+
base === "index.tsx" ||
|
|
69
|
+
base === "index.jsx" ||
|
|
70
|
+
base === "index.js");
|
|
71
|
+
return inApp || inPages;
|
|
72
|
+
},
|
|
73
|
+
signals: [
|
|
74
|
+
{ label: "next/navigation", pattern: /from\s+["']next\/navigation["']/ },
|
|
75
|
+
{ label: "next/router", pattern: /from\s+["']next\/router["']/ },
|
|
76
|
+
{ label: "next/head", pattern: /from\s+["']next\/head["']/ },
|
|
77
|
+
{ label: "Metadata", pattern: /\bexport\s+(const|async\s+function|function)\s+metadata\b/ },
|
|
78
|
+
],
|
|
79
|
+
pathConfidence: 0.8,
|
|
80
|
+
signalBoost: 0.06,
|
|
81
|
+
requireSignal: false,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
framework: "NestJS",
|
|
85
|
+
pathTest: (p) => {
|
|
86
|
+
const path = posix(p);
|
|
87
|
+
const base = basename(path);
|
|
88
|
+
return base === "main.ts" || base === "main.js";
|
|
89
|
+
},
|
|
90
|
+
signals: [
|
|
91
|
+
{ label: "NestFactory", pattern: /\bNestFactory\b/ },
|
|
92
|
+
{
|
|
93
|
+
label: "bootstrap()",
|
|
94
|
+
pattern: /\basync\s+function\s+bootstrap\s*\(|\bbootstrap\s*\(\s*\)/,
|
|
95
|
+
},
|
|
96
|
+
{ label: "@nestjs/core", pattern: /@nestjs\/core/ },
|
|
97
|
+
],
|
|
98
|
+
pathConfidence: 0.55,
|
|
99
|
+
signalBoost: 0.15,
|
|
100
|
+
requireSignal: true,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
framework: "React",
|
|
104
|
+
pathTest: (p) => {
|
|
105
|
+
const path = posix(p);
|
|
106
|
+
const base = basename(path);
|
|
107
|
+
if (/(^|\/)(app|pages)\//.test(path)) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
return (base === "main.tsx" ||
|
|
111
|
+
base === "main.jsx" ||
|
|
112
|
+
base === "index.tsx" ||
|
|
113
|
+
base === "index.jsx" ||
|
|
114
|
+
base === "App.tsx" ||
|
|
115
|
+
base === "App.jsx");
|
|
116
|
+
},
|
|
117
|
+
signals: [
|
|
118
|
+
{ label: "ReactDOM.createRoot()", pattern: /ReactDOM\s*\.\s*createRoot\s*\(/ },
|
|
119
|
+
{ label: "createRoot()", pattern: /\bcreateRoot\s*\(/ },
|
|
120
|
+
{ label: "ReactDOM.render(", pattern: /ReactDOM\s*\.\s*render\s*\(/ },
|
|
121
|
+
{ label: 'from "react"', pattern: /from\s+["']react["']/ },
|
|
122
|
+
],
|
|
123
|
+
pathConfidence: 0.6,
|
|
124
|
+
signalBoost: 0.12,
|
|
125
|
+
requireSignal: true,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
framework: "Node",
|
|
129
|
+
pathTest: (p) => {
|
|
130
|
+
const path = posix(p);
|
|
131
|
+
const base = basename(path);
|
|
132
|
+
return (base === "server.ts" ||
|
|
133
|
+
base === "server.js" ||
|
|
134
|
+
base === "server.mjs" ||
|
|
135
|
+
base === "app.ts" ||
|
|
136
|
+
base === "app.js" ||
|
|
137
|
+
base === "app.mjs" ||
|
|
138
|
+
base === "index.ts" ||
|
|
139
|
+
base === "index.js");
|
|
140
|
+
},
|
|
141
|
+
signals: [
|
|
142
|
+
{ label: "express()", pattern: /\bexpress\s*\(/ },
|
|
143
|
+
{ label: "fastify()", pattern: /\bfastify\s*\(/ },
|
|
144
|
+
{ label: "createServer(", pattern: /\bcreateServer\s*\(/ },
|
|
145
|
+
{ label: "listen(", pattern: /\.listen\s*\(/ },
|
|
146
|
+
{ label: "koa(", pattern: /\bnew\s+Koa\s*\(|\bkoa\s*\(/ },
|
|
147
|
+
],
|
|
148
|
+
pathConfidence: 0.5,
|
|
149
|
+
signalBoost: 0.15,
|
|
150
|
+
requireSignal: true,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
framework: "Django",
|
|
154
|
+
pathTest: (p) => basename(posix(p)) === "manage.py",
|
|
155
|
+
signals: [
|
|
156
|
+
{ label: "django", pattern: /\bdjango\b/i },
|
|
157
|
+
{ label: "execute_from_command_line", pattern: /\bexecute_from_command_line\b/ },
|
|
158
|
+
],
|
|
159
|
+
pathConfidence: 0.9,
|
|
160
|
+
signalBoost: 0.04,
|
|
161
|
+
requireSignal: false,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
framework: "Python",
|
|
165
|
+
pathTest: (p) => {
|
|
166
|
+
const base = basename(posix(p));
|
|
167
|
+
return base === "main.py" || base === "app.py" || base === "wsgi.py" || base === "asgi.py";
|
|
168
|
+
},
|
|
169
|
+
signals: [
|
|
170
|
+
{ label: "FastAPI()", pattern: /\bFastAPI\s*\(/ },
|
|
171
|
+
{ label: "Flask(", pattern: /\bFlask\s*\(/ },
|
|
172
|
+
{ label: "uvicorn", pattern: /\buvicorn\b/ },
|
|
173
|
+
{ label: "if __name__", pattern: /if\s+__name__\s*==\s*["']__main__["']/ },
|
|
174
|
+
],
|
|
175
|
+
pathConfidence: 0.55,
|
|
176
|
+
signalBoost: 0.15,
|
|
177
|
+
requireSignal: true,
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
framework: "Java",
|
|
181
|
+
pathTest: (p) => {
|
|
182
|
+
const path = posix(p);
|
|
183
|
+
return path.endsWith(".java") && /Application\.java$|Main\.java$/i.test(basename(path));
|
|
184
|
+
},
|
|
185
|
+
signals: [
|
|
186
|
+
{ label: "@SpringBootApplication", pattern: /@SpringBootApplication\b/ },
|
|
187
|
+
{ label: "public static void main", pattern: /public\s+static\s+void\s+main\s*\(/ },
|
|
188
|
+
{ label: "SpringApplication.run", pattern: /\bSpringApplication\s*\.\s*run\s*\(/ },
|
|
189
|
+
],
|
|
190
|
+
pathConfidence: 0.55,
|
|
191
|
+
signalBoost: 0.15,
|
|
192
|
+
requireSignal: true,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
framework: "Go",
|
|
196
|
+
pathTest: (p) => basename(posix(p)) === "main.go",
|
|
197
|
+
signals: [
|
|
198
|
+
{ label: "package main", pattern: /^package\s+main\b/m },
|
|
199
|
+
{ label: "func main()", pattern: /\bfunc\s+main\s*\(\s*\)/ },
|
|
200
|
+
],
|
|
201
|
+
pathConfidence: 0.65,
|
|
202
|
+
signalBoost: 0.15,
|
|
203
|
+
requireSignal: true,
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
framework: "Rust",
|
|
207
|
+
pathTest: (p) => {
|
|
208
|
+
const path = posix(p);
|
|
209
|
+
return (path === "src/main.rs" || path.endsWith("/src/main.rs") || basename(path) === "main.rs");
|
|
210
|
+
},
|
|
211
|
+
signals: [{ label: "fn main()", pattern: /\bfn\s+main\s*\(\s*\)/ }],
|
|
212
|
+
pathConfidence: 0.7,
|
|
213
|
+
signalBoost: 0.2,
|
|
214
|
+
requireSignal: true,
|
|
215
|
+
},
|
|
216
|
+
];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type EntrypointFramework = "Flutter" | "Laravel" | "React" | "Next.js" | "Node" | "NestJS" | "Python" | "Django" | "Java" | "Go" | "Rust";
|
|
2
|
+
export interface EntrypointMatch {
|
|
3
|
+
framework: EntrypointFramework;
|
|
4
|
+
file: string;
|
|
5
|
+
confidence: number;
|
|
6
|
+
evidence: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface EntrypointDiscoveryResult {
|
|
9
|
+
entrypoints: EntrypointMatch[];
|
|
10
|
+
timingMs: number;
|
|
11
|
+
filesConsidered: number;
|
|
12
|
+
filesInspected: number;
|
|
13
|
+
}
|
|
14
|
+
export interface EntrypointDiscoveryOptions {
|
|
15
|
+
cwd?: string;
|
|
16
|
+
/** Minimum confidence to include (0–1). Default 0.55. */
|
|
17
|
+
minConfidence?: number;
|
|
18
|
+
/** Max bytes to read from a candidate file. Default 256 KiB. */
|
|
19
|
+
maxReadBytes?: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal Software Understanding Engine.
|
|
3
|
+
* Not wired into scan/CLI. Import from this module only.
|
|
4
|
+
*/
|
|
5
|
+
export { discoverDomains, scoreDomainConfidence } from "./domain/index.js";
|
|
6
|
+
export { discoverEntrypoints, scoreEntrypointConfidence, ENTRYPOINT_MODELS, } from "./entrypoints/index.js";
|
|
7
|
+
export { discoverDependencies, scoreDependencyConfidence, extractReferences, RELATION_CONFIDENCE, } from "./dependencies/index.js";
|
|
8
|
+
export { discoverRelationships, scoreRelationshipConfidence, classifyComponent, classifyRoleFromPath, extractSemanticSignals, ROLE_PAIR_RULES, } from "./relationships/index.js";
|
|
9
|
+
export { inferArchitectures, ARCHITECTURE_RULES, listArchitecturePatterns, scorePatternConfidence, } from "./architecture/index.js";
|
|
10
|
+
export { ProjectModelBuilder, buildProjectModel, serializeProjectModel, parseProjectModel, validateProjectModel, PROJECT_MODEL_SCHEMA, PROJECT_MODEL_SCHEMA_VERSION, UNDERSTANDING_COMPILER_VERSION, } from "./model/index.js";
|
|
11
|
+
export { QueryEngine, createQueryEngine, Queries, executeQuery, validateQuery, listSupportedQueryTypes, QueryError, QueryValidationError, QueryNotFoundError, QueryUnsupportedError, } from "./query/index.js";
|
|
12
|
+
export { UnderstandService, createUnderstandService, understandAsText, UNDERSTAND_LIMITATIONS, } from "./understand/index.js";
|
|
13
|
+
export { discoverOwnership, ownersForPath, matchCodeownersPattern, scoreOwnershipConfidence, } from "./ownership/index.js";
|
|
14
|
+
export { discoverRisks } from "./risks/index.js";
|
|
15
|
+
export { computeContentHash, createSnapshotIdentity, hashSerializedModel, } from "./snapshot/index.js";
|
|
16
|
+
export { compareProjectModels } from "./delta/index.js";
|
|
17
|
+
export { buildProjectMind, buildProjectMindSync, extractClaims, findMindClaim, findMindOwner, findMindRisks, listMindOwnership, listMindRisks, mindSummary, PROJECT_MIND_LIMITATIONS, } from "./mind/index.js";
|
|
18
|
+
export type { DomainDiscoveryOptions, DomainDiscoveryResult, DomainMatch, UnderstandingConfidence, UnderstandingEvidence, } from "./types/index.js";
|
|
19
|
+
export type { EntrypointDiscoveryOptions, EntrypointDiscoveryResult, EntrypointFramework, EntrypointMatch, } from "./entrypoints/types.js";
|
|
20
|
+
export type { DependencyDiscoveryOptions, DependencyDiscoveryResult, DependencyMatch, DependencyRelationType, ExtractedReference, } from "./dependencies/types.js";
|
|
21
|
+
export type { RelationshipDiscoveryOptions, RelationshipDiscoveryResult, RelationshipKind, RelationshipMatch, RelationshipStrength, ComponentRole, } from "./relationships/types.js";
|
|
22
|
+
export type { ArchitectureInferenceInput, ArchitectureInferenceOptions, ArchitectureInferenceResult, ArchitectureMatch, ArchitecturePattern, } from "./architecture/types.js";
|
|
23
|
+
export type { ProjectModel, ProjectModelBuilderInput, ProjectModelValidationResult, CompilerPassId, } from "./model/types.js";
|
|
24
|
+
export type { Query, QueryType, QueryResponse, QueryMetadata, FindDomainResult, RepositorySummaryResult, } from "./query/index.js";
|
|
25
|
+
export type { UnderstandResult, UnderstandSection, UnderstandSnapshot, UnderstandServiceOptions, } from "./understand/types.js";
|
|
26
|
+
export type { OwnershipDiscoveryOptions, OwnershipDiscoveryResult, OwnershipMatch, OwnershipSource, } from "./ownership/index.js";
|
|
27
|
+
export type { RiskDiscoveryOptions, RiskDiscoveryResult, RiskKind, RiskMatch, RiskSeverity, } from "./risks/index.js";
|
|
28
|
+
export type { SnapshotIdentity } from "./snapshot/index.js";
|
|
29
|
+
export type { SetDelta, UnderstandingDelta } from "./delta/index.js";
|
|
30
|
+
export type { BuildProjectMindOptions, ClaimKind, ProjectClaim, ProjectMind, } from "./mind/index.js";
|
|
31
|
+
export { buildProjectBrain, createBrainQueryEngine, BrainQueryEngine, explainClaim, traceBrain, buildBrainDelta, serializeBrainDelta, parseBrainDelta, LocalBrainStore, BrainStorageError, serializeBrain, CONFIDENCE_CONTRACT, PROJECT_BRAIN_SCHEMA_VERSION, BRAIN_STORAGE_FORMAT_VERSION, PROJECT_BRAIN_LIMITATIONS, PROJECT_BRAIN_CONTRACT, assertBrainContract, redactBrainForStorage, applyClaimLifecycle, detectContradictions, } from "./brain/index.js";
|
|
32
|
+
export type { ProjectBrain, BrainClaim, BrainEvidence, BrainDelta, BrainQuery, BrainQueryResponse, ClaimExplanation, TraceResult, TraceMode, SnapshotMeta, BrainComponent, ClaimStatus, BuildProjectBrainOptions, } from "./brain/index.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal Software Understanding Engine.
|
|
3
|
+
* Not wired into scan/CLI. Import from this module only.
|
|
4
|
+
*/
|
|
5
|
+
export { discoverDomains, scoreDomainConfidence } from "./domain/index.js";
|
|
6
|
+
export { discoverEntrypoints, scoreEntrypointConfidence, ENTRYPOINT_MODELS, } from "./entrypoints/index.js";
|
|
7
|
+
export { discoverDependencies, scoreDependencyConfidence, extractReferences, RELATION_CONFIDENCE, } from "./dependencies/index.js";
|
|
8
|
+
export { discoverRelationships, scoreRelationshipConfidence, classifyComponent, classifyRoleFromPath, extractSemanticSignals, ROLE_PAIR_RULES, } from "./relationships/index.js";
|
|
9
|
+
export { inferArchitectures, ARCHITECTURE_RULES, listArchitecturePatterns, scorePatternConfidence, } from "./architecture/index.js";
|
|
10
|
+
export { ProjectModelBuilder, buildProjectModel, serializeProjectModel, parseProjectModel, validateProjectModel, PROJECT_MODEL_SCHEMA, PROJECT_MODEL_SCHEMA_VERSION, UNDERSTANDING_COMPILER_VERSION, } from "./model/index.js";
|
|
11
|
+
export { QueryEngine, createQueryEngine, Queries, executeQuery, validateQuery, listSupportedQueryTypes, QueryError, QueryValidationError, QueryNotFoundError, QueryUnsupportedError, } from "./query/index.js";
|
|
12
|
+
export { UnderstandService, createUnderstandService, understandAsText, UNDERSTAND_LIMITATIONS, } from "./understand/index.js";
|
|
13
|
+
export { discoverOwnership, ownersForPath, matchCodeownersPattern, scoreOwnershipConfidence, } from "./ownership/index.js";
|
|
14
|
+
export { discoverRisks } from "./risks/index.js";
|
|
15
|
+
export { computeContentHash, createSnapshotIdentity, hashSerializedModel, } from "./snapshot/index.js";
|
|
16
|
+
export { compareProjectModels } from "./delta/index.js";
|
|
17
|
+
export { buildProjectMind, buildProjectMindSync, extractClaims, findMindClaim, findMindOwner, findMindRisks, listMindOwnership, listMindRisks, mindSummary, PROJECT_MIND_LIMITATIONS, } from "./mind/index.js";
|
|
18
|
+
export { buildProjectBrain, createBrainQueryEngine, BrainQueryEngine, explainClaim, traceBrain, buildBrainDelta, serializeBrainDelta, parseBrainDelta, LocalBrainStore, BrainStorageError, serializeBrain, CONFIDENCE_CONTRACT, PROJECT_BRAIN_SCHEMA_VERSION, BRAIN_STORAGE_FORMAT_VERSION, PROJECT_BRAIN_LIMITATIONS, PROJECT_BRAIN_CONTRACT, assertBrainContract, redactBrainForStorage, applyClaimLifecycle, detectContradictions, } from "./brain/index.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ProjectModel } from "../model/types.js";
|
|
2
|
+
import { type OwnershipDiscoveryResult } from "../ownership/index.js";
|
|
3
|
+
import { type RiskDiscoveryResult } from "../risks/index.js";
|
|
4
|
+
import { type ProjectClaim, type ProjectMind } from "./types.js";
|
|
5
|
+
export declare function extractClaims(model: ProjectModel, ownership: OwnershipDiscoveryResult, risks: RiskDiscoveryResult, snapshotId: string): ProjectClaim[];
|
|
6
|
+
export interface BuildProjectMindOptions {
|
|
7
|
+
cwd?: string;
|
|
8
|
+
ownership?: OwnershipDiscoveryResult;
|
|
9
|
+
risks?: RiskDiscoveryResult;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Build a Project Mind from a ProjectModel (+ ownership/risk discovery).
|
|
13
|
+
* Never invents facts; preserves unknowns.
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildProjectMind(model: ProjectModel, options?: BuildProjectMindOptions): Promise<ProjectMind>;
|
|
16
|
+
export declare function buildProjectMindSync(model: ProjectModel, ownership: OwnershipDiscoveryResult, risks?: RiskDiscoveryResult): ProjectMind;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { discoverOwnership } from "../ownership/index.js";
|
|
2
|
+
import { discoverRisks } from "../risks/index.js";
|
|
3
|
+
import { createSnapshotIdentity } from "../snapshot/index.js";
|
|
4
|
+
import { PROJECT_MIND_LIMITATIONS } from "./types.js";
|
|
5
|
+
function collectUnknowns(ownership, risks, model) {
|
|
6
|
+
const unknowns = new Set();
|
|
7
|
+
for (const item of ownership.unknowns) {
|
|
8
|
+
unknowns.add(item);
|
|
9
|
+
}
|
|
10
|
+
for (const item of risks.unknowns) {
|
|
11
|
+
unknowns.add(item);
|
|
12
|
+
}
|
|
13
|
+
for (const arch of model.architectures) {
|
|
14
|
+
for (const unknown of arch.unknowns) {
|
|
15
|
+
unknowns.add(unknown);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (model.domains.length === 0) {
|
|
19
|
+
unknowns.add("No domains discovered at current confidence thresholds");
|
|
20
|
+
}
|
|
21
|
+
return [...unknowns].sort((a, b) => a.localeCompare(b));
|
|
22
|
+
}
|
|
23
|
+
export function extractClaims(model, ownership, risks, snapshotId) {
|
|
24
|
+
const claims = [];
|
|
25
|
+
for (const domain of model.domains) {
|
|
26
|
+
claims.push({
|
|
27
|
+
id: domain.id,
|
|
28
|
+
kind: "domain",
|
|
29
|
+
subject: domain.name,
|
|
30
|
+
confidence: domain.confidence,
|
|
31
|
+
evidence: domain.evidence,
|
|
32
|
+
snapshotId,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
for (const entry of model.entrypoints) {
|
|
36
|
+
claims.push({
|
|
37
|
+
id: entry.id,
|
|
38
|
+
kind: "entrypoint",
|
|
39
|
+
subject: entry.file,
|
|
40
|
+
confidence: entry.confidence,
|
|
41
|
+
evidence: entry.evidence,
|
|
42
|
+
snapshotId,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
for (const dep of model.dependencies) {
|
|
46
|
+
claims.push({
|
|
47
|
+
id: dep.id,
|
|
48
|
+
kind: "dependency",
|
|
49
|
+
subject: `${dep.from}->${dep.to}`,
|
|
50
|
+
confidence: dep.confidence,
|
|
51
|
+
evidence: dep.evidence,
|
|
52
|
+
snapshotId,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
for (const rel of model.relationships) {
|
|
56
|
+
claims.push({
|
|
57
|
+
id: rel.id,
|
|
58
|
+
kind: "relationship",
|
|
59
|
+
subject: `${rel.source}->${rel.target}:${rel.relationship}`,
|
|
60
|
+
confidence: rel.confidence,
|
|
61
|
+
evidence: rel.evidence,
|
|
62
|
+
snapshotId,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
for (const arch of model.architectures) {
|
|
66
|
+
claims.push({
|
|
67
|
+
id: arch.id,
|
|
68
|
+
kind: "architecture",
|
|
69
|
+
subject: arch.pattern,
|
|
70
|
+
confidence: arch.confidence,
|
|
71
|
+
evidence: arch.evidence,
|
|
72
|
+
snapshotId,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
ownership.ownerships.forEach((ownershipMatch, index) => {
|
|
76
|
+
claims.push({
|
|
77
|
+
id: `ownership_${index}_${ownershipMatch.path}`,
|
|
78
|
+
kind: "ownership",
|
|
79
|
+
subject: ownershipMatch.path,
|
|
80
|
+
confidence: ownershipMatch.confidence,
|
|
81
|
+
evidence: ownershipMatch.evidence,
|
|
82
|
+
snapshotId,
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
risks.risks.forEach((risk, index) => {
|
|
86
|
+
claims.push({
|
|
87
|
+
id: `risk_${index}_${risk.kind}_${risk.target}`,
|
|
88
|
+
kind: "risk",
|
|
89
|
+
subject: risk.target,
|
|
90
|
+
confidence: risk.confidence,
|
|
91
|
+
evidence: risk.evidence,
|
|
92
|
+
snapshotId,
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
return claims.sort((a, b) => b.confidence - a.confidence ||
|
|
96
|
+
a.kind.localeCompare(b.kind) ||
|
|
97
|
+
a.subject.localeCompare(b.subject));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Build a Project Mind from a ProjectModel (+ ownership/risk discovery).
|
|
101
|
+
* Never invents facts; preserves unknowns.
|
|
102
|
+
*/
|
|
103
|
+
export async function buildProjectMind(model, options = {}) {
|
|
104
|
+
const snapshot = createSnapshotIdentity(model);
|
|
105
|
+
const ownership = options.ownership ??
|
|
106
|
+
(await discoverOwnership(options.cwd !== undefined ? { cwd: options.cwd } : {}));
|
|
107
|
+
const risks = options.risks ?? discoverRisks(model, ownership);
|
|
108
|
+
const claims = extractClaims(model, ownership, risks, snapshot.id);
|
|
109
|
+
const unknowns = collectUnknowns(ownership, risks, model);
|
|
110
|
+
return Object.freeze({
|
|
111
|
+
snapshot,
|
|
112
|
+
model,
|
|
113
|
+
ownership,
|
|
114
|
+
risks,
|
|
115
|
+
claims: Object.freeze(claims),
|
|
116
|
+
unknowns: Object.freeze(unknowns),
|
|
117
|
+
limitations: Object.freeze([...PROJECT_MIND_LIMITATIONS]),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
export function buildProjectMindSync(model, ownership, risks) {
|
|
121
|
+
const snapshot = createSnapshotIdentity(model);
|
|
122
|
+
const resolvedRisks = risks ?? discoverRisks(model, ownership);
|
|
123
|
+
const claims = extractClaims(model, ownership, resolvedRisks, snapshot.id);
|
|
124
|
+
const unknowns = collectUnknowns(ownership, resolvedRisks, model);
|
|
125
|
+
return Object.freeze({
|
|
126
|
+
snapshot,
|
|
127
|
+
model,
|
|
128
|
+
ownership,
|
|
129
|
+
risks: resolvedRisks,
|
|
130
|
+
claims: Object.freeze(claims),
|
|
131
|
+
unknowns: Object.freeze(unknowns),
|
|
132
|
+
limitations: Object.freeze([...PROJECT_MIND_LIMITATIONS]),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { buildProjectMind, buildProjectMindSync, extractClaims } from "./build.js";
|
|
2
|
+
export { findMindClaim, findMindOwner, findMindRisks, listMindOwnership, listMindRisks, mindSummary, } from "./query.js";
|
|
3
|
+
export { PROJECT_MIND_LIMITATIONS } from "./types.js";
|
|
4
|
+
export type { BuildProjectMindOptions } from "./build.js";
|
|
5
|
+
export type { MindClaimResult, MindOwnershipResult, MindRiskResult } from "./query.js";
|
|
6
|
+
export type { ClaimKind, ProjectClaim, ProjectMind } from "./types.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { OwnershipMatch } from "../ownership/types.js";
|
|
2
|
+
import type { RiskMatch } from "../risks/types.js";
|
|
3
|
+
import type { ProjectClaim, ProjectMind } from "./types.js";
|
|
4
|
+
export interface MindOwnershipResult {
|
|
5
|
+
ownerships: readonly OwnershipMatch[];
|
|
6
|
+
count: number;
|
|
7
|
+
unknowns: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
export interface MindRiskResult {
|
|
10
|
+
risks: readonly RiskMatch[];
|
|
11
|
+
count: number;
|
|
12
|
+
unknowns: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
export interface MindClaimResult {
|
|
15
|
+
claim: ProjectClaim | null;
|
|
16
|
+
found: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function listMindOwnership(mind: ProjectMind): MindOwnershipResult;
|
|
19
|
+
export declare function listMindRisks(mind: ProjectMind): MindRiskResult;
|
|
20
|
+
export declare function findMindOwner(mind: ProjectMind, filePath: string): OwnershipMatch | null;
|
|
21
|
+
export declare function findMindRisks(mind: ProjectMind, target: string): RiskMatch[];
|
|
22
|
+
export declare function findMindClaim(mind: ProjectMind, claimId: string): MindClaimResult;
|
|
23
|
+
export declare function mindSummary(mind: ProjectMind): {
|
|
24
|
+
projectName: string;
|
|
25
|
+
snapshotId: string;
|
|
26
|
+
contentHash: string;
|
|
27
|
+
claimCount: number;
|
|
28
|
+
ownershipCount: number;
|
|
29
|
+
riskCount: number;
|
|
30
|
+
unknownCount: number;
|
|
31
|
+
topDomains: readonly string[];
|
|
32
|
+
topRisks: readonly string[];
|
|
33
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ownersForPath } from "../ownership/index.js";
|
|
2
|
+
export function listMindOwnership(mind) {
|
|
3
|
+
return {
|
|
4
|
+
ownerships: mind.ownership.ownerships,
|
|
5
|
+
count: mind.ownership.ownerships.length,
|
|
6
|
+
unknowns: mind.ownership.unknowns,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function listMindRisks(mind) {
|
|
10
|
+
return {
|
|
11
|
+
risks: mind.risks.risks,
|
|
12
|
+
count: mind.risks.risks.length,
|
|
13
|
+
unknowns: mind.risks.unknowns,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function findMindOwner(mind, filePath) {
|
|
17
|
+
return ownersForPath(filePath, mind.ownership.ownerships);
|
|
18
|
+
}
|
|
19
|
+
export function findMindRisks(mind, target) {
|
|
20
|
+
const needle = target.toLowerCase();
|
|
21
|
+
return mind.risks.risks.filter((risk) => risk.target.toLowerCase().includes(needle) || risk.kind.toLowerCase().includes(needle));
|
|
22
|
+
}
|
|
23
|
+
export function findMindClaim(mind, claimId) {
|
|
24
|
+
const claim = mind.claims.find((item) => item.id === claimId) ?? null;
|
|
25
|
+
return { claim, found: claim !== null };
|
|
26
|
+
}
|
|
27
|
+
export function mindSummary(mind) {
|
|
28
|
+
return {
|
|
29
|
+
projectName: mind.model.metadata.project.name,
|
|
30
|
+
snapshotId: mind.snapshot.id,
|
|
31
|
+
contentHash: mind.snapshot.contentHash,
|
|
32
|
+
claimCount: mind.claims.length,
|
|
33
|
+
ownershipCount: mind.ownership.ownerships.length,
|
|
34
|
+
riskCount: mind.risks.risks.length,
|
|
35
|
+
unknownCount: mind.unknowns.length,
|
|
36
|
+
topDomains: mind.model.summary.topDomains,
|
|
37
|
+
topRisks: mind.risks.risks.slice(0, 5).map((risk) => `${risk.kind}:${risk.target}`),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ProjectModel } from "../model/types.js";
|
|
2
|
+
import type { OwnershipDiscoveryResult } from "../ownership/types.js";
|
|
3
|
+
import type { RiskDiscoveryResult } from "../risks/types.js";
|
|
4
|
+
import type { SnapshotIdentity } from "../snapshot/index.js";
|
|
5
|
+
export type ClaimKind = "domain" | "entrypoint" | "dependency" | "relationship" | "architecture" | "ownership" | "risk";
|
|
6
|
+
export interface ProjectClaim {
|
|
7
|
+
id: string;
|
|
8
|
+
kind: ClaimKind;
|
|
9
|
+
subject: string;
|
|
10
|
+
confidence: number;
|
|
11
|
+
evidence: readonly string[];
|
|
12
|
+
/** Snapshot that produced this claim. */
|
|
13
|
+
snapshotId: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ProjectMind {
|
|
16
|
+
snapshot: SnapshotIdentity;
|
|
17
|
+
model: ProjectModel;
|
|
18
|
+
ownership: OwnershipDiscoveryResult;
|
|
19
|
+
risks: RiskDiscoveryResult;
|
|
20
|
+
claims: readonly ProjectClaim[];
|
|
21
|
+
unknowns: readonly string[];
|
|
22
|
+
limitations: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
export declare const PROJECT_MIND_LIMITATIONS: readonly ["Project Mind is derived from deterministic compiler passes only", "Ownership requires explicit CODEOWNERS / MAINTAINERS / package.json evidence", "Risks describe change-danger, not vulnerability scanning", "Business rules and design intent remain unknown unless evidenced", "AI consumers must not invent repository facts beyond this representation"];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const PROJECT_MIND_LIMITATIONS = [
|
|
2
|
+
"Project Mind is derived from deterministic compiler passes only",
|
|
3
|
+
"Ownership requires explicit CODEOWNERS / MAINTAINERS / package.json evidence",
|
|
4
|
+
"Risks describe change-danger, not vulnerability scanning",
|
|
5
|
+
"Business rules and design intent remain unknown unless evidenced",
|
|
6
|
+
"AI consumers must not invent repository facts beyond this representation",
|
|
7
|
+
];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ProjectModel, ProjectModelBuilderInput } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Builds a canonical immutable ProjectModel from compiler pass outputs.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ProjectModelBuilder {
|
|
6
|
+
build(input: ProjectModelBuilderInput): ProjectModel;
|
|
7
|
+
}
|
|
8
|
+
/** Convenience function wrapping ProjectModelBuilder. */
|
|
9
|
+
export declare function buildProjectModel(input: ProjectModelBuilderInput): ProjectModel;
|