carto-md 1.0.7 → 1.0.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/package.json +1 -1
- package/src/cli/init.js +1 -0
- package/src/detector/files.js +6 -4
- package/src/sync.js +7 -6
package/package.json
CHANGED
package/src/cli/init.js
CHANGED
package/src/detector/files.js
CHANGED
|
@@ -44,9 +44,10 @@ function discoverForFramework(projectRoot, framework, ignoreFn) {
|
|
|
44
44
|
});
|
|
45
45
|
const htmlFiles = findFilesRecursive(projectRoot, ['.html'], HTML_IGNORE, ignoreFn);
|
|
46
46
|
|
|
47
|
+
const cappedPy = cap(pyFiles);
|
|
47
48
|
return {
|
|
48
|
-
routeFiles:
|
|
49
|
-
modelFiles:
|
|
49
|
+
routeFiles: cappedPy,
|
|
50
|
+
modelFiles: cappedPy,
|
|
50
51
|
frontendFiles: cap(htmlFiles)
|
|
51
52
|
};
|
|
52
53
|
}
|
|
@@ -59,9 +60,10 @@ function discoverForFramework(projectRoot, framework, ignoreFn) {
|
|
|
59
60
|
});
|
|
60
61
|
const htmlFiles = findFilesRecursive(projectRoot, ['.html'], HTML_IGNORE, ignoreFn);
|
|
61
62
|
|
|
63
|
+
const cappedJs = cap(jsFiles);
|
|
62
64
|
return {
|
|
63
|
-
routeFiles:
|
|
64
|
-
modelFiles:
|
|
65
|
+
routeFiles: cappedJs,
|
|
66
|
+
modelFiles: cappedJs,
|
|
65
67
|
frontendFiles: cap(htmlFiles)
|
|
66
68
|
};
|
|
67
69
|
}
|
package/src/sync.js
CHANGED
|
@@ -56,6 +56,7 @@ async function scanStructure(basePath) {
|
|
|
56
56
|
*/
|
|
57
57
|
async function runFullSync(config) {
|
|
58
58
|
const warnings = [];
|
|
59
|
+
const projectRoot = config.projectRoot || process.cwd();
|
|
59
60
|
|
|
60
61
|
const allRouteFiles = config.watch.routeFiles || [];
|
|
61
62
|
const allModelFiles = config.watch.modelFiles || [];
|
|
@@ -90,7 +91,7 @@ async function runFullSync(config) {
|
|
|
90
91
|
if (!content) continue;
|
|
91
92
|
|
|
92
93
|
const basename = path.basename(filePath);
|
|
93
|
-
const relPath = path.relative(
|
|
94
|
+
const relPath = path.relative(projectRoot, filePath);
|
|
94
95
|
const plugin = getPluginForFile(plugins, filePath);
|
|
95
96
|
|
|
96
97
|
if (!plugin) {
|
|
@@ -181,10 +182,10 @@ async function runFullSync(config) {
|
|
|
181
182
|
// skip — already warned during extraction
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
|
-
const importGraph = buildImportGraph(fileContentsForImports,
|
|
185
|
+
const importGraph = buildImportGraph(fileContentsForImports, projectRoot);
|
|
185
186
|
|
|
186
187
|
// Detect tech stack from watched files + manifests
|
|
187
|
-
const stackItems = buildStackLine(fileContentsForImports,
|
|
188
|
+
const stackItems = buildStackLine(fileContentsForImports, projectRoot);
|
|
188
189
|
|
|
189
190
|
// Compute entry points and high impact files from import graph
|
|
190
191
|
const allValues = new Set();
|
|
@@ -211,7 +212,7 @@ async function runFullSync(config) {
|
|
|
211
212
|
const fileMap = [];
|
|
212
213
|
for (const filePath of allCodeFiles) {
|
|
213
214
|
const basename = path.basename(filePath);
|
|
214
|
-
const relPath = path.relative(
|
|
215
|
+
const relPath = path.relative(projectRoot, filePath);
|
|
215
216
|
const funcCount = (functionsMap[basename] || []).length;
|
|
216
217
|
const routeCount = routeCountMap[filePath] || 0;
|
|
217
218
|
const responsibility = inferResponsibility(basename, funcCount, routeCount);
|
|
@@ -226,7 +227,7 @@ async function runFullSync(config) {
|
|
|
226
227
|
.map(name => ({ name, files: [...envVarMap.get(name)].sort() }));
|
|
227
228
|
|
|
228
229
|
// Scan project structure
|
|
229
|
-
const structure = await scanStructure(
|
|
230
|
+
const structure = await scanStructure(projectRoot);
|
|
230
231
|
|
|
231
232
|
// Validate extracted data — drop anything malformed
|
|
232
233
|
const validated = validateExtracted({
|
|
@@ -256,7 +257,7 @@ async function runFullSync(config) {
|
|
|
256
257
|
mergeIntoAgentsMd(config.output, autoContent);
|
|
257
258
|
|
|
258
259
|
// Save graph to .carto/map.json (atomic write)
|
|
259
|
-
const cartoDir = path.join(
|
|
260
|
+
const cartoDir = path.join(projectRoot, '.carto');
|
|
260
261
|
const mapData = {
|
|
261
262
|
version: '1',
|
|
262
263
|
generated: new Date().toISOString(),
|