CI & Build / TypeScript typecheck (push) Successful in 35s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 14s
CI & Build / Python tests (push) Failing after 1m37s
CI & Build / integration (push) Successful in 2m11s
CI & Build / Build & push image (push) Skipped
A purely numeric #N is a record reference everywhere now. The tag patterns (frontend utils/tags.ts, the editor decoration, the first-line tag strip, tag autocomplete, backend utils/tags.py) leave digits alone, so #3127 is no longer drawn as a tag chip linking to /notes?tag=3127. - utils/recordRefs.ts links #N, milestone N and rule N in rendered markdown, with the same patterns and other-numbering word list as services/record_refs.py. A drift test reads the TS source and fails when the two differ. - v-record-refs (directives/recordRefs.ts) asks POST /api/notes/resolve-refs once per body for what each id is. A link gets the route for its kind (task, lesson, snippet, note, milestone, rule) and its kind and title on hover. One the reader cannot open is drawn as a dead reference, and missing vs not shared read the same. Applied on every surface that renders markdown. - /milestones/:id finds the project and opens its board at that milestone (?milestone= expands it, scrolls to it and focuses it). - Backlinks include records that cite #N in a body or a work log, through readable_notes_clause instead of an owner-only filter, and route by kind. The graph draws #N citations as dashed reference edges. - create_note, create_task and add_task_log say which forms link. There were no numeric tags to clean up: tags are stored only from the explicit field, and none of the 200 most used is numeric. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
217 lines
6.1 KiB
TypeScript
217 lines
6.1 KiB
TypeScript
import { createRouter, createWebHistory } from "vue-router";
|
|
import { useAuthStore } from "@/stores/auth";
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(),
|
|
routes: [
|
|
{
|
|
// The dashboard ("what to work on") is the landing page; Knowledge
|
|
// remains as the exhaustive "Browse" surface.
|
|
path: "/",
|
|
redirect: "/dashboard",
|
|
},
|
|
{
|
|
path: "/dashboard",
|
|
name: "dashboard",
|
|
component: () => import("@/views/DashboardView.vue"),
|
|
},
|
|
{
|
|
path: "/knowledge",
|
|
name: "knowledge",
|
|
component: () => import("@/views/KnowledgeView.vue"),
|
|
},
|
|
{
|
|
path: "/login",
|
|
name: "login",
|
|
component: () => import("@/views/LoginView.vue"),
|
|
meta: { public: true },
|
|
},
|
|
{
|
|
path: "/register",
|
|
name: "register",
|
|
component: () => import("@/views/RegisterView.vue"),
|
|
meta: { public: true },
|
|
},
|
|
{
|
|
path: "/forgot-password",
|
|
name: "forgot-password",
|
|
component: () => import("@/views/ForgotPasswordView.vue"),
|
|
meta: { public: true },
|
|
},
|
|
{
|
|
path: "/reset-password",
|
|
name: "reset-password",
|
|
component: () => import("@/views/ResetPasswordView.vue"),
|
|
meta: { public: true },
|
|
},
|
|
{
|
|
path: "/register-invite",
|
|
name: "register-invite",
|
|
component: () => import("@/views/RegisterInviteView.vue"),
|
|
meta: { public: true },
|
|
},
|
|
{
|
|
path: "/notes",
|
|
redirect: "/knowledge",
|
|
},
|
|
{
|
|
path: "/notes/new",
|
|
name: "note-new",
|
|
component: () => import("@/views/NoteEditorView.vue"),
|
|
},
|
|
{
|
|
path: "/notes/:id",
|
|
name: "note-view",
|
|
component: () => import("@/views/NoteViewerView.vue"),
|
|
},
|
|
{
|
|
path: "/notes/:id/edit",
|
|
name: "note-edit",
|
|
component: () => import("@/views/NoteEditorView.vue"),
|
|
},
|
|
{
|
|
// Lessons have no list view of their own: the Knowledge browse surface
|
|
// is where every kind is enumerated, and a second list would be a
|
|
// second vocabulary to keep in step with it. `/knowledge?type=lesson` is
|
|
// the list.
|
|
path: "/lessons/new",
|
|
name: "lesson-new",
|
|
component: () => import("@/views/LessonEditorView.vue"),
|
|
},
|
|
{
|
|
path: "/lessons/:id",
|
|
name: "lesson-view",
|
|
component: () => import("@/views/LessonDetailView.vue"),
|
|
},
|
|
{
|
|
path: "/lessons/:id/edit",
|
|
name: "lesson-edit",
|
|
component: () => import("@/views/LessonEditorView.vue"),
|
|
},
|
|
{
|
|
path: "/snippets",
|
|
name: "snippets",
|
|
component: () => import("@/views/SnippetListView.vue"),
|
|
},
|
|
{
|
|
path: "/snippets/new",
|
|
name: "snippet-new",
|
|
component: () => import("@/views/SnippetEditorView.vue"),
|
|
},
|
|
{
|
|
path: "/snippets/:id",
|
|
name: "snippet-view",
|
|
component: () => import("@/views/SnippetDetailView.vue"),
|
|
},
|
|
{
|
|
path: "/snippets/:id/edit",
|
|
name: "snippet-edit",
|
|
component: () => import("@/views/SnippetEditorView.vue"),
|
|
},
|
|
{
|
|
path: "/graph",
|
|
name: "graph",
|
|
component: () => import("@/views/GraphView.vue"),
|
|
},
|
|
{
|
|
path: "/projects",
|
|
name: "projects",
|
|
component: () => import("@/views/ProjectListView.vue"),
|
|
},
|
|
{
|
|
path: "/projects/:id",
|
|
name: "project-view",
|
|
component: () => import("@/views/ProjectView.vue"),
|
|
},
|
|
{
|
|
// Where a `milestone N` reference leads. A milestone is shown on its
|
|
// project's board, so this only looks up which project and goes there.
|
|
path: "/milestones/:id",
|
|
name: "milestone",
|
|
component: () => import("@/views/ProjectListView.vue"),
|
|
beforeEnter: async (to) => {
|
|
const id = Number(to.params.id);
|
|
const { resolveRecordRefs } = await import("@/directives/recordRefs");
|
|
try {
|
|
const found = (await resolveRecordRefs([{ space: "milestones", id }])).get(`milestones:${id}`);
|
|
if (found) return found.href;
|
|
} catch {
|
|
// Fall through to the projects list with the notice below.
|
|
}
|
|
const { useToastStore } = await import("@/stores/toast");
|
|
useToastStore().show(`No milestone ${id} you can open`, "warning");
|
|
return { name: "projects" };
|
|
},
|
|
},
|
|
{
|
|
path: "/rules",
|
|
name: "rules",
|
|
component: () => import("@/views/RulesView.vue"),
|
|
},
|
|
{
|
|
// Family canon: ideas shared across every project on a
|
|
// platform, and the log of every decision about them.
|
|
path: "/family",
|
|
name: "family",
|
|
component: () => import("@/views/FamilyView.vue"),
|
|
},
|
|
{
|
|
// The design systems this install RECORDS — for the projects it tracks,
|
|
// not for the install itself. A page reading the running app's own
|
|
// stylesheet out of the browser could only inspect the instance it was
|
|
// served from, a mirror rather than a tool.
|
|
path: "/design-systems",
|
|
name: "design-systems",
|
|
component: () => import("@/views/DesignSystemsView.vue"),
|
|
},
|
|
{
|
|
path: "/tasks",
|
|
redirect: "/",
|
|
},
|
|
{
|
|
path: "/tasks/new",
|
|
name: "task-new",
|
|
component: () => import("@/views/TaskEditorView.vue"),
|
|
},
|
|
{
|
|
path: "/tasks/:id",
|
|
name: "task-edit",
|
|
component: () => import("@/views/TaskEditorView.vue"),
|
|
},
|
|
{
|
|
path: "/shared",
|
|
name: "shared-with-me",
|
|
component: () => import("@/views/SharedWithMeView.vue"),
|
|
},
|
|
{
|
|
path: "/settings",
|
|
name: "settings",
|
|
component: () => import("@/views/SettingsView.vue"),
|
|
},
|
|
{
|
|
path: "/trash",
|
|
name: "trash",
|
|
component: () => import("@/views/TrashView.vue"),
|
|
},
|
|
{ path: "/admin/users", redirect: "/settings" },
|
|
{ path: "/admin/logs", redirect: "/settings" },
|
|
],
|
|
});
|
|
|
|
router.beforeEach(async (to) => {
|
|
if (to.meta.public) return;
|
|
|
|
const authStore = useAuthStore();
|
|
|
|
// Wait for initial auth check if still loading
|
|
if (authStore.loading && !authStore.isAuthenticated) {
|
|
await authStore.checkAuth();
|
|
}
|
|
|
|
if (!authStore.isAuthenticated) {
|
|
return { name: "login", query: { redirect: to.fullPath } };
|
|
}
|
|
});
|
|
|
|
export default router;
|