# About ARCLUX Source: https://arclux-os.mintlify.app/about The map: intelligence layer + platform layer # ABOUT ARCLUX **ARCLUX is an open-source platform that reads code the way an operating system reads hardware — and turns it into a living map of the repository.** Point it at any codebase and it parses the source, computes how everything connects, and answers questions like *"what breaks if I change this file?"* or *"this file is never imported — where was it supposed to be wired?"* — in seconds, without you reading 800 files first. ARCLUX is built in two layers: * **The intelligence layer** — the flagship capability: static analysis, dependency/call graphs, impact tracing, 20 automated code-health detectors, 14 framework convention rules, and a security pipeline. This is what works end-to-end today and is verified against real repos (vscode, react, vite, laravel, django, flask). * **The platform layer** — the runtime underneath: a kernel with a signal bus, process manager, job scheduler, service manager, storage, networking, notifications, and orchestration. This is the foundation ARCLUX grows on — codebase intelligence is the first application of the platform, not the last. Everything in this file is real and working. No marketing promises — every claim is backed by code and verified runs. *** ## The map ``` INTELLIGENCE LAYER PLATFORM LAYER (kernel) parser (27 langs) signal bus graph / call graph runtime / scheduler impact analysis services / storage 20 detectors networking / notifications 14 convention rules orchestration security pipeline scripting DSL · provenance CONSUMED BY CLI + shell · web app · security CLI · daemon (HTTP+SSE bridge) VS Code extension · any tool that can read HTTP/SSE ``` ## The intelligence layer — what you can do with it | Command | What it gives you | | - | - | | `arclux analyze ` | Full index: modules, imports, exports, dependency graph, call graph | | `arclux graph ` | Interactive dependency graph (SVG + d3-force, 3D view in web) | | `arclux impact ` | "If I change this file, 1,319 files are affected" — real result from analyzing django | | `arclux doctor ` | 20 automated checks: circular deps, dead code, orphan files (with where-to-integrate suggestions), duplicate modules, layer violations, and more | | `arclux verify ` | 14 framework convention rules (Next.js, NestJS, Express, Vite, Electron, React, Laravel) | | `arclux security ` | Secrets, unsafe patterns, sensitive data flow, trust boundaries, attack surface, dependency risk | | `arclux search ` | Full-text + symbol search across the codebase | | `arclux script ` | Run the ARCLUX scripting DSL — chain analyze doctor impact security in one readable script | | Web audit | `/{org}/{repo}/audit` — findings theater (STREAM × FOCUS × GRAPH), plus **live severity halos on the 3D graph** while the audit replays | | `arclux diff ` | What changed between two states, structurally | | `arclux diagnose ` | Deep-dive diagnostics for problem hunting | | `arclux shell` | Interactive REPL — analyze once, then ask impact/deps/doctor/graph/search instantly, with `watch on` for live re-analysis | | `arclux daemon` | Always-on background watcher with a local HTTP+SSE bridge (`/analysis`, `/impact`, `/events`) | | VS Code extension | Live status bar, Problems-panel diagnostics, and `ARCLUX: Trace Impact` right from the editor | | Web dashboard | Next.js UI: workspace (Impact/Issues/Security/Verify/Health/Calls), explorer, audit theater, opencode-style script playground, Ctrl+K command palette — `apps/web`, `pnpm run dev` | ### The 20 detectors Automated code-health checks, each an independent small file that is trivial to extend: * `circularDependency` — import cycles, with the full cycle path * `unusedExports` / `unusedFiles` — code that nothing consumes * `orphanFiles` — files nothing imports, **classified**: *dead* (leftover, delete it) vs *unwired* (should be connected) vs *ambiguous* * `orphanIntegration` — for unwired files, **where** they should be imported: the folder's barrel index, or the shared importer of same-kind siblings (confidence + score + evidence, derived from real patterns — never guessed) * `largeModules` / `duplicateModules` / `sharedModules` / `indexFiles` — structural smell detection * `layerViolation` — imports that cross architecture layers * `deadCode` / `ambiguousSymbolResolution` / `missingExports` * `componentConvention` / `featureStructure` / `repositoryPattern` / `routeConvention` / `storyConvention` / `testConvention` / `entryPoints` ### Remote sources & security boundaries `arclux analyze https://github.com/org/repo` clones, analyzes, and cleans up. Source adapters route any input — GitHub, GitLab (https/ssh/SCP-style), archive files, local paths (`~` expanded) — through the right boundary check: * **SSRF guard** — remote URLs are refused before anything else if they point at private networks, loopback, link-local, or cloud metadata endpoints (169.254.169.254). Public hosts — GitHub, GitLab, Bitbucket, any web server — are always allowed. * **Source boundary** — local paths are checked against allowed/denied roots with symlink containment. * **Evidence boundary** — doctor/security output is redacted (tokens, keys, passwords, AWS credentials, private keys, connection strings) and per-check capped. * **Analysis boundary** — hard caps on files/bytes/modules so no single run can exhaust the host. ## What ARCLUX understands * **Languages parsed today:** TypeScript/TSX, JavaScript, Python, Go, Java, PHP, Ruby, Rust, C++, C#, Bash, C, Dart, Elixir, Kotlin, Lua, Objective-C, OCaml, Scala, Solidity, Swift, Vue, Zig, Elm, ReScript — via TypeScript Compiler API + web-tree-sitter (25 grammar-backed, 2 compiler-API-backed, plus manifest parsers for package.json, go.mod, Cargo.toml, Gemfile, composer.json, csproj, gradle, pom.xml, requirements.txt) * **Frameworks with convention rules:** Next.js, NestJS, Express, Vite, Electron, React, Laravel * **Graphs:** dependency (imports/exports/folders) and call graph (which function calls which, across files) + folder graph ## The ARCLUX DSL — scripting the analysis `arclux script ` runs a tiny scripting language purpose-built for codebase intelligence. Scripts read like instructions, not API calls: ```arclux theme={"theme":"catppuccin-mocha"} # analyze the repo, then answer questions about it repo = analyze("~/flask") # what's affected if I change app.py? impact(repo, "app.py") # which files does nothing import, and where should they go? check(repo, "orphanFiles") ``` Every capability the engine exposes is bound into the DSL — analyze, doctor, check, graph, callgraph, impact, search, security, diff, archdiff, plus helpers (len, sum, filter, sort, exists, keys, values, env, cwd, extensions, checkids). The language grows automatically: registering a new parser or detector expands `extensions()` / `checkids()` with zero DSL changes (verified live — the 5 new parsers from PR #528 grew the binding surface from 9 to 19 extensions on their own). The browser playground at `/script` runs the same DSL server-side — including an **audit mode** that streams doctor + security + attack-surface findings as a terminal theater and replays them as breathing halos on the 3D dependency graph. ## How it works (the 10-second version) ``` repository parser graph detectors engine report rules (framework conventions) impact (consumer/dependent tracing) security pipeline ``` Each stage is an independent package (`parser`, `graph`, `impact`, `detectors`, `rules`, `engine`, `security`). Add a new parser, detector, or rule without touching the rest. The single entry point is `analyzeRepository` in the engine pipeline — nothing calls individual steps from outside. ## The platform layer Beneath the intelligence layer sits a real runtime, not scaffolding: * **kernel** — a signal bus every subsystem emits and subscribes through (`Kernel`) * **runtime** — `ProcessManager` spawns and supervises child processes (`RuntimeManager`) * **scheduler** — `JobScheduler` + `JobQueue` for async work * **services** — `ServiceManager` manages service lifecycle and dependencies * **storage** — `ArtifactStore`, `CacheManager`, `RecoveryManager` (crash-safe writes), `SnapshotManager` * **networking** — `ConnectionManager`, `PortManager`, `ServiceEndpoint` discovery files * **notifications** — `NotificationManager` fans events out to channels * **orchestration** — `PlatformOrchestrator` assembles it all The daemon, watcher, incremental indexer, shell session, and workspace layers sit on top of these. Packages like `observation`, `web-intake`, and `package-manager` mark the direction the platform is heading — not yet wired, but the seams are already there. ## What ARCLUX does NOT do yet (honest) * Analysis history is persisted per-run (JSON-record store wired into the daemon), but there's no query layer over it yet — `packages/db` has schema + stores, higher-level queries aren't built * Per-file incremental re-indexing: the incremental engine is built, but `buildIndex` still does a full rebuild per change — per-file wiring is deferred * The platform's runtime layers (scheduler/services/storage/observation/web-intake) are built but not all wired to consumers * Some exotic tree-sitter grammars shipped in `tree-sitter-wasms` are stale (elm was ABI 12 — vendored fix; ReScript's wasm predates its modern `import` syntax) — see `packages/parser/wasms/` ## Fair Evaluation Protocol — how to judge ARCLUX (or any architecture) Don't evaluate architecture from screenshots. Screenshot feeling ranking is not analysis. The fair ladder is: ``` repository source graph build/test runtime conclusion ``` 1. **Repository** — look at structure and scope, not renders. 2. **Source** — read the actual implementation. 3. **Graph** — check dependencies, impact, coupling (`arclux graph`, `arclux impact`, `arclux doctor` do exactly this). 4. **Build/Test** — verify claims executably (build scripts, `tsc`, detectors, checks — not words). 5. **Runtime** — observe real system behavior (server, snapshots, persistence — not mockups). 6. **Conclusion** — only conclude what the evidence supports. And keep four words apart — an honest engineer knows exactly which is which: | Word | Meaning | Example | | - | - | - | \| **PLAN** | designed, not implemented — never counted as a feature | Blueprint 10 (planetary runtime) | \| **ANALOGY** | explains architecture, claims nothing about resources | "ARCLUX is the factory, not the plane" — expansive by design, still bounded by compute/storage/network | \| **CLAIM** | anything else — must be verified before it becomes DONE | — | ## Where to go next * [`QUICKSTART.md`](https://github.com/GSF-001/ARCLUX/blob/main/QUICKSTART.md) — fast-path workflow cheat sheet * [`CONTEXT.md`](https://github.com/GSF-001/ARCLUX/blob/main/CONTEXT.md) — stack, architecture, current state at a glance * [docs site](https://arclux-os.mintlify.site) — full, searchable documentation * [`PROGRES.md`](https://github.com/GSF-001/ARCLUX/blob/main/PROGRES.md) ([https://github.com/GSF-001/ARCLUX/tree/ARCLUX.main/progres](https://github.com/GSF-001/ARCLUX/tree/ARCLUX.main/progres)) — live status: what works, what's a stub, known bugs # Architecture Source: https://arclux-os.mintlify.app/architecture Boundary map: core, extension points, what's safe to touch Not an implementation list — a **boundary map**. Read this before adding anything new, especially if you're extending ARCLUX with a new capability (search, intelligence layers, RAG), not just fixing an existing stub. **CORE and CORE-ADJACENT layers**: changes here need a `decisions.md` entry first. These are the packages everything else depends on. **EXTENSION POINTS**: safe to add to without discussion. New parsers, detectors, cache strategies, and framework rules go here. ## Layers Changes need a `decisions.md` entry first. * **`engine/`** — the orchestrator (`analyzeRepository()`). Everything else depends on this. * **`repository/`** — the domain model (`Repository`, `ModuleInfo`). * **`shared/`** — `types.ts` is the shape of everything. Adding fields is fine; changing or removing needs a `decisions.md` entry. Care needed, but not a full stop. * **`indexer/`** — resolves imports into a `Repository`. New resolver passes (routes, components, etc) are fine to add. Changing `buildIndex.ts`'s pass order needs care — later passes depend on earlier ones. * **`graph/`** — turns a `Repository` into a `DependencyGraph`. New graph variants (`buildCallGraph`, `buildImportGraph`) are extensions. Changing `buildDependencyGraph.ts`'s core shape is not. * **`impact/`** — consumer/dependent tracing. Safe to add to without discussion. * **`parser/`** — new language support, one subfolder per language, implements `LanguageParser`. * **`detectors/`** — each detector is independent, takes a `Repository`, returns findings. See `detectAmbiguousSymbolResolution.ts` for the pattern. * **`cache/`** — additive by nature. A cache miss should always fall back to the uncached path. * **`rules/`** — one subfolder per framework, independent convention checks. * **`search/`** — see `progres/status-*.md` for current state before assuming this is the place to add semantic search, embeddings, or RAG. See [Where intelligence layers go](#where-intelligence-ai-layers-go) below. * **`watcher/`**, **`incremental/`** — see `decisions.md`. Don't build on top of these until they're actually connected to `engine/pipeline.ts`. Consume `packages/`, no business logic here. * **`cli/`** — consumes `engine/`. * **`web/`** — consumes `engine/` via API routes. Graph rendering (SVG/d3-force) lives here, not in `packages/graph/`. ## Where intelligence & AI layers go ARCLUX's job is building an accurate **structural** model of a codebase: parse index graph impact detect. It is deliberately **not** trying to be a semantic search engine, a RAG system, an agent-facing MCP server, or an embeddings/reranking pipeline — those are legitimate problems, but they consume a structural model, they don't belong inside one. Adding semantic search, graph RAG, agent tool-calling, embeddings, LSP bridging, or self-healing behavior? It belongs in a **new top-level package** (e.g. `packages/intelligence/`), consuming `DependencyGraph`/`Repository`/`AnalyzeRepositoryResult` as inputs — not woven into `graph/`, `detectors/`, or `engine/`. Treat ARCLUX the way you'd treat a library you don't maintain: depend on its stable outputs, don't reach into its internals. This boundary exists on purpose, based on comparing notes with a collaborator (ManSio) who maintains a more elaborate codebase-intelligence system (graph RAG, agentic search, embeddings, LSP bridge, sandboxing, 1000+ tests). That project is a good example of what a **consumer** built on top of a structural model like ARCLUX's could look like — not a template for what ARCLUX's own core should become. ## Definition of "done" for anything non-trivial Not done until all five: 1. **Implemented** — the code exists and typechecks 2. **Tested** — verified against a real fixture or repo, not just `tsc --noEmit` (see TOOLING.md's verification standard) 3. **Integrated** — actually called from somewhere real (`engine/pipeline.ts`, a detector registry, an API route) — see `progres/bugs.md`'s manifest-parser and cache entries for what "implemented but never wired in" costs if skipped 4. **Verified** — for anything touching `apps/web`, confirmed visually in-browser, not just assumed from code review 5. **Documented** — a `progres/*.md` entry exists (status, decision, or bug depending on what it is) — see TOOLING.md section 1 ## Changing this file This file describes **boundaries**, not the current implementation state (that's what `progres/status-*.md` is for) and not package-by-package descriptions (that's `packages/README.md`). If a layer's boundary genuinely needs to move — not just "someone wants an exception" — log the reasoning in `decisions.md` first, then update this file to match. # Changelog Source: https://arclux-os.mintlify.app/changelog Release history — Keep a Changelog + SemVer # Changelog All notable changes to ARCLUX are documented here. Format based on [Keep a Changelog](https://keepachangelog.com/); versioning follows [SemVer](https://semver.org/) (pre-1.0: minor bump = significant features). ## \[0.3.1] — 2026-09-06 ### Fixed * **CLI --version on npm install** — `resolveVersion()` now walks up from `import.meta.url` (handles `dist/arclux.mjs ../package.json` npm layout). Verified: `npm pack npm install arclux --version 0.3.1`. Fixes `0.0.0` fallback. * **doctor --help stale count** — `10/18` dynamic `DETECTORS.length` (20, includes `orphanIntegration`). Single source of truth, never stale. * **Build break** — removed duplicate resolver fragment that left `const program` inside `try` (esbuild `Expected "finally" but found "const"`). ## \[0.3.0] — 2026-09-05 Stable README + self-triggering MCP + engine honesty fixes. The “boring but brutal” release. ### Added * **MCP self-triggering** — `SERVER_INSTRUCTIONS` (workflow 4 langkah) + 16 trigger-first tool descriptions (`FIRST`/`INSTEAD OF`/`BEFORE`). AI agents now pick the right tool without being reminded. Exported + test-locked. * **Two-pass call resolver** — port of ManSio PR #20: verified import `1.0` unique-global `0.85` external explicit unresolved. Closes silent pick/drop (G1/G2/G4) and verifies exports (G5). `ModuleInfo.unresolvedCalls` preserves evidence. * **Head freshness** — port of ManSio #21/#22 line: `getHeadState` + `evaluateFreshness`/`reportFreshness` (`FRESH`/`STALE`/`INCONCLUSIVE`), `RepositoryMeta.buildHead` stamped in pipeline, re-anchored on cache hits. Doctor now shows freshness lamp. * **Local fingerprint cache** — `analyzeLocalPath` now uses content-hash cache (`local:`). Hit = identical content, honest re-anchor; edit anywhere = miss by construction. In-memory (daemon/MCP/serve benefit), honest scope documented. * **CLI RESULT block** — `arclux analyze` prints modules/edges/deps/security + freshness; `arclux doctor` shows freshness lamp. Short lines, demo-safe. * **Fair Evaluation Protocol** — `ABOUT.md`: `repository source graph build/test runtime conclusion` + `DONE`/`PLAN`/`ANALOGY`/`CLAIM` distinction. * **Scene3D split** — `scene3d.ts` 1577 lines `scene3d/` 17 domain modules (zero behavior change), `planetary/` stub ready for Blueprint 10. Verified `tsc` + `build-game.mjs`. * **MMO polish** — HUD fade+glow, menu hover/slide-in (Fase 7), bot harness headless 2-player (9 checks, tick/move/scan/attack/dock), landing CCTV + live stats. ### Fixed * **BUG-1 `folder_graph` circular JSON** — `folderGraphToJSON()` (tree+folders+stats), MCP now JSON-safe. Repro test added. * **BUG-3 `semantic_diff` bloat** — `detail` `summary` (default, file lists + counts) vs `full` (legacy trees). 132 KB summary, opt-in full. * **BUG-2 orphan precision** — pure-barrel exclude, re-export honesty (barrel-re-exported `ambiguous` not `unwired`), noise skip (`*.config.*`, `*.d.ts`, `vendor-ui/`, `_inbox/`), dedupe by `filePath`. Cross-package `server.ts` case fixed. * **Builder drift** — `packages/mcp/package.json` types etc. no longer rot; MCP tool list auto-discovers detectors/rules. ### Changed * **README is now permanent** — high-level, links to live docs (`PROGRES.md`/`ABOUT.md`/docs site) instead of chasing numbers. Badges updated, install/usage evergreen, MCP self-triggering documented. * Versions bumped `0.2.0` `0.3.0` across `package.json`, `apps/cli`, `apps/web`, `apps/vscode-extension`, `packages/mcp`, `CITATION.cff`. ## \[0.2.1] — 2026-08-26 ### Added * **MCP server (32 tools)** — `arclux mcp` starts the Model Context Protocol server; registry-driven auto-evolution (new detectors/rules appear automatically in tool descriptions). * **Library / SDK exports** — `import { analyzeRepository } from "arclux"` exposes the full analysis engine programmatically (graphs, impact, search, security, rules, diagnostics) with typed `.d.ts` declarations, separate from the CLI bundle. ## \[0.2.1] — 2026-08-23 ### Added * **Published to npm as `arclux`** — `npx arclux analyze .` from anywhere. One-file esbuild bundle (self-contained, wasms shipped alongside) + treeSitterLoader resolves grammars from the package location when not in a dev checkout. Web experience wave — the engine is unchanged, the surface caught up. ### Added **Audit — the flagship feature** * `POST /api/audit`: composition of runDoctor + securityAnalysis + attack surface, grouped into narrative chapters (severity-first) * `/[org]/[repo]/audit` standalone page + audit mode inside the script playground: STREAM (systemd-style boot, 55ms scan reveal built from real findings) × FOCUS (one finding at a time, file preview overlay) × GRAPH (camera flies per finding, cycle-path HUD) * **Live audit on the 3D graph**: severity halos breathe on flagged nodes as findings replay — driven from outside the renderer (zero core changes); auto-switches 2D3D on launch **Web/CLI parity routes**: `/api/security`, `/api/verify`, `/api/script` * Workspace tabs: Security · Verify · Health (Phase 2 scoring) · Calls **Script playground v2 — opencode-style terminal** * Slash-command palette (11 commands), syntax-highlighted editor, JSON-tree output, transcript with per-run echo + ms, Ctrl+Enter **Navigation system** * `lib/navigation.ts` registry — sidebar, mobile bottom bar + More sheet, and the Ctrl+K command palette all render from one source * Pending spinners on every nav surface (useLinkStatus) — slow navigations never read as dead clicks * View-mode toggle (auto/desktop/mobile) persisted per user **Terminal craft**: JetBrains Mono, `$` prompt prefixes, systemd `[ OK ]` status tokens, steps(1) cursor blink, CRT scanlines ### Fixed * Audit halos never appeared (filePath missing from scene node objects — map now built from provider graph) * `packages/dsl` first real typecheck surfaced 13 latent errors; 3 bindings were silently broken (search/diff/archdiff read fields that don't exist) * Landing page claimed "2 languages" (actual: 27) ## \[0.2.0] — 2026-08-21 \~1,020 commits since `v0.1.0-alpha`. Still alpha — expect breaking changes. ### Added **ARCLUX DSL — scripting language** * `arclux script `: lexer/parser/runtime/bindings for a purpose-built scripting language over the engine (`packages/dsl`) * Built-ins: analyze, doctor, check, graph, callgraph, impact, search, security, diff, archdiff + helpers (len, sum, filter, sort, exists, keys, values, env, cwd, extensions, checkids) * Registry-driven: `extensions()` / `checkids()` grow automatically when new parsers/detectors register — no DSL code changes needed **Language support: 5 27 languages** * New via shared tree-sitter loader + config-driven factory (`makeTreeSitterParser`): PHP, Ruby, Rust, C++, C#, Bash, C, Dart, Elixir, Kotlin, Lua, Objective-C, OCaml, Scala, Solidity, Swift, Vue, Zig, Elm, ReScript * Manifest parsers: package.json, go.mod, Cargo.toml, Gemfile, composer.json, csproj, gradle, pom.xml, requirements.txt * Vendored elm wasm (`packages/parser/wasms/`) — npm build is ABI-stale; loader checks vendored dir first * Fixed web-tree-sitter race: concurrent `Language.load()` calls now serialized in the shared loader **Analysis & intelligence** * 20 architecture detectors (up from 18), including orphan-file classification (dead/unwired/ambiguous) and orphan-integration suggestions with confidence + evidence * Security pipeline: secrets, unsafe patterns, sensitive-data flow, trust boundaries, attack surface, dependency risk * Full-text + symbol search engine (`packages/search`, `/api/search`) * Call graph across files; folder graph; export/import graphs * Impact analysis: direct consumers + affected-files tree **Platform & delivery** * Always-on daemon with HTTP+SSE bridge (`/analysis`, `/impact`, `/events`), persisted re-analysis history via `packages/db` (RepoStore/AnalysisStore/IssueStore) * VS Code extension: status bar, Problems-panel diagnostics, trace impact * Interactive shell REPL (`arclux shell`) with watch mode * Source adapters: GitHub/GitLab URLs, archives, local paths — with SSRF guards (private-network/metadata endpoints refused) and source/evidence/ analysis boundaries * Persistence layer wired: schema v1 + three stores used by the daemon * Caching layer: file/repository/graph content-hash caches + CacheProvider stats/clear + MemoryCache **Web dashboard** * Workspace, explorer, overview pages; graph focus view with history nav and expand-on-demand; activity page (commit history/contributors) ### Changed * Documentation fully synced to current reality (README, ABOUT, CONTEXT, docs-site Docusaurus + Mintlify, CITATION.cff) * Repo description/topics updated on GitHub ### Fixed * `scripts/` accidentally deleted from main (PR #528 stash-pop side effect) — restored, including both docs generators and log-progress.sh * web-tree-sitter concurrent grammar-load race ("Incompatible language version 0") ### Known limitations (honest) * Per-file incremental re-index built but not wired into `buildIndex` (daemon uses coarse full rebuilds) * 5 platform packages remain header-only stubs: observation, services, package-manager, ui, web-intake ## \[0.1.0-alpha] — 2026-08-07 Initial public baseline: TypeScript/JavaScript/Python/Go/Java parsing, dependency graph, impact analysis, 18 detectors, CLI + early web UI. # Deep Dive Source: https://arclux-os.mintlify.app/deep-dive How ARCLUX works under the hood # ARCLUX Architecture Deep Dive Understanding ARCLUX's internal design and how everything connects. *** ## Table of Contents 1. [Core Concepts](#core-concepts) 2. [Data Model](#data-model) 3. [The Pipeline in Detail](#the-pipeline-in-detail) 4. [Parsing](#step-2-parsing) 5. [Indexing](#step-3-indexing) 6. [Graph Construction](#graph-construction) 7. [Detector Pattern](#detector-pattern) 8. [Performance Considerations](#performance-considerations) *** ## Core Concepts ### Repository Model Everything in ARCLUX is about the `Repository` object: ```typescript theme={"theme":"catppuccin-mocha"} interface Repository { rootPath: string; modules: Module[]; // All code modules files: File[]; // All files dependencies: Map; // What depends on what metadata: { detectedFrameworks: string[]; languages: string[]; totalLines: number; }; } ``` ### The Three Levels of Abstraction **Level 1: Files** ``` MyProject/ ├── src/ │ ├── utils/ │ │ └── helper.ts │ └── Button.tsx ``` **Level 2: Modules** (importable units) ``` src/utils/helper.ts exports: - function helper() src/Button.tsx imports: - from src/utils/helper ``` **Level 3: Graph** (relationships) ``` Button.tsx helper.ts ``` *** ## Data Model ### Module ```typescript theme={"theme":"catppuccin-mocha"} interface Module { id: string; // unique ID name: string; // display name filePath: string; // relative path type: "file" | "directory" | "virtual"; imports: Import[]; // What this module imports exports: Export[]; // What this module exports dependencies: Dependency[]; // Resolved dependencies language: "typescript" | "python" | "go" | "java" | "javascript"; content?: string; // Optional file content warning?: string[]; // Issues found } ``` ### Import ```typescript theme={"theme":"catppuccin-mocha"} interface Import { source: string; // raw import string: "./helper" resolvedTo?: string; // resolved module ID line: number; // line number type: "es6" | "commonjs" | "path-alias" | "relative"; // For TypeScript/JavaScript specifiers?: string[]; // what's being imported: ["Button", "useButton"] // Status resolved: boolean; // Did we resolve it? warning?: string; // Why didn't we resolve it? } ``` ### Export ```typescript theme={"theme":"catppuccin-mocha"} interface Export { name: string; // what's exported: "Button" type: "default" | "named"; line: number; // Optional details kind?: "function" | "class" | "variable" | "type"; } ``` ### Dependency ```typescript theme={"theme":"catppuccin-mocha"} interface Dependency { from: Module; to: Module; type: "import" | "require" | "circular"; weight: number; // connection strength transitiveDepth?: number; // how many hops } ``` *** ## The Pipeline in Detail ### Step 1: Git Operations ```typescript theme={"theme":"catppuccin-mocha"} // packages/git/clone.ts export async function cloneRepository( repoUrl: string, targetDir: string ): Promise { // 1. Clone to temp directory // 2. Checkout default branch // 3. Return path } ``` **What happens:** ``` Input: https://github.com/user/repo.git Git clone to /tmp/arclux-XXXXX Read .gitignore Checkout ARCLUX.main or main branch Output: /tmp/arclux-XXXXX ``` *** ### Step 2: Parsing ```typescript theme={"theme":"catppuccin-mocha"} // packages/parser/index.ts export class MultiLanguageParser { async parseFile(filePath: string): Promise { // 1. Detect language const language = this.detectLanguage(filePath); // 2. Get parser for language const parser = PARSER_REGISTRY.find(p => p.supports(filePath)); // 3. Parse file return parser.parse(filePath); } } ``` **For TypeScript:** ```typescript theme={"theme":"catppuccin-mocha"} // packages/parser/typescript/parse.ts export function parseTypeScript(filePath: string): ParsedFile { // 1. Create AST using TypeScript Compiler API const ast = createSourceFile( filePath, readFileSync(filePath, "utf-8"), ScriptTarget.Latest, true ); // 2. Walk AST and extract imports const imports = extractImports(ast, filePath); // 3. Walk AST and extract exports const exports = extractExports(ast); // 4. Walk AST and extract nodes (functions, classes) const nodes = extractNodes(ast); return { imports, exports, nodes, warnings: [] }; } function extractImports(ast: SourceFile, filePath: string): Import[] { const imports: Import[] = []; visitNode(ast, node => { if (isImportDeclaration(node)) { const source = node.moduleSpecifier.text; const specifiers = node.importClause?.namedBindings ? /* extract names */ : []; imports.push({ source, specifiers, line: ast.getLineAndCharacterOfPosition(node.getStart()).line, type: detectImportType(source) }); } }); return imports; } ``` *** ### Step 3: Indexing ```typescript theme={"theme":"catppuccin-mocha"} // packages/indexer/buildIndex.ts export async function buildIndex( rootPath: string, meta: AnalysisMeta ): Promise { // 1. Collect all files const files = await collectFiles(rootPath); // 2. Parse all files in parallel const parsedFiles = await Promise.all( files.map(file => parser.parseFile(file)) ); // 3. Create modules from parsed files const modules = createModules(files, parsedFiles); // 4. CRITICAL: Resolve imports await resolveImports(modules, rootPath); // 5. Resolve exports resolveExports(modules); // 6. Build dependency map const dependencies = buildDependencyMap(modules); return { rootPath, modules, files, dependencies, metadata: meta }; } ``` ### Import Resolution Deep Dive This is the hardest part! ```typescript theme={"theme":"catppuccin-mocha"} // packages/indexer/resolveImports.ts async function resolveImports(modules: Module[], rootPath: string) { modules.forEach(module => { module.imports.forEach(imp => { // 1. Try direct path imp.resolvedTo = tryResolvePath(imp.source, module, rootPath); // 2. Try TypeScript path aliases if (!imp.resolvedTo) { imp.resolvedTo = tryResolvePathAlias(imp.source, rootPath); } // 3. Try node_modules if (!imp.resolvedTo) { imp.resolvedTo = tryResolveNodeModule(imp.source, rootPath); } // 4. Try framework-specific resolution if (!imp.resolvedTo) { imp.resolvedTo = tryResolveFramework(imp.source, module, rootPath); } // 5. Mark as unresolved if failed if (!imp.resolvedTo) { imp.warning = `Could not resolve ${imp.source}`; imp.resolved = false; } else { imp.resolved = true; } }); }); } // Example: TypeScript path alias resolution function tryResolvePathAlias(source: string, rootPath: string): string | undefined { const tsconfig = readTsconfigJson(rootPath); for (const [alias, paths] of Object.entries(tsconfig.compilerOptions.paths)) { if (source.startsWith(alias.replace("/*", ""))) { const actualPath = paths[0].replace("/*", ""); return resolveToModule(actualPath, source, alias); } } } ``` *** ## Graph Construction ### Dependency Graph ```typescript theme={"theme":"catppuccin-mocha"} // packages/graph/buildDependencyGraph.ts export function buildDependencyGraph( repository: Repository ): DependencyGraph { const nodes: Node[] = []; const edges: Edge[] = []; // 1. Create node for each module repository.modules.forEach(module => { nodes.push({ id: module.id, label: module.name, type: module.type, size: calculateSize(module), metadata: { path: module.filePath, language: module.language, imports: module.imports.length, exports: module.exports.length } }); }); // 2. Create edges for each import repository.modules.forEach(source => { source.imports.forEach(imp => { if (imp.resolved && imp.resolvedTo) { edges.push({ source: source.id, target: imp.resolvedTo, type: "import", weight: calculateWeight(source, imp), transitivity: "direct" }); } }); }); // 3. Calculate transitive edges calculateTransitiveDependencies(nodes, edges); return { nodes, edges, metadata: { totalNodes: nodes.length, totalEdges: edges.length, cycleCount: detectCycles(edges).length } }; } ``` ### Call Graph (Advanced) ```typescript theme={"theme":"catppuccin-mocha"} // packages/graph/buildCallGraph.ts export function buildCallGraph(repository: Repository): CallGraph { // 1. Extract all function definitions const functions = extractAllFunctions(repository); // 2. Extract all function calls const calls = extractAllCalls(repository); // 3. Match calls to definitions const edges: CallEdge[] = []; calls.forEach(call => { const definition = findFunctionDefinition(call.name, functions); if (definition) { edges.push({ from: call, to: definition, type: "call" }); } }); return { functions, edges }; } // This is complex because: // - Same function name in different modules // - Aliased imports // - Dynamic calls (can't always resolve) // - Metaprogramming ``` *** ## Detector Pattern All 20 detectors follow same pattern: ```typescript theme={"theme":"catppuccin-mocha"} export function detect(repository: Repository): Finding[] { const findings: Finding[] = []; repository.modules.forEach(module => { // Check if this module has the issue if (hasIssue(module)) { findings.push({ type: "issue-type", severity: "error" | "warning" | "info", module: module.id, message: "Clear message", affected: [module.id, ...otherAffectedModules], details: { // Custom details for this issue type } }); } }); return findings; } ``` ### Example: Circular Dependency Detection ```typescript theme={"theme":"catppuccin-mocha"} // packages/detectors/detectCircularDependency.ts export function detectCircularDependency( repository: Repository ): Finding[] { const findings: Finding[] = []; const visited = new Set(); const recursionStack = new Set(); function dfs(moduleId: string, path: string[]): void { visited.add(moduleId); recursionStack.add(moduleId); const module = repository.modules.find(m => m.id === moduleId); if (!module) return; module.imports.forEach(imp => { if (!imp.resolved || !imp.resolvedTo) return; if (!visited.has(imp.resolvedTo)) { dfs(imp.resolvedTo, [...path, moduleId]); } else if (recursionStack.has(imp.resolvedTo)) { // Found cycle! const cycle = path.slice( path.indexOf(imp.resolvedTo) ); findings.push({ type: "circular-dependency", severity: "error", module: moduleId, message: `Circular dependency: ${cycle.join(" ")}`, affected: cycle, details: { cycle: cycle.map(id => repository.modules.find(m => m.id === id)?.name ), complexity: cycle.length } }); } }); recursionStack.delete(moduleId); } repository.modules.forEach(module => { if (!visited.has(module.id)) { dfs(module.id, []); } }); return findings; } ``` *** ## Performance Considerations ### Why It's Fast 1. **Streaming parsing** - Parse files as read 2. **Parallel processing** - Parse multiple files at once 3. **Lazy evaluation** - Only compute what's needed 4. **Caching** - Cache results of expensive operations ### Bottlenecks ``` File I/O 60% (reading all files) Parsing 25% (AST generation) Resolution 10% (import resolution) Analysis 5% (detectors) ``` ### Optimization Strategies ```typescript theme={"theme":"catppuccin-mocha"} // Strategy 1: Parallel parsing const results = await Promise.all( files.map(f => parseFile(f)) ); // Strategy 2: Cached resolution const cache = new Map(); function resolveWithCache(source: string): string | undefined { if (cache.has(source)) { return cache.get(source); } const result = slowResolve(source); cache.set(source, result); return result; } // Strategy 3: Limit depth // Don't traverse too deeply into node_modules ``` *** ## Thread Model ARCLUX is **synchronous** by design: ``` Input Sequential processing (no race conditions) Output ``` Benefits: * Easy to understand * No race conditions * Simple error handling Trade-off: * Slower than parallel on large projects * But still fast enough! *** ## Extensibility Hooks Where you can extend ARCLUX: 1. **Add parser** `PARSER_REGISTRY` 2. **Add detector** `DETECTOR_REGISTRY` 3. **Add graph type** Call from CLI 4. **Add rule** `RULES_REGISTRY` 5. **Custom analysis** Use programmatic API All without modifying core! *** ## Error Handling ```typescript theme={"theme":"catppuccin-mocha"} // ARCLUX defines custom error type export class ArcluxError extends Error { constructor( public code: string, message: string, public context?: Record ) { super(message); } } // Usage: throw new ArcluxError( "UNRESOLVED_IMPORT", `Could not resolve: ${source}`, { source, from: modulePath } ); ``` *** ## Design Principles 1. **Single Responsibility** - Each package does one thing 2. **Dependency Injection** - Pass Repository around 3. **Immutability** - Don't modify Repository 4. **Composition** - Build complex behavior from simple pieces 5. **Testability** - Everything can be tested in isolation These make ARCLUX: * Easy to understand * Easy to extend * Easy to test * Easy to maintain *** \*\*Ready to dive into code? Start with `packages/engine/pipeline.ts`! \*\* # Examples Source: https://arclux-os.mintlify.app/examples Real analysis runs on real repos # ARCLUX Analysis See ARCLUX in action analyzing real, famous projects. *** ## Case Study 1: Analyzing a React Component Library ### Scenario You maintain a React component library with: * 150+ components * 500+ files * 2-year-old codebase * 20+ contributors * "Code is getting messy" feedback ### Running ARCLUX ```bash theme={"theme":"catppuccin-mocha"} cd component-library npx tsx apps/cli/index.ts analyze . ``` ### Output Analysis ``` ARCLUX Analysis Report Project Summary • Total modules: 87 • Total files: 312 • Languages: TypeScript, JavaScript Frameworks Detected React TypeScript Storybook Issues Found: 18 Circular Dependencies (3) • Button ButtonGroup Button • Tooltip Popover Tooltip • Modal Dialog Modal Unused Exports (8) • src/components/Button/deprecated-props.ts • src/components/Input/old-variants.ts • src/hooks/useOldAnimation.ts • [5 more...] Orphan Files (5) • src/components/LegacyButton/ • src/types/old-api.ts • src/utils/deprecated-helpers.ts • [2 more...] Layer Violations (2) • Button.tsx imports from pages/ (shouldn't!) • Tooltip imports from forms/ (wrong layer!) ``` ### Key Findings & Insights **1. Circular Dependencies (3)** **Finding:** Components depending on each other **What it means:** * Components can't be used independently * Hard to test individually * Tree-shaking doesn't work properly * Increases bundle size **Root cause:** Poor component composition * Button exports ButtonGroup * ButtonGroup needs to export Button for convenience * Creates circle **Solution:** ```javascript theme={"theme":"catppuccin-mocha"} // BEFORE (Circular) // Button/index.ts export { Button } from './Button' export { ButtonGroup } from './ButtonGroup' // ButtonGroup/index.ts export { ButtonGroup } from './ButtonGroup' import Button from '../Button' // AFTER (Fixed) // Button/index.ts export { Button } from './Button' // ButtonGroup/index.ts export { ButtonGroup } from './ButtonGroup' // Don't re-export Button - users import both if needed // Usage: import { Button } from '@lib/Button' import { ButtonGroup } from '@lib/ButtonGroup' ``` **Impact:** * Each component independently usable * Better tree-shaking * Smaller bundle sizes *** **2. Unused Exports (8)** **Finding:** Code exported but never imported **Examples:** * `deprecated-props.ts` - Kept for backwards compatibility but removed from docs * `useOldAnimation.ts` - Replaced by new animation hook * `old-variants.ts` - Component variants from v1 **What it means:** * Dead code taking up space * Confuses new contributors ("Should I use this?") * Version bloat * Maintenance burden **Action:** ```bash theme={"theme":"catppuccin-mocha"} # Document as deprecated # Plan removal in next major version # Add comment: "Deprecated in v2.0, use X instead" ``` *** **3. Orphan Files (5)** **Finding:** Entire folders/files not imported by anything **Examples:** * `/LegacyButton/` folder (replaced by new Button component) * `old-api.ts` (types from old version) * `deprecated-helpers.ts` (utils no longer needed) **What it means:** * Takes up space * Confuses developers ("Why is this here?") * Should be deleted or archived **Solution:** ```bash theme={"theme":"catppuccin-mocha"} # Option 1: Delete if truly unused rm -rf src/components/LegacyButton # Option 2: Archive if might need later mv src/components/LegacyButton archive/LegacyButton-v1 # Then commit with note: # "Archive: Moved LegacyButton to archive for reference" ``` *** **4. Layer Violations (2)** **Finding:** Components importing from wrong layers **Example:** ```javascript theme={"theme":"catppuccin-mocha"} // Button.tsx (WRONG!) import { User } from '../../pages/Profile/User' // Should be: import { User } from '../../types/User' ``` **What it means:** * Breaking architectural boundaries * Hard to maintain * Can't reuse Button without entire pages/ folder **Solution:** Extract shared types to separate file. *** ### Action Plan ``` Week 1: Fix Circular Dependencies - Refactor ButtonGroup to not depend on Button - Refactor Tooltip/Popover - Refactor Modal/Dialog - Test all components independently - Re-run ARCLUX: should see 0 circular deps Week 2: Remove Dead Code - Delete 5 orphan files (LegacyButton, old files) - Clean up unused exports - Re-run ARCLUX: should see 0 orphan files Week 3: Fix Architecture - Fix layer violations - Move imports to right place - Re-run ARCLUX: should see 0 violations Result: Clean, maintainable component library! ``` *** ## Case Study 2: Analyzing a Next.js Monorepo ### Scenario Your company has a Next.js monorepo: * `apps/web` - Main website * `apps/admin` - Admin dashboard * `packages/ui` - Shared components * `packages/api` - API client * `packages/utils` - Shared utilities Team is growing, "things are getting tangled." ### Running ARCLUX ```bash theme={"theme":"catppuccin-mocha"} npx tsx apps/cli/index.ts analyze . ``` ### Output ``` ARCLUX Analysis Report Project Summary • Total modules: 124 • Total files: 643 • Languages: TypeScript, JavaScript Frameworks Detected Next.js React TailwindCSS TypeScript Issues Found: 22 Circular Dependencies (4) • packages/ui packages/api (both import each other!) • apps/web packages/utils (unexpected!) Unused Exports (7) • apps/admin/lib/old-auth.ts • packages/ui/components/DeprecatedButton.tsx Orphan Files (6) • apps/web/utils/backup/ • packages/api/old-endpoints/ Layer Violations (5) • apps/web/components/UserCard imports from apps/admin • packages/utils exports server utilities to browser code ``` ### Key Findings **1. CRITICAL: Monorepo Architecture Issue** ``` packages/ui packages/api (circular!) Why this is bad: - Can't use UI without API - Can't use API without UI - Breaks dependency order - Hard to build independently ``` **Root cause:** ```javascript theme={"theme":"catppuccin-mocha"} // packages/ui/Button.tsx import { api } from '@myapp/api' // Depends on API! // packages/api/client.ts import { Button } from '@myapp/ui' // API imports UI! ``` **Solution:** ```javascript theme={"theme":"catppuccin-mocha"} // packages/ui/Button.tsx (remove API dependency!) // Just render the component, don't call API from here // packages/api/client.ts (can't depend on UI) // Pure API client, no UI // apps/web uses both separately: import { Button } from '@myapp/ui' import { api } from '@myapp/api' ``` *** **2. Cross-App Imports (Breaking Boundaries!)** ``` apps/web/components/UserCard imports from apps/admin Problem: - Web app now depends on admin code - Can't deploy web without admin - Can't share components properly - Should use packages/ui instead! ``` **Fix:** ```javascript theme={"theme":"catppuccin-mocha"} // BEFORE (WRONG) // apps/web/components/UserCard.tsx import { UserProfile } from '../../apps/admin/components' // AFTER (CORRECT) // apps/web/components/UserCard.tsx import { UserProfile } from '@myapp/ui' // Shared component should be in packages/ui ``` *** **3. Mixed Server/Client Code** ``` packages/utils exports server utilities to browser code Problem: - Importing Node.js code in browser - Causes runtime errors - Should split into separate packages Solution: packages/utils-node/ (server only) packages/utils-client/ (browser safe) packages/utils-shared/ (both) ``` *** ### Transformation **Before ARCLUX:** * "Code is messy" * "Things are tangled" * "Hard to ship independently" * "Performance issues" **After ARCLUX + Fixes:** * Clear boundaries * Independent packages * Faster builds * Better performance * New devs understand structure *** ## Case Study 3: Legacy Express Backend Cleanup ### Scenario You have a 3-year-old Express backend: * 400+ files * "Spaghetti code" * Hard to test * Performance issues * Nobody wants to touch it ### Running ARCLUX ```bash theme={"theme":"catppuccin-mocha"} npx tsx apps/cli/index.ts analyze . ``` ### Findings ``` Issues Found: 45 Circular Dependencies (8) Many files importing each other Unused Exports (22) Dead code everywhere Orphan Files (12) Old code nobody uses Layer Violations (3) Routes importing from each other ``` ### Strategy **Don't try to fix all 45 at once!** ``` Week 1-2: Fix 5 critical circular deps - Prevents build errors - Improves testability Week 3-4: Remove 10 orphan files - Cleans up codebase - Reduces confusion Week 5-6: Fix 3 layer violations - Improves architecture - Better maintainability Month 2: Continued cleanup - Remove more dead code - Fix remaining issues ``` **Result after 2 months:** ``` Issues: 45 5 Circular deps: 8 0 Orphan files: 12 0 Code quality: ``` *** ## Lessons from Real Projects ### 1. Size Doesn't Matter, Structure Does * Small project (50 files) with 0 issues = better than * Large project (500 files) with 5 issues = worse Focus on architecture, not size. ### 2. Circular Dependencies are ALWAYS a Problem * Never "okay" to have * Fix immediately * Root cause: unclear boundaries ### 3. Dead Code Accumulates * Every project has orphan files * Normal and expected * Clean regularly (quarterly) ### 4. Layer Violations Hide Real Issues * They indicate unclear architecture * Usually mean something is in wrong place * Fixing them improves everything ### 5. Technical Debt is Real * ARCLUX shows exactly what it is * Can be quantified and tracked * Takes consistent effort to pay down *** ## Using These Examples **When you see ARCLUX output:** * Match it to one of these case studies * See how problems were solved * Apply same solutions to your project **For your team:** * Show them these examples * "This is what ARCLUX found in similar projects" * "Here's how we'll fix it" * "Progress will look like this" *** \*\*Now run ARCLUX on YOUR project! See what you find! \*\* # Gotchas Source: https://arclux-os.mintlify.app/gotchas Hal-hal yang gampang bikin salah kalau gak tau ## GOTCHA KRITIS — baca ini sebelum debug apapun 1. **`nodeRequire.resolve()` TIDAK BISA DIPERCAYA di runtime webpack Next.js** — balikin path relatif ke lokasi bundle, bukan absolute filesystem path. Ini udah bikin bug yang sama 2x (sekali asli, sekali regresi pas "cleanup"). Kalau butuh resolve path native asset (`.wasm`, dll) di server-side Next.js code, JANGAN pakai `nodeRequire.resolve()` sama sekali — build path dari `process.cwd()`. 2. **Next.js dev server port suka geser + zombie process numpuk.** Kalau curl/test dapet response kosong/aneh, JANGAN asumsi itu bug kode — cek dulu `ps aux | grep node` (harus kosong sebelum start ulang) dan pastiin port yang dites PERSIS sama dengan yang muncul di baris `Local: http://localhost:XXXX`. Ini penyebab kebingungan paling sering sepanjang sesi-sesi kemarin. 3. **Selalu `cat` file dulu sebelum patch** — jangan asumsi isi file dari draft/issue/percakapan sebelumnya, walau keliatan "pasti sama". File bisa udah berubah dari sesi lain / PR lain. 4. Patch pakai python3 heredoc + verifikasi `anchor count == 1` sebelum nulis (abort kalau 0 atau >1) — pola aman yang udah terbukti. `set +H` dulu di awal sesi biar bash gak makan karakter `!` di heredoc. 5. Error yang ketangkep `ArcluxError` di API routes **gak otomatis ke-log** ke server console — kalau debug error yang gak keliatan di log, cek dulu apa error-handling-nya sengaja skip `console.error`. 6. Testing lewat `tsx` langsung (`analyzeRepository`/`buildIndex`) SKIP TOTAL webpack — itu cuma buktiin logic Node-nya bener, BUKAN buktiin jalan di runtime Next.js beneran. Dua-duanya harus dites terpisah, bug bisa ada di salah satu doang. 7. Komponen yang progress notes-nya bilang "typecheck-only, belum diverifikasi visual" — anggap serius kalau ada bug report soal itu, walau kodenya "kelihatan" udah bener pas dibaca. 8. `wasmPath` sekarang hardcoded ke struktur pnpm (`node_modules/.pnpm/tree-sitter-wasms@VERSION/...`) — bakal patah kalau pindah ke npm/yarn. # Guides Source: https://arclux-os.mintlify.app/guides Step-by-step guides # Framework-Specific Guides Using ARCLUX with your specific framework? Here's what to look for! *** ## Next.js Projects ### What ARCLUX Checks for Next.js When you run: ```bash theme={"theme":"catppuccin-mocha"} npx tsx apps/cli/index.ts verify . ``` ARCLUX checks: 1. App Router structure (pages in `/app`) 2. API routes (must be in `/app/api`) 3. Layout organization 4. Component placement ### Expected Output Example ``` Next.js Convention Check ======================== Route /dashboard app/dashboard/page.tsx exists API /api/users app/api/users/route.ts exists Route /old-page NO CORRESPONDING FILE FOUND Component imports server-only lib in client component ``` ### Common Issues & Fixes **Issue: "Route /old-page NO CORRESPONDING FILE FOUND"** * **Meaning:** You have a route defined but no actual file * **Fix:** Create the missing page.tsx OR remove the reference **Issue: "Component imports server-only lib in client component"** * **Meaning:** Using server-only code in client component * **Fix:** Add `"use client"` directive at top of file ### Tips for Next.js ```bash theme={"theme":"catppuccin-mocha"} # Check your Next.js project npx tsx apps/cli/index.ts verify . # Analyze impact before refactoring app structure npx tsx apps/cli/index.ts impact --file app/layout.tsx . # Find unused components in your app npx tsx apps/cli/index.ts doctor ``` *** ## NestJS Projects ### What ARCLUX Checks for NestJS ARCLUX verifies: 1. Module organization 2. Service dependencies 3. Controller structure 4. Circular dependencies (major issue!) ### Expected Structure ``` src/ ├── users/ │ ├── users.module.ts │ ├── users.service.ts │ └── users.controller.ts ├── auth/ │ ├── auth.module.ts │ ├── auth.service.ts │ └── auth.controller.ts ``` ### Common Issues & Fixes **Issue: "Circular dependency in NestJS modules"** * **Meaning:** Module A imports Module B, and vice versa * **Fix:** Refactor to extract shared logic to third module **Issue: "Service imported directly instead of via Module"** * **Meaning:** Breaking NestJS dependency injection pattern * **Fix:** Import via Module, not direct service ### Tips for NestJS ```bash theme={"theme":"catppuccin-mocha"} # Check module structure npx tsx apps/cli/index.ts analyze . # Find problematic circular imports npx tsx apps/cli/index.ts doctor | grep Circular # Check what depends on auth module npx tsx apps/cli/index.ts impact --file src/auth/auth.module.ts . ``` *** ## Express Projects ### What ARCLUX Checks for Express ARCLUX verifies: 1. Route organization 2. Middleware structure 3. Controller isolation 4. Service layer separation ### Expected Structure ``` src/ ├── routes/ │ ├── users.ts │ └── products.ts ├── controllers/ │ ├── usersController.ts │ └── productsController.ts ├── services/ │ ├── userService.ts │ └── productService.ts └── app.ts (entry point) ``` ### Common Issues & Fixes **Issue: "Controller imports from routes"** * **Meaning:** Breaking layer separation * **Fix:** Routes import controllers, not vice versa **Issue: "Business logic in routes"** * **Meaning:** Not using controller/service pattern * **Fix:** Move logic to service, call from controller ### Tips for Express ```bash theme={"theme":"catppuccin-mocha"} # Analyze your Express project npx tsx apps/cli/index.ts analyze . # Check if controllers are properly separated npx tsx apps/cli/index.ts graph --filter controllers # Find unused services npx tsx apps/cli/index.ts doctor ``` *** ## React Projects ### What ARCLUX Checks for React ARCLUX verifies: 1. Component structure 2. Hook organization 3. State management patterns 4. Dead components ### Expected Structure ``` src/ ├── components/ │ ├── Button/ │ ├── Card/ │ └── Modal/ ├── hooks/ │ ├── useAuth.ts │ └── useForm.ts ├── pages/ │ └── Home.tsx └── App.tsx ``` ### Common Issues & Fixes **Issue: "Component never imported anywhere"** * **Meaning:** Orphan component * **Fix:** Delete or find use for it **Issue: "Hook used in multiple places"** * **Meaning:** Good! Reusable logic * **Keep:** This is the pattern to follow ### Tips for React ```bash theme={"theme":"catppuccin-mocha"} # Analyze component structure npx tsx apps/cli/index.ts analyze . # Check what uses your custom hook npx tsx apps/cli/index.ts impact --file src/hooks/useAuth.ts . # Find unused components npx tsx apps/cli/index.ts graph | grep "import.*component" ``` *** ## TypeScript Projects ### What ARCLUX Checks for TypeScript ARCLUX verifies: 1. Type imports vs value imports 2. Module boundaries 3. Interface usage 4. Type organization ### Expected Structure ``` src/ ├── types/ │ ├── user.ts │ └── api.ts ├── interfaces/ │ ├── IUser.ts │ └── IProduct.ts ├── models/ │ └── User.ts └── index.ts ``` ### Common Issues & Fixes **Issue: "Type imported as value"** * **Meaning:** Using `import { Type }` instead of `import type { Type }` * **Fix:** Use `import type` for types only **Issue: "Circular type dependencies"** * **Meaning:** Type A references Type B, Type B references Type A * **Fix:** Refactor to extract common types ### Tips for TypeScript ```bash theme={"theme":"catppuccin-mocha"} # Analyze type structure npx tsx apps/cli/index.ts analyze . # Check what depends on your types file npx tsx apps/cli/index.ts impact --file src/types/user.ts . # Find unused type definitions npx tsx apps/cli/index.ts graph ``` *** ## Multi-Language Projects ### Using ARCLUX with Multiple Languages ARCLUX supports: * TypeScript * JavaScript * Python * Go * Java ### How to Use ```bash theme={"theme":"catppuccin-mocha"} # Analyze entire monorepo npx tsx apps/cli/index.ts analyze . # It will: # - Parse TypeScript files with TS parser # - Parse Python files with Tree-sitter # - Parse Go files with Tree-sitter # - Parse Java files with Tree-sitter ``` ### Example: Mixed TS + Python Project ``` project/ ├── frontend/ (TypeScript) ├── backend/ (Python) └── scripts/ (Go) ``` Output: ``` Project Summary • Total modules: 35 • Total files: 120 • Languages: TypeScript, Python, Go ``` ### Tips for Multi-Language Projects ```bash theme={"theme":"catppuccin-mocha"} # Analyze everything npx tsx apps/cli/index.ts analyze . # Check frontend specifically npx tsx apps/cli/index.ts analyze ./frontend # Check backend specifically npx tsx apps/cli/index.ts analyze ./backend ``` *** ## Monorepo Projects ### Using ARCLUX with Monorepos ARCLUX works great with monorepos: ```bash theme={"theme":"catppuccin-mocha"} # Analyze entire monorepo npx tsx apps/cli/index.ts analyze . # Or specific package npx tsx apps/cli/index.ts analyze packages/ui ``` ### Typical Monorepo Structure ``` monorepo/ ├── packages/ │ ├── core/ │ ├── ui/ │ ├── api/ │ └── cli/ └── apps/ ├── web/ └── mobile/ ``` ### Benefits for Monorepos 1. **See cross-package dependencies** ```bash theme={"theme":"catppuccin-mocha"} npx tsx apps/cli/index.ts graph | grep "packages/" ``` 2. **Check for circular imports between packages** ```bash theme={"theme":"catppuccin-mocha"} npx tsx apps/cli/index.ts doctor ``` 3. **Understand impact of changes** ```bash theme={"theme":"catppuccin-mocha"} npx tsx apps/cli/index.ts impact --file packages/core/index.ts . ``` *** ## Don't See Your Framework? ARCLUX works with any TypeScript/JavaScript project! The guides above are just recommendations. You can still: * Run `analyze` * Find circular dependencies * Check impact analysis * Find dead code It all works! Try it out! *** \*\*Pick your framework above and get started! \*\* # How to Use ARCLUX Source: https://arclux-os.mintlify.app/how-to-use CLI, daemon, web dashboard, and VS Code extension Everything ARCLUX can do today, from a one-off CLI check to always-on background analysis with editor integration. ## 1. One-off CLI commands Point any command at a local repo path (defaults to .): ```bash theme={"theme":"catppuccin-mocha"} arclux analyze [path] arclux graph [path] arclux impact [path] arclux doctor [path] arclux diagnose [path] arclux diff [path] arclux verify [path] arclux security [path] arclux search [path] arclux script arclux config [path] arclux shell arclux mcp ``` diagnose output includes clickable file paths (OSC 8 hyperlinks) in terminals that support it (Termux, iTerm2, VS Code integrated terminal) -- tap/click to open the file directly. `analyze` also accepts a remote repo URL (arclux analyze [https://github.com/org/repo](https://github.com/org/repo)) -- it clones, analyzes, and cleans up, with SSRF/private-network guards on the URL before anything else. ## 2. DSL scripting (arclux script) Scripts chain every engine capability in one readable file: ```arclux theme={"theme":"catppuccin-mocha"} repo = analyze("~/flask") impact(repo, "app.py") check(repo, "orphanFiles") ``` Built-ins: analyze, doctor, check, graph, callgraph, impact, search, security, diff, archdiff + helpers (len, sum, filter, sort, exists, keys, values, env, cwd, extensions, checkids). extensions() and checkids() grow automatically as new parsers/detectors are registered -- the DSL is registry-driven, it never needs a code change to know a new language. ## 3. Always-on daemon Instead of re-running commands by hand, start ARCLUX as a background process that watches your repo and re-analyzes on every save: ```bash theme={"theme":"catppuccin-mocha"} arclux daemon --detach arclux daemon --status arclux daemon --stop ``` Run without --detach to see live output in the foreground instead. The daemon exposes a local HTTP+SSE bridge so any editor or terminal can connect: ```bash theme={"theme":"catppuccin-mocha"} curl http://127.0.0.1:PORT/analysis curl http://127.0.0.1:PORT/events ``` Find the port from \~/.arclux/endpoints/DAEMON\_ID.json, written automatically when the daemon starts. ## 4. Web dashboard ```bash theme={"theme":"catppuccin-mocha"} cd apps/web pnpm run dev ``` Open localhost:3000/ORG/REPO for a given GitHub URL. From the Overview page: * Click any file in the Project structure tree to open it * The File tab shows syntax-highlighted source (Python, JavaScript, TypeScript today) with inline diagnostic gutter markers -- a colored bar on any line with a finding, click it to expand the message + fix suggestion * Dependencies and Impact tabs show what a file needs and what breaks if you change it * Click the collapse chevron to give the file panel full width The Graph page renders the full dependency graph; selecting a node opens a focus panel showing what it needs and what it affects. ## 5. VS Code extension Connects to a running daemon and surfaces diagnostics in VS Code's Problems panel + a status bar module count. ```bash theme={"theme":"catppuccin-mocha"} cd apps/vscode-extension pnpm install && pnpm build ``` Then load it via VS Code's Extension Development Host. Requires a daemon already running for the workspace folder. ## 5. Audit — the findings theater Run the full analysis (doctor + security + attack surface) as one guided experience: * `/{org}/{repo}/audit` — standalone page, repo prefilled from the URL * or the `▸ audit` tab inside `/script` The terminal streams the scan (systemd-style boot, real numbers), then chapters reveal one finding at a time in the FOCUS panel with a file preview overlay. On the graph page, **run audit on graph** replays every finding as a breathing severity halo on the 3D nodes — critical red, high orange, medium yellow. # cli Source: https://arclux-os.mintlify.app/map/apps/cli Codebase intelligence platform — 27-language parser, dependency & call graphs, 20 architecture detectors, impact tracing, security pipeline, ## apps/cli Codebase intelligence platform — 27-language parser, dependency & call graphs, 20 architecture detectors, impact tracing, security pipeline, and the ARCLUX scripting DSL. *Entry point `index.ts` ditemukan, tapi tidak ada export terdeteksi.* # vscode-extension Source: https://arclux-os.mintlify.app/map/apps/vscode-extension Live dependency graph, impact analysis, and diagnostics -- connects to a running ARCLUX daemon (arclux daemon --detach) ## apps/vscode-extension Live dependency graph, impact analysis, and diagnostics -- connects to a running ARCLUX daemon (arclux daemon --detach) **Isi folder:** * `package.json` * `src`/ * `tsconfig.json` *Tidak ada file entry point (index.ts/js) ditemukan.* # web Source: https://arclux-os.mintlify.app/map/apps/web Ringkasan apps/web ## apps/web This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). ## Getting Started First, run the development server: ```bash theme={"theme":"catppuccin-mocha"} npm run dev # or yarn dev # or pnpm dev # or bun dev ``` Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. ## Learn More To learn more about Next.js, take a look at the following resources: * [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. * [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! ## Deploy on Vercel The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template\&filter=next.js\&utm_source=create-next-app\&utm_campaign=create-next-app-readme) from the creators of Next.js. Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. **Isi folder:** * `AGENT.md` * `README.md` * `app`/ * `components`/ * `components.json` * `eslint.config.mjs` * `features`/ * `hooks`/ * `lib`/ * `next.config.ts` * `package-lock.json` * `package.json` * `postcss.config.mjs` * `public`/ * `theme`/ * `tsconfig.json` * `vendor-ui`/ *Tidak ada file entry point (index.ts/js) ditemukan.* # acquisition Source: https://arclux-os.mintlify.app/map/intelligence/acquisition Ringkasan packages/acquisition ## packages/acquisition *Tidak ada package.json (bukan package standar Node).* **Exports** (dari `index.ts`): * re-exports from `./AcquisitionPolicy` * re-exports from `./AcquisitionResult` * re-exports from `./ArchiveAcquirer` * re-exports from `./RepositoryAcquirer` * re-exports from `./SourceAcquirer` * re-exports from `./SourceSnapshot` # adapters Source: https://arclux-os.mintlify.app/map/intelligence/adapters Ringkasan packages/adapters ## packages/adapters *Tidak ada package.json (bukan package standar Node).* **Exports** (dari `index.ts`): * `createSourceAdapter` * `adaptSource` # boundaries Source: https://arclux-os.mintlify.app/map/intelligence/boundaries Ringkasan packages/boundaries ## packages/boundaries *Tidak ada package.json (bukan package standar Node).* **Exports** (dari `index.ts`): * re-exports from `./AnalysisBoundary` * re-exports from `./EvidenceBoundary` * re-exports from `./RemoteAccessPolicy` * re-exports from `./SourceBoundaryPolicy` # correlation Source: https://arclux-os.mintlify.app/map/intelligence/correlation Ringkasan packages/correlation ## packages/correlation *Tidak ada package.json (bukan package standar Node).* **Exports** (dari `index.ts`): * `buildImpactSnapshot` * `type ImpactSnapshot` * `type ImpactedFile` * `mapAttackSurface` * `type AttackSurfaceMap` * `type AttackSurfaceOptions` * `type Exposure` * `dedupeFindings` * `groupFindingsBySeverity` * `groupFindingsByFile` * `linkFindingsToProvenance` * `type LinkProvenanceInput` * `type LinkProvenanceResult` * `correlateFindingsWithImpact` * `scoreFinding` * `type CorrelatedFinding` # detectors Source: https://arclux-os.mintlify.app/map/intelligence/detectors Ringkasan packages/detectors ## packages/detectors *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `detectAmbiguousSymbolResolution.ts` * `detectCircularDependency.ts` * `detectComponentConvention.ts` * `detectDeadCode.ts` * `detectDuplicateModules.ts` * `detectEntryPoints.ts` * `detectFeatureStructure.ts` * `detectIndexFiles.ts` * `detectLargeModules.ts` * `detectLayerViolation.ts` * `detectMissingExports.ts` * `detectOrphanFiles.ts` * `detectOrphanIntegration.ts` * `detectRepositoryPattern.ts` * `detectRouteConvention.ts` * `detectSharedModules.ts` * `detectStoryConvention.ts` * `detectTestConvention.ts` * `detectUnusedExports.ts` * `detectUnusedFiles.ts` * `testFiles.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # diagnostics Source: https://arclux-os.mintlify.app/map/intelligence/diagnostics Ringkasan packages/diagnostics ## packages/diagnostics *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `DiagnosticEngine.ts` * `DiagnosticEvent.ts` * `DiagnosticEvidence.ts` * `DiagnosticOrigin.ts` * `ErrorContext.ts` * `ErrorLocation.ts` * `FixSuggestion.ts` * `RemoteDiagnostic.ts` * `RuntimeDiagnostic.ts` * `SourceDiagnostic.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # diff Source: https://arclux-os.mintlify.app/map/intelligence/diff Ringkasan packages/diff ## packages/diff *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `architecturalDiff.ts` * `gitDiff.ts` * `types.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # directory Source: https://arclux-os.mintlify.app/map/intelligence/directory Ringkasan packages/directory ## packages/directory *Tidak ada package.json (bukan package standar Node).* **Exports** (dari `index.ts`): * re-exports from `./types` * re-exports from `./registry` # dsl Source: https://arclux-os.mintlify.app/map/intelligence/dsl Ringkasan packages/dsl ## packages/dsl *Tidak ada package.json (bukan package standar Node).* **Exports** (dari `index.ts`): * re-exports from `./lexer` * re-exports from `./parser` * re-exports from `./runtime` * re-exports from `./bindings` * re-exports from `./script` # engine Source: https://arclux-os.mintlify.app/map/intelligence/engine Ringkasan packages/engine ## packages/engine *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `analyzeArchitecture.ts` * `analyzeConvention.ts` * `analyzeDependency.ts` * `analyzeFile.ts` * `analyzeImpact.ts` * `analyzeModule.ts` * `contract.ts` * `detectRepositoryMeta.ts` * `generateReport.ts` * `generateSummary.ts` * `healthScore.ts` * `pipeline.ts` * `runDoctor.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # git Source: https://arclux-os.mintlify.app/map/intelligence/git Ringkasan packages/git ## packages/git *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `checkoutBranch.ts` * `cleanupRepository.ts` * `cloneRepository.ts` * `detectDefaultBranch.ts` * `getBranches.ts` * `getCommitHistory.ts` * `getContributors.ts` * `getRemoteOriginUrl.ts` * `headFreshness.ts` * `readGitignore.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # graph Source: https://arclux-os.mintlify.app/map/intelligence/graph Ringkasan packages/graph ## packages/graph *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `buildCallGraph.ts` * `buildDependencyGraph.ts` * `buildExportGraph.ts` * `buildFolderGraph.ts` * `buildImportGraph.ts` * `resolveAliases.ts` * `resolveCalls.ts` * `resolvePath.ts` * `serializeGraph.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # impact Source: https://arclux-os.mintlify.app/map/intelligence/impact Ringkasan packages/impact ## packages/impact *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `buildImpactTree.ts` * `calculateAffectedComponents.ts` * `calculateAffectedFiles.ts` * `calculateAffectedModules.ts` * `calculateAffectedRoutes.ts` * `traceConsumers.ts` * `traceDependencies.ts` * `traceExports.ts` * `traceImports.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # indexer Source: https://arclux-os.mintlify.app/map/intelligence/indexer Ringkasan packages/indexer ## packages/indexer *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `buildIndex.ts` * `indexSchema.ts` * `resolveComponents.ts` * `resolveExports.ts` * `resolveHooks.ts` * `resolveProviders.ts` * `resolveRoutes.ts` * `resolveSameScopeDependencies.ts` * `updateIndex.ts` * `watchIndex.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # language Source: https://arclux-os.mintlify.app/map/intelligence/language Ringkasan packages/language ## packages/language *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `CompletionEngine.ts` * `DiffEngine.ts` * `FormattingEngine.ts` * `LanguageService.ts` * `SymbolEngine.ts` * `SyntaxEngine.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # mcp Source: https://arclux-os.mintlify.app/map/intelligence/mcp MCP server for ARCLUX — exposes codebase intelligence tools via Model Context Protocol ## packages/mcp MCP server for ARCLUX — exposes codebase intelligence tools via Model Context Protocol **Exports** (dari `src/index.ts`): * `SERVER_INSTRUCTIONS` * `TOOLS` # parser Source: https://arclux-os.mintlify.app/map/intelligence/parser Ringkasan packages/parser ## packages/parser *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `bash`/ * `c`/ * `config`/ * `core`/ * `cpp`/ * `csharp`/ * `dart`/ * `elixir`/ * `elm`/ * `go`/ * `java`/ * `javascript`/ * `kotlin`/ * `lua`/ * `objc`/ * `ocaml`/ * `php`/ * `python`/ * `rescript`/ * `ruby`/ * `rust`/ * `scala`/ * `solidity`/ * `swift`/ * `typescript`/ * `vue`/ * `wasms`/ * `zig`/ *Tidak ada file entry point (index.ts/js) ditemukan.* # provenance Source: https://arclux-os.mintlify.app/map/intelligence/provenance Ringkasan packages/provenance ## packages/provenance *Tidak ada package.json (bukan package standar Node).* **Exports** (dari `index.ts`): * `createProvenanceRecord` * `type ProvenanceRecord` * `type CreateProvenanceRecordInput` # relay Source: https://arclux-os.mintlify.app/map/intelligence/relay Ringkasan packages/relay ## packages/relay *Tidak ada package.json (bukan package standar Node).* **Exports** (dari `index.ts`): * re-exports from `./types` * re-exports from `./registry` * re-exports from `./gate` * re-exports from `./identity` # remote Source: https://arclux-os.mintlify.app/map/intelligence/remote Ringkasan packages/remote ## packages/remote *Tidak ada package.json (bukan package standar Node).* **Exports** (dari `index.ts`): * `RemoteRepository` * `createRemoteSnapshot` * `type RemoteSnapshot` * `type CreateRemoteSnapshotInput` * re-exports from `./RemoteAccess` * re-exports from `./RemoteLocator` * re-exports from `./RemoteProvider` * re-exports from `./RemoteRevision` # remote-analysis Source: https://arclux-os.mintlify.app/map/intelligence/remote-analysis Ringkasan packages/remote-analysis ## packages/remote-analysis *Tidak ada package.json (bukan package standar Node).* **Exports** (dari `index.ts`): * re-exports from `./RemoteAnalysisRequest` * re-exports from `./RemoteAnalysisResult` * re-exports from `./RemoteAnalysisSession` * re-exports from `./RemoteImpactReport` * re-exports from `./SourceHealthReport` * re-exports from `./analyzeRemoteSource` # repository Source: https://arclux-os.mintlify.app/map/intelligence/repository Ringkasan packages/repository ## packages/repository *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `Dependency.ts` * `Edge.ts` * `File.ts` * `Folder.ts` * `Graph.ts` * `Module.ts` * `Node.ts` * `Repository.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # rules Source: https://arclux-os.mintlify.app/map/intelligence/rules Ringkasan packages/rules ## packages/rules *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `RuleEngine.ts` * `electron`/ * `express`/ * `laravel`/ * `nestjs`/ * `nextjs`/ * `react`/ * `vite`/ *Tidak ada file entry point (index.ts/js) ditemukan.* # search Source: https://arclux-os.mintlify.app/map/intelligence/search Ringkasan packages/search ## packages/search *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `SearchEngine.ts` * `SearchFilters.ts` * `SearchIndex.ts` * `SearchKeyboard.ts` * `SearchProvider.ts` * `SearchResults.ts` * `fuzzyScore.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # security Source: https://arclux-os.mintlify.app/map/intelligence/security Ringkasan packages/security ## packages/security *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `Capability.ts` * `PermissionManager.ts` * `PolicyEngine.ts` * `Sandbox.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # security-analysis Source: https://arclux-os.mintlify.app/map/intelligence/security-analysis Ringkasan packages/security-analysis ## packages/security-analysis # ARCLUX Security Analysis This package provides defensive, source-based security findings and provenance contracts. `analyzeRepositorySecurity(repository)` is the integration point for the ARCLUX engine. It does not execute repository code or perform network scans. **Exports** (dari `index.ts`): * `DiskSourceProvider` * `type SourceProvider` * `detectSecretExposure` * `shannonEntropy` * `DEFAULT_SECRET_RULES` * `type SecretRule` * `type SecretDetectionOptions` * `detectUnsafePatterns` * `DEFAULT_UNSAFE_PATTERN_RULES` * `type UnsafePatternRule` * `type UnsafePatternOptions` * `detectSensitiveDataFlow` * `DEFAULT_DATA_FLOW_RULES` * `type DataFlowRule` * `type SensitiveDataFlowOptions` * `detectTrustBoundaryViolations` * `classifyTrustZone` * `DEFAULT_TRUST_ZONES` * `type TrustZoneDefinition` * `type TrustZoneId` * `type TrustBoundaryOptions` * `detectCrossBoundaryCalls` * `analyzeSecurityImpact` * `attachImpactToFindings` * `type SecurityImpactReport` * `type ImpactedFinding` * `remediateRule` * `attachRemediations` * `buildSecurityReport` * `summarize` * `type SecurityReport` * `type SecurityReportSummary` * `type ReportAttackSurface` * `type BuildSecurityReportInput` * `parseLockfiles` * `normalizeVersion` * `LOCKFILE_NAMES` * `type LockedDependency` * `type LockfileParseResult` * `compareSemver` * `isVulnerable` * `detectVulnerableDependencies` * `toSecurityFindings` * `DEFAULT_KNOWN_VULNERABILITIES` * `type KnownVulnerability` * `type VulnerableDependencyFinding` * `analyzeTransitiveRisk` * `vulnerableNames` * `type TransitiveRiskReport` * `analyzeDependencyRisk` * `isUnpinnedRange` * `type DependencyRiskInput` * `type DependencyRiskResult` # semantic-diff Source: https://arclux-os.mintlify.app/map/intelligence/semantic-diff Ringkasan packages/semantic-diff ## packages/semantic-diff *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `AstDiff.ts` * `DependencyDiff.ts` * `DiffRenderer.ts` * `SemanticDiff.ts` * `SymbolDiff.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # shared Source: https://arclux-os.mintlify.app/map/intelligence/shared Ringkasan packages/shared ## packages/shared *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `config.ts` * `constants.ts` * `errors.ts` * `hash.ts` * `logger.ts` * `paths.ts` * `types.ts` * `utils.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # ui Source: https://arclux-os.mintlify.app/map/intelligence/ui Ringkasan packages/ui ## packages/ui *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `graphAnimation.ts` * `graphIcons.ts` * `graphLayout.ts` * `graphTheme.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # universe Source: https://arclux-os.mintlify.app/map/intelligence/universe Ringkasan packages/universe ## packages/universe *Tidak ada package.json (bukan package standar Node).* **Exports** (dari `index.ts`): * re-exports from `./types` * re-exports from `./stats` * re-exports from `./license` * re-exports from `./schema` * re-exports from `./connect` * re-exports from `./fitCalc` * re-exports from `./capSim` # cache Source: https://arclux-os.mintlify.app/map/platform/cache Ringkasan packages/cache ## packages/cache *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `CacheProvider.ts` * `diskCache.ts` * `fileCache.ts` * `graphCache.ts` * `memoryCache.ts` * `repositoryCache.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # change Source: https://arclux-os.mintlify.app/map/platform/change Ringkasan packages/change ## packages/change *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `ChangeExecutor.ts` * `ChangePlan.ts` * `PatchSet.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # daemon Source: https://arclux-os.mintlify.app/map/platform/daemon Ringkasan packages/daemon ## packages/daemon *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `ArcluxDaemon.ts` * `DaemonProcess.ts` * `DaemonRepositoryWatcher.ts` * `LocalBridgeServer.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # db Source: https://arclux-os.mintlify.app/map/platform/db Ringkasan packages/db ## packages/db *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `client.ts` * `repositories`/ * `schema.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # editor Source: https://arclux-os.mintlify.app/map/platform/editor Ringkasan packages/editor ## packages/editor *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `CodeNavigator.ts` * `EditContext.ts` * `ImpactNavigator.ts` * `LineContext.ts` * `SymbolProvider.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # environment Source: https://arclux-os.mintlify.app/map/platform/environment Ringkasan packages/environment ## packages/environment *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `ArcluxEnvironment.ts` * `EnvironmentDetector.ts` * `EnvironmentManager.ts` * `EnvironmentProfile.ts` * `EnvironmentVariables.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # incremental Source: https://arclux-os.mintlify.app/map/platform/incremental Ringkasan packages/incremental ## packages/incremental *Tidak ada package.json (bukan package standar Node).* **Exports** (dari `index.ts`): * `Database` * `Cell` * `Query` # kernel Source: https://arclux-os.mintlify.app/map/platform/kernel Ringkasan packages/kernel ## packages/kernel *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `Kernel.ts` * `ProcessTable.ts` * `ServiceRegistry.ts` * `SignalBus.ts` * `introspection`/ *Tidak ada file entry point (index.ts/js) ditemukan.* # networking Source: https://arclux-os.mintlify.app/map/platform/networking Ringkasan packages/networking ## packages/networking *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `ConnectionManager.ts` * `NetworkRegistry.ts` * `PortManager.ts` * `ServiceEndpoint.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # notifications Source: https://arclux-os.mintlify.app/map/platform/notifications Ringkasan packages/notifications ## packages/notifications *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `Notification.ts` * `NotificationChannel.ts` * `NotificationManager.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # observation Source: https://arclux-os.mintlify.app/map/platform/observation Ringkasan packages/observation ## packages/observation *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `NetworkObservation.ts` * `ObservationRecord.ts` * `ObservationScope.ts` * `RuntimeObservation.ts` * `SourceObservation.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # orchestration Source: https://arclux-os.mintlify.app/map/platform/orchestration Ringkasan packages/orchestration ## packages/orchestration *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `EventRouter.ts` * `PlatformOrchestrator.ts` * `RecoveryOrchestrator.ts` * `TaskOrchestrator.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # package-manager Source: https://arclux-os.mintlify.app/map/platform/package-manager Ringkasan packages/package-manager ## packages/package-manager *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `PackageManager.ts` * `PackageManifest.ts` * `PackageResolver.ts` * `PackageState.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # runtime Source: https://arclux-os.mintlify.app/map/platform/runtime Ringkasan packages/runtime ## packages/runtime *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `ProcessManager.ts` * `ProcessOutput.ts` * `ProcessSpec.ts` * `ProcessState.ts` * `RuntimeManager.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # scheduler Source: https://arclux-os.mintlify.app/map/platform/scheduler Ringkasan packages/scheduler ## packages/scheduler *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `Job.ts` * `JobQueue.ts` * `JobScheduler.ts` * `JobState.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # services Source: https://arclux-os.mintlify.app/map/platform/services Ringkasan packages/services ## packages/services *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `ServiceDefinition.ts` * `ServiceDependency.ts` * `ServiceManager.ts` * `ServiceState.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # shell Source: https://arclux-os.mintlify.app/map/platform/shell Ringkasan packages/shell ## packages/shell *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `ArcluxShell.ts` * `detectors.ts` * `plugins.ts` * `query.ts` * `session.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # storage Source: https://arclux-os.mintlify.app/map/platform/storage Ringkasan packages/storage ## packages/storage *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `ArtifactStore.ts` * `CacheManager.ts` * `RecoveryManager.ts` * `SnapshotManager.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # system Source: https://arclux-os.mintlify.app/map/platform/system Ringkasan packages/system ## packages/system *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `ConfigurationStore.ts` * `HealthMonitor.ts` * `SystemManager.ts` * `SystemState.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # terminal Source: https://arclux-os.mintlify.app/map/platform/terminal Ringkasan packages/terminal ## packages/terminal *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `CommandExecutor.ts` * `CommandSession.ts` * `ShellEnvironment.ts` * `TerminalManager.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # watcher Source: https://arclux-os.mintlify.app/map/platform/watcher Ringkasan packages/watcher ## packages/watcher *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `changeQueue.ts` * `watchFilesystem.ts` * `watchGit.ts` * `watchRepository.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # web-intake Source: https://arclux-os.mintlify.app/map/platform/web-intake Ringkasan packages/web-intake ## packages/web-intake *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `AssetReference.ts` * `IntakeResult.ts` * `SourceBoundary.ts` * `WebsiteLocator.ts` * `WebsiteManifest.ts` * `WebsiteSource.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # workspace Source: https://arclux-os.mintlify.app/map/platform/workspace Ringkasan packages/workspace ## packages/workspace *Tidak ada package.json (bukan package standar Node).* **Isi folder:** * `WorkspaceManager.ts` * `WorkspaceSession.ts` * `WorkspaceSnapshot.ts` * `WorkspaceState.ts` *Tidak ada file entry point (index.ts/js) ditemukan.* # Overview Source: https://arclux-os.mintlify.app/overview See through your codebase before it breaks # ARCLUX See through your codebase before it breaks. Every codebase accumulates debt nobody can see until it's too late -- circular dependencies, dead code, files nobody remembers touching. ARCLUX builds a live dependency graph of your repo, traces the blast radius of every change, and catches structural rot before it ships. ## Get started Published on npm -- zero setup: ```bash theme={"theme":"catppuccin-mocha"} npx arclux analyze . # one-off, no install npm i -g arclux # or install once, get the `arclux` binary ``` The package ships every tree-sitter grammar it needs -- no native compilation, no grammar installs. Node 20+. From source (development): ```bash theme={"theme":"catppuccin-mocha"} git clone https://github.com/GSF-001/ARCLUX.git cd ARCLUX pnpm install pnpm build:cli ``` Or start the web dashboard: ```bash theme={"theme":"catppuccin-mocha"} cd apps/web pnpm run dev ``` Jalan di Termux (Android) arm64: `apps/web` pakai Webpack, bukan Turbopack -- Turbopack belum didukung di arsitektur ini. Jangan tambahkan `--turbo` ke script dev. Parsing TypeScript/TSX pakai TypeScript Compiler API, parsing Python pakai `web-tree-sitter`. Kalau nambah bahasa baru, cek `packages/parser/` dulu sebelum bikin parser baru. ## MCP for AI agents ARCLUX exposes 30+ tools over Model Context Protocol, with self-triggering workflow instructions so agents pick the right tool unprompted: ```json theme={"theme":"catppuccin-mocha"} { "mcpServers": { "arclux": { "command": "npx", "args": ["arclux", "mcp"] } } } ``` ## Always-on daemon ```bash theme={"theme":"catppuccin-mocha"} arclux daemon --detach # watch the repo, re-analyze on every change arclux daemon --status arclux daemon --stop ``` The daemon exposes a local HTTP+SSE bridge (`GET /analysis`, `GET /events`) so any editor or terminal can connect. ## What it actually does Maps every import, export, and folder into one live dependency graph Change one file, trace everything downstream before you ship Circular deps, dead code, orphan files, layer violations, and more Enforces conventions across Next.js, NestJS, Express, Vite, Electron, React, Laravel arclux script -- chain analyze, impact, doctor, security in plain-text scripts ## Status: alpha This project is under active development with a small team. Expect breaking changes and stubs that aren't wired up yet. Core pipeline, 27 languages, all 20 detectors, impact analysis, call graph, DSL, search, security, MCP server, daemon -- verified against `vscode`, `react`, `vite`, `laravel`, `flask` Per-file incremental re-indexing is still coarse (full rebuild per change) ## License **Apache License 2.0** — open source, contribute freely. See [LICENSE](https://github.com/GSF-001/ARCLUX/blob/ARCLUX.main/LICENSE). ## Next steps Full CLI command reference and web dashboard setup How the pipeline fits together: parser to graph to detectors What's solid, what's a stub, and what's actively being worked on Browse every package and app in the monorepo # Quickstart Source: https://arclux-os.mintlify.app/quickstart Clone, install, and run your first analysis in a few minutes Welcome to ARCLUX. This guide gets you from a fresh clone to your first dependency graph in a few minutes. ## Before you begin Make sure you have: * **Node.js** and **pnpm** installed * **Git** installed * A codebase you want to analyze (your own repo, or clone something like `vscode` or `react` to try it out) This guide covers running ARCLUX locally in your terminal. The web dashboard (Step 3 below) requires the same local setup — there's no hosted version yet. ARCLUX isn't published to npm yet, so you build it locally. ```bash theme={null} git clone https://github.com/GSF-001/ARCLUX.git cd ARCLUX ``` ```bash theme={null} pnpm install ``` Point the CLI at any local path: ```bash theme={null} npx tsx apps/cli/index.ts analyze [path] ``` This parses the target codebase, builds the dependency graph, and runs all 20 structural detectors (circular dependencies, dead code, orphan files, layer violations, and more) across 27 languages. ```bash theme={null} cd apps/web pnpm run dev ``` Open the printed local URL to browse the interactive dependency graph, trace impact, and view file details. Running in Termux (Android) on arm64: `apps/web` uses Webpack, not Turbopack — Turbopack isn't supported on this architecture. Don't add `--turbo` to the dev script. ## What's next What ARCLUX actually does and its current alpha status How the pipeline fits together: parser to graph to detectors What's solid, what's a stub, and what's actively being worked on Browse every package and app in the monorepo # AI Agent Skill Source: https://arclux-os.mintlify.app/skill SKILL.md reference for AI coding agents working in this repo ARCLUX ships a `SKILL.md` file at the repo root, following the convention used by AI coding agent skill managers (Claude Code, Cursor, and similar tools that auto-discover `SKILL.md`). Any agent working in this repository picks it up automatically -- no manual prompting needed. Full source, always up to date with the repo ## What it covers * Which `arclux` command to run for common situations (before editing, after editing, before opening a PR) * Environment gotchas specific to this repo (Termux/Webpack, large-repo memory flags, the Python WASM path regression) * Boundaries the agent should respect (don't hand-edit progres files, don't add intelligence layers inside core packages) ## Example ```bash theme={"theme":"catppuccin-mocha"} npx tsx apps/cli/index.ts impact packages/engine/pipeline.ts ``` # Stack & Environment Source: https://arclux-os.mintlify.app/stack Tooling dan environment yang dipakai ARCLUX # ARCLUX — Tooling & Config Guide This file explains all the config/tooling in this repo, what it's for, and how to use it. If you're wondering "what is this file for", check here first. Also read `CONTRIBUTING.md` for code contribution conventions (project structure, how to add a detector/parser, etc). This file focuses on tooling/workflow. *** ## 1. PROGRES system (progres/PROGRES-\*.md) All project work history is logged in the `progres/` folder, split by category: | File | Contents | | - | - | | `status-core.md` | Status: pipeline, parser, indexer, graph, impact, incremental | | `status-detectors.md` | Status: detectors | | `status-web.md` | Status: apps/web, graph viewer, vendor-ui, theme | | `status-infra.md` | Status: CLI, collaborator tooling, testing, cleanup, dogfood | | `status-backlog.md` | Backlog | | `bugs.md` | Bugs found in ARCLUX's own code + their fixes | | `decisions.md` | Design/architecture decisions ("we chose X over Y, because...") | | `gotchas.md` | Tooling/environment traps (Termux, tsconfig, Webpack, etc) — NOT bugs in ARCLUX's code | | `collaborators.md` | Who's assigned to what | The root `PROGRES.md` is just an index + "quick decision guide" for figuring out which file an entry belongs in. ### How to add a progress entry — USE THE SCRIPT, DON'T EDIT MANUALLY ```bash theme={"theme":"catppuccin-mocha"} scripts/log-progress.sh "short title" "progress details" ``` Valid categories: `status-core`, `status-detectors`, `status-web`, `status-infra`, `status-backlog`, `bugs`, `decisions`, `gotchas`, `collaborators`. Example: ```bash theme={"theme":"catppuccin-mocha"} scripts/log-progress.sh bugs \ "Fix parser crash on empty file" \ "TypeScript parser crashed on empty files (license header \ only). Fixed by adding an early-return check in parseTs.ts." ``` ### Closing out an old plan -- use close-plan If progres/decisions.md has an old entry that says "planned", "not yet built", or "next step", and you just finished that work, don't just add a new status entry -- the old entry will look pending forever if left untouched. Use close-plan mode: ```bash theme={"theme":"catppuccin-mocha"} scripts/log-progress.sh close-plan \ "" "" "" ``` This automatically finds the old entry by a substring of its title, inserts a status pointer below the old header, and appends a new entry titled UPDATE: \ -- implemented at the end of the file. The old entry isn't deleted, history stays intact. The script automatically: * Gets today's date from the device * Builds a `## YYYY-MM-DD — title` header * Appends it to the right category file **Why use the script instead of editing manually?** Because there's a pre-commit hook (see section 4) that will reject a commit if a new entry is missing a date in its header. The script guarantees the format is always correct. ### Tagging progress entries with status -- Not Started / In Progress / Done Every entry can now have a status, so collaborators can see at a glance which ones are still ideas, which are in progress, which are done -- without reading the full content of each entry. Adding a new entry with a status: ```bash theme={"theme":"catppuccin-mocha"} scripts/log-progress.sh <category> "title" "body" "Not Started" ``` The status argument is optional -- if omitted, it defaults to "Not Started". Only 3 consistent statuses are used: `Not Started`, `In Progress`, `Done`. Updating the status of an EXISTING entry (e.g. starting work on something, or just finishing it), without creating a new entry: ```bash theme={"theme":"catppuccin-mocha"} scripts/log-progress.sh set-status <category> "<entry title>" "<new status>" ``` This finds the entry by a substring of its title (must be unique), then replaces its `**Status:** ...` line in place -- the rest of the entry is untouched. If the entry doesn't have a status line yet (an old entry from before this feature existed), a status line is added automatically. Example workflow: ```bash theme={"theme":"catppuccin-mocha"} # Start working on something scripts/log-progress.sh decisions \ "Refactor X" "Plan to refactor X because of Y" "In Progress" # ...a few hours later, it's done... scripts/log-progress.sh set-status decisions "Refactor X" "Done" ``` *** ## 2. Git workflow — branch protection `main` is locked by a branch protection rule on GitHub. **You can't push directly to `main`**, everything goes through a Pull Request. ### Standard flow: ```bash theme={"theme":"catppuccin-mocha"} git checkout main git pull origin main git checkout -b <type>/<short-description> # ... make your changes ... git add <file> git commit -m "commit message" git push origin <type>/<short-description> ``` Then open the link that appears in the `git push` output (or go to `github.com/GSF-001/ARCLUX/pulls`), open a PR, check the "Files changed" tab, then merge. ### Branch naming: * `split/...` — breaking a large file into smaller ones * `fix/...` — bug/mistake fix * `update/...` — content/documentation update * `feat/...` — new feature/tooling * `docs/...` — documentation only ### IMPORTANT — verify before merging There have been a few cases where a PR got merged but the result turned out to be a stale version, not the latest pushed commit. Before clicking "Merge pull request" on GitHub: ```bash theme={"theme":"catppuccin-mocha"} git diff main..<your-branch> --stat ``` Read the output. If a file shows a lot of unexpected `-` (deletions), check the actual diff content (`git diff main..<branch> -- <file>`) before continuing -- it might be overwriting something important. After merging, **always** verify locally again: ```bash theme={"theme":"catppuccin-mocha"} git checkout main git pull origin main cat <changed-file> ``` Then delete the branch: ```bash theme={"theme":"catppuccin-mocha"} git branch -D <branch-name> ``` *** ## 3. PR Template (.github/PULL\_REQUEST\_TEMPLATE.md) Automatically shows up every time you open a new PR on GitHub. Contains a checklist: PROGRES.md updated, tested on Termux/playground, etc. No need to touch it manually -- GitHub displays it automatically. *** ## 4. Pre-commit hook (.githooks/pre-commit) Active automatically in this repo (already set via `git config core.hooksPath .githooks`). Runs on every `git commit`. **What it does:** if a staged `progres/PROGRES-*.md` file has a new `##` header **without** a date (`YYYY-MM-DD`), the commit is **rejected**. This guarantees no more dateless progress entries. If your commit gets rejected by this hook, the error message will tell you which file and which entry title is the problem. The fix: use `scripts/log-progress.sh` (see section 1), don't edit manually. *** ## 5. Commit message template (.gitmessage) If you commit **without** `-m` (just `git commit` alone), an editor opens showing the commit format template: ``` # [category] Short title (max 50 char) # # category: status | bug | decision | gotcha | infra | docs # # More detail (optional), why this change was made. ``` Lines starting with `#` are comments, automatically ignored by git. Just write the actual message below them. If you commit with `-m "message"` directly, this template isn't used (that's fine, it's optional). *** ## 6. CODEOWNERS (.github/CODEOWNERS) Determines who's automatically a reviewer when a PR comes in. Current setting: all collaborators (`@Alitindrawan24`, `@xcontcom`, `@svSeniorEngineer`) are default reviewers for all files. If you want to split by area later (e.g. person A owns `apps/web/`, person B owns `packages/detectors/`), just edit that file and add a line: ``` apps/web/ @username packages/detectors/ @username ``` *** ## 7. .editorconfig Standardizes code style across editors (indentation, line endings, etc) so it's not inconsistent depending on which editor each collaborator uses. Most modern editors (VS Code, etc) read this file automatically, no manual setup needed. *** ## 8. CI (.github/workflows/ci.yml) Runs automatically on GitHub's servers for every PR to `main` -- doesn't run on your Termux. Checks 3 things: * `npm run typecheck` (`tsc --noEmit`) * `npm run lint` * `npm run test` If any of these fail, the PR will show a failing status on GitHub -- meaning something needs to be fixed before merging. *** ## 9. Daily workflow summary ```bash theme={"theme":"catppuccin-mocha"} # 1. Start new work git checkout main git pull origin main git checkout -b feat/feature-name # 2. Work, commit as needed git add . git commit -m "progress content" # 3. Log progress scripts/log-progress.sh status-infra "title" "progress detail" git add progres/ git commit -m "Log progress: title" # 4. Push and open PR git push origin feat/feature-name # open the link that appears, open a PR, check Files changed # 5. After merging on GitHub git checkout main git pull origin main git branch -D feat/feature-name ``` # Status & Progress Source: https://arclux-os.mintlify.app/status Current progress, open bugs, priorities This is an index. The real history lives in `progres/*.md` -- read all of them, not just this page. <Note> At the start of any session: `cat PROGRES.md progres/status-core.md progres/status-detectors.md progres/status-web.md progres/status-infra.md progres/status-backlog.md progres/bugs.md progres/decisions.md progres/gotchas.md progres/collaborators.md` Skipping the detail files means missing most of what has actually been learned about this codebase. </Note> ## What this is ARCLUX is a codebase analysis tool: clone repo -> parse -> index -> build dependency graph -> interactive browser visualization. It shows how files and modules connect, what breaks if you change something, and which conventions are being violated. ## Stack * **Monorepo**: `apps/web` (Next.js 16, App Router, Webpack -- not Turbopack, unsupported on Termux arm64), `packages/*` (framework-agnostic core logic) * **UI**: React, Tailwind v4, shadcn/ui (Base UI variant) + Aceternity + Magic UI * **Graph rendering**: SVG + `d3-force` * **Parsing**: TypeScript Compiler API (TS/TSX) + `web-tree-sitter` (Python) * **Environment**: Termux on Android, not desktop * **License**: Apache 2.0 ## Progress detail <CardGroup> <Card title="Core status" icon="gears" href="/progres/progres-status-core"> Pipeline, parser, indexer, graph, impact, incremental </Card> <Card title="Detectors status" icon="magnifying-glass" href="/progres/progres-status-detectors"> All 20 structural detectors </Card> <Card title="Web status" icon="window" href="/progres/progres-status-web"> apps/web, graph viewer, vendor-ui, theme </Card> <Card title="Infra status" icon="wrench" href="/progres/progres-status-infra"> CLI, collaborator tooling, testing, cleanup </Card> <Card title="Backlog" icon="list-check" href="/progres/progres-status-backlog"> What is planned but not started </Card> <Card title="Bugs" icon="bug" href="/progres/progres-bugs"> Real bugs found in ARCLUX's own code, and their fixes </Card> <Card title="Decisions" icon="scale-balanced" href="/progres/progres-decisions"> "We chose X over Y, here's why" -- design calls, not bugs </Card> <Card title="Gotchas" icon="triangle-exclamation" href="/gotchas"> Environment/tooling traps, not bugs in ARCLUX's code </Card> </CardGroup> # Tooling & Config Guide Source: https://arclux-os.mintlify.app/tooling Semua config/tooling di repo ini dijelaskan # ARCLUX — Tooling & Config Guide This file explains all the config/tooling in this repo, what it's for, and how to use it. If you're wondering "what is this file for", check here first. Also read `CONTRIBUTING.md` for code contribution conventions (project structure, how to add a detector/parser, etc). This file focuses on tooling/workflow. *** ## 1. PROGRES system (progres/PROGRES-\*.md) All project work history is logged in the `progres/` folder, split by category: | File | Contents | | - | - | | `status-core.md` | Status: pipeline, parser, indexer, graph, impact, incremental | | `status-detectors.md` | Status: detectors | | `status-web.md` | Status: apps/web, graph viewer, vendor-ui, theme | | `status-infra.md` | Status: CLI, collaborator tooling, testing, cleanup, dogfood | | `status-backlog.md` | Backlog | | `bugs.md` | Bugs found in ARCLUX's own code + their fixes | | `decisions.md` | Design/architecture decisions ("we chose X over Y, because...") | | `gotchas.md` | Tooling/environment traps (Termux, tsconfig, Webpack, etc) — NOT bugs in ARCLUX's code | | `collaborators.md` | Who's assigned to what | The root `PROGRES.md` is just an index + "quick decision guide" for figuring out which file an entry belongs in. ### How to add a progress entry — USE THE SCRIPT, DON'T EDIT MANUALLY ```bash theme={"theme":"catppuccin-mocha"} scripts/log-progress.sh <category> "short title" "progress details" ``` Valid categories: `status-core`, `status-detectors`, `status-web`, `status-infra`, `status-backlog`, `bugs`, `decisions`, `gotchas`, `collaborators`. Example: ```bash theme={"theme":"catppuccin-mocha"} scripts/log-progress.sh bugs \ "Fix parser crash on empty file" \ "TypeScript parser crashed on empty files (license header \ only). Fixed by adding an early-return check in parseTs.ts." ``` ### Closing out an old plan -- use close-plan If progres/decisions.md has an old entry that says "planned", "not yet built", or "next step", and you just finished that work, don't just add a new status entry -- the old entry will look pending forever if left untouched. Use close-plan mode: ```bash theme={"theme":"catppuccin-mocha"} scripts/log-progress.sh close-plan <category> \ "<old entry title>" "<new update title>" "<update body>" ``` This automatically finds the old entry by a substring of its title, inserts a status pointer below the old header, and appends a new entry titled UPDATE: \<title> -- implemented at the end of the file. The old entry isn't deleted, history stays intact. The script automatically: * Gets today's date from the device * Builds a `## YYYY-MM-DD — title` header * Appends it to the right category file **Why use the script instead of editing manually?** Because there's a pre-commit hook (see section 4) that will reject a commit if a new entry is missing a date in its header. The script guarantees the format is always correct. ### Tagging progress entries with status -- Not Started / In Progress / Done Every entry can now have a status, so collaborators can see at a glance which ones are still ideas, which are in progress, which are done -- without reading the full content of each entry. Adding a new entry with a status: ```bash theme={"theme":"catppuccin-mocha"} scripts/log-progress.sh <category> "title" "body" "Not Started" ``` The status argument is optional -- if omitted, it defaults to "Not Started". Only 3 consistent statuses are used: `Not Started`, `In Progress`, `Done`. Updating the status of an EXISTING entry (e.g. starting work on something, or just finishing it), without creating a new entry: ```bash theme={"theme":"catppuccin-mocha"} scripts/log-progress.sh set-status <category> "<entry title>" "<new status>" ``` This finds the entry by a substring of its title (must be unique), then replaces its `**Status:** ...` line in place -- the rest of the entry is untouched. If the entry doesn't have a status line yet (an old entry from before this feature existed), a status line is added automatically. Example workflow: ```bash theme={"theme":"catppuccin-mocha"} # Start working on something scripts/log-progress.sh decisions \ "Refactor X" "Plan to refactor X because of Y" "In Progress" # ...a few hours later, it's done... scripts/log-progress.sh set-status decisions "Refactor X" "Done" ``` *** ## 2. Git workflow — branch protection `main` is locked by a branch protection rule on GitHub. **You can't push directly to `main`**, everything goes through a Pull Request. ### Standard flow: ```bash theme={"theme":"catppuccin-mocha"} git checkout main git pull origin main git checkout -b <type>/<short-description> # ... make your changes ... git add <file> git commit -m "commit message" git push origin <type>/<short-description> ``` Then open the link that appears in the `git push` output (or go to `github.com/GSF-001/ARCLUX/pulls`), open a PR, check the "Files changed" tab, then merge. ### Branch naming: * `split/...` — breaking a large file into smaller ones * `fix/...` — bug/mistake fix * `update/...` — content/documentation update * `feat/...` — new feature/tooling * `docs/...` — documentation only ### IMPORTANT — verify before merging There have been a few cases where a PR got merged but the result turned out to be a stale version, not the latest pushed commit. Before clicking "Merge pull request" on GitHub: ```bash theme={"theme":"catppuccin-mocha"} git diff main..<your-branch> --stat ``` Read the output. If a file shows a lot of unexpected `-` (deletions), check the actual diff content (`git diff main..<branch> -- <file>`) before continuing -- it might be overwriting something important. After merging, **always** verify locally again: ```bash theme={"theme":"catppuccin-mocha"} git checkout main git pull origin main cat <changed-file> ``` Then delete the branch: ```bash theme={"theme":"catppuccin-mocha"} git branch -D <branch-name> ``` *** ## 3. PR Template (.github/PULL\_REQUEST\_TEMPLATE.md) Automatically shows up every time you open a new PR on GitHub. Contains a checklist: PROGRES.md updated, tested on Termux/playground, etc. No need to touch it manually -- GitHub displays it automatically. *** ## 4. Pre-commit hook (.githooks/pre-commit) Active automatically in this repo (already set via `git config core.hooksPath .githooks`). Runs on every `git commit`. **What it does:** if a staged `progres/PROGRES-*.md` file has a new `##` header **without** a date (`YYYY-MM-DD`), the commit is **rejected**. This guarantees no more dateless progress entries. If your commit gets rejected by this hook, the error message will tell you which file and which entry title is the problem. The fix: use `scripts/log-progress.sh` (see section 1), don't edit manually. *** ## 5. Commit message template (.gitmessage) If you commit **without** `-m` (just `git commit` alone), an editor opens showing the commit format template: ``` # [category] Short title (max 50 char) # # category: status | bug | decision | gotcha | infra | docs # # More detail (optional), why this change was made. ``` Lines starting with `#` are comments, automatically ignored by git. Just write the actual message below them. If you commit with `-m "message"` directly, this template isn't used (that's fine, it's optional). *** ## 6. CODEOWNERS (.github/CODEOWNERS) Determines who's automatically a reviewer when a PR comes in. Current setting: all collaborators (`@Alitindrawan24`, `@xcontcom`, `@svSeniorEngineer`) are default reviewers for all files. If you want to split by area later (e.g. person A owns `apps/web/`, person B owns `packages/detectors/`), just edit that file and add a line: ``` apps/web/ @username packages/detectors/ @username ``` *** ## 7. .editorconfig Standardizes code style across editors (indentation, line endings, etc) so it's not inconsistent depending on which editor each collaborator uses. Most modern editors (VS Code, etc) read this file automatically, no manual setup needed. *** ## 8. CI (.github/workflows/ci.yml) Runs automatically on GitHub's servers for every PR to `main` -- doesn't run on your Termux. Checks 3 things: * `npm run typecheck` (`tsc --noEmit`) * `npm run lint` * `npm run test` If any of these fail, the PR will show a failing status on GitHub -- meaning something needs to be fixed before merging. *** ## 9. Daily workflow summary ```bash theme={"theme":"catppuccin-mocha"} # 1. Start new work git checkout main git pull origin main git checkout -b feat/feature-name # 2. Work, commit as needed git add . git commit -m "progress content" # 3. Log progress scripts/log-progress.sh status-infra "title" "progress detail" git add progres/ git commit -m "Log progress: title" # 4. Push and open PR git push origin feat/feature-name # open the link that appears, open a PR, check Files changed # 5. After merging on GitHub git checkout main git pull origin main git branch -D feat/feature-name ``` # Complete Tutorial Source: https://arclux-os.mintlify.app/tutorial End-to-end ARCLUX tutorial (verified against real repos) # ARCLUX Complete Tutorial **Learn ARCLUX end to end — from first install to daemon, detectors, rules, and CI gating.** Every command and output in this tutorial was verified against a real open-source repository (Flask, 83 modules). Where output is shown, it is the actual output ARCLUX produced, so you know what to expect before you run it. *** ## Part 1 — What ARCLUX is ARCLUX builds an accurate **structural model** of a codebase: ``` repository -> parser -> index -> graph -> impact -> detectors \-> rules (framework conventions) ``` It answers questions like: * Which files depend on which? (`graph`) * What breaks if I change file X? (`impact`) * Where are circular dependencies, dead code, orphan files? (`doctor`) * Does this repo follow framework conventions? (`verify`) * Did the architecture change between two commits? (`diff`) ARCLUX is a deterministic structural-truth engine: every fact it reports is traceable to a real import statement, export declaration, or resolved path. No AI, no guessing. Supported languages today: TypeScript, JavaScript, Python, Go, Java, PHP, Ruby, Rust, C++, C#, Bash, C, Dart, Elixir, Kotlin, Lua, Objective-C, OCaml, Scala, Solidity, Swift, Vue, Zig, Elm, ReScript (25 via web-tree-sitter, 2 via TypeScript Compiler API) plus manifest parsers for package.json, go.mod, Cargo.toml, Gemfile, composer.json, .csproj, Gradle/POM, requirements.txt. ## Part 2 — Install & setup Requirements: Node 20+, pnpm. ```bash theme={"theme":"catppuccin-mocha"} git clone https://github.com/GSF-001/ARCLUX.git cd ARCLUX pnpm install ``` Run the CLI with tsx (no build step needed): ```bash theme={"theme":"catppuccin-mocha"} npx tsx apps/cli/index.ts --help ``` Or add an alias so you don't type the prefix every time: ```bash theme={"theme":"catppuccin-mocha"} alias arclux="npx tsx $(pwd)/apps/cli/index.ts" ``` Verify it works: ```bash theme={"theme":"catppuccin-mocha"} arclux analyze . ``` ## Part 3 — Your first analysis Point ARCLUX at any repository on disk (it needs no network for local analysis): ```bash theme={"theme":"catppuccin-mocha"} arclux analyze ~/flask ``` Real output (analyzing Flask): ``` ● Repository: flask │ ● Frameworks: none detected │ ● Package manager: uv │ ◆ 83 modules indexed │ ● Scan: 83 files, 83 parsed, 0 skipped (no parser) │ ◆ 83 nodes, 118 edges in dependency graph │ ● Detectors: 184 issues — circular 43, unused 116, orphan 25, layer 0 │ ● Elapsed: 2.19s ``` Reading the output: * **modules indexed** — how many files made it into the model * **Scan: X parsed, Y skipped** — the population guard. If a repo has files in a language without a parser yet, they are *counted as skipped*, not silently dropped. `0 skipped` means the whole repo got into the graph. * **nodes / edges** — the size of the dependency graph * **Detectors** — a first-pass summary of what `doctor` will report in detail ## Part 4 — Working with the graph The dependency graph can be printed or saved as JSON: ```bash theme={"theme":"catppuccin-mocha"} arclux graph ~/flask arclux graph ~/flask -o graph.json ``` Real output: ``` ● 83 nodes, 118 edges │ │ [file] conf.py │ │ [file] make_celery.py │ │ [file] __init__.py │ │ [file] tasks.py │ │ [file] views.py ``` Graph variants available in `packages/graph/`: * `buildDependencyGraph` — module-level import graph (what `graph` prints) * `buildImportGraph` — same shape, import edges * `buildCallGraph` — which module's functions are actually *called*, edge weight = distinct call sites * `buildExportGraph` — export/re-export chains * `buildFolderGraph` — folder-level tree (used by the web dashboard) ## Part 5 — Impact analysis The killer feature: **what is affected if this file changes?** ```bash theme={"theme":"catppuccin-mocha"} arclux impact <file> [repoPath] ``` Real output for `src/flask/app.py`: ``` ● Direct consumers (6): │ │ src/flask/__init__.py │ │ src/flask/cli.py │ │ src/flask/ctx.py │ │ src/flask/globals.py │ │ src/flask/sessions.py ``` `impact` traces both directions — direct consumers (importers) and, on the web side, the full affected-files tree. Use it before any refactor: change the file, know exactly who breaks. ## Part 6 — Doctor: 20 detectors `doctor` runs the full detector suite and normalizes every finding to `checkId + severity + message`: ```bash theme={"theme":"catppuccin-mocha"} arclux doctor ~/flask ``` Real output (excerpt): ``` ▲ 43 circular dependencies found: │ │ examples/celery/src/task_app/__init__.py examples/celery/src/task_app/__init__.py │ │ examples/tutorial/flaskr/__init__.py examples/tutorial/flaskr/__init__.py │ │ src/flask/__init__.py src/flask/__init__.py │ │ src/flask/__init__.py src/flask/app.py src/flask/__init__.py │ │ src/flask/__init__.py src/flask/app.py src/flask/ctx.py src/flask/__init__.py ``` The 20 detectors (all crash-isolated — a detector that throws becomes an error finding, it never kills the run): | Severity | Detectors | | - | - | | error | circularDependency, unusedExports, orphanFiles, layerViolation, ambiguousSymbolResolution | | warning | largeModules, duplicateModules, indexFiles, deadCode, componentConvention, featureStructure, missingExports, repositoryPattern, routeConvention, storyConvention, testConvention, unusedFiles | | info | sharedModules, entryPoints | ## Part 7 — Verify: the CI gate `verify` runs detectors + framework rules and gives a single PASS/FAIL verdict — this is the command to gate CI on: ```bash theme={"theme":"catppuccin-mocha"} arclux verify ~/flask ``` Real output: ``` ● Detectors: 246 issue(s) across 10 checks │ ● Rules: 0 violation(s) (0 error, 0 warning) — frameworks checked: none detected │ ■ FAIL — 246 detector issue(s), 0 rule error(s) ``` The 14 framework rules (Next.js, NestJS, Express, Vite, Electron, React, Laravel) only fire when the corresponding framework is detected — a plain Python repo reports `frameworks checked: none detected` and only detectors matter. ## Part 8 — Diff: architectural change between refs ```bash theme={"theme":"catppuccin-mocha"} arclux diff <refA> <refB> [repoPath] ``` Shows the architectural impact of changes between two git refs — which modules gained/lost dependencies, which edges changed. Run it in code review or before merge to catch unintended architectural drift. ## Part 9 — Diagnose `diagnose` runs the wired diagnostic adapters (circularDependency, deadCode, ambiguousSymbolResolution) with **impact context and fix suggestions** — not just "what", but "who it affects": ```bash theme={"theme":"catppuccin-mocha"} arclux diagnose ~/flask ``` Real output (excerpt): ``` ▲ 387 diagnostic event(s) found: │ │ [error] examples/celery/src/task_app/__init__.py — Circular dependency: ... │ │ affects 1 file(s) ``` ## Part 10 — Config ```bash theme={"theme":"catppuccin-mocha"} arclux config ~/flask ``` Real output: ``` ● name: flask │ ● frameworks: none detected │ ● packageManager: uv │ ● rootPath: /root/flask ``` Shows the auto-detected repository metadata (framework + package manager detection). Config *file* support is not built yet — detection is automatic. ## Part 11 — The daemon (always-on analysis) The daemon watches a repo and re-analyzes on every change: ```bash theme={"theme":"catppuccin-mocha"} arclux daemon <path> # foreground arclux daemon <path> --detach # background process arclux daemon <path> --status # is it running? arclux daemon <path> --health # is the bridge actually responding? arclux daemon <path> --stop # stop it ``` Re-analysis is routed through a job scheduler (ported from the Linux kernel's workqueue pattern): change bursts **coalesce** (N saves = 1 re-analysis), analyses **never overlap**, and the local HTTP+SSE bridge lets any tool subscribe: * `GET /analysis` — current analysis * `GET /events` — SSE stream (`analysis`, `diagnostics` events) * `GET /diagnostics` — last diagnostics run A minimal VS Code extension (`apps/vscode-extension/`) connects to a running daemon: Problems-panel diagnostics + status-bar module count. ## Part 12 — Platform commands Commands that work on a *workspace* model (the kernel process/service/job registry): | Command | What it does | | - | - | | `ps` | List processes registered with the ARCLUX kernel | | `run <service>` | Start a named internal service (`web`, ...) | | `exec <cmd> [args...]` | Run a command through the sandboxed terminal layer (capability checks + session recording) | | `work <file> <newContentFile>` | Apply a file's new content via the Change Pipeline (ChangePlan PatchSet ChangeExecutor) | | `edit <file>` | Show a file's dependencies and consumers before you edit it | | `open <file>` | Resolve a file to its module in the repository model | | `logs` | View daemon or CLI logs | | `workspace <path>` | Open a workspace session and print its snapshot | | `system` | System state: workspaces + processes + services + jobs + health | | `language <file>` | Parse a single file and print its exports/imports/calls | | `security <path>` | Run the security-analysis pipeline (secrets, unsafe patterns, trust boundaries, attack surface) | ## Part 13 — The web dashboard ```bash theme={"theme":"catppuccin-mocha"} cd apps/web pnpm run dev ``` The dashboard analyzes a **remote repo URL** (clone analyze visualize), then renders: * Interactive dependency graph (SVG + d3-force physics layout) * Graph variants: import / call / folder views, expand-on-demand * Impact halo — hover a node, see who is affected * Search across the repo (fuzzy filename + export-name matching) * Detector findings and route/component resolution ## Part 14 — CI / team workflow Gate CI on the structural truth: ```bash theme={"theme":"catppuccin-mocha"} arclux verify . # FAIL block the PR arclux diff main..HEAD . # show what the PR changes architecturally ``` Team conventions: * Keep PRs scoped to one package or one concern * `main` is protected — everything goes through a PR * Run `arclux doctor` before opening a PR; fix at least the `error` severity findings ## Part 15 — Troubleshooting * **Ports shift / zombie node processes** — before debugging weird web responses, check `ps aux | grep node` and confirm the port you're hitting matches the `Local:` line of the dev server. * **Empty analysis on local dirs** — local-path analysis never caches by design (stale results mid-edit would be worse). Re-run if results feel stale. * **Files skipped, not parsed** — check the `Scan:` line. `skipped (no parser)` means the language isn't supported yet, not that ARCLUX broke. * **Termux/Android** — no `/tmp`; ARCLUX uses `~` for scratch space. The web app uses Webpack, not Turbopack. *** That's the whole tool. The shortest useful loop: `analyze` to look, `impact` before you change, `doctor` to find, `verify` to gate, `daemon` to stay current. # Instalasi & Penggunaan Source: https://arclux-os.mintlify.app/usage Cara install dan pakai ARCLUX # ARCLUX Quickstart Read this first. Full details live in TOOLING.md, scripts/README.md, and CONTRIBUTING.md — this is just the fast path. ## Standard workflow git checkout ARCLUX.main git pull origin ARCLUX.main git checkout -b type/short-description git add file git commit -m "message" git push origin type/short-description gh pr create --repo GSF-001/ARCLUX --title "title" --body "description" git diff ARCLUX.main..type/short-description --stat gh pr merge NUMBER --repo GSF-001/ARCLUX --merge --delete-branch git checkout ARCLUX.main git pull origin ARCLUX.main Branch types: feat, fix, docs, chore, test, split, update main is protected — direct push will be rejected, always go through a PR. ## Logging progress Never edit progres/PROGRES-\*.md by hand. Use the script: scripts/log-progress.sh category "short title" "what happened" Categories: status-core, status-detectors, status-web, status-infra, status-backlog, bugs, decisions, gotchas, collaborators A pre-commit hook rejects any new entry missing a date in its header — the script always formats this correctly, manual edits often don't. ## Before touching a file that looks empty npx tsx scripts/checkCollaboratorMarkers.ts Confirms whether the file is already claimed by a collaborator before you start writing in it. ## Three things people forget most 1. Log progress before moving to the next task, not at the end of the session. 2. Typecheck apps/web from inside apps/web, not repo root: cd apps/web && npx tsc --noEmit Running from root produces 100+ false "@/" alias errors — known, harmless, documented in gotchas.md. 3. /tmp does not exist on Termux. Put throwaway scripts inside the repo folder and delete them after use. ## Where things live TOOLING.md — full config/tooling reference scripts/README.md — what every script does CONTRIBUTING.md — project structure, how to add a detector or parser progres/collaborators.md — who owns what right now ## Usage arclux analyze \[path] arclux graph \[path] arclux graph \[path] -o out.json arclux impact \<file> \[path] arclux doctor \[path] arclux diff \<from> \<to> \[path] arclux diagnose \[path] arclux verify \[path] arclux security \[path] arclux search \<query> \[path] arclux script \<file.arclux> arclux config \[path] arclux shell arclux mcp Run `arclux --help` for the full, always-current command list. Web dashboard: cd apps/web pnpm run dev ### MCP for AI (self-triggering) ARCLUX exposes 30+ tools via Model Context Protocol. The server ships workflow instructions so AI agents use the right tool without being asked — `analyze` first, `file_info`/`impact` instead of manual reads, `detect`/`doctor` to verify. ```json theme={"theme":"catppuccin-mocha"} { "mcpServers": { "arclux": { "command": "npx", "args": ["arclux", "mcp"] } } } ``` See the pinned Discussion “Getting Started — install, CLI usage, MCP client config” and [`SKILL.md`](https://github.com/GSF-001/ARCLUX/blob/main/SKILL.md) for details. New detectors/rules/parsers automatically appear as tools — no manual MCP updates.