@anmezing/lce-cloud 1.3.6 → 1.4.1

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.
Files changed (3) hide show
  1. package/README.md +231 -181
  2. package/lce-cloud.cjs +200 -193
  3. package/package.json +23 -23
package/README.md CHANGED
@@ -1,186 +1,236 @@
1
- # @anmezing/lce-cloud
2
-
3
- LCE Cloud Mode client. Runs as a local stdio MCP server inside your IDE, keeps your
4
- project index in sync with the LCE cloud, and augments cloud retrieval with optional
5
- repository-contained Graphify and OKF knowledge.
6
-
7
- ## Usage
8
-
9
- Add LCE to any editor, IDE, or coding agent that can launch a local stdio MCP server.
10
- Use the JSON or TOML shape required by that client.
11
-
12
- Generic JSON:
13
-
14
- ```json
15
- {
16
- "mcpServers": {
17
- "lce": {
18
- "command": "npx",
19
- "args": ["-y", "@anmezing/lce-cloud@latest", "--key", "lce_xxxxxxxx"]
20
- }
21
- }
22
- }
23
- ```
24
-
25
- Generic TOML:
26
-
27
- ```toml
28
- [mcp_servers.lce]
29
- command = "npx"
30
- args = ["-y", "@anmezing/lce-cloud@latest", "--key", "lce_xxxxxxxx"]
31
- ```
32
-
33
- Get your API key from the LCE console. For faster and more reliable startup, install
34
- the client globally and use `lce-cloud` as the MCP command:
35
-
36
- ```bash
37
- npm install -g @anmezing/lce-cloud@latest
38
- ```
39
-
40
- The generated `npx` configuration remains fully supported and runs the same client.
41
- Both launch modes provide file watching, automatic incremental indexing, and branch
42
- view tracking while the MCP process is running. Each client process is owned by its own
43
- MCP stdio pipe: EOF, pipe close, or pipe failure starts graceful shutdown immediately,
44
- including when an IDE is terminated abnormally. Cleanup is force-bounded to five seconds.
45
- The client deliberately does not infer ownership from parent PIDs because IDEs and package
46
- runners may use short-lived intermediate launcher processes.
47
-
48
- The client resolves project roots in this order:
49
-
50
- 1. Repeatable `--repo <absolute-git-repository>` arguments.
51
- 2. Standard workspace roots reported by the MCP client through `roots/list`.
52
- 3. A safety-validated process directory when it is itself a Git repository.
1
+ # @anmezing/lce-cloud
2
+
3
+ LCE Cloud Mode client. Runs as a local stdio MCP server inside your IDE, keeps your
4
+ project index in sync with the LCE cloud, and augments cloud retrieval with optional
5
+ repository-contained Graphify and OKF knowledge.
6
+
7
+ ## Usage
8
+
9
+ Add LCE to any editor, IDE, or coding agent that can launch a local stdio MCP server.
10
+ Use the JSON or TOML shape required by that client.
11
+
12
+ Generic JSON:
13
+
14
+ ```json
15
+ {
16
+ "mcpServers": {
17
+ "lce": {
18
+ "command": "npx",
19
+ "args": ["-y", "@anmezing/lce-cloud@latest", "--key", "lce_xxxxxxxx"]
20
+ }
21
+ }
22
+ }
23
+ ```
24
+
25
+ Generic TOML:
26
+
27
+ ```toml
28
+ [mcp_servers.lce]
29
+ command = "npx"
30
+ args = ["-y", "@anmezing/lce-cloud@latest", "--key", "lce_xxxxxxxx"]
31
+ ```
32
+
33
+ Get your API key from the LCE console. For faster and more reliable startup, install
34
+ the client globally and use `lce-cloud` as the MCP command:
35
+
36
+ ```bash
37
+ npm install -g @anmezing/lce-cloud@latest
38
+ ```
39
+
40
+ The generated `npx` configuration remains fully supported and runs the same client.
41
+ Both launch modes provide file watching, automatic incremental indexing, and branch
42
+ view tracking while the MCP process is running. Each client process is owned by its own
43
+ MCP stdio pipe: EOF, pipe close, or pipe failure starts graceful shutdown immediately,
44
+ including when an IDE is terminated abnormally. Cleanup is force-bounded to five seconds.
45
+ The client deliberately does not infer ownership from parent PIDs because IDEs and package
46
+ runners may use short-lived intermediate launcher processes.
47
+
48
+ The client resolves project roots in this order:
49
+
50
+ 1. Repeatable `--repo <absolute-git-repository>` arguments.
51
+ 2. Standard workspace roots reported by the MCP client through `roots/list`.
52
+ 3. A safety-validated process directory when it is itself a Git repository.
53
53
  4. An absolute `repo_path` supplied on an LCE tool call. This fallback registers and
54
54
  starts indexing that repository without restarting the MCP server.
55
55
 
56
- Some MCP hosts do not implement `roots/list` and start servers from the editor's
57
- installation directory. For those hosts, add the project root explicitly:
58
-
59
- ```json
60
- {
61
- "mcpServers": {
62
- "lce": {
63
- "command": "npx",
64
- "args": [
65
- "-y",
66
- "@anmezing/lce-cloud@latest",
67
- "--key",
68
- "lce_xxxxxxxx",
69
- "--repo",
70
- "D:\\code\\my-project"
71
- ]
72
- }
73
- }
74
- }
75
- ```
76
-
77
- Use the native absolute path for Windows, macOS, or Linux. LCE refuses relative
78
- paths, non-Git directories, home directories, and filesystem roots. `repo_path` is
79
- handled only by the local npm client and is never forwarded to Relay.
56
+ Each root indexes its own working tree. Scanning stops at nested repositories,
57
+ including linked worktrees and initialized submodules with a `.git` file. Register
58
+ those repositories separately with another `--repo` or workspace root to index them.
59
+ Ordinary monorepo package directories without their own `.git` remain included.
60
+
61
+ Cloud upload exclusions are mandatory: Git ignore negations cannot re-include
62
+ lockfiles such as `package-lock.json`, environment files, or generated/binary paths
63
+ rejected by Relay. The client and Relay share the versioned
64
+ `cloud-index-path-policy.json` contract. Local-only indexing retains its normal
65
+ configurable ignore rules.
66
+
67
+ Some MCP hosts do not implement `roots/list` and start servers from the editor's
68
+ installation directory. For those hosts, add the project root explicitly:
69
+
70
+ ```json
71
+ {
72
+ "mcpServers": {
73
+ "lce": {
74
+ "command": "npx",
75
+ "args": [
76
+ "-y",
77
+ "@anmezing/lce-cloud@latest",
78
+ "--key",
79
+ "lce_xxxxxxxx",
80
+ "--repo",
81
+ "D:\\code\\my-project"
82
+ ]
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
88
+ Use the native absolute path for Windows, macOS, or Linux. LCE refuses relative
89
+ paths, non-Git directories, home directories, and filesystem roots. `repo_path` is
90
+ handled only by the local npm client and is never forwarded to Relay.
91
+
92
+ ## Automatic Swift compiler synchronization
93
+
94
+ After source publication, the client automatically collects Swift semantic facts
95
+ on the development/build host and uploads them to the server. Ubuntu publishes
96
+ them through the existing index-publication-worker and Neo4j projector. No manual
97
+ snapshot export or transfer is needed for subsequent source updates.
98
+
99
+ The build host needs SourceKit-LSP and an existing repository-root `buildServer.json`,
100
+ `compile_commands.json`, or `Package.swift`. Apple SDK projects need the development
101
+ Mac with Xcode and a SourceKit-compatible build-server configuration for the selected
102
+ scheme. LCE reuses that configuration; it does not install Xcode, choose a scheme,
103
+ or run arbitrary project build commands. A project without build context remains
104
+ searchable through its source index and reports compiler status `unavailable`.
105
+ Linux-buildable Swift can use a Linux build host. Other languages keep their existing
106
+ server compiler backends. The computer issuing queries does not need to be a Mac.
107
+
108
+ `codebase_index_status` exposes independent `compiler_status` states: `collecting`,
109
+ `uploading`, `publishing`, `ready`, `unavailable`, `failed`, and `disabled`. `ready`
110
+ means the validated compiler snapshot was published; graph projection freshness and
111
+ per-file semantic coverage still apply. It does not certify a successful application
112
+ build or complete runtime dispatch coverage. Set `LCE_SWIFT_SYNC=off` to disable.
113
+
114
+ Collection is serialized per client process, with at most 32 waiting roots, a 15-minute
115
+ compiler deadline and a 30-minute collection/upload deadline. A snapshot is limited
116
+ to 5,000 Swift files, 20,000 manifest files, 64 MiB of verified source, and 128 MiB of
117
+ artifact data, uploaded in 256 KiB parts. Source/config changes cancel stale work.
118
+ State checks run at most once per minute. Three collection attempts per source/config
119
+ fingerprint persist across restart; correcting the source or build configuration
120
+ enables fresh attempts. The server permits three active uploads per tenant, 64
121
+ globally, and one Swift publication at a time with three bounded attempts. Expired
122
+ uploads are cleaned up, and accepted publications survive client disconnects.
123
+ Synchronization makes no embedding or reranking provider calls. Its MCP requests
124
+ remain subject to Relay's existing request quota: preparation uses one plan request
125
+ per Swift file, plus bounded upload parts and publication checks.
126
+
127
+ Deploy the matching LCE server and Relay versions before updating build-host clients.
128
+ The client synchronization tool is internal to this workflow and is not included in
129
+ the eight tools exposed by the npm client to the coding agent.
80
130
 
81
131
  ## Exposed tools
82
-
83
- The npm client exposes eight tools to the coding agent. Six use the tenant-safe
84
- server index or its synchronization state, while two run against the local Git checkout:
85
-
86
- | Tool | Runs in | Function |
87
- | --- | --- | --- |
88
- | `codebase-retrieval` | LCE server + local npm client | Semantic retrieval, coarse ranking, and reranking, complemented by local Graphify/OKF evidence when present |
89
- | `codebase_symbol_graph` | LCE server | Symbol definitions, references, call chains, dependencies, and shallow change impact |
90
- | `codebase_deep_graph` | LCE server | Bounded Neo4j deep traversal for multi-hop impact, paths, cycles, SCC, and centrality; global cross-repository analysis is reported explicitly unavailable until its asynchronous graph manifest exists |
91
- | `codebase_graph_algorithm` | LCE server | Submit or inspect generation-bound asynchronous SCC/centrality jobs; a separately deployed Neo4j GDS worker executes them only after a successful capability probe and fresh heartbeat |
92
- | `codebase_enhance_prompt` | LCE server | Convert a natural-language task into a code-grounded implementation brief |
93
- | `codebase_index_status` | LCE client + Relay | Report readiness, synchronization progress, and failure details for one or all project roots |
94
- | `codebase_git_context` | Local npm client | Git status, diffs, history, blame, and branch context from the current checkout |
95
- | `codebase_review_changes` | Local npm client | Build a review range, identify risks, and produce retrieval and test plans |
96
-
97
- The relay's Streamable HTTP endpoint remains the transport used by this client and
98
- by relay-to-LCE service calls. Directly configuring an IDE against that endpoint is
99
- not the recommended user flow: it omits the npm client's local Git tools, file
100
- watcher, automatic incremental synchronization, and branch-view tracking. The
101
- console therefore generates the complete npx configuration only.
102
-
103
- ## Graphify and OKF enhancement
104
-
105
- No extra LCE request option is required. When `graphify-out/graph.json` or `.okf/`
106
- exists in the current repository, `codebase-retrieval` automatically adds matching
107
- local evidence after the server has completed semantic recall and reranking.
108
-
109
- - Graphify contributes extracted relationships. A declared source range is included
110
- only when it is inside the repository file and contains the referenced symbol. A
111
- broad graph match may support a file already returned by LCE; introducing a new
112
- Graphify file requires a match in `technical_terms`.
113
- - OKF contributes curated concepts and repository-contained `repo://path#Lx-Ly` source references whose ranges are in bounds.
114
- Deprecated, stale, malformed, out-of-repository, and invalid-line references are
115
- excluded or conservatively downgraded.
116
- - These artifacts remain local. They are not indexed, synchronized, or uploaded to
117
- Relay. Missing artifacts leave the Relay response unchanged; malformed artifacts
118
- cannot make a valid cloud retrieval fail.
119
-
120
- Generate the Graphify artifact with Graphify itself. LCE only reads it:
121
-
122
- ```bash
123
- graphify extract . --code-only --no-cluster
124
- graphify cluster-only . --no-viz --no-label
125
- ```
126
-
127
- The default artifact paths can be changed with `--graphify-root` and `--okf-root`.
128
- Use `--local-knowledge off` to disable local fusion.
129
-
130
- ## Recommended coding-agent rules
131
-
132
- Adding an MCP server does not guarantee that an agent will use it. Add the following
133
- to the project's `AGENTS.md`, `CLAUDE.md`, or `.cursor/rules` file:
134
-
135
- ```markdown
136
- ## LCE tool usage
137
-
138
- - Prefer a global `@anmezing/lce-cloud` installation for faster and more reliable startup; the generated npx configuration remains functionally equivalent.
139
- - (Server-provided) Use `codebase-retrieval` first to find, understand, or locate code with a natural-language request.
140
- - (Server-provided) Use `codebase_symbol_graph` for definitions, references, call chains, dependencies, and shallow change impact.
141
- - (Server-provided) Use `codebase_deep_graph` for bounded multi-hop impact, paths, cycles, SCC, and centrality; it reports freshness and budget truncation explicitly.
142
- - (Server-provided) Use `codebase_graph_algorithm` to submit or inspect durable SCC/centrality jobs when an asynchronous graph result is required; wait for `state=completed` and do not treat `executor.available=false` or `control_plane_only` as a completed algorithm result.
143
- - (Server-provided) Use `codebase_enhance_prompt` to turn a task into a code-grounded implementation brief.
144
- - (Local npm client) Use `codebase_git_context` for Git status, diffs, history, blame, and branch context.
145
- - (Local npm client) Use `codebase_review_changes` for change-review risks, retrieval plans, and test plans.
146
- - Fall back to local text search only when LCE is unavailable or exact regex/literal matching is required.
147
- ```
148
-
149
- The `codebase_enhance_prompt` tool accepts a natural-language coding task and returns
150
- a structured task grounded in the current branch index. The original request remains
151
- authoritative, and file/line references are derived from retrieved chunks. An
152
- administrator must configure and enable a prompt-enhancement model before this tool
153
- can complete a request.
154
-
155
- ### How to use prompt enhancement
156
-
157
- Prompt enhancement is an explicit MCP tool call, not an automatic prompt interceptor.
158
- Ask the coding agent to call it before implementation when you want the request refined:
159
-
160
- > Call `codebase_enhance_prompt` first, show me the enhanced result, and then implement
161
- > it while keeping my original requirements authoritative: fix authentication timeout
162
- > handling and add regression tests. Known identifiers: `AuthService`, `sessionTTL`.
163
-
164
- The agent should pass the complete request as `prompt`, put known symbols, file names,
165
- or error codes in `technical_terms`, and normally leave `root_id` unset so the npm
166
- client uses the current branch view. `output_language` accepts `auto`, `zh-CN`, or
167
- `en`. The result contains the original request, goals, implementation requirements,
168
- constraints, verified code references, verification steps, and open questions. It is
169
- supplemental context, not permission to drop or rewrite the user's requirements.
170
-
171
- The cloud administrator can configure prompt enhancement with an OpenAI-compatible
172
- chat endpoint, Anthropic Messages, or Google Gemini. The console discovers models from
173
- the selected provider and sends only the retrieved repository context required for the
174
- enhancement request.
175
-
176
- ## Options
177
-
178
- | Flag | Description |
179
- | --- | --- |
180
- | `--key, -k` | API key (required) |
181
- | `--cloud` | Relay URL override |
182
- | `--repo` | Absolute Git repository path; repeatable for multi-root clients |
183
- | `--local-knowledge` | Local Graphify/OKF fusion: `auto` (default) or `off` |
184
- | `--graphify-root` | Repository-contained Graphify graph path (default: `graphify-out/graph.json`) |
185
- | `--okf-root` | Repository-contained OKF bundle path (default: `.okf`) |
186
- | `--version, -v` | Print client version |
132
+
133
+ The npm client exposes eight tools to the coding agent. Six use the tenant-safe
134
+ server index or its synchronization state, while two run against the local Git checkout:
135
+
136
+ | Tool | Runs in | Function |
137
+ | --- | --- | --- |
138
+ | `codebase-retrieval` | LCE server + local npm client | Semantic retrieval, coarse ranking, and reranking, complemented by local Graphify/OKF evidence when present |
139
+ | `codebase_symbol_graph` | LCE server | Symbol definitions, references, call chains, dependencies, and shallow change impact |
140
+ | `codebase_deep_graph` | LCE server | Bounded Neo4j deep traversal for multi-hop impact, paths, cycles, SCC, and centrality; global cross-repository analysis is reported explicitly unavailable until its asynchronous graph manifest exists |
141
+ | `codebase_graph_algorithm` | LCE server | Submit or inspect generation-bound asynchronous SCC/centrality jobs; a separately deployed Neo4j GDS worker executes them only after a successful capability probe and fresh heartbeat |
142
+ | `codebase_enhance_prompt` | LCE server | Convert a natural-language task into a code-grounded implementation brief |
143
+ | `codebase_index_status` | LCE client + Relay | Report readiness, synchronization progress, and failure details for one or all project roots |
144
+ | `codebase_git_context` | Local npm client | Git status, diffs, history, blame, and branch context from the current checkout |
145
+ | `codebase_review_changes` | Local npm client | Build a review range, identify risks, and produce retrieval and test plans |
146
+
147
+ The relay's Streamable HTTP endpoint remains the transport used by this client and
148
+ by relay-to-LCE service calls. Directly configuring an IDE against that endpoint is
149
+ not the recommended user flow: it omits the npm client's local Git tools, file
150
+ watcher, automatic incremental synchronization, and branch-view tracking. The
151
+ console therefore generates the complete npx configuration only.
152
+
153
+ ## Graphify and OKF enhancement
154
+
155
+ No extra LCE request option is required. When `graphify-out/graph.json` or `.okf/`
156
+ exists in the current repository, `codebase-retrieval` automatically adds matching
157
+ local evidence after the server has completed semantic recall and reranking.
158
+
159
+ - Graphify contributes extracted relationships. A declared source range is included
160
+ only when it is inside the repository file and contains the referenced symbol. A
161
+ broad graph match may support a file already returned by LCE; introducing a new
162
+ Graphify file requires a match in `technical_terms`.
163
+ - OKF contributes curated concepts and repository-contained `repo://path#Lx-Ly` source references whose ranges are in bounds.
164
+ Deprecated, stale, malformed, out-of-repository, and invalid-line references are
165
+ excluded or conservatively downgraded.
166
+ - These artifacts remain local. They are not indexed, synchronized, or uploaded to
167
+ Relay. Missing artifacts leave the Relay response unchanged; malformed artifacts
168
+ cannot make a valid cloud retrieval fail.
169
+
170
+ Generate the Graphify artifact with Graphify itself. LCE only reads it:
171
+
172
+ ```bash
173
+ graphify extract . --code-only --no-cluster
174
+ graphify cluster-only . --no-viz --no-label
175
+ ```
176
+
177
+ The default artifact paths can be changed with `--graphify-root` and `--okf-root`.
178
+ Use `--local-knowledge off` to disable local fusion.
179
+
180
+ ## Recommended coding-agent rules
181
+
182
+ Adding an MCP server does not guarantee that an agent will use it. Add the following
183
+ to the project's `AGENTS.md`, `CLAUDE.md`, or `.cursor/rules` file:
184
+
185
+ ```markdown
186
+ ## LCE tool usage
187
+
188
+ - Prefer a global `@anmezing/lce-cloud` installation for faster and more reliable startup; the generated npx configuration remains functionally equivalent.
189
+ - (Server-provided) Use `codebase-retrieval` first to find, understand, or locate code with a natural-language request.
190
+ - (Server-provided) Use `codebase_symbol_graph` for definitions, references, call chains, dependencies, and shallow change impact.
191
+ - (Server-provided) Use `codebase_deep_graph` for bounded multi-hop impact, paths, cycles, SCC, and centrality; it reports freshness and budget truncation explicitly.
192
+ - (Server-provided) Use `codebase_graph_algorithm` to submit or inspect durable SCC/centrality jobs when an asynchronous graph result is required; wait for `state=completed` and do not treat `executor.available=false` or `control_plane_only` as a completed algorithm result.
193
+ - (Server-provided) Use `codebase_enhance_prompt` to turn a task into a code-grounded implementation brief.
194
+ - (Local npm client) Use `codebase_git_context` for Git status, diffs, history, blame, and branch context.
195
+ - (Local npm client) Use `codebase_review_changes` for change-review risks, retrieval plans, and test plans.
196
+ - Fall back to local text search only when LCE is unavailable or exact regex/literal matching is required.
197
+ ```
198
+
199
+ The `codebase_enhance_prompt` tool accepts a natural-language coding task and returns
200
+ a structured task grounded in the current branch index. The original request remains
201
+ authoritative, and file/line references are derived from retrieved chunks. An
202
+ administrator must configure and enable a prompt-enhancement model before this tool
203
+ can complete a request.
204
+
205
+ ### How to use prompt enhancement
206
+
207
+ Prompt enhancement is an explicit MCP tool call, not an automatic prompt interceptor.
208
+ Ask the coding agent to call it before implementation when you want the request refined:
209
+
210
+ > Call `codebase_enhance_prompt` first, show me the enhanced result, and then implement
211
+ > it while keeping my original requirements authoritative: fix authentication timeout
212
+ > handling and add regression tests. Known identifiers: `AuthService`, `sessionTTL`.
213
+
214
+ The agent should pass the complete request as `prompt`, put known symbols, file names,
215
+ or error codes in `technical_terms`, and normally leave `root_id` unset so the npm
216
+ client uses the current branch view. `output_language` accepts `auto`, `zh-CN`, or
217
+ `en`. The result contains the original request, goals, implementation requirements,
218
+ constraints, verified code references, verification steps, and open questions. It is
219
+ supplemental context, not permission to drop or rewrite the user's requirements.
220
+
221
+ The cloud administrator can configure prompt enhancement with an OpenAI-compatible
222
+ chat endpoint, Anthropic Messages, or Google Gemini. The console discovers models from
223
+ the selected provider and sends only the retrieved repository context required for the
224
+ enhancement request.
225
+
226
+ ## Options
227
+
228
+ | Flag | Description |
229
+ | --- | --- |
230
+ | `--key, -k` | API key (required) |
231
+ | `--cloud` | Relay URL override |
232
+ | `--repo` | Absolute Git repository path; repeatable for multi-root clients |
233
+ | `--local-knowledge` | Local Graphify/OKF fusion: `auto` (default) or `off` |
234
+ | `--graphify-root` | Repository-contained Graphify graph path (default: `graphify-out/graph.json`) |
235
+ | `--okf-root` | Repository-contained OKF bundle path (default: `.okf`) |
236
+ | `--version, -v` | Print client version |