openkrak-mcp 1.0.19 → 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.
Files changed (2) hide show
  1. package/dist/index.js +84 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -241629,13 +241629,63 @@ function createLogger(component) {
241629
241629
  process.stderr
241630
241630
  );
241631
241631
  }
241632
- var SUPPORTED_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx"];
241632
+ var SUPPORTED_EXTENSIONS = [
241633
+ // JavaScript / TypeScript
241634
+ ".ts",
241635
+ ".tsx",
241636
+ ".js",
241637
+ ".jsx",
241638
+ // Python
241639
+ ".py",
241640
+ // Go
241641
+ ".go",
241642
+ // Rust
241643
+ ".rs",
241644
+ // Java
241645
+ ".java",
241646
+ // C#
241647
+ ".cs"
241648
+ ];
241649
+ var LANGUAGE_BY_EXT = {
241650
+ ".ts": "typescript",
241651
+ ".tsx": "typescript",
241652
+ ".js": "javascript",
241653
+ ".jsx": "javascript",
241654
+ ".py": "python",
241655
+ ".go": "go",
241656
+ ".rs": "rust",
241657
+ ".java": "java",
241658
+ ".cs": "csharp"
241659
+ };
241660
+ function isTypeScriptOrJS(filePath) {
241661
+ const ext2 = import_path.default.extname(filePath).toLowerCase();
241662
+ return [".ts", ".tsx", ".js", ".jsx"].includes(ext2);
241663
+ }
241633
241664
  async function discoverFiles(repoRoot) {
241634
241665
  const patterns = SUPPORTED_EXTENSIONS.map((ext2) => `**/*${ext2}`);
241635
241666
  const files = await glob(patterns, {
241636
241667
  cwd: repoRoot,
241637
241668
  absolute: false,
241638
- ignore: ["**/node_modules/**", "**/dist/**", "**/build/**", "**/.git/**", "**/*.d.ts"]
241669
+ ignore: [
241670
+ "**/node_modules/**",
241671
+ "**/dist/**",
241672
+ "**/build/**",
241673
+ "**/.git/**",
241674
+ "**/*.d.ts",
241675
+ // Python
241676
+ "**/__pycache__/**",
241677
+ "**/.venv/**",
241678
+ "**/venv/**",
241679
+ "**/*.pyc",
241680
+ // Go
241681
+ "**/vendor/**",
241682
+ // Rust
241683
+ "**/target/**",
241684
+ // Java / C#
241685
+ "**/bin/**",
241686
+ "**/obj/**",
241687
+ "**/.gradle/**"
241688
+ ]
241639
241689
  });
241640
241690
  return files.map((f) => f.replace(/\\/g, "/")).sort();
241641
241691
  }
@@ -242804,6 +242854,35 @@ function extractCyclomaticComplexity(ast, filePath) {
242804
242854
  return fileMetrics;
242805
242855
  }
242806
242856
  var logger = createLogger("deepstrike");
242857
+ function detectPrimaryLanguage(filePaths) {
242858
+ const counts = computeLanguageCounts(filePaths);
242859
+ let maxLang = "typescript";
242860
+ let maxCount = 0;
242861
+ for (const [lang, count] of Object.entries(counts)) {
242862
+ if (count > maxCount) {
242863
+ maxCount = count;
242864
+ maxLang = lang;
242865
+ }
242866
+ }
242867
+ return maxLang;
242868
+ }
242869
+ function computeLanguageBreakdown(filePaths) {
242870
+ const counts = computeLanguageCounts(filePaths);
242871
+ const total = filePaths.length || 1;
242872
+ return Object.entries(counts).map(([name, count]) => ({
242873
+ name,
242874
+ percentage: Math.round(count / total * 100)
242875
+ }));
242876
+ }
242877
+ function computeLanguageCounts(filePaths) {
242878
+ const counts = {};
242879
+ for (const fp of filePaths) {
242880
+ const ext2 = fp.slice(fp.lastIndexOf(".")).toLowerCase();
242881
+ const lang = LANGUAGE_BY_EXT[ext2] ?? "unknown";
242882
+ counts[lang] = (counts[lang] ?? 0) + 1;
242883
+ }
242884
+ return counts;
242885
+ }
242807
242886
  async function runDeepStrike(store, opts) {
242808
242887
  const start = Date.now();
242809
242888
  const scanId = store.getMeta().scan_id;
@@ -242849,7 +242928,7 @@ async function runDeepStrike(store, opts) {
242849
242928
  allFindings.push(...secFindings);
242850
242929
  try {
242851
242930
  const partialEntry = await buildFileIndexEntry(opts.repoRoot, relPath, content, symbols.length);
242852
- const cyclomaticByFunc = extractCyclomaticComplexity(ast, relPath);
242931
+ const cyclomaticByFunc = isTypeScriptOrJS(relPath) ? extractCyclomaticComplexity(parseFile(absPath, content, opts.repoRoot).ast, relPath) : /* @__PURE__ */ new Map();
242853
242932
  const entry = {
242854
242933
  ...partialEntry,
242855
242934
  complexity: {
@@ -242881,8 +242960,8 @@ async function runDeepStrike(store, opts) {
242881
242960
  name: repoName,
242882
242961
  path: opts.repoRoot,
242883
242962
  remote_url: null,
242884
- primary_language: "typescript",
242885
- languages: [{ name: "typescript", percentage: 100 }],
242963
+ primary_language: detectPrimaryLanguage(fileIndexEntries.map((e) => e.path)),
242964
+ languages: computeLanguageBreakdown(fileIndexEntries.map((e) => e.path)),
242886
242965
  framework: null,
242887
242966
  total_files: relFiles.length,
242888
242967
  total_loc: fileIndexEntries.reduce((s, e) => s + e.loc, 0),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openkrak-mcp",
3
- "version": "1.0.19",
3
+ "version": "1.1.0",
4
4
  "description": "OpenKrak MCP Server - AI coding intelligence via Dorchester engine",
5
5
  "mcpName": "io.github.FrnzJulianBergmann/openkrak",
6
6
  "type": "commonjs",