repomeld 3.0.1 → 3.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.
- package/package.json +4 -4
- package/src/core/fileScanner.js +41 -10
- package/src/utils/constants.js +3 -2
- package/src/utils/version.js +24 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repomeld",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Meld your entire repo into a single file — perfect for AI context & code reviews",
|
|
5
5
|
"main": "bin/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|
|
35
|
-
"url": "git+https://github.com/
|
|
35
|
+
"url": "git+https://github.com/sakshsky/repomeld.git"
|
|
36
36
|
},
|
|
37
37
|
"bugs": {
|
|
38
|
-
"url": "https://github.com/
|
|
38
|
+
"url": "https://github.com/sakshsky/repomeld/issues"
|
|
39
39
|
},
|
|
40
|
-
"homepage": "https://github.com/
|
|
40
|
+
"homepage": "https://github.com/sakshsky/repomeld#readme"
|
|
41
41
|
}
|
package/src/core/fileScanner.js
CHANGED
|
@@ -2,10 +2,20 @@ const fs = require("fs").promises;
|
|
|
2
2
|
const path = require("path");
|
|
3
3
|
const { normalizePath } = require("../utils/constants");
|
|
4
4
|
|
|
5
|
+
// Pattern to detect repomeld-related files/folders
|
|
6
|
+
const REPOMELD_PATTERN = /^repomeld/i; // Case-insensitive, matches anything starting with "repomeld"
|
|
7
|
+
|
|
5
8
|
async function getAllFilesWithIgnore(dirPath, ig, forceIncludePatterns) {
|
|
6
9
|
const fileList = [];
|
|
7
10
|
const stack = [{ dirPath, relativePath: '.' }];
|
|
8
11
|
|
|
12
|
+
// Pre-process force include patterns for faster matching
|
|
13
|
+
const processedPatterns = forceIncludePatterns?.map(pattern => ({
|
|
14
|
+
original: pattern,
|
|
15
|
+
clean: pattern.replace(/^\.\//, '').replace(/\/$/, ''),
|
|
16
|
+
isExact: !pattern.includes('*') && !pattern.includes('/')
|
|
17
|
+
})) || [];
|
|
18
|
+
|
|
9
19
|
while (stack.length) {
|
|
10
20
|
const { dirPath: currentDir, relativePath: currentRelative } = stack.pop();
|
|
11
21
|
|
|
@@ -20,19 +30,40 @@ async function getAllFilesWithIgnore(dirPath, ig, forceIncludePatterns) {
|
|
|
20
30
|
const fullPath = path.join(currentDir, entry.name);
|
|
21
31
|
const relativePath = path.join(currentRelative, entry.name);
|
|
22
32
|
const normalizedPath = normalizePath(relativePath);
|
|
33
|
+
|
|
34
|
+
// HARD-CODED: Always ignore any file/folder starting with "repomeld"
|
|
35
|
+
// This prevents recursive inclusion and infinite loops
|
|
36
|
+
// Also ignores repomeld_output.txt, repomeld_zips/, etc.
|
|
37
|
+
if (REPOMELD_PATTERN.test(entry.name)) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
23
40
|
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
41
|
+
// Fast force-include check
|
|
42
|
+
let isForceIncluded = false;
|
|
43
|
+
if (processedPatterns.length) {
|
|
44
|
+
for (const pattern of processedPatterns) {
|
|
45
|
+
if (pattern.isExact) {
|
|
46
|
+
// Exact match - fastest
|
|
47
|
+
if (entry.name === pattern.clean || normalizedPath === pattern.clean) {
|
|
48
|
+
isForceIncluded = true;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
// Pattern matching
|
|
53
|
+
if (normalizedPath.includes(pattern.clean) ||
|
|
54
|
+
normalizedPath.startsWith(pattern.clean + '/') ||
|
|
55
|
+
entry.name.includes(pattern.clean)) {
|
|
56
|
+
isForceIncluded = true;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
33
62
|
|
|
34
63
|
// Only check ignore if not force-included
|
|
35
|
-
if (!isForceIncluded && ig.ignores(normalizedPath))
|
|
64
|
+
if (!isForceIncluded && ig.ignores(normalizedPath)) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
36
67
|
|
|
37
68
|
if (entry.isDirectory()) {
|
|
38
69
|
stack.push({ dirPath: fullPath, relativePath });
|
package/src/utils/constants.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
const path = require("path");
|
|
2
|
+
const { getVersion } = require("./version");
|
|
2
3
|
|
|
3
4
|
// Normalize paths for cross-platform compatibility
|
|
4
5
|
const normalizePath = (p) => p.split(path.sep).join('/');
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
const PACKAGE_NAME =
|
|
7
|
+
// Auto-read version from package.json
|
|
8
|
+
const { version: VERSION, name: PACKAGE_NAME } = getVersion();
|
|
8
9
|
|
|
9
10
|
const DEFAULT_IGNORE = [
|
|
10
11
|
"node_modules", ".git", ".env", ".env.local", ".env.production",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
|
|
4
|
+
// Cache the version to avoid reading file multiple times
|
|
5
|
+
let cachedVersion = null;
|
|
6
|
+
let cachedPackageName = null;
|
|
7
|
+
|
|
8
|
+
function getVersion() {
|
|
9
|
+
if (!cachedVersion) {
|
|
10
|
+
try {
|
|
11
|
+
const packageJsonPath = path.join(__dirname, "../../package.json");
|
|
12
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
13
|
+
cachedVersion = packageJson.version;
|
|
14
|
+
cachedPackageName = packageJson.name;
|
|
15
|
+
} catch (error) {
|
|
16
|
+
console.warn(`⚠️ Could not read package.json: ${error.message}`);
|
|
17
|
+
cachedVersion = "0.0.0";
|
|
18
|
+
cachedPackageName = "repomeld";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return { version: cachedVersion, name: cachedPackageName };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = { getVersion };
|