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

fix: normalize declared navigation aliases before matching

[._.]/ Adam Eivy1623bef901e9
diff --git a/server/lib/navManifest.js b/server/lib/navManifest.js
index d2ad20b523..e26758abc2 100644
--- a/server/lib/navManifest.js
+++ b/server/lib/navManifest.js
@@ -483,7 +483,6 @@ for (const cmd of NAV_COMMANDS) {
if (!aliasToPath[alias]) aliasToPath[alias] = cmd.path;
}
}
-const ALIAS_KEYS = Object.keys(aliasToPath);
export const getNavAliasMap = () => ({ ...aliasToPath });
@@ -493,9 +492,19 @@ export const normalizeLabel = (s) => (s || '')
.trim()
.replace(/[.!?:;,"']+$/, '');
+// Derive lookup keys using the same normalization as spoken input. Keep the
+// original alias for getNavAliasMap(), matched, and command ownership lookup.
+const normalizeNavAlias = (alias) => normalizeLabel(alias).replace(/\s+/g, '-');
+const normalizedAliases = new Map();
+for (const alias of Object.keys(aliasToPath)) {
+ const key = normalizeNavAlias(alias);
+ if (!normalizedAliases.has(key)) normalizedAliases.set(key, alias);
+}
+const ALIAS_KEYS = [...normalizedAliases.keys()];
+
export const resolveNavCommand = (input) => {
if (!input || typeof input !== 'string') return null;
- const norm = normalizeLabel(input).replace(/\s+/g, '-');
+ const norm = normalizeNavAlias(input);
if (!norm) return null;
const tail = norm.split('-').filter(Boolean).pop();
@@ -529,6 +538,7 @@ export const resolveNavCommand = (input) => {
}
if (!matched) return null;
+ matched = normalizedAliases.get(matched);
const path = aliasToPath[matched];
const command = NAV_COMMANDS.find((c) => c.path === path && (c.aliases || []).includes(matched))
|| NAV_COMMANDS.find((c) => c.path === path);
diff --git a/server/lib/navManifest.test.js b/server/lib/navManifest.test.js
index befcf2d969..dc8c02cf6a 100644
--- a/server/lib/navManifest.test.js
+++ b/server/lib/navManifest.test.js
@@ -248,6 +248,17 @@ describe('nav contract — instance-feature gating', () => {
});
describe('resolveNavCommand — fuzzy matching', () => {
+ it('resolves every declared alias to its owning command', () => {
+ for (const command of NAV_COMMANDS) {
+ for (const alias of command.aliases || []) {
+ const hit = resolveNavCommand(alias);
+ expect(hit?.path, alias).toBe(command.path);
+ expect(hit?.command?.id, alias).toBe(command.id);
+ expect(command.aliases, alias).toContain(hit?.matched);
+ }
+ }
+ });
+
it('resolves exact alias', () => {
expect(resolveNavCommand('dashboard')?.path).toBe('/');
expect(resolveNavCommand('tasks')?.path).toBe('/cos/tasks');