Skip to content

Code Structure

Yash Aryan edited this page Aug 8, 2026 · 1 revision

Code Structure

Monorepo

/
├── README.md
├── .env.example              # CI only: GH_TOKEN, code-signing
├── .github/workflows/        # build.yml, release.yml
├── scripts/setup.sh, dev.sh
├── app/                      # ★ desktop product
├── web/                      # marketing + downloads
├── firebase/                 # rules, indexes, hosting sign-in
├── auth-backend/             # retired NestJS (reference)
├── docs/
│   ├── releases/             # tag notes (e.g. v0.4.0.md)
│   └── superpowers/          # specs + implementation plans
├── AnyLM_Skill_Building_Guide.pdf
└── AnyLM_Tool_Building_Guide.pdf

PDF guides are useful but slightly stale (they still mention NestJS/auth-backend and older tool lists). Prefer this wiki + current TypeScript sources.

app/ — Electron product

app/
├── main.ts                   # Bootstrap: userData pin, deps, proxy, registerIpc, window
├── preload.ts                # Sole bridge → window.api
├── package.json              # electron-builder, scripts, version
├── .env.example → .env       # Public bake-in config
├── bunfig.toml               # test preload: electron-mock
├── test/electron-mock.ts
├── scripts/
│   ├── build-env.js          # .env → env.generated.ts (+ secret guard)
│   ├── env-schema.js         # Allowlist / denylist
│   ├── copy-assets.js
│   ├── fetch-chroma.js
│   └── before-pack / fix-electron-bundle …
├── vendor/chroma             # Bundled Chroma binary (extraResources)
└── src/
    ├── types/
    │   ├── api.d.ts          # AnyLmApi IPC contract
    │   ├── domain.d.ts       # Projects, tools, skills, settings, …
    │   └── dom.d.ts
    ├── main/
    │   ├── ipc.ts            # All handlers + chat orchestration (~core)
    │   ├── auth.ts, token-store.ts, identity*.ts, oauth/
    │   ├── api/              # In-process governance REST
    │   ├── data/             # Firestore REST client
    │   ├── ollama.ts, ollama-setup/, model-catalog.ts
    │   ├── store.ts, chats.ts, settings.ts, workspace.ts
    │   ├── rag.ts, context.ts, chroma*.ts, vectorstore.ts, memory.ts, embed.ts
    │   ├── graph/            # Entity/relation extract + store
    │   ├── tools/            # registry, exec, fs-tools, web-search
    │   ├── skills/           # builtins, registry, exec
    │   ├── agents/           # plan, classify, orchestrate, workers, load
    │   ├── documents/, artifacts.ts, project-files.ts, project-coding/
    │   ├── proxy/            # OpenAI-compatible server
    │   ├── load-guard/, governance.ts, policy-engine.ts
    │   ├── updater/, scheduler.ts, startup-deps.ts
    │   └── …
    └── renderer/
        ├── index.html, styles.css, assets/
        └── js/
            ├── app.ts        # Bootstrap / wiring
            ├── auth.ts, chat.ts, projects.ts, state.ts, views.ts, dom.ts
            ├── tools-view.ts, skills-view.ts, settings*
            ├── setup-wizard.ts
            ├── rail/, sidebar/, updates/
            └── …

Two TypeScript projects

Config Emits Module
tsconfig.main.json dist/main.js, dist/preload.js, dist/src/main/** CommonJS
tsconfig.renderer.json dist/renderer/js/** (+ copied HTML/CSS) ESM

Shared types are ambient .d.ts under src/types/ so neither config crosses rootDir.

firebase/

firebase/
├── firestore.rules           # ★ authorization — read before changing api/
├── firestore.indexes.json
├── hosting/public/           # Google/GitHub sign-in page
├── .firebaserc.example
└── README.md

web/

Next.js site: glass landing, feature catalog, /download and /releases fed by GitHub API (web/lib/github.ts).

auth-backend/

Retired NestJS + Prisma service. Useful for understanding original REST shapes and connector OAuth, but not started or shipped. Live connectors live under app/src/main/api/connectors.ts (+ related modules).

Where to look for X

Concern Start here
New IPC method api.d.tspreload.tsipc.ts → renderer caller
Builtin tool tools/registry.ts + tools/exec.ts
Builtin skill skills/builtins.ts + optionally connectors
Chat system prompt ipc.ts + context.ts + memory.ts + skills registry
Org/policy/usage api/index.ts + sibling modules + firestore.rules
Settings default settings.ts + domain.d.ts + settings UI
First-run Ollama ollama-setup/, startup-deps.ts, setup-wizard.ts
Packaging app/package.json build key + .github/workflows

Design docs in-repo

docs/superpowers/specs/ and plans/ hold feature designs (multi-agent, load protection, project-first coding, web research, UI passes, etc.). Use them when implementing or reviewing related work — they are not always fully synced with HEAD.

Clone this wiki locally