arceus-s 1.6.6 → 1.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +118 -332
- package/dist/_shared/integrations/understand-quickly.js +1 -1
- package/dist/cli/analyze.js +0 -10
- package/dist/core/embeddings/config.js +1 -3
- package/dist/core/lbug/lbug-config.js +19 -0
- package/dist/core/lbug/pool-adapter.js +24 -0
- package/package.json +1 -1
- package/scripts/build.js +1 -1
- package/scripts/install-duckdb-extension.mjs +1 -3
- package/web/assets/__vite-browser-external-ZHh0aOLt.js +1 -0
- package/web/assets/{agent-DaYmiVrk.js → agent-D08sq62e.js} +3 -3
- package/web/assets/architecture-7EHR7CIX-6QZW5X65-Cg69mitr.js +1 -0
- package/web/assets/{architectureDiagram-UL44E2DR-613o-OfM.js → architectureDiagram-UL44E2DR-D_Kwz4GF.js} +1 -1
- package/web/assets/{blockDiagram-7IZFK4PR-BBJRt4vF.js → blockDiagram-7IZFK4PR-Rftr7I3J.js} +1 -1
- package/web/assets/{c4Diagram-Y2BXMSZH-BhR2CErx.js → c4Diagram-Y2BXMSZH-Blfibz8B.js} +1 -1
- package/web/assets/{chunk-3SSMPTDK-DWfEAoKy.js → chunk-3SSMPTDK-Dzc7Yf3M.js} +1 -1
- package/web/assets/{chunk-6764PJDD-NOXEgi3n.js → chunk-6764PJDD-y1Zhu3dl.js} +1 -1
- package/web/assets/{chunk-AZZRMDJM-DVvcxwI7.js → chunk-AZZRMDJM-Ckc7sqLz.js} +1 -1
- package/web/assets/{chunk-JQRUD6KW-CQgkrimK.js → chunk-JQRUD6KW-OwYAjIDW.js} +1 -1
- package/web/assets/{chunk-KGYTTC2M-DxOdSoAJ.js → chunk-KGYTTC2M-icDjj_dF.js} +2 -2
- package/web/assets/{chunk-KRXBNO2N-BlnQTnxv.js → chunk-KRXBNO2N-DST_NbH2.js} +1 -1
- package/web/assets/{chunk-LCXTWHL2-Dhf_u-1F.js → chunk-LCXTWHL2-HAyCqcYc.js} +1 -1
- package/web/assets/{chunk-LII3EMHJ-Cb3HLCZX.js → chunk-LII3EMHJ-CK3snkrl.js} +1 -1
- package/web/assets/{chunk-RG4AUYOV-DLCfNede.js → chunk-RG4AUYOV-Fv4PUQgU.js} +1 -1
- package/web/assets/chunk-T5OCTHI4-nCSIBvb4.js +1 -0
- package/web/assets/{chunk-W44A43WB-ZyrAMwtT.js → chunk-W44A43WB-CXihcI9p.js} +1 -1
- package/web/assets/{chunk-ZXARS5L4-B0TJPmj5.js → chunk-ZXARS5L4-BxJ5q1D9.js} +1 -1
- package/web/assets/classDiagram-KGZ6W3CR-BukzWJD4.js +1 -0
- package/web/assets/classDiagram-v2-72OJOZXJ-BukzWJD4.js +1 -0
- package/web/assets/{cose-bilkent-UX7MHV2Q-BsPIaeag.js → cose-bilkent-UX7MHV2Q-DuYon5xW.js} +1 -1
- package/web/assets/{dagre-ND4H6XIP-CV4l9vOZ.js → dagre-ND4H6XIP-CmcxqIrI.js} +1 -1
- package/web/assets/{diagram-3NCE3AQN-9kSzEbS8.js → diagram-3NCE3AQN-C1qPDs8V.js} +1 -1
- package/web/assets/{diagram-GF46GFSD-qRvqbex6.js → diagram-GF46GFSD-BGcKhccJ.js} +1 -1
- package/web/assets/{diagram-HNR7UZ2L-Dj_ye4Ua.js → diagram-HNR7UZ2L-CmQInrek.js} +1 -1
- package/web/assets/{diagram-QXG6HAR7-COwBV6B0.js → diagram-QXG6HAR7-D0COCNQM.js} +1 -1
- package/web/assets/{diagram-WEQXMOUZ-C9xjn5dU.js → diagram-WEQXMOUZ-Dp4WM6wH.js} +1 -1
- package/web/assets/{erDiagram-L5TCEMPS-fRp0t1Yd.js → erDiagram-L5TCEMPS-Bvi8O3E7.js} +1 -1
- package/web/assets/eventmodeling-FCH6USID-MREXMVOE-1KjNRBui.js +1 -0
- package/web/assets/{flowDiagram-H6V6AXG4-Ccr8FDLD.js → flowDiagram-H6V6AXG4-86waGA_9.js} +1 -1
- package/web/assets/{ganttDiagram-JCBTUEKG-DfBPqAGN.js → ganttDiagram-JCBTUEKG-CB2y4tlc.js} +1 -1
- package/web/assets/gitGraph-WXDBUCRP-R675I2BI-DpY0BgB0.js +1 -0
- package/web/assets/{gitGraphDiagram-S2ZK5IYY-CHvG_UQ0.js → gitGraphDiagram-S2ZK5IYY-CTB3Q2Jy.js} +1 -1
- package/web/assets/{index-CJJQgfSH.js → index-C_U4LtVd.js} +8 -8
- package/web/assets/index-ChWMOJVF.css +2 -0
- package/web/assets/info-J43DQDTF-KCYPFFUO-DpUIwTWQ.js +1 -0
- package/web/assets/{infoDiagram-3YFTVSEB-C7cMy-GP.js → infoDiagram-3YFTVSEB-L4P_fiuW.js} +1 -1
- package/web/assets/{ishikawaDiagram-BNXS4ZKH-C80yCPYi.js → ishikawaDiagram-BNXS4ZKH-CITb_lI_.js} +1 -1
- package/web/assets/{journeyDiagram-M6C3CM3L-BHxH1zjE.js → journeyDiagram-M6C3CM3L-C_GoTswH.js} +1 -1
- package/web/assets/{kanban-definition-75IXJCU3-DNZo1hOE.js → kanban-definition-75IXJCU3-DIO2rDwv.js} +1 -1
- package/web/assets/{katex-K3KEBU37-CbyuvTf1.js → katex-K3KEBU37-BGx8vmMI.js} +1 -1
- package/web/assets/{mindmap-definition-2TDM6QVE-Dpgl3Elt.js → mindmap-definition-2TDM6QVE-BwpfdZuv.js} +1 -1
- package/web/assets/packet-YPE3B663-LP52Z2RK-CS02eChX.js +1 -0
- package/web/assets/pie-LRSECV5Y-TCRJHUBD-MN8Lhnq1.js +1 -0
- package/web/assets/{pieDiagram-CU6KROY3-BW0mr0ek.js → pieDiagram-CU6KROY3-CJydlFN5.js} +1 -1
- package/web/assets/{quadrantDiagram-VICAPDV7-C1dCMBbk.js → quadrantDiagram-VICAPDV7-C_tHB163.js} +1 -1
- package/web/assets/radar-GUYGQ44K-RDLRG3WG-DlPHMJir.js +1 -0
- package/web/assets/{requirementDiagram-JXO7QTGE-Dyqqny4j.js → requirementDiagram-JXO7QTGE-4ugGQFD5.js} +1 -1
- package/web/assets/{sankeyDiagram-URQDO5SZ-B3FGr5SL.js → sankeyDiagram-URQDO5SZ-B22-qiwB.js} +1 -1
- package/web/assets/{sequenceDiagram-VS2MUI6T-B4LlGP9C.js → sequenceDiagram-VS2MUI6T-BxYAC7JW.js} +1 -1
- package/web/assets/{stateDiagram-7D4R322I-V9F-klBP.js → stateDiagram-7D4R322I-DtGlq52y.js} +1 -1
- package/web/assets/stateDiagram-v2-36443NZ5-DVW4TIqN.js +1 -0
- package/web/assets/{timeline-definition-O6YCAMPW-CX2WjkZA.js → timeline-definition-O6YCAMPW-BvLaVchF.js} +1 -1
- package/web/assets/treeView-BLDUP644-QA4HXRO3-BhurUJPT.js +1 -0
- package/web/assets/treemap-LRROVOQU-LLAWBHMP-CNYyLmQO.js +1 -0
- package/web/assets/{vennDiagram-MWXL3ELB-BxZPYqOF.js → vennDiagram-MWXL3ELB-DzWO4INt.js} +1 -1
- package/web/assets/wardley-L42UT6IY-5TKZOOLJ-DVYbFSZ8.js +1 -0
- package/web/assets/{wardleyDiagram-CUQ6CDDI-BLdJJYkV.js → wardleyDiagram-CUQ6CDDI-zMXmXc6p.js} +1 -1
- package/web/assets/{xychartDiagram-N2JHSOCM-DqDgigLa.js → xychartDiagram-N2JHSOCM-8TsH4zE8.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/__vite-browser-external-CLwMvL_q.js +0 -1
- package/web/assets/architecture-7EHR7CIX-6QZW5X65-aGTGQQQG.js +0 -1
- package/web/assets/chunk-T5OCTHI4-B0CGAG7q.js +0 -1
- package/web/assets/classDiagram-KGZ6W3CR-CvSnsfJD.js +0 -1
- package/web/assets/classDiagram-v2-72OJOZXJ-CvSnsfJD.js +0 -1
- package/web/assets/eventmodeling-FCH6USID-MREXMVOE-BR0Ygfrw.js +0 -1
- package/web/assets/gitGraph-WXDBUCRP-R675I2BI-CYihBz6Z.js +0 -1
- package/web/assets/index-B7cw1L6-.css +0 -2
- package/web/assets/info-J43DQDTF-KCYPFFUO-BmmoeX4D.js +0 -1
- package/web/assets/packet-YPE3B663-LP52Z2RK-7JAqDnUy.js +0 -1
- package/web/assets/pie-LRSECV5Y-TCRJHUBD-Bv9vE7io.js +0 -1
- package/web/assets/radar-GUYGQ44K-RDLRG3WG-dtZpcOZd.js +0 -1
- package/web/assets/stateDiagram-v2-36443NZ5-CKDYYzqR.js +0 -1
- package/web/assets/treeView-BLDUP644-QA4HXRO3-BQaKTdhr.js +0 -1
- package/web/assets/treemap-LRROVOQU-LLAWBHMP-Bqlxdyrq.js +0 -1
- package/web/assets/wardley-L42UT6IY-5TKZOOLJ-dofeprUr.js +0 -1
package/README.md
CHANGED
|
@@ -1,92 +1,67 @@
|
|
|
1
|
-
# Arceus
|
|
1
|
+
# Arceus Core CLI: `arceus-s`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Works with **Cursor**, **Claude Code**, **Codex**, **Windsurf**, **Cline**, **OpenCode**, and any MCP-compatible tool.
|
|
3
|
+
This is the core compiler-aware static analyzer and Model Context Protocol (MCP) server daemon for Arceus. It parses raw codebase trees into a queryable semantic graph database (built on LadybugDB) to empower AI engineering agents with high-fidelity system-level reasoning.
|
|
6
4
|
|
|
7
5
|
[](https://www.npmjs.com/package/arceus-s)
|
|
8
6
|
[](https://polyformproject.org/licenses/noncommercial/1.0.0/)
|
|
9
7
|
|
|
10
8
|
---
|
|
11
9
|
|
|
12
|
-
## Why?
|
|
10
|
+
## Why Use Arceus?
|
|
13
11
|
|
|
14
|
-
AI
|
|
12
|
+
Standard AI code generation assistants are constrained by linear text analysis. They write, edit, and refactor lines of code without a compiler's understanding of structural side effects and calling dependencies.
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
Arceus resolves imports, cross-file call targets, variable types, class interfaces, and modular clusters, representing the entire relational map inside an embedded local database. AI agents can then query this database, minimizing context pollution and preventing broken implementation chains.
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
---
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
## Installation & Command Ingestion
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
Because the command name `arc` is already registered by an unrelated project in the public registry, Arceus is distributed under the name **`arceus-s`**. Npm automatically routes global binary path calls to both `arc` and `arceus`.
|
|
23
21
|
|
|
24
22
|
```bash
|
|
25
|
-
#
|
|
23
|
+
# Global install from registry
|
|
26
24
|
npm install -g arceus-s
|
|
27
25
|
|
|
28
|
-
#
|
|
29
|
-
arc
|
|
30
|
-
# or: arceus analyze
|
|
26
|
+
# Verify CLI commands
|
|
27
|
+
arc --help
|
|
31
28
|
```
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
If you prefer to run it without a global installation:
|
|
36
|
-
|
|
30
|
+
### Ingesting Your First Repository
|
|
31
|
+
Run the indexer from your project's root folder:
|
|
37
32
|
```bash
|
|
38
|
-
#
|
|
33
|
+
# Run one-off without global install
|
|
39
34
|
npx arceus-s analyze
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
That's it. This indexes the codebase, installs agent skills, registers Claude Code hooks, and creates `AGENTS.md` / `CLAUDE.md` context files — all in one command.
|
|
43
35
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
### Editor Support
|
|
49
|
-
|
|
50
|
-
| Editor | MCP | Skills | Hooks (auto-augment) | Support |
|
|
51
|
-
|--------|-----|--------|---------------------|---------|
|
|
52
|
-
| **Claude Code** | Yes | Yes | Yes (PreToolUse) | **Full** |
|
|
53
|
-
| **Cursor** | Yes | Yes | Yes (postToolUse, [manual install](../arceus-cursor-integration/README.md#hook-install)) | **Full** |
|
|
54
|
-
| **Codex** | Yes | Yes | — | MCP + Skills |
|
|
55
|
-
| **Windsurf** | Yes | — | — | MCP |
|
|
56
|
-
| **OpenCode** | Yes | Yes | — | MCP + Skills |
|
|
57
|
-
|
|
58
|
-
> **Claude Code** gets the deepest integration: MCP tools + agent skills + PreToolUse hooks that automatically enrich grep/glob/bash calls with knowledge graph context.
|
|
36
|
+
# Or run via global installer
|
|
37
|
+
arc analyze
|
|
38
|
+
```
|
|
39
|
+
This command maps the directory, persists the graph database inside `.arc/`, registers the repository in your global directory, and generates `AGENTS.md` and `CLAUDE.md` context files.
|
|
59
40
|
|
|
60
|
-
|
|
41
|
+
---
|
|
61
42
|
|
|
62
|
-
|
|
63
|
-
|-------|---------|--------|
|
|
64
|
-
| [pi](https://pi.dev) | `pi install npm:pi-arc` | [pi-arc](https://github.com/tintinweb/pi-arc) |
|
|
43
|
+
## Editor & MCP Server Integration
|
|
65
44
|
|
|
66
|
-
|
|
45
|
+
To automatically write the connection parameters for your active editors, run:
|
|
46
|
+
```bash
|
|
47
|
+
arc setup
|
|
48
|
+
```
|
|
67
49
|
|
|
68
|
-
|
|
50
|
+
### Manual Configuration Schemes
|
|
69
51
|
|
|
70
|
-
|
|
52
|
+
If your editor requires manual server setup:
|
|
71
53
|
|
|
54
|
+
#### 1. Claude Code
|
|
72
55
|
```bash
|
|
73
|
-
#
|
|
74
|
-
claude mcp add arceus -- npx -y arceus-s mcp
|
|
75
|
-
|
|
76
|
-
# Windows
|
|
56
|
+
# Windows systems
|
|
77
57
|
claude mcp add arceus -- cmd /c npx -y arceus-s mcp
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Codex (full support — MCP + skills)
|
|
81
58
|
|
|
82
|
-
|
|
83
|
-
|
|
59
|
+
# Unix / macOS systems
|
|
60
|
+
claude mcp add arceus -- npx -y arceus-s mcp
|
|
84
61
|
```
|
|
85
62
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
Add to `~/.cursor/mcp.json` (global — works for all projects):
|
|
89
|
-
|
|
63
|
+
#### 2. Cursor
|
|
64
|
+
Add this entry to your system's global config (`~/.cursor/mcp.json`):
|
|
90
65
|
```json
|
|
91
66
|
{
|
|
92
67
|
"mcpServers": {
|
|
@@ -98,10 +73,8 @@ Add to `~/.cursor/mcp.json` (global — works for all projects):
|
|
|
98
73
|
}
|
|
99
74
|
```
|
|
100
75
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
Add to `~/.config/opencode/config.json`:
|
|
104
|
-
|
|
76
|
+
#### 3. OpenCode
|
|
77
|
+
Append this config to `~/.config/opencode/config.json`:
|
|
105
78
|
```json
|
|
106
79
|
{
|
|
107
80
|
"mcp": {
|
|
@@ -113,144 +86,44 @@ Add to `~/.config/opencode/config.json`:
|
|
|
113
86
|
}
|
|
114
87
|
```
|
|
115
88
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
Arceus builds a complete knowledge graph of your codebase through a multi-phase indexing pipeline:
|
|
119
|
-
|
|
120
|
-
1. **Structure** — Walks the file tree and maps folder/file relationships
|
|
121
|
-
2. **Parsing** — Extracts functions, classes, methods, and interfaces using Tree-sitter ASTs
|
|
122
|
-
3. **Resolution** — Resolves imports and function calls across files with language-aware logic
|
|
123
|
-
- **Field & Property Type Resolution** — Tracks field types across classes and interfaces for deep chain resolution (e.g., `user.address.city.getName()`)
|
|
124
|
-
- **Return-Type-Aware Variable Binding** — Infers variable types from function return types, enabling accurate call-result binding
|
|
125
|
-
4. **Clustering** — Groups related symbols into functional communities
|
|
126
|
-
5. **Processes** — Traces execution flows from entry points through call chains
|
|
127
|
-
6. **Search** — Builds hybrid search indexes for fast retrieval
|
|
128
|
-
|
|
129
|
-
The result is a **LadybugDB graph database** stored locally in `.arc/` with full-text search and semantic embeddings.
|
|
130
|
-
|
|
131
|
-
## MCP Tools
|
|
132
|
-
|
|
133
|
-
Your AI agent gets these tools automatically:
|
|
134
|
-
|
|
135
|
-
| Tool | What It Does | `repo` Param |
|
|
136
|
-
|------|-------------|--------------|
|
|
137
|
-
| `list_repos` | Discover all indexed repositories | — |
|
|
138
|
-
| `query` | Process-grouped hybrid search (BM25 + semantic + RRF) | Optional |
|
|
139
|
-
| `context` | 360-degree symbol view — categorized refs, process participation | Optional |
|
|
140
|
-
| `impact` | Blast radius analysis with depth grouping and confidence | Optional |
|
|
141
|
-
| `detect_changes` | Git-diff impact — maps changed lines to affected processes | Optional |
|
|
142
|
-
| `rename` | Multi-file coordinated rename with graph + text search | Optional |
|
|
143
|
-
| `cypher` | Raw Cypher graph queries | Optional |
|
|
144
|
-
|
|
145
|
-
> With one indexed repo, the `repo` param is optional. With multiple, specify which: `query({query: "auth", repo: "my-app"})`.
|
|
146
|
-
|
|
147
|
-
## MCP Resources
|
|
148
|
-
|
|
149
|
-
| Resource | Purpose |
|
|
150
|
-
|----------|---------|
|
|
151
|
-
| `arc://repos` | List all indexed repositories (read first) |
|
|
152
|
-
| `arc://repo/{name}/context` | Codebase stats, staleness check, and available tools |
|
|
153
|
-
| `arc://repo/{name}/clusters` | All functional clusters with cohesion scores |
|
|
154
|
-
| `arc://repo/{name}/cluster/{name}` | Cluster members and details |
|
|
155
|
-
| `arc://repo/{name}/processes` | All execution flows |
|
|
156
|
-
| `arc://repo/{name}/process/{name}` | Full process trace with steps |
|
|
157
|
-
| `arc://repo/{name}/schema` | Graph schema for Cypher queries |
|
|
158
|
-
|
|
159
|
-
## MCP Prompts
|
|
160
|
-
|
|
161
|
-
| Prompt | What It Does |
|
|
162
|
-
|--------|-------------|
|
|
163
|
-
| `detect_impact` | Pre-commit change analysis — scope, affected processes, risk level |
|
|
164
|
-
| `generate_map` | Architecture documentation from the knowledge graph with mermaid diagrams |
|
|
165
|
-
|
|
166
|
-
## CLI Commands
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
arc setup # Configure MCP for your editors (one-time)
|
|
170
|
-
arc analyze [path] # Index a repository (or update stale index)
|
|
171
|
-
arc analyze --force # Force full re-index
|
|
172
|
-
arc analyze --embeddings # Enable embedding generation (slower, better search)
|
|
173
|
-
arc analyze --skip-agents-md # Preserve custom AGENTS.md/CLAUDE.md arc section edits
|
|
174
|
-
arc analyze --verbose # Log skipped files when parsers are unavailable
|
|
175
|
-
arc analyze --max-file-size 1024 # Skip files larger than N KB (default: 512, cap: 32768)
|
|
176
|
-
arc analyze --worker-timeout 60 # Increase worker idle timeout for slow parses
|
|
177
|
-
arc mcp # Start MCP server (stdio) — serves all indexed repos
|
|
178
|
-
arc serve # Start local HTTP server (multi-repo) for web UI
|
|
179
|
-
arc index # Register an existing .arc/ folder into the global registry
|
|
180
|
-
arc list # List all indexed repositories
|
|
181
|
-
arc status # Show index status for current repo
|
|
182
|
-
arc clean # Delete index for current repo
|
|
183
|
-
arc clean --all --force # Delete all indexes
|
|
184
|
-
arc wiki [path] # Generate LLM-powered docs from knowledge graph
|
|
185
|
-
arc wiki --model <model> # Wiki with custom LLM model (default: gpt-4o-mini)
|
|
186
|
-
|
|
187
|
-
# Repository groups (multi-repo / monorepo service tracking)
|
|
188
|
-
arc group create <name> # Create a repository group
|
|
189
|
-
arc group add <group> <groupPath> <registryName> # Add a repo to a group. <groupPath> is a hierarchy path (e.g. hr/hiring/backend); <registryName> is the repo's name from the registry (see `arc list`)
|
|
190
|
-
arc group remove <group> <groupPath> # Remove a repo from a group by its hierarchy path
|
|
191
|
-
arc group list [name] # List groups, or show one group's config
|
|
192
|
-
arc group sync <name> # Extract contracts and match across repos/services
|
|
193
|
-
arc group contracts <name> # Inspect extracted contracts and cross-links
|
|
194
|
-
arc group query <name> <q> # Search execution flows across all repos in a group
|
|
195
|
-
arc group status <name> # Check staleness of repos in a group
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
## Remote Embeddings
|
|
89
|
+
---
|
|
199
90
|
|
|
200
|
-
|
|
91
|
+
## CLI Command Interface
|
|
201
92
|
|
|
202
93
|
```bash
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
arc analyze
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
| PHP | ✓ | ✓ | ✓ | — | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
233
|
-
| Ruby | ✓ | — | ✓ | ✓ | — | ✓ | — | ✓ | ✓ |
|
|
234
|
-
| Swift | — | — | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
235
|
-
| C | — | — | ✓ | — | ✓ | ✓ | — | ✓ | ✓ |
|
|
236
|
-
| C++ | — | — | ✓ | ✓ | ✓ | ✓ | — | ✓ | ✓ |
|
|
237
|
-
|
|
238
|
-
**Imports** — cross-file import resolution · **Named Bindings** — `import { X as Y }` / re-export tracking · **Exports** — public/exported symbol detection · **Heritage** — class inheritance, interfaces, mixins · **Type Annotations** — explicit type extraction for receiver resolution · **Constructor Inference** — infer receiver type from constructor calls (`self`/`this` resolution included for all languages) · **Config** — language toolchain config parsing (tsconfig, go.mod, etc.) · **Frameworks** — AST-based framework pattern detection · **Entry Points** — entry point scoring heuristics
|
|
239
|
-
|
|
240
|
-
## Agent Skills
|
|
241
|
-
|
|
242
|
-
Arceus ships with skill files that teach AI agents how to use the tools effectively:
|
|
243
|
-
|
|
244
|
-
- **Exploring** — Navigate unfamiliar code using the knowledge graph
|
|
245
|
-
- **Debugging** — Trace bugs through call chains
|
|
246
|
-
- **Impact Analysis** — Analyze blast radius before changes
|
|
247
|
-
- **Refactoring** — Plan safe refactors using dependency mapping
|
|
248
|
-
|
|
249
|
-
Installed automatically by both `arc analyze` (per-repo) and `arc setup` (global).
|
|
94
|
+
arc setup # Writes MCP configurations for active editors
|
|
95
|
+
arc analyze [path] # Parses source code and updates repository index
|
|
96
|
+
arc analyze --force # Discards graph caches and runs a full re-index
|
|
97
|
+
arc analyze --skills # Generates specialized AI agent guidelines
|
|
98
|
+
arc analyze --skip-embeddings # Fast parse mode; skips calculating vector embeddings
|
|
99
|
+
arc analyze --skip-git # Indexes folder even if not initialized as a git repo
|
|
100
|
+
arc analyze --embeddings # Generates full semantic vector embeddings (slower)
|
|
101
|
+
arc analyze --verbose # Outputs file skips and parser debug logs
|
|
102
|
+
arc analyze --worker-timeout N# Sets custom parse timeout in seconds
|
|
103
|
+
arc mcp # Runs the Model Context Protocol daemon (stdio)
|
|
104
|
+
arc serve # Launches HTTP server for browser Web UI connection
|
|
105
|
+
arc list # Prints all registered repositories on this machine
|
|
106
|
+
arc status # Shows index health, size, and statistics
|
|
107
|
+
arc clean # Deletes database files for the current project
|
|
108
|
+
arc clean --all --force # Wipes all repository graphs from disk
|
|
109
|
+
arc wiki [path] # Formulates a markdown wiki from the codebase graph
|
|
110
|
+
arc wiki --model <name> # Custom LLM model target (defaults: gpt-4o-mini)
|
|
111
|
+
arc wiki --base-url <url> # Custom LLM provider endpoint URL
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Multi-Service Sync & Monorepos
|
|
115
|
+
* `arc group create <name>`: Mappings a new microservice group structure.
|
|
116
|
+
* `arc group add <group> <path> <name>`: Registers a codebase in a sync group.
|
|
117
|
+
* `arc group remove <group> <path>`: Deletes a codebase from a sync group.
|
|
118
|
+
* `arc group list [name]`: Outputs active group schemas.
|
|
119
|
+
* `arc group sync <name>`: Resolves boundaries and maps contract exchanges.
|
|
120
|
+
* `arc group contracts <name>`: Reviews service endpoints and interface dependencies.
|
|
121
|
+
* `arc group query <name> <q>`: Executes search routines across all service libraries in a group.
|
|
122
|
+
* `arc group status <name>`: Reports health and stale statuses for grouped codebases.
|
|
250
123
|
|
|
251
124
|
---
|
|
252
125
|
|
|
253
|
-
##
|
|
126
|
+
## Token Efficiency & Graph RAG Performance
|
|
254
127
|
|
|
255
128
|
Arceus's semantic graph model drastically reduces token wastage and context pollution for downstream LLMs compared to traditional lexical exploration (e.g., recursive grep and file reading).
|
|
256
129
|
|
|
@@ -262,156 +135,69 @@ Arceus's semantic graph model drastically reduces token wastage and context poll
|
|
|
262
135
|
| **2. API Route Mapping** <br> Discover all registered endpoints and handler files. | **~20,162 tokens** <br>(Requires reading multiple route-registration files, middleware modules, and unit test suites). | **~65 tokens** <br>(Cypher execution: fetches all `Route` nodes containing route paths and source locations). | **310x Reduction** <br>(99.68% Saved) | **Interface Discovery**: Obtains complete routing topography without feeding entire source files to the LLM. |
|
|
263
136
|
| **3. Monorepo Class Indexing** <br> Index all classes and paths in the workspace. | **~87,500 tokens** <br>(Requires reading over 20 files containing class structures to capture inheritance and signatures). | **~1,250 tokens** <br>(Cypher execution: returns a complete node list of all `Class` names and file paths). | **70x Reduction** <br>(98.57% Saved) | **Architecture Mapping**: Instant monorepo-wide indexing with minimal network and computational overhead. |
|
|
264
137
|
|
|
265
|
-
### Architectural Advantages
|
|
266
|
-
|
|
267
|
-
1. **Deterministic Precision (Zero Noise)**: Lexical tools like grep require models to ingest noise (boilerplates, imports, formatting, unrelated logic) to resolve relationships. Arceus returns only the exact requested graph nodes and edges.
|
|
268
|
-
2. **Multi-Hop Traversal**: Tracing transitive chains (e.g., `Class A extends Class B implements Interface C`) normally requires iterative lexical searches. A single Cypher query (e.g., `MATCH (a:Class)-[:EXTENDS]->(b)-[:IMPLEMENTS]->(c) RETURN a, c`) evaluates this instantly on the graph.
|
|
269
|
-
3. **Optimized Concurrency**: Read-only graph locking ensures concurrent MCP context retrieval does not block editor processes, runtime tasks, or local file systems.
|
|
270
|
-
|
|
271
138
|
---
|
|
272
139
|
|
|
273
|
-
##
|
|
274
|
-
|
|
275
|
-
- Node.js >= 18
|
|
276
|
-
- Git repository (uses git for commit tracking)
|
|
277
|
-
|
|
278
|
-
## Release candidates
|
|
140
|
+
## Language Support Matrix
|
|
279
141
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
bigger cycle) and `N` increments per published rc. Example sequence:
|
|
297
|
-
`1.6.2-rc.1`, `1.6.2-rc.2`, …, then once `1.6.2` ships stable,
|
|
298
|
-
`1.6.3-rc.1`. See the [Releases page](https://github.com/Sirius6907/Arceus/releases)
|
|
299
|
-
for the full list; stable `latest` is unaffected.
|
|
300
|
-
|
|
301
|
-
## Troubleshooting
|
|
302
|
-
|
|
303
|
-
### `Cannot destructure property 'package' of 'node.target' as it is null`
|
|
304
|
-
|
|
305
|
-
This crash was caused by a dependency URL format that is incompatible with
|
|
306
|
-
certain npm/arborist versions ([npm/cli#8126](https://github.com/npm/cli/issues/8126)).
|
|
307
|
-
It is fixed in **arc v1.6.2+**. Upgrade to the latest version:
|
|
308
|
-
|
|
309
|
-
```bash
|
|
310
|
-
npx arceus-s analyze # always uses the newest release
|
|
311
|
-
# — or —
|
|
312
|
-
npm install -g arceus-s # upgrade a global install
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
If you still hit npm install issues after upgrading, these generic workarounds
|
|
316
|
-
may help:
|
|
317
|
-
|
|
318
|
-
```bash
|
|
319
|
-
npm install -g npm@latest # update npm itself
|
|
320
|
-
npm cache clean --force # clear a possibly corrupt cache
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### Installation fails with native module errors
|
|
324
|
-
|
|
325
|
-
Some optional language grammars (Dart, Kotlin, Swift) require native compilation. If they fail, Arceus still works — those languages will be skipped.
|
|
326
|
-
|
|
327
|
-
If `npm install -g arceus-s` fails on native modules:
|
|
328
|
-
|
|
329
|
-
```bash
|
|
330
|
-
# Ensure build tools are available (Linux/macOS)
|
|
331
|
-
# Ubuntu/Debian: sudo apt install python3 make g++
|
|
332
|
-
# macOS: xcode-select --install
|
|
333
|
-
|
|
334
|
-
# Retry installation
|
|
335
|
-
npm install -g arceus-s
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
### Analyze warns about unavailable FTS or VECTOR extensions
|
|
339
|
-
|
|
340
|
-
Arceus uses optional DuckDB extensions for BM25 and vector search. The `arc serve` and MCP read paths only ever try to `LOAD` the extensions — they never block on a network install. The `analyze` command, by default, attempts one bounded out-of-process `INSTALL` if `LOAD` fails and proceeds even when that install times out, so the index is always written to disk; BM25/vector search degrade gracefully until the extensions become available.
|
|
341
|
-
|
|
342
|
-
Configure the behavior with two environment variables:
|
|
343
|
-
|
|
344
|
-
| Variable | Values | Default | Effect |
|
|
345
|
-
|----------|--------|---------|--------|
|
|
346
|
-
| `ARC_LBUG_EXTENSION_INSTALL` | `auto`, `load-only`, `never` | `auto` | `auto` runs one bounded INSTALL if LOAD fails. `load-only` only uses already-installed extensions (recommended for offline / firewalled environments). `never` skips optional extensions entirely. |
|
|
347
|
-
| `ARC_LBUG_EXTENSION_INSTALL_TIMEOUT_MS` | positive integer | `15000` | Wall-clock budget for the out-of-process `INSTALL` child before it is killed. |
|
|
348
|
-
|
|
349
|
-
```bash
|
|
350
|
-
# Offline/airgapped: never reach the network for extensions
|
|
351
|
-
ARC_LBUG_EXTENSION_INSTALL=load-only npx arceus-s analyze
|
|
352
|
-
|
|
353
|
-
# Slow network: give extension downloads more time
|
|
354
|
-
ARC_LBUG_EXTENSION_INSTALL_TIMEOUT_MS=30000 npx arceus-s analyze
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
### Analysis runs out of memory
|
|
358
|
-
|
|
359
|
-
For very large repositories:
|
|
360
|
-
|
|
361
|
-
```bash
|
|
362
|
-
# Increase Node.js heap size
|
|
363
|
-
NODE_OPTIONS="--max-old-space-size=16384" npx arceus-s analyze
|
|
364
|
-
|
|
365
|
-
# Exclude large directories
|
|
366
|
-
echo "vendor/" >> .arcignore
|
|
367
|
-
echo "dist/" >> .arcignore
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
### Large files are being skipped
|
|
371
|
-
|
|
372
|
-
By default the walker skips files larger than **512 KB** (see log line `Skipped N large files (>512KB)`). Raise the threshold via either the CLI flag or the environment variable — both accept a value in **KB**:
|
|
373
|
-
|
|
374
|
-
```bash
|
|
375
|
-
# CLI flag (takes precedence over the env var)
|
|
376
|
-
npx arceus-s analyze --max-file-size 2048 # skip only files > 2 MB
|
|
377
|
-
|
|
378
|
-
# Environment variable (persists across commands)
|
|
379
|
-
export ARC_MAX_FILE_SIZE=2048
|
|
380
|
-
npx arceus-s analyze
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
Values above **32768 KB (32 MB)** are clamped to the tree-sitter parser ceiling; invalid values fall back to the 512 KB default with a one-time warning. When an override is active, `analyze` prints the effective threshold in its startup banner (e.g. `ARC_MAX_FILE_SIZE: effective threshold 2048KB (default 512KB)`).
|
|
384
|
-
|
|
385
|
-
### Analyze reports a worker timeout
|
|
142
|
+
| Language | Imports | Named Bindings | Exports | Heritage | Type Annotations | Constructor Inference | Config | Frameworks | Entry Points |
|
|
143
|
+
| :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
144
|
+
| **TypeScript** | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
145
|
+
| **JavaScript** | ✓ | ✓ | ✓ | ✓ | — | ✓ | ✓ | ✓ | ✓ |
|
|
146
|
+
| **Python** | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
147
|
+
| **Java** | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | — | ✓ | ✓ |
|
|
148
|
+
| **Kotlin** | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | — | ✓ | ✓ |
|
|
149
|
+
| **C#** | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
150
|
+
| **Go** | ✓ | — | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
151
|
+
| **Rust** | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | — | ✓ | ✓ |
|
|
152
|
+
| **PHP** | ✓ | ✓ | ✓ | — | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
153
|
+
| **Ruby** | ✓ | — | ✓ | ✓ | — | ✓ | — | ✓ | ✓ |
|
|
154
|
+
| **Swift** | — | — | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
155
|
+
| **C** | — | — | ✓ | — | ✓ | ✓ | — | ✓ | ✓ |
|
|
156
|
+
| **C++** | — | — | ✓ | ✓ | ✓ | ✓ | — | ✓ | ✓ |
|
|
157
|
+
| **Dart** | ✓ | — | ✓ | ✓ | ✓ | ✓ | — | ✓ | ✓ |
|
|
386
158
|
|
|
387
|
-
|
|
159
|
+
---
|
|
388
160
|
|
|
161
|
+
## Troubleshooting Guide
|
|
162
|
+
|
|
163
|
+
### 1. Arborist Conflict: `Cannot destructure property 'package'`
|
|
164
|
+
This error occurs in older npm environments due to unresolved symbolic references.
|
|
165
|
+
* **Remedy**: Update your CLI package to version `v1.6.2+`:
|
|
166
|
+
```bash
|
|
167
|
+
npm install -g arceus-s@latest
|
|
168
|
+
npm cache clean --force
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### 2. Grammar Compilation Failures
|
|
172
|
+
Advanced syntax structures (Dart, Kotlin, Swift) require local C++ compilers. If compilation fails, Arceus bypasses these optional parsers and functions normally for other languages.
|
|
173
|
+
* **Remedy (macOS/Linux)**: Install development essentials:
|
|
174
|
+
```bash
|
|
175
|
+
# Debian/Ubuntu
|
|
176
|
+
sudo apt install python3 make g++
|
|
177
|
+
# macOS
|
|
178
|
+
xcode-select --install
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### 3. DuckDB Vector Extension Load Warns
|
|
182
|
+
Arceus queries leverage local analytical extensions. During `analyze`, it attempts to auto-download them. If offline or in an air-gapped environment, you can set the install behavior:
|
|
183
|
+
|
|
184
|
+
| Environment Variable | Supported Options | Description |
|
|
185
|
+
| :--- | :--- | :--- |
|
|
186
|
+
| `ARC_LBUG_EXTENSION_INSTALL` | `auto`, `load-only`, `never` | `auto` downloads on demand. `load-only` prevents network queries. `never` disables vector extensions. |
|
|
187
|
+
| `ARC_LBUG_EXTENSION_INSTALL_TIMEOUT_MS` | Integer value | Download process budget in milliseconds (defaults to `15000`). |
|
|
188
|
+
|
|
189
|
+
### 4. Memory Heap Exceeded on Large Codebases
|
|
190
|
+
If the process runs out of memory, increase Node's heap size:
|
|
389
191
|
```bash
|
|
390
|
-
|
|
391
|
-
npx arceus-s analyze --worker-timeout 60
|
|
392
|
-
|
|
393
|
-
# Environment variable, in milliseconds
|
|
394
|
-
export ARC_WORKER_SUB_BATCH_TIMEOUT_MS=60000
|
|
395
|
-
npx arceus-s analyze
|
|
192
|
+
NODE_OPTIONS="--max-old-space-size=16384" arc analyze
|
|
396
193
|
```
|
|
397
194
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
## Privacy
|
|
401
|
-
|
|
402
|
-
- All processing happens locally on your machine
|
|
403
|
-
- No code is sent to any server
|
|
404
|
-
- Index stored in `.arc/` inside your repo (gitignored)
|
|
405
|
-
- Global registry at `~/.arc/` stores only paths and metadata
|
|
406
|
-
|
|
407
|
-
## Web UI
|
|
408
|
-
|
|
409
|
-
Arceus also has a browser-based UI at [arceus-arc.vercel.app](https://arceus-arc.vercel.app) — 100% client-side, your code never leaves the browser.
|
|
410
|
-
|
|
411
|
-
**Local Backend Mode:** Run `arc serve` and open the web UI locally — it auto-detects the server and shows all your indexed repos, with full AI chat support. No need to re-upload or re-index. The agent's tools (Cypher queries, search, code navigation) route through the backend HTTP API automatically.
|
|
195
|
+
---
|
|
412
196
|
|
|
413
197
|
## License
|
|
414
198
|
|
|
199
|
+
Copyright (c) 2026 Chandan Kumar Behera
|
|
200
|
+
|
|
415
201
|
[PolyForm Noncommercial 1.0.0](https://polyformproject.org/licenses/noncommercial/1.0.0/)
|
|
416
202
|
|
|
417
203
|
Free for non-commercial use. Contact for commercial licensing.
|
package/dist/cli/analyze.js
CHANGED
|
@@ -271,9 +271,7 @@ export const analyzeCommand = async (inputPath, options) => {
|
|
|
271
271
|
// overwrite the bar mid-render. We capture originals, swap to barLog for
|
|
272
272
|
// the lifetime of the run, and restore on completion/error/SIGINT.
|
|
273
273
|
const origLog = console.log.bind(console);
|
|
274
|
-
// eslint-disable-next-line no-console -- intentional console-routing for progress bar UX
|
|
275
274
|
const origWarn = console.warn.bind(console);
|
|
276
|
-
// eslint-disable-next-line no-console -- intentional console-routing for progress bar UX
|
|
277
275
|
const origError = console.error.bind(console);
|
|
278
276
|
let barCurrentValue = 0;
|
|
279
277
|
const barLog = (...args) => {
|
|
@@ -282,9 +280,7 @@ export const analyzeCommand = async (inputPath, options) => {
|
|
|
282
280
|
bar.update(barCurrentValue);
|
|
283
281
|
};
|
|
284
282
|
console.log = barLog;
|
|
285
|
-
// eslint-disable-next-line no-console -- intentional console-routing for progress bar UX
|
|
286
283
|
console.warn = barLog;
|
|
287
|
-
// eslint-disable-next-line no-console -- intentional console-routing for progress bar UX
|
|
288
284
|
console.error = barLog;
|
|
289
285
|
// Track elapsed time per phase
|
|
290
286
|
let lastPhaseLabel = 'Initializing...';
|
|
@@ -344,9 +340,7 @@ export const analyzeCommand = async (inputPath, options) => {
|
|
|
344
340
|
clearInterval(elapsedTimer);
|
|
345
341
|
process.removeListener('SIGINT', sigintHandler);
|
|
346
342
|
console.log = origLog;
|
|
347
|
-
// eslint-disable-next-line no-console -- restoring after intentional progress-bar routing
|
|
348
343
|
console.warn = origWarn;
|
|
349
|
-
// eslint-disable-next-line no-console -- restoring after intentional progress-bar routing
|
|
350
344
|
console.error = origError;
|
|
351
345
|
bar.stop();
|
|
352
346
|
console.log(' Already up to date\n');
|
|
@@ -404,9 +398,7 @@ export const analyzeCommand = async (inputPath, options) => {
|
|
|
404
398
|
clearInterval(elapsedTimer);
|
|
405
399
|
process.removeListener('SIGINT', sigintHandler);
|
|
406
400
|
console.log = origLog;
|
|
407
|
-
// eslint-disable-next-line no-console -- restoring after intentional progress-bar routing
|
|
408
401
|
console.warn = origWarn;
|
|
409
|
-
// eslint-disable-next-line no-console -- restoring after intentional progress-bar routing
|
|
410
402
|
console.error = origError;
|
|
411
403
|
bar.update(100, { phase: 'Done' });
|
|
412
404
|
bar.stop();
|
|
@@ -427,9 +419,7 @@ export const analyzeCommand = async (inputPath, options) => {
|
|
|
427
419
|
clearInterval(elapsedTimer);
|
|
428
420
|
process.removeListener('SIGINT', sigintHandler);
|
|
429
421
|
console.log = origLog;
|
|
430
|
-
// eslint-disable-next-line no-console -- restoring after intentional progress-bar routing
|
|
431
422
|
console.warn = origWarn;
|
|
432
|
-
// eslint-disable-next-line no-console -- restoring after intentional progress-bar routing
|
|
433
423
|
console.error = origError;
|
|
434
424
|
bar.stop();
|
|
435
425
|
const msg = err.message || String(err);
|
|
@@ -29,8 +29,6 @@ export const resolveEmbeddingConfig = (overrides = {}) => {
|
|
|
29
29
|
batchSize: parsePositiveInt('ARC_EMBEDDING_BATCH_SIZE', env.ARC_EMBEDDING_BATCH_SIZE, overrides.batchSize ?? DEFAULT_EMBEDDING_CONFIG.batchSize),
|
|
30
30
|
subBatchSize: parsePositiveInt('ARC_EMBEDDING_SUB_BATCH_SIZE', env.ARC_EMBEDDING_SUB_BATCH_SIZE, overrides.subBatchSize ?? DEFAULT_EMBEDDING_CONFIG.subBatchSize),
|
|
31
31
|
threads: parsePositiveInt('ARC_EMBEDDING_THREADS', env.ARC_EMBEDDING_THREADS, overrides.threads ?? defaultEmbeddingThreads()),
|
|
32
|
-
device: parseDevice(env.ARC_EMBEDDING_DEVICE) ??
|
|
33
|
-
overrides.device ??
|
|
34
|
-
DEFAULT_EMBEDDING_CONFIG.device,
|
|
32
|
+
device: parseDevice(env.ARC_EMBEDDING_DEVICE) ?? overrides.device ?? DEFAULT_EMBEDDING_CONFIG.device,
|
|
35
33
|
};
|
|
36
34
|
};
|
|
@@ -229,11 +229,30 @@ export async function openLbugConnection(lbugModule, databasePath, options = {})
|
|
|
229
229
|
let db;
|
|
230
230
|
try {
|
|
231
231
|
db = await openWithLockRetry(() => createLbugDatabase(lbugModule, databasePath, options), databasePath);
|
|
232
|
+
await db.init();
|
|
232
233
|
return { db, conn: new lbugModule.Connection(db) };
|
|
233
234
|
}
|
|
234
235
|
catch (err) {
|
|
235
236
|
if (db)
|
|
236
237
|
await db.close().catch(() => { });
|
|
238
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
239
|
+
if (msg.includes('replay shadow pages')) {
|
|
240
|
+
try {
|
|
241
|
+
// Open in read-write mode briefly to replay shadow pages and auto-checkpoint the WAL
|
|
242
|
+
const tempDb = await openWithLockRetry(() => createLbugDatabase(lbugModule, databasePath, { ...options, readOnly: false }), databasePath);
|
|
243
|
+
await tempDb.init();
|
|
244
|
+
await tempDb.close().catch(() => { });
|
|
245
|
+
// Re-try opening in read-only mode
|
|
246
|
+
db = await openWithLockRetry(() => createLbugDatabase(lbugModule, databasePath, options), databasePath);
|
|
247
|
+
await db.init();
|
|
248
|
+
return { db, conn: new lbugModule.Connection(db) };
|
|
249
|
+
}
|
|
250
|
+
catch (retryErr) {
|
|
251
|
+
if (db)
|
|
252
|
+
await db.close().catch(() => { });
|
|
253
|
+
throw retryErr;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
237
256
|
throw err;
|
|
238
257
|
}
|
|
239
258
|
}
|