@bryan-thompson/inspector-assessment-cli 1.20.8 → 1.20.9
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/build/assess-full.js +25 -0
- package/package.json +1 -1
package/build/assess-full.js
CHANGED
|
@@ -89,14 +89,39 @@ function loadServerConfig(serverName, configPath) {
|
|
|
89
89
|
*/
|
|
90
90
|
function loadSourceFiles(sourcePath) {
|
|
91
91
|
const result = {};
|
|
92
|
+
// Search for README in source directory and parent directories (up to 3 levels)
|
|
93
|
+
// This handles cases where --source points to a subdirectory but README is at repo root
|
|
92
94
|
const readmePaths = ["README.md", "readme.md", "Readme.md"];
|
|
95
|
+
let readmeFound = false;
|
|
96
|
+
// First try the source directory itself
|
|
93
97
|
for (const readmePath of readmePaths) {
|
|
94
98
|
const fullPath = path.join(sourcePath, readmePath);
|
|
95
99
|
if (fs.existsSync(fullPath)) {
|
|
96
100
|
result.readmeContent = fs.readFileSync(fullPath, "utf-8");
|
|
101
|
+
readmeFound = true;
|
|
97
102
|
break;
|
|
98
103
|
}
|
|
99
104
|
}
|
|
105
|
+
// If not found, search parent directories (up to 3 levels)
|
|
106
|
+
if (!readmeFound) {
|
|
107
|
+
let currentDir = sourcePath;
|
|
108
|
+
for (let i = 0; i < 3; i++) {
|
|
109
|
+
const parentDir = path.dirname(currentDir);
|
|
110
|
+
if (parentDir === currentDir)
|
|
111
|
+
break; // Reached filesystem root
|
|
112
|
+
for (const readmePath of readmePaths) {
|
|
113
|
+
const fullPath = path.join(parentDir, readmePath);
|
|
114
|
+
if (fs.existsSync(fullPath)) {
|
|
115
|
+
result.readmeContent = fs.readFileSync(fullPath, "utf-8");
|
|
116
|
+
readmeFound = true;
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (readmeFound)
|
|
121
|
+
break;
|
|
122
|
+
currentDir = parentDir;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
100
125
|
const packagePath = path.join(sourcePath, "package.json");
|
|
101
126
|
if (fs.existsSync(packagePath)) {
|
|
102
127
|
result.packageJson = JSON.parse(fs.readFileSync(packagePath, "utf-8"));
|
package/package.json
CHANGED