Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

drop the scan fields and duplicated constants left behind when line numbers went

[._.]/ Adam Eivyd3622c599084
diff --git a/scripts/generate-api-route-catalog.js b/scripts/generate-api-route-catalog.js
index 6f337ad9a1..ac4fde6813 100644
--- a/scripts/generate-api-route-catalog.js
+++ b/scripts/generate-api-route-catalog.js
@@ -168,38 +168,26 @@ const joinRoutePath = (...parts) => {
return `/${joined}`.replace(/\/{2,}/g, '/');
};
-const uniqueSortedSources = (sources) => [...new Set(sources)].sort((a, b) => a.localeCompare(b));
-
-export function parseTopLevelMounts({ source, filePath, repoRoot = REPO_ROOT }) {
+export function parseTopLevelMounts({ source, filePath }) {
const imports = parseImports(source, filePath);
const mounts = [];
for (const match of source.matchAll(APP_MOUNT_RE)) {
const imported = imports.get(match[3]);
if (!imported) continue;
- mounts.push({
- mountPath: match[2],
- routerName: match[3],
- filePath: imported.file,
- imported: imported.imported,
- source: toPosix(relative(repoRoot, filePath)),
- });
+ mounts.push({ mountPath: match[2], filePath: imported.file });
}
return mounts;
}
/**
* Walk the mounted route graph and return everything the scan learned,
- * including the declaration keys that never reach the manifest.
- *
- * `buildApiRouteCatalog` narrows this to the serializable subset. Tests that
- * need to prove every declaration in `server/routes/**` was reached compare
- * two fresh in-memory scans, so the manifest does not have to carry pointers
- * back into the source it was derived from.
+ * including the `declarationKeys` that never reach the manifest —
+ * `buildApiRouteCatalog` narrows this to the serializable subset.
*/
export function scanRouteGraph({ repoRoot = REPO_ROOT, indexSource } = {}) {
const indexPath = join(repoRoot, INDEX_RELATIVE_PATH);
const source = indexSource ?? readFileSync(indexPath, 'utf8');
- const topLevelMounts = parseTopLevelMounts({ source, filePath: indexPath, repoRoot });
+ const topLevelMounts = parseTopLevelMounts({ source, filePath: indexPath });
const moduleCache = new Map();
const operations = new Map();
const declarationKeys = new Set();
@@ -284,7 +272,7 @@ export function scanRouteGraph({ repoRoot = REPO_ROOT, indexSource } = {}) {
}
const routes = [...operations.values()]
- .map((operation) => ({ ...operation, sources: uniqueSortedSources(operation.sources) }))
+ .map((operation) => ({ ...operation, sources: [...new Set(operation.sources)].sort() }))
.sort((a, b) => a.path.localeCompare(b.path) || a.method.localeCompare(b.method));
return {
diff --git a/server/lib/apiCatalog.js b/server/lib/apiCatalog.js
index 9eac6d15b9..2933272231 100644
--- a/server/lib/apiCatalog.js
+++ b/server/lib/apiCatalog.js
@@ -95,9 +95,10 @@ export const buildApiCatalog = (settings = {}) => {
const modeled = operations.filter((operation) => operation.contractStatus === 'modeled').length;
return {
- // Bumped to 2 with the manifest: `operations[].sources` is now a list of
- // repo-relative file paths rather than `{ source, line }` records.
- schemaVersion: 2,
+ // Mirrors the manifest rather than restating it: this projection reshapes
+ // `operations[]` but never changes the shape independently, so a hand-copied
+ // literal here could only ever drift from the file it describes.
+ schemaVersion: routeManifest.schemaVersion,
generatedFrom: 'server/index.js and mounted Express routers',
regenerateCommand: 'node scripts/generate-api-route-catalog.js',
stats: { ...routeManifest.stats, domains: domains.length, modeled, generated: operations.length - modeled },
diff --git a/server/lib/openapiSpec.js b/server/lib/openapiSpec.js
index 3edf857f8b..16c7b2ac41 100644
--- a/server/lib/openapiSpec.js
+++ b/server/lib/openapiSpec.js
@@ -52,11 +52,10 @@ export const apiOperationId = (method, path) => {
const generatedOperation = (operation) => {
const parameters = pathParametersFor(operation.path);
- const source = operation.sources.join(', ');
return {
operationId: apiOperationId(operation.method, operation.path),
summary: operation.summary,
- description: `Generated from the mounted Express route inventory. Detailed request and response schemas are not modeled yet. Source: ${source}.`,
+ description: `Generated from the mounted Express route inventory. Detailed request and response schemas are not modeled yet. Source: ${operation.sources.join(', ')}.`,
tags: [operation.domain],
...(parameters.length ? { parameters } : {}),
responses: { default: { description: 'Response shape is not yet modeled.' } },