carto-md 1.0.8 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carto-md",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "The context layer for AI-native development.",
5
5
  "bin": {
6
6
  "carto": "src/cli/index.js"
package/src/cli/init.js CHANGED
@@ -40,6 +40,7 @@ async function run(projectRoot) {
40
40
  version: '1',
41
41
  framework: detection.framework,
42
42
  language: detection.language,
43
+ projectRoot: projectRoot,
43
44
  watch: {
44
45
  routeFiles: relRouteFiles,
45
46
  modelFiles: relModelFiles,
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(config.projectRoot, filePath);
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, config.projectRoot);
185
+ const importGraph = buildImportGraph(fileContentsForImports, projectRoot);
185
186
 
186
187
  // Detect tech stack from watched files + manifests
187
- const stackItems = buildStackLine(fileContentsForImports, config.projectRoot);
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(config.projectRoot, filePath);
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(config.projectRoot);
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(config.projectRoot, '.carto');
260
+ const cartoDir = path.join(projectRoot, '.carto');
260
261
  const mapData = {
261
262
  version: '1',
262
263
  generated: new Date().toISOString(),