$ show tiddly-gittly/TidGi-Desktop
TidGi-Desktop is a cross-platform Electron application that integrates TiddlyWiki (a personal wiki) with AI agent capabilities, Git synchronization, and modern desktop features. It allows users to manage multiple workspaces (folder-based or single-file HTML wikis), sync with Git remotes, and interact with AI agents for chat, tool execution, and knowledge management. The architecture is Electron multi-process with main process, renderer processes (multiple windows), and a utility process for wiki worker. Services are wired via Inversify DI container and communicate via typed IPC (electron-ipc-cat). Key entry points include src/main.ts (Electron main), src/renderer.tsx (React renderer), src/services/agentInstance/ (AI agent lifecycle), src/services/wiki/ (wiki management), and src/services/git/ (Git operations). External dependencies include TiddlyWiki, Git (via dugite), SQLite (TypeORM), various AI SDKs (OpenAI, Anthropic, etc.), OAuth providers, and system-level integrations. The codebase is well-structured with a service-oriented architecture, extensive test coverage (unit, E2E, BDD), and a rich preference system driven by Zod schemas. It demonstrates high craftsmanship in areas like AI prompt concatenation, tool registration, and file system watching, though some modules are tightly coupled to the application's domain.
The LLM identified 5 files worth highlighting for reuse:
Provides a factory function `defineTool` that creates tool definitions with Zod schema, tapable hooks (processPrompts, onResponseComplete, etc.), and execution logic. This pattern is reusable for any AI tool system requiring declarative registration with lifecycle hooks, and is not tightly coupled to TiddlyWiki.
Implements a registry for preference sections, each defined with a Zod schema, search hits, conditions, and optional custom React components. This pattern decouples preference UI from definition and is reusable for any application needing a type-safe, extensible settings system.
Implements an inverse index mapping file paths to tiddler titles for O(1) lookup. This is a standalone data structure that can be extracted for any file-watching system requiring efficient path-to-entity resolution, independent of TiddlyWiki.
A custom i18next backend that reads/writes translation files via Electron IPC, handling both main and renderer processes. This solves the common Electron problem of loading locale files from the filesystem and is reusable for any Electron app using i18next.
Implements the IWorkspaceStrategy interface for folder-based wikis, exposing facets for runtime, HTTP, git, and menu behaviors. The strategy pattern with facet separation is reusable for any application needing polymorphic workspace types, though the implementation is specific to TiddlyWiki.