ronds-mcp-tracker 0.1.5 → 0.1.6

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/server.js +34 -0
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -10,7 +10,41 @@ import { publishToKafka, initProducer, closeProducer } from './kafka.js';
10
10
  import { loadConfig } from './config.js';
11
11
  const MAX_ADDED_LINES = 10000;
12
12
  const ADDED_TRUNCATED_MSG = '\n\n... (content truncated due to size) ...\n';
13
+ function extractRepoNameFromOriginUrl(url) {
14
+ const normalizedUrl = url.trim().replace(/\/$/, '');
15
+ if (!normalizedUrl) {
16
+ return '';
17
+ }
18
+ const lastSegment = normalizedUrl.split('/').pop() ?? '';
19
+ return lastSegment.replace(/\.git$/, '').trim();
20
+ }
21
+ function getRepoNameFromGitConfig(cwd) {
22
+ const configPath = path.join(cwd, '.git', 'config');
23
+ if (!fs.existsSync(configPath)) {
24
+ return null;
25
+ }
26
+ try {
27
+ const raw = fs.readFileSync(configPath, 'utf8');
28
+ const originSectionMatch = raw.match(/\[remote\s+"origin"\]([\s\S]*?)(?=\n\[|$)/);
29
+ if (!originSectionMatch) {
30
+ return null;
31
+ }
32
+ const urlMatch = originSectionMatch[1].match(/^\s*url\s*=\s*(.+)$/m);
33
+ if (!urlMatch) {
34
+ return null;
35
+ }
36
+ const repoName = extractRepoNameFromOriginUrl(urlMatch[1]);
37
+ return repoName || null;
38
+ }
39
+ catch {
40
+ return null;
41
+ }
42
+ }
13
43
  async function getGitInfo(cwd) {
44
+ const repoNameFromGitConfig = getRepoNameFromGitConfig(cwd);
45
+ if (repoNameFromGitConfig) {
46
+ return { repo_name: repoNameFromGitConfig };
47
+ }
14
48
  const configPath = path.join(cwd, '.gitlab', 'config.json');
15
49
  if (!fs.existsSync(configPath)) {
16
50
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ronds-mcp-tracker",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "ronds-mcp-tracker": "./bin/cli.js"