← back to MagicMicky__chronicle

Function bodies 868 total

All specs Real LLM only Function bodies
createDigestsStore function · typescript · L16-L56 (41 LOC)
app/src/lib/stores/digests.ts
function createDigestsStore() {
  const { subscribe, set, update } = writable<DigestsState>({
    digests: [],
    isGenerating: false,
  });

  return {
    subscribe,

    async load(workspacePath: string) {
      try {
        const digests = await invoke<DigestInfo[]>('list_digests', { workspacePath });
        update((s) => ({ ...s, digests }));
      } catch (e) {
        console.error('Failed to load digests:', e);
      }
    },

    async generate(
      workspacePath: string,
      range: string,
      fromDate?: string,
      toDate?: string
    ) {
      update((s) => ({ ...s, isGenerating: true }));
      try {
        await invoke('generate_digest', { workspacePath, range, fromDate, toDate });
        // Reload digest list after generation
        const digests = await invoke<DigestInfo[]>('list_digests', { workspacePath });
        update((s) => ({ ...s, digests, isGenerating: false }));
      } catch (e) {
        console.error('Failed to generate digest:', e);
        
createDigestsStore function · typescript · L16-L56 (41 LOC)
app/src/lib/stores/digests.ts
function createDigestsStore() {
  const { subscribe, set, update } = writable<DigestsState>({
    digests: [],
    isGenerating: false,
  });

  return {
    subscribe,

    async load(workspacePath: string) {
      try {
        const digests = await invoke<DigestInfo[]>('list_digests', { workspacePath });
        update((s) => ({ ...s, digests }));
      } catch (e) {
        console.error('Failed to load digests:', e);
      }
    },

    async generate(
      workspacePath: string,
      range: string,
      fromDate?: string,
      toDate?: string
    ) {
      update((s) => ({ ...s, isGenerating: true }));
      try {
        await invoke('generate_digest', { workspacePath, range, fromDate, toDate });
        // Reload digest list after generation
        const digests = await invoke<DigestInfo[]>('list_digests', { workspacePath });
        update((s) => ({ ...s, digests, isGenerating: false }));
      } catch (e) {
        console.error('Failed to generate digest:', e);
        
createDigestsStore function · typescript · L16-L56 (41 LOC)
app/src/lib/stores/digests.ts
function createDigestsStore() {
  const { subscribe, set, update } = writable<DigestsState>({
    digests: [],
    isGenerating: false,
  });

  return {
    subscribe,

    async load(workspacePath: string) {
      try {
        const digests = await invoke<DigestInfo[]>('list_digests', { workspacePath });
        update((s) => ({ ...s, digests }));
      } catch (e) {
        console.error('Failed to load digests:', e);
      }
    },

    async generate(
      workspacePath: string,
      range: string,
      fromDate?: string,
      toDate?: string
    ) {
      update((s) => ({ ...s, isGenerating: true }));
      try {
        await invoke('generate_digest', { workspacePath, range, fromDate, toDate });
        // Reload digest list after generation
        const digests = await invoke<DigestInfo[]>('list_digests', { workspacePath });
        update((s) => ({ ...s, digests, isGenerating: false }));
      } catch (e) {
        console.error('Failed to generate digest:', e);
        
createDigestsStore function · typescript · L16-L56 (41 LOC)
app/src/lib/stores/digests.ts
function createDigestsStore() {
  const { subscribe, set, update } = writable<DigestsState>({
    digests: [],
    isGenerating: false,
  });

  return {
    subscribe,

    async load(workspacePath: string) {
      try {
        const digests = await invoke<DigestInfo[]>('list_digests', { workspacePath });
        update((s) => ({ ...s, digests }));
      } catch (e) {
        console.error('Failed to load digests:', e);
      }
    },

    async generate(
      workspacePath: string,
      range: string,
      fromDate?: string,
      toDate?: string
    ) {
      update((s) => ({ ...s, isGenerating: true }));
      try {
        await invoke('generate_digest', { workspacePath, range, fromDate, toDate });
        // Reload digest list after generation
        const digests = await invoke<DigestInfo[]>('list_digests', { workspacePath });
        update((s) => ({ ...s, digests, isGenerating: false }));
      } catch (e) {
        console.error('Failed to generate digest:', e);
        
createEntitiesStore function · typescript · L24-L55 (32 LOC)
app/src/lib/stores/entities.ts
function createEntitiesStore() {
  const { subscribe, set, update } = writable<EntitiesState>({
    people: [],
    decisions: [],
    topics: [],
    loading: false,
  });

  return {
    subscribe,
    async loadAll(workspacePath: string) {
      update((s) => ({ ...s, loading: true }));
      try {
        const result = await invoke<{
          people: Person[];
          decisions: Decision[];
          topics: string[];
          references: { ref: string; source: string }[];
        }>('list_all_entities', { workspacePath });
        set({
          people: result.people || [],
          decisions: result.decisions || [],
          topics: result.topics || [],
          loading: false,
        });
      } catch (e) {
        console.error('Failed to load entities:', e);
        update((s) => ({ ...s, loading: false }));
      }
    },
  };
}
createEntitiesStore function · typescript · L24-L55 (32 LOC)
app/src/lib/stores/entities.ts
function createEntitiesStore() {
  const { subscribe, set, update } = writable<EntitiesState>({
    people: [],
    decisions: [],
    topics: [],
    loading: false,
  });

  return {
    subscribe,
    async loadAll(workspacePath: string) {
      update((s) => ({ ...s, loading: true }));
      try {
        const result = await invoke<{
          people: Person[];
          decisions: Decision[];
          topics: string[];
          references: { ref: string; source: string }[];
        }>('list_all_entities', { workspacePath });
        set({
          people: result.people || [],
          decisions: result.decisions || [],
          topics: result.topics || [],
          loading: false,
        });
      } catch (e) {
        console.error('Failed to load entities:', e);
        update((s) => ({ ...s, loading: false }));
      }
    },
  };
}
createEntitiesStore function · typescript · L24-L55 (32 LOC)
app/src/lib/stores/entities.ts
function createEntitiesStore() {
  const { subscribe, set, update } = writable<EntitiesState>({
    people: [],
    decisions: [],
    topics: [],
    loading: false,
  });

  return {
    subscribe,
    async loadAll(workspacePath: string) {
      update((s) => ({ ...s, loading: true }));
      try {
        const result = await invoke<{
          people: Person[];
          decisions: Decision[];
          topics: string[];
          references: { ref: string; source: string }[];
        }>('list_all_entities', { workspacePath });
        set({
          people: result.people || [],
          decisions: result.decisions || [],
          topics: result.topics || [],
          loading: false,
        });
      } catch (e) {
        console.error('Failed to load entities:', e);
        update((s) => ({ ...s, loading: false }));
      }
    },
  };
}
Repobility analyzer · published findings · https://repobility.com
createEntitiesStore function · typescript · L24-L55 (32 LOC)
app/src/lib/stores/entities.ts
function createEntitiesStore() {
  const { subscribe, set, update } = writable<EntitiesState>({
    people: [],
    decisions: [],
    topics: [],
    loading: false,
  });

  return {
    subscribe,
    async loadAll(workspacePath: string) {
      update((s) => ({ ...s, loading: true }));
      try {
        const result = await invoke<{
          people: Person[];
          decisions: Decision[];
          topics: string[];
          references: { ref: string; source: string }[];
        }>('list_all_entities', { workspacePath });
        set({
          people: result.people || [],
          decisions: result.decisions || [],
          topics: result.topics || [],
          loading: false,
        });
      } catch (e) {
        console.error('Failed to load entities:', e);
        update((s) => ({ ...s, loading: false }));
      }
    },
  };
}
createFileStatusStore function · typescript · L20-L56 (37 LOC)
app/src/lib/stores/fileStatus.ts
function createFileStatusStore() {
  const { subscribe, set, update } = writable<FileStatusState>(defaultState);

  return {
    subscribe,

    // Refresh git status from backend
    refresh: async () => {
      const workspace = get(currentWorkspace);
      if (!workspace) {
        update((s) => ({ ...s, uncommittedFiles: new Set() }));
        return;
      }

      update((s) => ({ ...s, isLoading: true }));
      try {
        const invoke = await getInvoke();
        const files = await invoke<string[]>('get_git_status', {
          workspacePath: workspace.path,
        });
        update((s) => ({
          ...s,
          uncommittedFiles: new Set(files),
          isLoading: false,
          error: null,
        }));
      } catch (e) {
        const error = e instanceof Error ? e.message : String(e);
        console.error('[FileStatus] Failed to get git status:', error);
        update((s) => ({ ...s, isLoading: false, error }));
      }
    },

    // Reset store
    reset
createFileStatusStore function · typescript · L20-L56 (37 LOC)
app/src/lib/stores/fileStatus.ts
function createFileStatusStore() {
  const { subscribe, set, update } = writable<FileStatusState>(defaultState);

  return {
    subscribe,

    // Refresh git status from backend
    refresh: async () => {
      const workspace = get(currentWorkspace);
      if (!workspace) {
        update((s) => ({ ...s, uncommittedFiles: new Set() }));
        return;
      }

      update((s) => ({ ...s, isLoading: true }));
      try {
        const invoke = await getInvoke();
        const files = await invoke<string[]>('get_git_status', {
          workspacePath: workspace.path,
        });
        update((s) => ({
          ...s,
          uncommittedFiles: new Set(files),
          isLoading: false,
          error: null,
        }));
      } catch (e) {
        const error = e instanceof Error ? e.message : String(e);
        console.error('[FileStatus] Failed to get git status:', error);
        update((s) => ({ ...s, isLoading: false, error }));
      }
    },

    // Reset store
    reset
createFileStatusStore function · typescript · L20-L56 (37 LOC)
app/src/lib/stores/fileStatus.ts
function createFileStatusStore() {
  const { subscribe, set, update } = writable<FileStatusState>(defaultState);

  return {
    subscribe,

    // Refresh git status from backend
    refresh: async () => {
      const workspace = get(currentWorkspace);
      if (!workspace) {
        update((s) => ({ ...s, uncommittedFiles: new Set() }));
        return;
      }

      update((s) => ({ ...s, isLoading: true }));
      try {
        const invoke = await getInvoke();
        const files = await invoke<string[]>('get_git_status', {
          workspacePath: workspace.path,
        });
        update((s) => ({
          ...s,
          uncommittedFiles: new Set(files),
          isLoading: false,
          error: null,
        }));
      } catch (e) {
        const error = e instanceof Error ? e.message : String(e);
        console.error('[FileStatus] Failed to get git status:', error);
        update((s) => ({ ...s, isLoading: false, error }));
      }
    },

    // Reset store
    reset
createFileStatusStore function · typescript · L20-L56 (37 LOC)
app/src/lib/stores/fileStatus.ts
function createFileStatusStore() {
  const { subscribe, set, update } = writable<FileStatusState>(defaultState);

  return {
    subscribe,

    // Refresh git status from backend
    refresh: async () => {
      const workspace = get(currentWorkspace);
      if (!workspace) {
        update((s) => ({ ...s, uncommittedFiles: new Set() }));
        return;
      }

      update((s) => ({ ...s, isLoading: true }));
      try {
        const invoke = await getInvoke();
        const files = await invoke<string[]>('get_git_status', {
          workspacePath: workspace.path,
        });
        update((s) => ({
          ...s,
          uncommittedFiles: new Set(files),
          isLoading: false,
          error: null,
        }));
      } catch (e) {
        const error = e instanceof Error ? e.message : String(e);
        console.error('[FileStatus] Failed to get git status:', error);
        update((s) => ({ ...s, isLoading: false, error }));
      }
    },

    // Reset store
    reset
getFileStatus function · typescript · L61-L77 (17 LOC)
app/src/lib/stores/fileStatus.ts
export function getFileStatus(filePath: string): FileStatus {
  const state = get(fileStatusStore);
  const note = get(currentNote);
  const dirty = get(isNoteDirty);

  // Check if this is the current file and it's dirty (unsaved)
  if (note?.path === filePath && dirty) {
    return 'unsaved';
  }

  // Check if file is uncommitted in git
  if (state.uncommittedFiles.has(filePath)) {
    return 'uncommitted';
  }

  return 'clean';
}
getFileStatus function · typescript · L61-L77 (17 LOC)
app/src/lib/stores/fileStatus.ts
export function getFileStatus(filePath: string): FileStatus {
  const state = get(fileStatusStore);
  const note = get(currentNote);
  const dirty = get(isNoteDirty);

  // Check if this is the current file and it's dirty (unsaved)
  if (note?.path === filePath && dirty) {
    return 'unsaved';
  }

  // Check if file is uncommitted in git
  if (state.uncommittedFiles.has(filePath)) {
    return 'uncommitted';
  }

  return 'clean';
}
getFileStatus function · typescript · L61-L77 (17 LOC)
app/src/lib/stores/fileStatus.ts
export function getFileStatus(filePath: string): FileStatus {
  const state = get(fileStatusStore);
  const note = get(currentNote);
  const dirty = get(isNoteDirty);

  // Check if this is the current file and it's dirty (unsaved)
  if (note?.path === filePath && dirty) {
    return 'unsaved';
  }

  // Check if file is uncommitted in git
  if (state.uncommittedFiles.has(filePath)) {
    return 'uncommitted';
  }

  return 'clean';
}
Provenance: Repobility (https://repobility.com) — every score reproducible from /scan/
getFileStatus function · typescript · L61-L77 (17 LOC)
app/src/lib/stores/fileStatus.ts
export function getFileStatus(filePath: string): FileStatus {
  const state = get(fileStatusStore);
  const note = get(currentNote);
  const dirty = get(isNoteDirty);

  // Check if this is the current file and it's dirty (unsaved)
  if (note?.path === filePath && dirty) {
    return 'unsaved';
  }

  // Check if file is uncommitted in git
  if (state.uncommittedFiles.has(filePath)) {
    return 'uncommitted';
  }

  return 'clean';
}
createLinksStore function · typescript · L18-L42 (25 LOC)
app/src/lib/stores/links.ts
function createLinksStore() {
  const { subscribe, set, update } = writable<LinksState>(defaultState);

  return {
    subscribe,

    load: async () => {
      const ws = get(currentWorkspace);
      if (!ws || !isTauri()) return;

      try {
        const invoke = await getInvoke();
        const data = await invoke<LinksIndex>('read_links', { workspacePath: ws.path });
        update((s) => ({
          ...s,
          index: data && typeof data === 'object' ? data : {},
        }));
      } catch {
        // Links file may not exist yet
      }
    },

    clear: () => set(defaultState),
  };
}
createLinksStore function · typescript · L18-L42 (25 LOC)
app/src/lib/stores/links.ts
function createLinksStore() {
  const { subscribe, set, update } = writable<LinksState>(defaultState);

  return {
    subscribe,

    load: async () => {
      const ws = get(currentWorkspace);
      if (!ws || !isTauri()) return;

      try {
        const invoke = await getInvoke();
        const data = await invoke<LinksIndex>('read_links', { workspacePath: ws.path });
        update((s) => ({
          ...s,
          index: data && typeof data === 'object' ? data : {},
        }));
      } catch {
        // Links file may not exist yet
      }
    },

    clear: () => set(defaultState),
  };
}
createLinksStore function · typescript · L18-L42 (25 LOC)
app/src/lib/stores/links.ts
function createLinksStore() {
  const { subscribe, set, update } = writable<LinksState>(defaultState);

  return {
    subscribe,

    load: async () => {
      const ws = get(currentWorkspace);
      if (!ws || !isTauri()) return;

      try {
        const invoke = await getInvoke();
        const data = await invoke<LinksIndex>('read_links', { workspacePath: ws.path });
        update((s) => ({
          ...s,
          index: data && typeof data === 'object' ? data : {},
        }));
      } catch {
        // Links file may not exist yet
      }
    },

    clear: () => set(defaultState),
  };
}
createLinksStore function · typescript · L18-L42 (25 LOC)
app/src/lib/stores/links.ts
function createLinksStore() {
  const { subscribe, set, update } = writable<LinksState>(defaultState);

  return {
    subscribe,

    load: async () => {
      const ws = get(currentWorkspace);
      if (!ws || !isTauri()) return;

      try {
        const invoke = await getInvoke();
        const data = await invoke<LinksIndex>('read_links', { workspacePath: ws.path });
        update((s) => ({
          ...s,
          index: data && typeof data === 'object' ? data : {},
        }));
      } catch {
        // Links file may not exist yet
      }
    },

    clear: () => set(defaultState),
  };
}
initLinksListener function · typescript · L63-L69 (7 LOC)
app/src/lib/stores/links.ts
export async function initLinksListener(): Promise<() => void> {
  if (!isTauri()) return () => {};
  const { listen } = await import('@tauri-apps/api/event');
  return listen('chronicle:links-updated', () => {
    linksStore.load();
  });
}
initLinksListener function · typescript · L63-L69 (7 LOC)
app/src/lib/stores/links.ts
export async function initLinksListener(): Promise<() => void> {
  if (!isTauri()) return () => {};
  const { listen } = await import('@tauri-apps/api/event');
  return listen('chronicle:links-updated', () => {
    linksStore.load();
  });
}
initLinksListener function · typescript · L63-L69 (7 LOC)
app/src/lib/stores/links.ts
export async function initLinksListener(): Promise<() => void> {
  if (!isTauri()) return () => {};
  const { listen } = await import('@tauri-apps/api/event');
  return listen('chronicle:links-updated', () => {
    linksStore.load();
  });
}
Generated by Repobility's multi-pass static-analysis pipeline (https://repobility.com)
initLinksListener function · typescript · L63-L69 (7 LOC)
app/src/lib/stores/links.ts
export async function initLinksListener(): Promise<() => void> {
  if (!isTauri()) return () => {};
  const { listen } = await import('@tauri-apps/api/event');
  return listen('chronicle:links-updated', () => {
    linksStore.load();
  });
}
saveLastSession function · typescript · L12-L18 (7 LOC)
app/src/lib/stores/note.ts
export function saveLastSession(workspacePath: string, filePath: string) {
  try {
    localStorage.setItem(SESSION_KEY, JSON.stringify({ workspacePath, filePath }));
  } catch {
    // Ignore storage errors
  }
}
saveLastSession function · typescript · L12-L18 (7 LOC)
app/src/lib/stores/note.ts
export function saveLastSession(workspacePath: string, filePath: string) {
  try {
    localStorage.setItem(SESSION_KEY, JSON.stringify({ workspacePath, filePath }));
  } catch {
    // Ignore storage errors
  }
}
saveLastSession function · typescript · L12-L18 (7 LOC)
app/src/lib/stores/note.ts
export function saveLastSession(workspacePath: string, filePath: string) {
  try {
    localStorage.setItem(SESSION_KEY, JSON.stringify({ workspacePath, filePath }));
  } catch {
    // Ignore storage errors
  }
}
saveLastSession function · typescript · L12-L18 (7 LOC)
app/src/lib/stores/note.ts
export function saveLastSession(workspacePath: string, filePath: string) {
  try {
    localStorage.setItem(SESSION_KEY, JSON.stringify({ workspacePath, filePath }));
  } catch {
    // Ignore storage errors
  }
}
loadLastSession function · typescript · L20-L33 (14 LOC)
app/src/lib/stores/note.ts
export function loadLastSession(): LastSession | null {
  try {
    const saved = localStorage.getItem(SESSION_KEY);
    if (saved) {
      const parsed = JSON.parse(saved);
      if (parsed.workspacePath && parsed.filePath) {
        return parsed as LastSession;
      }
    }
  } catch {
    // Ignore parse errors
  }
  return null;
}
loadLastSession function · typescript · L20-L33 (14 LOC)
app/src/lib/stores/note.ts
export function loadLastSession(): LastSession | null {
  try {
    const saved = localStorage.getItem(SESSION_KEY);
    if (saved) {
      const parsed = JSON.parse(saved);
      if (parsed.workspacePath && parsed.filePath) {
        return parsed as LastSession;
      }
    }
  } catch {
    // Ignore parse errors
  }
  return null;
}
loadLastSession function · typescript · L20-L33 (14 LOC)
app/src/lib/stores/note.ts
export function loadLastSession(): LastSession | null {
  try {
    const saved = localStorage.getItem(SESSION_KEY);
    if (saved) {
      const parsed = JSON.parse(saved);
      if (parsed.workspacePath && parsed.filePath) {
        return parsed as LastSession;
      }
    }
  } catch {
    // Ignore parse errors
  }
  return null;
}
Want this analysis on your repo? https://repobility.com/scan/
loadLastSession function · typescript · L20-L33 (14 LOC)
app/src/lib/stores/note.ts
export function loadLastSession(): LastSession | null {
  try {
    const saved = localStorage.getItem(SESSION_KEY);
    if (saved) {
      const parsed = JSON.parse(saved);
      if (parsed.workspacePath && parsed.filePath) {
        return parsed as LastSession;
      }
    }
  } catch {
    // Ignore parse errors
  }
  return null;
}
createNoteStore function · typescript · L54-L141 (88 LOC)
app/src/lib/stores/note.ts
function createNoteStore() {
  const { subscribe, set, update } = writable<NoteState>(defaultState);

  return {
    subscribe,

    // Create a new empty note
    newNote: () =>
      update((state) => ({
        ...state,
        currentNote: {
          path: null,
          content: '# New Note\n\n',
          title: 'New Note',
          isNew: true,
        },
        isDirty: false,
        lastSavedContent: '# New Note\n\n',
      })),

    // Open an existing note
    openNote: (path: string, content: string) => {
      const title = extractTitle(content);
      update((state) => ({
        ...state,
        currentNote: {
          path,
          content,
          title,
          isNew: false,
        },
        isDirty: false,
        lastSavedContent: content,
      }));
      // Sync file path and content to backend for MCP server
      syncAppState({ filePath: path, fileContent: content });
    },

    // Update note content (called on every edit)
    updateContent: (c
createNoteStore function · typescript · L54-L141 (88 LOC)
app/src/lib/stores/note.ts
function createNoteStore() {
  const { subscribe, set, update } = writable<NoteState>(defaultState);

  return {
    subscribe,

    // Create a new empty note
    newNote: () =>
      update((state) => ({
        ...state,
        currentNote: {
          path: null,
          content: '# New Note\n\n',
          title: 'New Note',
          isNew: true,
        },
        isDirty: false,
        lastSavedContent: '# New Note\n\n',
      })),

    // Open an existing note
    openNote: (path: string, content: string) => {
      const title = extractTitle(content);
      update((state) => ({
        ...state,
        currentNote: {
          path,
          content,
          title,
          isNew: false,
        },
        isDirty: false,
        lastSavedContent: content,
      }));
      // Sync file path and content to backend for MCP server
      syncAppState({ filePath: path, fileContent: content });
    },

    // Update note content (called on every edit)
    updateContent: (c
createNoteStore function · typescript · L54-L141 (88 LOC)
app/src/lib/stores/note.ts
function createNoteStore() {
  const { subscribe, set, update } = writable<NoteState>(defaultState);

  return {
    subscribe,

    // Create a new empty note
    newNote: () =>
      update((state) => ({
        ...state,
        currentNote: {
          path: null,
          content: '# New Note\n\n',
          title: 'New Note',
          isNew: true,
        },
        isDirty: false,
        lastSavedContent: '# New Note\n\n',
      })),

    // Open an existing note
    openNote: (path: string, content: string) => {
      const title = extractTitle(content);
      update((state) => ({
        ...state,
        currentNote: {
          path,
          content,
          title,
          isNew: false,
        },
        isDirty: false,
        lastSavedContent: content,
      }));
      // Sync file path and content to backend for MCP server
      syncAppState({ filePath: path, fileContent: content });
    },

    // Update note content (called on every edit)
    updateContent: (c
createNoteStore function · typescript · L54-L141 (88 LOC)
app/src/lib/stores/note.ts
function createNoteStore() {
  const { subscribe, set, update } = writable<NoteState>(defaultState);

  return {
    subscribe,

    // Create a new empty note
    newNote: () =>
      update((state) => ({
        ...state,
        currentNote: {
          path: null,
          content: '# New Note\n\n',
          title: 'New Note',
          isNew: true,
        },
        isDirty: false,
        lastSavedContent: '# New Note\n\n',
      })),

    // Open an existing note
    openNote: (path: string, content: string) => {
      const title = extractTitle(content);
      update((state) => ({
        ...state,
        currentNote: {
          path,
          content,
          title,
          isNew: false,
        },
        isDirty: false,
        lastSavedContent: content,
      }));
      // Sync file path and content to backend for MCP server
      syncAppState({ filePath: path, fileContent: content });
    },

    // Update note content (called on every edit)
    updateContent: (c
extractTitle function · typescript · L144-L147 (4 LOC)
app/src/lib/stores/note.ts
function extractTitle(content: string): string {
  const match = content.match(/^#\s+(.+)$/m);
  return match ? match[1].trim() : 'Untitled';
}
extractTitle function · typescript · L144-L147 (4 LOC)
app/src/lib/stores/note.ts
function extractTitle(content: string): string {
  const match = content.match(/^#\s+(.+)$/m);
  return match ? match[1].trim() : 'Untitled';
}
extractTitle function · typescript · L144-L147 (4 LOC)
app/src/lib/stores/note.ts
function extractTitle(content: string): string {
  const match = content.match(/^#\s+(.+)$/m);
  return match ? match[1].trim() : 'Untitled';
}
Repobility analyzer · published findings · https://repobility.com
extractTitle function · typescript · L144-L147 (4 LOC)
app/src/lib/stores/note.ts
function extractTitle(content: string): string {
  const match = content.match(/^#\s+(.+)$/m);
  return match ? match[1].trim() : 'Untitled';
}
openDailyNote function · typescript · L163-L191 (29 LOC)
app/src/lib/stores/note.ts
export async function openDailyNote(workspacePath: string): Promise<string | null> {
  const now = new Date();
  const dayName = now.toLocaleDateString('en-US', { weekday: 'long' }).toLowerCase();
  const yyyy = now.getFullYear();
  const mm = String(now.getMonth() + 1).padStart(2, '0');
  const dd = String(now.getDate()).padStart(2, '0');
  const filename = `${yyyy}-${mm}-${dd}-${dayName}.md`;
  const fullPath = `${workspacePath}/${filename}`;

  const invoke = await getInvoke();
  const exists = await invoke<boolean>('file_exists', { path: fullPath });

  if (exists) {
    const content = await invoke<string>('read_file', { path: fullPath });
    noteStore.openNote(fullPath, content);
  } else {
    const dateHeader = now.toLocaleDateString('en-US', {
      weekday: 'long',
      year: 'numeric',
      month: 'long',
      day: 'numeric',
    });
    const template = `# ${dateHeader}\n\n## Notes\n\n\n## Action Items\n\n`;
    await invoke('write_file', { path: fullPath, content: temp
openDailyNote function · typescript · L163-L191 (29 LOC)
app/src/lib/stores/note.ts
export async function openDailyNote(workspacePath: string): Promise<string | null> {
  const now = new Date();
  const dayName = now.toLocaleDateString('en-US', { weekday: 'long' }).toLowerCase();
  const yyyy = now.getFullYear();
  const mm = String(now.getMonth() + 1).padStart(2, '0');
  const dd = String(now.getDate()).padStart(2, '0');
  const filename = `${yyyy}-${mm}-${dd}-${dayName}.md`;
  const fullPath = `${workspacePath}/${filename}`;

  const invoke = await getInvoke();
  const exists = await invoke<boolean>('file_exists', { path: fullPath });

  if (exists) {
    const content = await invoke<string>('read_file', { path: fullPath });
    noteStore.openNote(fullPath, content);
  } else {
    const dateHeader = now.toLocaleDateString('en-US', {
      weekday: 'long',
      year: 'numeric',
      month: 'long',
      day: 'numeric',
    });
    const template = `# ${dateHeader}\n\n## Notes\n\n\n## Action Items\n\n`;
    await invoke('write_file', { path: fullPath, content: temp
openDailyNote function · typescript · L163-L191 (29 LOC)
app/src/lib/stores/note.ts
export async function openDailyNote(workspacePath: string): Promise<string | null> {
  const now = new Date();
  const dayName = now.toLocaleDateString('en-US', { weekday: 'long' }).toLowerCase();
  const yyyy = now.getFullYear();
  const mm = String(now.getMonth() + 1).padStart(2, '0');
  const dd = String(now.getDate()).padStart(2, '0');
  const filename = `${yyyy}-${mm}-${dd}-${dayName}.md`;
  const fullPath = `${workspacePath}/${filename}`;

  const invoke = await getInvoke();
  const exists = await invoke<boolean>('file_exists', { path: fullPath });

  if (exists) {
    const content = await invoke<string>('read_file', { path: fullPath });
    noteStore.openNote(fullPath, content);
  } else {
    const dateHeader = now.toLocaleDateString('en-US', {
      weekday: 'long',
      year: 'numeric',
      month: 'long',
      day: 'numeric',
    });
    const template = `# ${dateHeader}\n\n## Notes\n\n\n## Action Items\n\n`;
    await invoke('write_file', { path: fullPath, content: temp
openDailyNote function · typescript · L163-L191 (29 LOC)
app/src/lib/stores/note.ts
export async function openDailyNote(workspacePath: string): Promise<string | null> {
  const now = new Date();
  const dayName = now.toLocaleDateString('en-US', { weekday: 'long' }).toLowerCase();
  const yyyy = now.getFullYear();
  const mm = String(now.getMonth() + 1).padStart(2, '0');
  const dd = String(now.getDate()).padStart(2, '0');
  const filename = `${yyyy}-${mm}-${dd}-${dayName}.md`;
  const fullPath = `${workspacePath}/${filename}`;

  const invoke = await getInvoke();
  const exists = await invoke<boolean>('file_exists', { path: fullPath });

  if (exists) {
    const content = await invoke<string>('read_file', { path: fullPath });
    noteStore.openNote(fullPath, content);
  } else {
    const dateHeader = now.toLocaleDateString('en-US', {
      weekday: 'long',
      year: 'numeric',
      month: 'long',
      day: 'numeric',
    });
    const template = `# ${dateHeader}\n\n## Notes\n\n\n## Action Items\n\n`;
    await invoke('write_file', { path: fullPath, content: temp
loadFromStorage function · typescript · L13-L23 (11 LOC)
app/src/lib/stores/recentFiles.ts
function loadFromStorage(): RecentFile[] {
  try {
    const saved = localStorage.getItem(STORAGE_KEY);
    if (saved) {
      return JSON.parse(saved);
    }
  } catch {
    // Ignore parse errors
  }
  return [];
}
loadFromStorage function · typescript · L13-L23 (11 LOC)
app/src/lib/stores/recentFiles.ts
function loadFromStorage(): RecentFile[] {
  try {
    const saved = localStorage.getItem(STORAGE_KEY);
    if (saved) {
      return JSON.parse(saved);
    }
  } catch {
    // Ignore parse errors
  }
  return [];
}
loadFromStorage function · typescript · L13-L23 (11 LOC)
app/src/lib/stores/recentFiles.ts
function loadFromStorage(): RecentFile[] {
  try {
    const saved = localStorage.getItem(STORAGE_KEY);
    if (saved) {
      return JSON.parse(saved);
    }
  } catch {
    // Ignore parse errors
  }
  return [];
}
Provenance: Repobility (https://repobility.com) — every score reproducible from /scan/
loadFromStorage function · typescript · L13-L23 (11 LOC)
app/src/lib/stores/recentFiles.ts
function loadFromStorage(): RecentFile[] {
  try {
    const saved = localStorage.getItem(STORAGE_KEY);
    if (saved) {
      return JSON.parse(saved);
    }
  } catch {
    // Ignore parse errors
  }
  return [];
}
saveToStorage function · typescript · L25-L31 (7 LOC)
app/src/lib/stores/recentFiles.ts
function saveToStorage(files: RecentFile[]) {
  try {
    localStorage.setItem(STORAGE_KEY, JSON.stringify(files));
  } catch {
    // Ignore storage errors
  }
}
saveToStorage function · typescript · L25-L31 (7 LOC)
app/src/lib/stores/recentFiles.ts
function saveToStorage(files: RecentFile[]) {
  try {
    localStorage.setItem(STORAGE_KEY, JSON.stringify(files));
  } catch {
    // Ignore storage errors
  }
}
‹ prevpage 3 / 18next ›