@ophan/core 0.0.2 → 0.0.3

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 (76) hide show
  1. package/dist/community-detectors/index.d.ts +20 -0
  2. package/dist/community-detectors/index.d.ts.map +1 -0
  3. package/dist/community-detectors/index.js +45 -0
  4. package/dist/community-detectors/label-prop.d.ts +20 -0
  5. package/dist/community-detectors/label-prop.d.ts.map +1 -0
  6. package/dist/community-detectors/label-prop.js +77 -0
  7. package/dist/community-detectors/leiden.d.ts +22 -0
  8. package/dist/community-detectors/leiden.d.ts.map +1 -0
  9. package/dist/community-detectors/leiden.js +312 -0
  10. package/dist/community-detectors/louvain.d.ts +13 -0
  11. package/dist/community-detectors/louvain.d.ts.map +1 -0
  12. package/dist/community-detectors/louvain.js +29 -0
  13. package/dist/community-detectors/types.d.ts +36 -0
  14. package/dist/community-detectors/types.d.ts.map +1 -0
  15. package/dist/{parsers/__fixtures__/no-functions.js → community-detectors/types.js} +0 -2
  16. package/dist/edge-resolvers/call.d.ts +13 -0
  17. package/dist/edge-resolvers/call.d.ts.map +1 -0
  18. package/dist/edge-resolvers/call.js +40 -0
  19. package/dist/edge-resolvers/co-location.d.ts +16 -0
  20. package/dist/edge-resolvers/co-location.d.ts.map +1 -0
  21. package/dist/edge-resolvers/co-location.js +129 -0
  22. package/dist/edge-resolvers/import.d.ts +16 -0
  23. package/dist/edge-resolvers/import.d.ts.map +1 -0
  24. package/dist/edge-resolvers/import.js +118 -0
  25. package/dist/edge-resolvers/index.d.ts +9 -0
  26. package/dist/edge-resolvers/index.d.ts.map +1 -0
  27. package/dist/edge-resolvers/index.js +29 -0
  28. package/dist/edge-resolvers/jsx-ref.d.ts +13 -0
  29. package/dist/edge-resolvers/jsx-ref.d.ts.map +1 -0
  30. package/dist/edge-resolvers/jsx-ref.js +40 -0
  31. package/dist/edge-resolvers/types.d.ts +40 -0
  32. package/dist/edge-resolvers/types.d.ts.map +1 -0
  33. package/dist/edge-resolvers/types.js +2 -0
  34. package/dist/graph.d.ts +293 -0
  35. package/dist/graph.d.ts.map +1 -0
  36. package/dist/graph.js +1295 -0
  37. package/dist/index.d.ts +37 -8
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +385 -183
  40. package/dist/migrations.d.ts +25 -0
  41. package/dist/migrations.d.ts.map +1 -0
  42. package/dist/migrations.js +323 -0
  43. package/dist/module-resolvers/index.d.ts +11 -0
  44. package/dist/module-resolvers/index.d.ts.map +1 -0
  45. package/dist/module-resolvers/index.js +67 -0
  46. package/dist/module-resolvers/javascript.d.ts +18 -0
  47. package/dist/module-resolvers/javascript.d.ts.map +1 -0
  48. package/dist/module-resolvers/javascript.js +130 -0
  49. package/dist/module-resolvers/types.d.ts +18 -0
  50. package/dist/module-resolvers/types.d.ts.map +1 -0
  51. package/dist/module-resolvers/types.js +2 -0
  52. package/dist/parsers/python.d.ts.map +1 -1
  53. package/dist/parsers/python.js +38 -4
  54. package/dist/parsers/typescript.d.ts.map +1 -1
  55. package/dist/parsers/typescript.js +133 -0
  56. package/dist/practices.d.ts +28 -0
  57. package/dist/practices.d.ts.map +1 -0
  58. package/dist/practices.js +95 -0
  59. package/dist/schemas.d.ts +251 -3
  60. package/dist/schemas.d.ts.map +1 -1
  61. package/dist/schemas.js +121 -6
  62. package/dist/shared.d.ts +8 -0
  63. package/dist/shared.d.ts.map +1 -1
  64. package/dist/summarize.d.ts +165 -0
  65. package/dist/summarize.d.ts.map +1 -0
  66. package/dist/summarize.js +1067 -0
  67. package/ophan_logo.png +0 -0
  68. package/package.json +9 -2
  69. package/dist/parsers/__fixtures__/arrow-functions.d.ts +0 -5
  70. package/dist/parsers/__fixtures__/arrow-functions.d.ts.map +0 -1
  71. package/dist/parsers/__fixtures__/arrow-functions.js +0 -16
  72. package/dist/parsers/__fixtures__/class-methods.d.ts +0 -6
  73. package/dist/parsers/__fixtures__/class-methods.d.ts.map +0 -1
  74. package/dist/parsers/__fixtures__/class-methods.js +0 -12
  75. package/dist/parsers/__fixtures__/no-functions.d.ts +0 -9
  76. package/dist/parsers/__fixtures__/no-functions.d.ts.map +0 -1
package/dist/schemas.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DATA_TAG_LABELS = exports.SECURITY_FLAG_LABELS = exports.SCHEMA_VERSIONS = exports.ClaudeAnalysisResponse = exports.TypedAnalysis = exports.SecurityAnalysis = exports.DocumentationAnalysis = exports.ReturnsSchema = exports.ParamSchema = exports.KNOWN_SECURITY_FLAGS = exports.KNOWN_DATA_TAGS = exports.AnalysisType = void 0;
3
+ exports.DATA_TAG_LABELS = exports.SECURITY_TIER_LABELS = exports.SECURITY_FLAG_META = exports.SECURITY_FLAG_LABELS = exports.MAX_RULE_LENGTH = exports.MAX_PRACTICES = exports.SCHEMA_VERSIONS = exports.CrossCuttingConcernSummary = exports.L3Summary = exports.L2Summary = exports.L1Summary = exports.SummaryMeta = exports.ClaudeAnalysisResponse = exports.TypedAnalysis = exports.PracticesAnalysis = exports.SecurityAnalysis = exports.DetailedIssue = exports.DocumentationAnalysis = exports.ReturnsSchema = exports.ParamSchema = exports.KNOWN_SECURITY_FLAGS = exports.KNOWN_DATA_TAGS = exports.AnalysisType = void 0;
4
4
  const zod_1 = require("zod");
5
5
  // ============ ANALYSIS TYPE ENUM ============
6
- exports.AnalysisType = zod_1.z.enum(["documentation", "security"]);
6
+ exports.AnalysisType = zod_1.z.enum(["documentation", "security", "practices"]);
7
7
  // ============ KNOWN VALUE SETS ============
8
8
  //
9
9
  // These are the values we prompt Claude for and have display labels for.
@@ -53,13 +53,37 @@ exports.DocumentationAnalysis = zod_1.z.object({
53
53
  returns: exports.ReturnsSchema,
54
54
  });
55
55
  /**
56
- * Security analysis: data flow tags and security vulnerability flags.
57
- * Both fields use z.string() arrays (not enums) open with known values.
58
- * Unknown values from Claude are preserved, not rejected.
56
+ * A rich security or practice issue with location, description, and fix guidance.
57
+ * Every field uses .catch() so malformed Claude responses degrade gracefully.
58
+ * The `line` field is 1-indexed within the function (from line-numbered prompt context).
59
+ * `startText`/`endText` are anchor snippets for character-level precision.
60
+ */
61
+ exports.DetailedIssue = zod_1.z.object({
62
+ flag: zod_1.z.string(),
63
+ title: zod_1.z.string().catch(""),
64
+ description: zod_1.z.string().catch(""),
65
+ explanation: zod_1.z.string().catch(""),
66
+ line: zod_1.z.number().catch(0),
67
+ startText: zod_1.z.string().catch(""),
68
+ endText: zod_1.z.string().catch(""),
69
+ severity: zod_1.z.enum(["error", "warning", "info"]).catch("warning"),
70
+ confidence: zod_1.z.enum(["high", "medium", "low"]).catch("medium"),
71
+ lineText: zod_1.z.string().catch(""), // trimmed source line at analysis time, for modification detection
72
+ });
73
+ /**
74
+ * Security analysis: data flow tags, vulnerability flags, and detailed issues.
75
+ * `securityFlags` is kept as a lightweight summary (for CodeLens icons, filtering, badge counts).
76
+ * `issues` provides rich details (title, description, explanation, line location).
77
+ * `issues` uses .catch([]) so v1 rows (without issues) parse successfully.
59
78
  */
60
79
  exports.SecurityAnalysis = zod_1.z.object({
61
80
  dataTags: zod_1.z.array(zod_1.z.string()),
62
81
  securityFlags: zod_1.z.array(zod_1.z.string()),
82
+ issues: zod_1.z.array(exports.DetailedIssue).catch([]),
83
+ });
84
+ /** Practices analysis: violations of team-defined coding practices. */
85
+ exports.PracticesAnalysis = zod_1.z.object({
86
+ violations: zod_1.z.array(exports.DetailedIssue).catch([]),
63
87
  });
64
88
  // ============ DISCRIMINATED UNION ============
65
89
  exports.TypedAnalysis = zod_1.z.discriminatedUnion("analysisType", [
@@ -71,6 +95,10 @@ exports.TypedAnalysis = zod_1.z.discriminatedUnion("analysisType", [
71
95
  analysisType: zod_1.z.literal("security"),
72
96
  data: exports.SecurityAnalysis,
73
97
  }),
98
+ zod_1.z.object({
99
+ analysisType: zod_1.z.literal("practices"),
100
+ data: exports.PracticesAnalysis,
101
+ }),
74
102
  ]);
75
103
  // ============ CLAUDE RESPONSE VALIDATOR ============
76
104
  /**
@@ -88,6 +116,71 @@ exports.ClaudeAnalysisResponse = zod_1.z.object({
88
116
  returns: exports.ReturnsSchema.catch({ type: "unknown", description: "" }),
89
117
  dataTags: zod_1.z.array(zod_1.z.string()).catch([]),
90
118
  securityFlags: zod_1.z.array(zod_1.z.string()).catch([]),
119
+ issues: zod_1.z.array(exports.DetailedIssue).catch([]),
120
+ practiceViolations: zod_1.z.array(exports.DetailedIssue).catch([]),
121
+ });
122
+ // ============ COMMUNITY SUMMARY SCHEMAS ============
123
+ //
124
+ // Each community summary has two parts:
125
+ // - documentation: rich markdown explaining the subsystem to a junior engineer
126
+ // - meta: structured data for badges, search, filtering in the UI
127
+ //
128
+ // Length scales dynamically with complexity — Claude decides based on
129
+ // function count, relationship density, and security concerns.
130
+ exports.SummaryMeta = zod_1.z.object({
131
+ securityPosture: zod_1.z.string().catch(""),
132
+ dataClassification: zod_1.z.array(zod_1.z.string()).catch([]),
133
+ boundaries: zod_1.z.array(zod_1.z.string()).catch([]),
134
+ keyFunctions: zod_1.z.array(zod_1.z.string()).catch([]),
135
+ complexity: zod_1.z.enum(["low", "medium", "high"]).catch("medium"),
136
+ });
137
+ const defaultMeta = {
138
+ securityPosture: "",
139
+ dataClassification: [],
140
+ boundaries: [],
141
+ keyFunctions: [],
142
+ complexity: "medium",
143
+ };
144
+ /** L1 subsystem summary: docs for a group of closely-related functions */
145
+ exports.L1Summary = zod_1.z.object({
146
+ title: zod_1.z.string().catch("Untitled Subsystem"),
147
+ documentation: zod_1.z.string().catch(""),
148
+ meta: exports.SummaryMeta.catch(defaultMeta),
149
+ });
150
+ /** L2 system summary: docs for a group of L1 subsystems */
151
+ exports.L2Summary = zod_1.z.object({
152
+ title: zod_1.z.string().catch("Untitled System"),
153
+ documentation: zod_1.z.string().catch(""),
154
+ meta: exports.SummaryMeta.catch(defaultMeta),
155
+ });
156
+ /** L3 architecture overview: top-level docs from L2 summaries */
157
+ exports.L3Summary = zod_1.z.object({
158
+ title: zod_1.z.string().catch("Architecture Overview"),
159
+ documentation: zod_1.z.string().catch(""),
160
+ meta: exports.SummaryMeta.catch(defaultMeta),
161
+ });
162
+ // ============ CROSS-CUTTING CONCERN SCHEMA ============
163
+ const defaultCCMeta = {
164
+ bridgeFunctions: [],
165
+ affectedCommunities: [],
166
+ };
167
+ /** Cross-cutting concern summary: docs for a data flow or security pattern spanning communities */
168
+ exports.CrossCuttingConcernSummary = zod_1.z.object({
169
+ title: zod_1.z.string().catch("Untitled Concern"),
170
+ concernType: zod_1.z.string().catch("data_flow"),
171
+ tag: zod_1.z.string().catch("unknown"),
172
+ documentation: zod_1.z.string().catch(""),
173
+ bridgeFunctions: zod_1.z.array(zod_1.z.object({
174
+ functionName: zod_1.z.string(),
175
+ contentHash: zod_1.z.string(),
176
+ communityId: zod_1.z.string(),
177
+ centrality: zod_1.z.number(),
178
+ })).catch(defaultCCMeta.bridgeFunctions),
179
+ affectedCommunities: zod_1.z.array(zod_1.z.object({
180
+ communityId: zod_1.z.string(),
181
+ communityTitle: zod_1.z.string(),
182
+ })).catch(defaultCCMeta.affectedCommunities),
183
+ severity: zod_1.z.string().catch("medium"),
91
184
  });
92
185
  // ============ SCHEMA VERSIONS ============
93
186
  /**
@@ -97,8 +190,12 @@ exports.ClaudeAnalysisResponse = zod_1.z.object({
97
190
  */
98
191
  exports.SCHEMA_VERSIONS = {
99
192
  documentation: 1,
100
- security: 1,
193
+ security: 2,
194
+ practices: 1,
101
195
  };
196
+ // ============ PRACTICE CONSTRAINTS ============
197
+ exports.MAX_PRACTICES = 10;
198
+ exports.MAX_RULE_LENGTH = 200;
102
199
  // ============ DISPLAY LABELS ============
103
200
  //
104
201
  // Label maps for known values. UI code should use these for display,
@@ -116,6 +213,24 @@ exports.SECURITY_FLAG_LABELS = {
116
213
  eval_exec: "Eval/Exec",
117
214
  insecure_subprocess: "Insecure Subprocess",
118
215
  };
216
+ exports.SECURITY_FLAG_META = {
217
+ sql_injection: { tier: 1, cwe: "CWE-89", owasp: "A03:2021" },
218
+ command_injection: { tier: 1, cwe: "CWE-78", owasp: "A03:2021" },
219
+ hardcoded_secret: { tier: 1, cwe: "CWE-798", owasp: "A07:2021" },
220
+ eval_exec: { tier: 2, cwe: "CWE-95", owasp: "A03:2021" },
221
+ path_traversal: { tier: 2, cwe: "CWE-22", owasp: "A01:2021" },
222
+ insecure_subprocess: { tier: 2, cwe: "CWE-78", owasp: "A03:2021" },
223
+ unsanitized_input: { tier: 3, cwe: "CWE-20", owasp: "A03:2021" },
224
+ xss: { tier: 3, cwe: "CWE-79", owasp: "A03:2021" },
225
+ pickle_deserialization: { tier: 3, cwe: "CWE-502", owasp: "A08:2021" },
226
+ prototype_pollution: { tier: 4, cwe: "CWE-1321", owasp: "A03:2021" },
227
+ };
228
+ exports.SECURITY_TIER_LABELS = {
229
+ 1: "Critical",
230
+ 2: "High",
231
+ 3: "Medium",
232
+ 4: "Low",
233
+ };
119
234
  exports.DATA_TAG_LABELS = {
120
235
  user_input: "User Input",
121
236
  pii: "PII",
package/dist/shared.d.ts CHANGED
@@ -7,6 +7,14 @@ export interface FunctionInfo {
7
7
  contentHash: string;
8
8
  language: string;
9
9
  entityType: string;
10
+ calls?: string[];
11
+ jsxRefs?: string[];
12
+ imports?: ImportRef[];
13
+ exported?: boolean;
14
+ }
15
+ export interface ImportRef {
16
+ module: string;
17
+ names: string[];
10
18
  }
11
19
  export declare function computeHash(str: string): string;
12
20
  //# sourceMappingURL=shared.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAID,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C"}
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IAGnB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAID,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C"}
@@ -0,0 +1,165 @@
1
+ import type Database from "better-sqlite3";
2
+ import { type L1Summary as L1SummaryType, type L2Summary as L2SummaryType, type L3Summary as L3SummaryType, type CrossCuttingConcernSummary as CrossCuttingConcernSummaryType } from "./schemas";
3
+ import { type ModuleResolver } from "./graph";
4
+ export declare function computePackageBreakdown(members: {
5
+ filePath: string;
6
+ }[], rootPath: string, resolver?: ModuleResolver): Record<string, number>;
7
+ export declare function formatPackageBreakdown(breakdown: Record<string, number>): string;
8
+ export interface MemberContext {
9
+ contentHash: string;
10
+ functionName: string;
11
+ filePath: string;
12
+ language: string;
13
+ entityType: string;
14
+ description: string;
15
+ params: {
16
+ name: string;
17
+ type: string;
18
+ description: string;
19
+ }[];
20
+ returns: {
21
+ type: string;
22
+ description: string;
23
+ };
24
+ dataTags: string[];
25
+ securityFlags: string[];
26
+ callsTo: string[];
27
+ calledBy: string[];
28
+ }
29
+ export interface L1CommunityContext {
30
+ communityId: string;
31
+ algorithm: string;
32
+ members: MemberContext[];
33
+ inputHash: string;
34
+ internalEdges: {
35
+ from: string;
36
+ to: string;
37
+ type: string;
38
+ }[];
39
+ packageInfo?: string;
40
+ }
41
+ export interface L2CommunityContext {
42
+ communityId: string;
43
+ algorithm: string;
44
+ l1Summaries: {
45
+ communityId: string;
46
+ title: string;
47
+ documentation: string;
48
+ packageInfo?: string;
49
+ }[];
50
+ crossEdges: {
51
+ fromCommunity: string;
52
+ toCommunity: string;
53
+ count: number;
54
+ }[];
55
+ inputHash: string;
56
+ }
57
+ export interface CrossCuttingConcern {
58
+ tag: string;
59
+ concernType: "data_flow" | "security";
60
+ bridgeFunctions: {
61
+ contentHash: string;
62
+ functionName: string;
63
+ communityId: string;
64
+ centrality: number;
65
+ }[];
66
+ affectedCommunities: {
67
+ communityId: string;
68
+ communityTitle: string;
69
+ }[];
70
+ crossEdgeCount: number;
71
+ }
72
+ export interface StoredSummary {
73
+ communityId: string;
74
+ level: number;
75
+ algorithm: string;
76
+ inputHash: string;
77
+ summary: unknown;
78
+ modelVersion: string;
79
+ createdAt: number;
80
+ }
81
+ export interface SummarizeConfig {
82
+ algorithm: string;
83
+ skipUnanalyzed: boolean;
84
+ }
85
+ export declare const DEFAULT_SUMMARIZE_CONFIG: SummarizeConfig;
86
+ export interface SummarizeResult {
87
+ l1Summarized: number;
88
+ l1Cached: number;
89
+ l1DriftSkipped: number;
90
+ l1Failed?: number;
91
+ l2Summarized: number;
92
+ l2Cached: number;
93
+ l3Summarized: number;
94
+ l3Cached: number;
95
+ ccDetected: number;
96
+ ccSummarized: number;
97
+ ccCached: number;
98
+ }
99
+ export interface SummarizeOptions {
100
+ config?: Partial<SummarizeConfig>;
101
+ onProgress?: (step: string) => void;
102
+ /** When provided, L1 prompts use raw function source code instead of analysis metadata */
103
+ sourceMap?: Map<string, string>;
104
+ /** Repository root path — enables package-aware labeling in prompts */
105
+ rootPath?: string;
106
+ /** Injectable for testing — overrides actual Claude calls */
107
+ _summarizeL1?: (context: L1CommunityContext) => Promise<L1SummaryType>;
108
+ _summarizeL2?: (context: L2CommunityContext) => Promise<L2SummaryType>;
109
+ _summarizeL3?: (l2Summaries: L2SummaryType[]) => Promise<L3SummaryType>;
110
+ _summarizeCC?: (concern: CrossCuttingConcern, communityDocs: Map<string, string>) => Promise<CrossCuttingConcernSummaryType>;
111
+ }
112
+ export declare function computeL1InputHash(memberHashes: string[], rawSource?: boolean): string;
113
+ export declare function computeL2InputHash(l1InputHashes: string[]): string;
114
+ export declare function computeL3InputHash(l2InputHashes: string[]): string;
115
+ export declare function computeCCInputHash(concern: CrossCuttingConcern): string;
116
+ export interface FunctionSignature {
117
+ name: string;
118
+ paramCount: number;
119
+ }
120
+ export declare function storeCommunitySignatures(db: Database.Database, communityId: string, algorithm: string, members: MemberContext[]): void;
121
+ export declare function loadCommunitySignatures(db: Database.Database, communityId: string, algorithm: string): FunctionSignature[] | null;
122
+ /**
123
+ * Determine if a community has meaningfully changed by comparing function signatures.
124
+ * Returns true if the community should be re-summarized.
125
+ *
126
+ * A community is "drifted" if:
127
+ * - >threshold of members were added or removed (by name)
128
+ * - >threshold of surviving members changed param count
129
+ */
130
+ export declare function hasCommunityDrifted(oldSigs: FunctionSignature[], newMembers: MemberContext[], threshold?: number): boolean;
131
+ export declare function storeSummary(db: Database.Database, communityId: string, level: number, algorithm: string, inputHash: string, summary: object, modelVersion: string): void;
132
+ export declare function loadSummary(db: Database.Database, communityId: string, level: number, algorithm: string): StoredSummary | null;
133
+ export declare function loadAllSummaries(db: Database.Database, algorithm: string, level: number): StoredSummary[];
134
+ /**
135
+ * Delete community_summaries rows at a given level whose community_id
136
+ * is NOT in the activeIds set. Called after each summarization level
137
+ * to remove orphans from previous runs.
138
+ */
139
+ export declare function cleanupOrphanedSummaries(db: Database.Database, algorithm: string, level: number, activeIds: Set<string>): void;
140
+ export declare function buildL1Context(db: Database.Database, communityId: string, algorithm: string, rootPath?: string): L1CommunityContext | null;
141
+ /**
142
+ * Build L1 context using raw function source code instead of analysis metadata.
143
+ * Used when --raw-source flag is set. Source code comes from the sourceMap
144
+ * (contentHash → sourceCode) which is built from FunctionInfo[] during extraction.
145
+ */
146
+ export declare function buildL1RawContext(db: Database.Database, communityId: string, algorithm: string, sourceMap: Map<string, string>, rootPath?: string): L1CommunityContext | null;
147
+ export declare function summarizeL1(context: L1CommunityContext): Promise<L1SummaryType>;
148
+ export declare function summarizeL1Raw(context: L1CommunityContext): Promise<L1SummaryType>;
149
+ export declare function summarizeL2(context: L2CommunityContext): Promise<L2SummaryType>;
150
+ export declare function summarizeL3(summaries: L2SummaryType[]): Promise<L3SummaryType>;
151
+ /**
152
+ * Detect cross-cutting concerns by analyzing cross-community edges for shared
153
+ * dataTags/securityFlags. Returns concerns sorted by significance (security first,
154
+ * then by affected community count).
155
+ *
156
+ * Significance filter: only returns concerns with 2+ affected community pairs
157
+ * OR at least one bridge function above median centrality.
158
+ */
159
+ export declare function detectCrossCuttingConcerns(db: Database.Database, algorithm: string, centralityScores: Map<string, number>, l1Communities: {
160
+ communityId: string;
161
+ title: string;
162
+ }[]): CrossCuttingConcern[];
163
+ export declare function summarizeCC(concern: CrossCuttingConcern, communityDocs: Map<string, string>): Promise<CrossCuttingConcernSummaryType>;
164
+ export declare function summarizeCommunities(db: Database.Database, options?: SummarizeOptions): Promise<SummarizeResult>;
165
+ //# sourceMappingURL=summarize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summarize.d.ts","sourceRoot":"","sources":["../src/summarize.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAK3C,OAAO,EAOL,KAAK,SAAS,IAAI,aAAa,EAC/B,KAAK,SAAS,IAAI,aAAa,EAC/B,KAAK,SAAS,IAAI,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