@anmezing/lce-cloud 1.3.6 → 1.4.0

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 +223 -184
  2. package/lce-cloud.cjs +200 -193
  3. package/package.json +23 -23
package/README.md CHANGED
@@ -1,186 +1,225 @@
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
- 4. An absolute `repo_path` supplied on an LCE tool call. This fallback registers and
54
- starts indexing that repository without restarting the MCP server.
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.
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
+ 4. An absolute `repo_path` supplied on an LCE tool call. This fallback registers and
54
+ starts indexing that repository without restarting the MCP server.
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.
80
+
81
+ ## Automatic Swift compiler synchronization
82
+
83
+ After source publication, the client automatically collects Swift semantic facts
84
+ on the development/build host and uploads them to the server. Ubuntu publishes
85
+ them through the existing index-publication-worker and Neo4j projector. No manual
86
+ snapshot export or transfer is needed for subsequent source updates.
87
+
88
+ The build host needs SourceKit-LSP and an existing repository-root `buildServer.json`,
89
+ `compile_commands.json`, or `Package.swift`. Apple SDK projects need the development
90
+ Mac with Xcode and a SourceKit-compatible build-server configuration for the selected
91
+ scheme. LCE reuses that configuration; it does not install Xcode, choose a scheme,
92
+ or run arbitrary project build commands. A project without build context remains
93
+ searchable through its source index and reports compiler status `unavailable`.
94
+ Linux-buildable Swift can use a Linux build host. Other languages keep their existing
95
+ server compiler backends. The computer issuing queries does not need to be a Mac.
96
+
97
+ `codebase_index_status` exposes independent `compiler_status` states: `collecting`,
98
+ `uploading`, `publishing`, `ready`, `unavailable`, `failed`, and `disabled`. `ready`
99
+ means the validated compiler snapshot was published; graph projection freshness and
100
+ per-file semantic coverage still apply. It does not certify a successful application
101
+ build or complete runtime dispatch coverage. Set `LCE_SWIFT_SYNC=off` to disable.
102
+
103
+ Collection is serialized per client process, with at most 32 waiting roots, a 15-minute
104
+ compiler deadline and a 30-minute collection/upload deadline. A snapshot is limited
105
+ to 5,000 Swift files, 20,000 manifest files, 64 MiB of verified source, and 128 MiB of
106
+ artifact data, uploaded in 256 KiB parts. Source/config changes cancel stale work.
107
+ State checks run at most once per minute. Three collection attempts per source/config
108
+ fingerprint persist across restart; correcting the source or build configuration
109
+ enables fresh attempts. The server permits three active uploads per tenant, 64
110
+ globally, and one Swift publication at a time with three bounded attempts. Expired
111
+ uploads are cleaned up, and accepted publications survive client disconnects.
112
+ Synchronization makes no embedding or reranking provider calls. Its MCP requests
113
+ remain subject to Relay's existing request quota: preparation uses one plan request
114
+ per Swift file, plus bounded upload parts and publication checks.
115
+
116
+ Deploy the matching LCE server and Relay versions before updating build-host clients.
117
+ The client synchronization tool is internal to this workflow and is not included in
118
+ the eight tools exposed by the npm client to the coding agent.
80
119
 
81
120
  ## 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 |
121
+
122
+ The npm client exposes eight tools to the coding agent. Six use the tenant-safe
123
+ server index or its synchronization state, while two run against the local Git checkout:
124
+
125
+ | Tool | Runs in | Function |
126
+ | --- | --- | --- |
127
+ | `codebase-retrieval` | LCE server + local npm client | Semantic retrieval, coarse ranking, and reranking, complemented by local Graphify/OKF evidence when present |
128
+ | `codebase_symbol_graph` | LCE server | Symbol definitions, references, call chains, dependencies, and shallow change impact |
129
+ | `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 |
130
+ | `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 |
131
+ | `codebase_enhance_prompt` | LCE server | Convert a natural-language task into a code-grounded implementation brief |
132
+ | `codebase_index_status` | LCE client + Relay | Report readiness, synchronization progress, and failure details for one or all project roots |
133
+ | `codebase_git_context` | Local npm client | Git status, diffs, history, blame, and branch context from the current checkout |
134
+ | `codebase_review_changes` | Local npm client | Build a review range, identify risks, and produce retrieval and test plans |
135
+
136
+ The relay's Streamable HTTP endpoint remains the transport used by this client and
137
+ by relay-to-LCE service calls. Directly configuring an IDE against that endpoint is
138
+ not the recommended user flow: it omits the npm client's local Git tools, file
139
+ watcher, automatic incremental synchronization, and branch-view tracking. The
140
+ console therefore generates the complete npx configuration only.
141
+
142
+ ## Graphify and OKF enhancement
143
+
144
+ No extra LCE request option is required. When `graphify-out/graph.json` or `.okf/`
145
+ exists in the current repository, `codebase-retrieval` automatically adds matching
146
+ local evidence after the server has completed semantic recall and reranking.
147
+
148
+ - Graphify contributes extracted relationships. A declared source range is included
149
+ only when it is inside the repository file and contains the referenced symbol. A
150
+ broad graph match may support a file already returned by LCE; introducing a new
151
+ Graphify file requires a match in `technical_terms`.
152
+ - OKF contributes curated concepts and repository-contained `repo://path#Lx-Ly` source references whose ranges are in bounds.
153
+ Deprecated, stale, malformed, out-of-repository, and invalid-line references are
154
+ excluded or conservatively downgraded.
155
+ - These artifacts remain local. They are not indexed, synchronized, or uploaded to
156
+ Relay. Missing artifacts leave the Relay response unchanged; malformed artifacts
157
+ cannot make a valid cloud retrieval fail.
158
+
159
+ Generate the Graphify artifact with Graphify itself. LCE only reads it:
160
+
161
+ ```bash
162
+ graphify extract . --code-only --no-cluster
163
+ graphify cluster-only . --no-viz --no-label
164
+ ```
165
+
166
+ The default artifact paths can be changed with `--graphify-root` and `--okf-root`.
167
+ Use `--local-knowledge off` to disable local fusion.
168
+
169
+ ## Recommended coding-agent rules
170
+
171
+ Adding an MCP server does not guarantee that an agent will use it. Add the following
172
+ to the project's `AGENTS.md`, `CLAUDE.md`, or `.cursor/rules` file:
173
+
174
+ ```markdown
175
+ ## LCE tool usage
176
+
177
+ - Prefer a global `@anmezing/lce-cloud` installation for faster and more reliable startup; the generated npx configuration remains functionally equivalent.
178
+ - (Server-provided) Use `codebase-retrieval` first to find, understand, or locate code with a natural-language request.
179
+ - (Server-provided) Use `codebase_symbol_graph` for definitions, references, call chains, dependencies, and shallow change impact.
180
+ - (Server-provided) Use `codebase_deep_graph` for bounded multi-hop impact, paths, cycles, SCC, and centrality; it reports freshness and budget truncation explicitly.
181
+ - (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.
182
+ - (Server-provided) Use `codebase_enhance_prompt` to turn a task into a code-grounded implementation brief.
183
+ - (Local npm client) Use `codebase_git_context` for Git status, diffs, history, blame, and branch context.
184
+ - (Local npm client) Use `codebase_review_changes` for change-review risks, retrieval plans, and test plans.
185
+ - Fall back to local text search only when LCE is unavailable or exact regex/literal matching is required.
186
+ ```
187
+
188
+ The `codebase_enhance_prompt` tool accepts a natural-language coding task and returns
189
+ a structured task grounded in the current branch index. The original request remains
190
+ authoritative, and file/line references are derived from retrieved chunks. An
191
+ administrator must configure and enable a prompt-enhancement model before this tool
192
+ can complete a request.
193
+
194
+ ### How to use prompt enhancement
195
+
196
+ Prompt enhancement is an explicit MCP tool call, not an automatic prompt interceptor.
197
+ Ask the coding agent to call it before implementation when you want the request refined:
198
+
199
+ > Call `codebase_enhance_prompt` first, show me the enhanced result, and then implement
200
+ > it while keeping my original requirements authoritative: fix authentication timeout
201
+ > handling and add regression tests. Known identifiers: `AuthService`, `sessionTTL`.
202
+
203
+ The agent should pass the complete request as `prompt`, put known symbols, file names,
204
+ or error codes in `technical_terms`, and normally leave `root_id` unset so the npm
205
+ client uses the current branch view. `output_language` accepts `auto`, `zh-CN`, or
206
+ `en`. The result contains the original request, goals, implementation requirements,
207
+ constraints, verified code references, verification steps, and open questions. It is
208
+ supplemental context, not permission to drop or rewrite the user's requirements.
209
+
210
+ The cloud administrator can configure prompt enhancement with an OpenAI-compatible
211
+ chat endpoint, Anthropic Messages, or Google Gemini. The console discovers models from
212
+ the selected provider and sends only the retrieved repository context required for the
213
+ enhancement request.
214
+
215
+ ## Options
216
+
217
+ | Flag | Description |
218
+ | --- | --- |
219
+ | `--key, -k` | API key (required) |
220
+ | `--cloud` | Relay URL override |
221
+ | `--repo` | Absolute Git repository path; repeatable for multi-root clients |
222
+ | `--local-knowledge` | Local Graphify/OKF fusion: `auto` (default) or `off` |
223
+ | `--graphify-root` | Repository-contained Graphify graph path (default: `graphify-out/graph.json`) |
224
+ | `--okf-root` | Repository-contained OKF bundle path (default: `.okf`) |
225
+ | `--version, -v` | Print client version |