@codua/codeoutline-win32-x64 0.1.5 → 0.1.8
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/DISTRIBUTION.md +60 -15
- package/README.md +7 -7
- package/README.zh-CN.md +7 -7
- package/bin/xnet.exe +0 -0
- package/build-info.json +1 -1
- package/codeoutline +3 -1
- package/codeoutline.cmd +5 -1
- package/package.json +1 -1
- package/scripts/codeoutline/command.lua +103 -7
- package/scripts/codeoutline/common.lua +10 -2
- package/scripts/codeoutline/daemon.lua +221 -0
- package/scripts/codeoutline/explore.lua +46 -42
- package/scripts/codeoutline/graph.lua +89 -54
- package/scripts/codeoutline/http.lua +5 -0
- package/scripts/codeoutline/index.lua +246 -66
- package/scripts/codeoutline/index_worker.lua +1 -0
- package/scripts/codeoutline/main.lua +71 -11
- package/scripts/codeoutline/service.lua +25 -4
- package/scripts/codeoutline/update_sequence.lua +1 -1
- package/scripts/codeoutline/update_worker.lua +17 -7
- package/scripts/codeoutline/updater.lua +7 -4
- package/scripts/codeoutline/version.lua +1 -1
- package/scripts/codeoutline/xscan.lua +41 -2
- package/scripts/xupgate/client.lua +77 -1
package/DISTRIBUTION.md
CHANGED
|
@@ -109,17 +109,28 @@ to acquire this updater. Updating does not change npm's recorded package version
|
|
|
109
109
|
```sh
|
|
110
110
|
codeoutline update --check
|
|
111
111
|
codeoutline update
|
|
112
|
-
codeoutline update --rollback
|
|
113
112
|
```
|
|
114
113
|
|
|
115
114
|
Every command starts the newest verified installed version without requesting the
|
|
116
|
-
network. `serve`
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
network. `serve` checks for updates in a background thread at startup and then
|
|
116
|
+
every hour while it runs, so an unreachable update server never delays startup or
|
|
117
|
+
requests; failed checks are reported on stderr. After installing an update, a
|
|
118
|
+
stdio service exits as soon as no request is in flight: MCP clients start it again
|
|
119
|
+
on the next request, now running the new version. The background service
|
|
120
|
+
(`codeoutline daemon`) likewise waits until idle, closes its port, starts the new
|
|
121
|
+
version detached from itself and exits, so exactly one service process remains.
|
|
122
|
+
A `serve --http` service keeps running and uses the update at its next start.
|
|
123
|
+
`CODEOUTLINE_EXIT_ON_UPDATE=1` or `0` overrides the stdio and `serve --http` defaults.
|
|
119
124
|
Set `CODEOUTLINE_AUTO_UPDATE=0` to disable automatic checks. Manual update still works.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
Only the active update is kept. After installing, the updater deletes other
|
|
126
|
+
installed versions and the runtime cache, except versions a running process
|
|
127
|
+
still uses: each process started from an installed update holds a lease for as
|
|
128
|
+
long as it runs. On Windows the process keeps its lease file open; elsewhere the
|
|
129
|
+
file records its PID. Versions before 0.1.7 hold no lease, so they are
|
|
130
|
+
deleted only 7 days after cleanup first finds them inactive. There is no local
|
|
131
|
+
rollback: to return to the npm (or native) installation, delete
|
|
132
|
+
`~/.codeoutline/updates` and set `CODEOUTLINE_AUTO_UPDATE=0` so `serve` does not
|
|
133
|
+
reinstall the latest release.
|
|
123
134
|
|
|
124
135
|
The default endpoint is `https://43.133.255.193:51215`, project `codeoutline`,
|
|
125
136
|
channel `stable`. Packages pin the signing public key and the server's TLS CA in
|
|
@@ -143,6 +154,32 @@ checks signatures, file hashes, platform, version, sequence and runtime health
|
|
|
143
154
|
before activating the directory. CI must produce each platform runtime; a Windows
|
|
144
155
|
package cannot update a Linux or macOS installation.
|
|
145
156
|
|
|
157
|
+
### Background service and login entry
|
|
158
|
+
|
|
159
|
+
A global npm installation runs `codeoutline install --npm` as its `postinstall`
|
|
160
|
+
script; local installs, `npx` and `--ignore-scripts` skip it, and it never fails the
|
|
161
|
+
installation. `install` registers a login entry for the installation it belongs to
|
|
162
|
+
(launchers pass it as `CODEOUTLINE_INITIAL`; installed updates are deleted when
|
|
163
|
+
unused, the initial installation is not), stops a running service and starts
|
|
164
|
+
`codeoutline daemon` detached. Each login entry runs the daemon once per login:
|
|
165
|
+
|
|
166
|
+
- Windows: `HKCU\Software\Microsoft\Windows\CurrentVersion\Run\CodeOutline`, run
|
|
167
|
+
under `conhost.exe --headless` so the console runtime shows no window.
|
|
168
|
+
- macOS: `~/Library/LaunchAgents/io.github.1dao.codeoutline.plist` with
|
|
169
|
+
`AbandonProcessGroup`, so launchd keeps the replacement the daemon starts.
|
|
170
|
+
- Linux: `~/.config/systemd/user/codeoutline.service` with `KillMode=process`.
|
|
171
|
+
Without a systemd user manager (WSL, containers) `install` reports that the
|
|
172
|
+
entry is missing; start `codeoutline daemon` at login another way.
|
|
173
|
+
|
|
174
|
+
The daemon starts the newest installed version (an installed update, or the
|
|
175
|
+
initial installation when an npm upgrade made it newer) and exits if a service
|
|
176
|
+
already answers on its port: Windows lets a second process bind a port the runtime
|
|
177
|
+
listens on. `codeoutline uninstall` removes the entry and asks the daemon to exit
|
|
178
|
+
by creating `~/.codeoutline/service-<port>.stop`, which it checks every second.
|
|
179
|
+
Services from 0.1.7 and earlier ignore that file; they exit after installing an
|
|
180
|
+
update. `CODEOUTLINE_AUTOSTART=0` skips the login entry; with `--npm` it also skips
|
|
181
|
+
starting the service.
|
|
182
|
+
|
|
146
183
|
### Make an all-platform script update with xnet
|
|
147
184
|
|
|
148
185
|
For automatic releases, commit the feature changes and the release tools first,
|
|
@@ -184,11 +221,20 @@ not require GitHub CLI or npm publishing authentication:
|
|
|
184
221
|
.\bin\xnet.exe tools/release.lua MODE=update LOG_STDERR=1 LOG_FILE=0
|
|
185
222
|
```
|
|
186
223
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
224
|
+
Every mode first runs the Lua specs (`codeoutline_spec` with the native and pure
|
|
225
|
+
Lua scanners, `stability_spec`, `update_spec`). Runtime and full modes then run
|
|
226
|
+
the Node SDK and package tests; update mode skips them unless `NODE_TESTS=1`,
|
|
227
|
+
because script bundles ship no npm launcher.
|
|
228
|
+
|
|
229
|
+
Update mode commits the release version locally, builds the signed script
|
|
230
|
+
bundles, installs this machine's bundle through the real updater (including its
|
|
231
|
+
health check) and runs `explore` on a sample project with it. Only then does it
|
|
232
|
+
tag, push, upload and publish. If any of these local steps fail, the release
|
|
233
|
+
commit and output directory are removed; nothing is pushed or uploaded, and the
|
|
234
|
+
same version can be retried. CI runs on the pushed tag, but the local tool does
|
|
235
|
+
not wait for it or publish its npm/GitHub artifacts. npm read access remains
|
|
236
|
+
necessary for duplicate-version checks. The initial npm launcher is only
|
|
237
|
+
upgraded by full npm publication, not an XUpgate script bundle.
|
|
192
238
|
|
|
193
239
|
For native runtime/executable updates without publishing npm, use `MODE=runtime`:
|
|
194
240
|
|
|
@@ -201,8 +247,7 @@ including the new executables. It requires GitHub CLI but does not publish npm o
|
|
|
201
247
|
create a GitHub Release. `MODE=full` retains the complete npm/GitHub/XUpgate workflow.
|
|
202
248
|
Both full bundles and script bundles install into immutable version directories;
|
|
203
249
|
active executables are never overwritten. `serve` installs in the background and
|
|
204
|
-
the next launch selects the verified scripts and matching executable.
|
|
205
|
-
switches the complete local version, including the reused or downloaded runtime.
|
|
250
|
+
the next launch selects the verified scripts and matching executable.
|
|
206
251
|
|
|
207
252
|
Script bundles use protocol updater version 2. Existing 0.1.4 initial bootstraps
|
|
208
253
|
only understand updater version 1 and safely reject script bundles. They need a
|
|
@@ -299,5 +344,5 @@ python tests/update-deployed.py --stage .update-test/final --credential-file C:/
|
|
|
299
344
|
```
|
|
300
345
|
|
|
301
346
|
The credential file contains `ADMIN_TOKEN=...`. The test creates a separate project,
|
|
302
|
-
exercises manual and automatic updates,
|
|
347
|
+
exercises manual and automatic updates, pruning and tamper rejection, and disables
|
|
303
348
|
the project on exit. It never publishes to the production CodeOutline channel.
|
package/README.md
CHANGED
|
@@ -19,11 +19,7 @@ codeoutline --version
|
|
|
19
19
|
|
|
20
20
|
A stdio server is a child process of its client, so every agent session (each Claude Code session, each Cursor window) starts its own copy and builds its own in-memory index. One HTTP service serves all sessions from a single process and a single index.
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
codeoutline serve --http
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
The service listens on `127.0.0.1:19876` and, without `--allow-root`, serves projects anywhere on the machine, so switching between projects on different drives needs no configuration. Only local processes can reach it, and they already have your file access. To restrict it anyway, repeat `--allow-root` for each directory tree to allow; a tree that is unavailable at startup, such as an unmounted drive, is reported and becomes usable once it appears.
|
|
22
|
+
A global npm installation starts that service in the background and registers it to start at login: a `Run` registry value on Windows, a LaunchAgent on macOS, and a systemd user unit on Linux; without a systemd user manager (WSL, containers), start `codeoutline daemon` at login yourself. The service installs updates and restarts itself into them, so after installation the only setup is registering its URL once.
|
|
27
23
|
|
|
28
24
|
**Claude Code** (added globally, available in every project):
|
|
29
25
|
|
|
@@ -37,7 +33,11 @@ claude mcp add --transport http codeoutline --scope user http://127.0.0.1:19876/
|
|
|
37
33
|
{ "mcpServers": { "codeoutline": { "url": "http://127.0.0.1:19876/mcp" } } }
|
|
38
34
|
```
|
|
39
35
|
|
|
40
|
-
|
|
36
|
+
`codeoutline install` does the same for a native installation, or after installing with `--ignore-scripts`; `--port` selects a port other than 19876. Set `CODEOUTLINE_AUTOSTART=0` when installing to skip the login entry. `codeoutline uninstall` stops the service and removes the entry; run it before `npm uninstall -g codeoutline`, which does not run package scripts. The service logs to `~/.codeoutline/logs`.
|
|
37
|
+
|
|
38
|
+
The service listens on `127.0.0.1:19876` and serves projects anywhere on the machine, so switching between projects on different drives needs no configuration. Only local processes can reach it, and they already have your file access. A shared service has no project of its own: it uses the client's roots when the client provides them, and otherwise the agent passes `projectPath`, which the tools ask for when it is missing.
|
|
39
|
+
|
|
40
|
+
To run an HTTP service yourself instead, for example restricted to some directories, start `codeoutline serve --http` and repeat `--allow-root` for each directory tree to allow; a tree that is unavailable at startup, such as an unmounted drive, is reported and becomes usable once it appears. Such a service installs updates but keeps running the old version until restarted; on Windows, supervise the native launcher rather than the npm one; see [DISTRIBUTION.md](docs/DISTRIBUTION.md).
|
|
41
41
|
|
|
42
42
|
### Alternative: stdio, one process per session
|
|
43
43
|
|
|
@@ -47,7 +47,7 @@ Use stdio when you do not want a resident service. Each session then starts and
|
|
|
47
47
|
claude mcp add codeoutline --scope user -- codeoutline serve --stdio
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
On Windows, Claude Code cannot start the `codeoutline.cmd` shim directly; use `-- cmd /c codeoutline serve --stdio`. For Cursor, set `"command": "codeoutline", "args": ["serve", "--stdio"]`.
|
|
50
|
+
On Windows, Claude Code cannot start the `codeoutline.cmd` shim directly; use `-- cmd /c codeoutline serve --stdio`. For Cursor, set `"command": "codeoutline", "args": ["serve", "--stdio"]`. A client that starts `codeoutline` with no arguments, as 0.1.7 recommended, gets the same stdio server.
|
|
51
51
|
|
|
52
52
|
When no project is specified, the service uses, in order: the `projectPath` argument of the call, the `--project` option, the client's roots (the first directory returned by `roots/list`), and the directory the service was started in. Clients usually start a stdio service in the project directory, so a global configuration needs no project path. Access defaults to `--project` or the start directory; repeat `--allow-root` to allow more.
|
|
53
53
|
|
package/README.zh-CN.md
CHANGED
|
@@ -19,11 +19,7 @@ codeoutline --version
|
|
|
19
19
|
|
|
20
20
|
stdio 服务是客户端的子进程,每个智能体会话(每个 Claude Code 会话、每个 Cursor 窗口)都会各自启动一份,并各自建一份内存索引。HTTP 服务只用一个进程、一份索引,供所有会话共用。
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
codeoutline serve --http
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
服务监听 `127.0.0.1:19876`。不传 `--allow-root` 时可访问本机任意位置的项目,在不同盘的项目之间切换无需额外配置;只有本机进程能连到它,而本机进程本来就有你的文件访问权限。仍想限制时,为每个允许的目录树重复一次 `--allow-root`;启动时不可用的目录(如未挂载的盘)只会给出提示,出现后即可使用。
|
|
22
|
+
通过 npm 全局安装时,会在后台启动这个服务,并登记为登录时自动启动:Windows 写入注册表 `Run` 项,macOS 添加 LaunchAgent,Linux 添加 systemd 用户单元;没有 systemd 用户管理器时(WSL、容器),请自行在登录时运行 `codeoutline daemon`。服务会自行安装更新并重启到新版本,因此安装后只需登记一次它的地址。
|
|
27
23
|
|
|
28
24
|
**Claude Code**(全局添加,在任意项目中可用):
|
|
29
25
|
|
|
@@ -37,7 +33,11 @@ claude mcp add --transport http codeoutline --scope user http://127.0.0.1:19876/
|
|
|
37
33
|
{ "mcpServers": { "codeoutline": { "url": "http://127.0.0.1:19876/mcp" } } }
|
|
38
34
|
```
|
|
39
35
|
|
|
40
|
-
|
|
36
|
+
原生安装或使用 `--ignore-scripts` 安装后,运行 `codeoutline install` 完成同样的操作;`--port` 可指定 19876 以外的端口。安装时设置 `CODEOUTLINE_AUTOSTART=0` 可不登记自启动。`codeoutline uninstall` 会停止服务并删除自启动项;`npm uninstall -g codeoutline` 不会运行包脚本,请先运行它。服务日志位于 `~/.codeoutline/logs`。
|
|
37
|
+
|
|
38
|
+
服务监听 `127.0.0.1:19876`,可访问本机任意位置的项目,在不同盘的项目之间切换无需额外配置;只有本机进程能连到它,而本机进程本来就有你的文件访问权限。共享服务没有自己的项目:客户端提供 roots 时使用 roots,否则由智能体传入 `projectPath`,缺少时工具会提示需要它。
|
|
39
|
+
|
|
40
|
+
如需自行运行 HTTP 服务(例如只允许访问部分目录),启动 `codeoutline serve --http`,并为每个允许的目录树重复一次 `--allow-root`;启动时不可用的目录(如未挂载的盘)只会给出提示,出现后即可使用。这样的服务会安装更新,但在重启前继续运行旧版本;Windows 上请托管原生启动器而不是 npm 启动器,原因见 [DISTRIBUTION.md](docs/DISTRIBUTION.md)。
|
|
41
41
|
|
|
42
42
|
### 备选:stdio,每个会话一个进程
|
|
43
43
|
|
|
@@ -47,7 +47,7 @@ claude mcp add --transport http codeoutline --scope user http://127.0.0.1:19876/
|
|
|
47
47
|
claude mcp add codeoutline --scope user -- codeoutline serve --stdio
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
Windows 上 Claude Code 无法直接启动 `codeoutline.cmd`,请改用 `-- cmd /c codeoutline serve --stdio`。Cursor 配置为 `"command": "codeoutline", "args": ["serve", "--stdio"]
|
|
50
|
+
Windows 上 Claude Code 无法直接启动 `codeoutline.cmd`,请改用 `-- cmd /c codeoutline serve --stdio`。Cursor 配置为 `"command": "codeoutline", "args": ["serve", "--stdio"]`。客户端不带参数启动 `codeoutline`(0.1.7 推荐的写法)时,得到的也是这个 stdio 服务。
|
|
51
51
|
|
|
52
52
|
未指定项目时,服务依次使用:调用参数 `projectPath`、启动参数 `--project`、客户端 roots(`roots/list` 返回的第一个目录)、服务启动目录。客户端通常在项目目录中启动 stdio 服务,因此全局配置无需写项目路径。访问范围默认为 `--project` 或启动目录,可用可重复的 `--allow-root` 扩大。
|
|
53
53
|
|
package/bin/xnet.exe
CHANGED
|
Binary file
|
package/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"sha256":{"scripts/codeoutline/lang/go.lua":"f5717cbeabe6d30dad72c473fa445480d7fb6b5546bb262e5f4c46185f0959da","scripts/codeoutline/text.lua":"75f9af87ff5ce62def74f69d8972a6b11ff660723fc5cf515369ee3012ff0675","scripts/codeoutline/explore.lua":"94f8d1e467a2220932cc2f6db8b90672111b05d42ba7cd2e30fb174da7b35e4a","licenses/rpmalloc.txt":"f6c10eb9ec349900767c3dcb8bc71fe4fba2aefea329f05e2608827188016c0f","scripts/codeoutline/lang/java.lua":"435b6ddcd231679db9e705a604344a3fb6c00b84cc20b2ecd210423ee0b376a6","scripts/codeoutline/updater.lua":"6cc97407d57f04f874155141021bc184de7fca56ce89c229adc403a454672c3f","scripts/codeoutline/graph.lua":"b2a99a18cfc5563f6bd4747b2c6fe280a32434e5722ad3cb1de32a01c0fc5a78","licenses/mbedtls.txt":"9b405ef4c89342f5eae1dd828882f931747f71001cfba7d114801039b52ad09b","README.md":"7dfce8ebe8fac01ae271a4e50264c6156be04ebe16869c6d2e2d4f1b6049a3a1","scripts/codeoutline/lang/js.lua":"7a25a195356deeef7da3fdaf6e8a483b2a3a230cae3064e5dde2a3556fdcbda9","scripts/xupgate/client.lua":"70207e88378ad11885284f251080b6325287661d6a1967fcc258644b380192bc","scripts/codeoutline/update_sequence.lua":"2007dc85060acefe127a1f06747f58f5f77d7410504ec177520f6e5dc4c70f55","scripts/codeoutline/http.lua":"3d957628ecc9592d57cc68a61e5d4229a71da501eb8fb3aa0bbb5e1cd772adf0","THIRD_PARTY.md":"a70238f26ec05b7be4b813fa49c337cfb4d3cd64c36fcd27401d121e0e6e38df","scripts/codeoutline/lang/lua.lua":"33b038192425e4db29251674e30c73b7a1af849789c49ff6430ee409c062f812","scripts/codeoutline/update_worker.lua":"7e2ec28e4b911d7b90fd97d0a4c0e2f5b295d1a9200c5c7250e47a99139ca550","scripts/codeoutline/index.lua":"92b55f73f41fecebdfe6bdb8cfba57288706d655fbdb359b5493d2732c176941","scripts/codeoutline/lang/python.lua":"f7219c04914673ee6bae387c222b09acd433596c746237bdd6650a4f4087b17c","scripts/codeoutline/version.lua":"f1a43bdca47fb7cd0d0211a5b6ef5c26abf18be48f321fc078d28941aaa4f93d","scripts/codeoutline/index_worker.lua":"46b83e51f0e3d49315e7b209f2daaf6345e2dcd43f5f275431058369d91937e3","scripts/xupgate/http_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/codeoutline/lang/rust.lua":"f7c21751b1ab08512a406f45bd53546dddfa98ff680b1374d29a4152ae110023","licenses/xnet2lua.txt":"1aa8af3df70f60f1ebf2d23e14c27af1606057ad9c32a9a0d15fd76cff257532","codeoutline.cmd":"607b60c6d107becdb6793df8f41aaf2cff944baf69f5ece59dba990d0f24c13b","scripts/codeoutline/cli.lua":"ba996c3c3def65aab08ba60141a7a98a19dfcc1bbe004ab5d8ea14a7f9f9a08b","scripts/codeoutline/main.lua":"91f928171c98a51a89b3276863164acf462bdc20a2cfed7befab4ff6a1aeac24","DISTRIBUTION.md":"da4a1048fc9b44670fd6fcef97e7d92ac3f50d3523da1773930c49f7e2c38dc3","README.zh-CN.md":"21677989f9e8a87910a5e56e528479066e7a5a4fbef2ce1928e3d598f6dea316","bin/xnet.exe":"8084b7773145ace6c6080e8331bdb9c5f4bc4c7dafc2b187ef91b58963fa5e74","licenses/luajit.txt":"1b10a02c9474cb908da2d87bc908edd8798f9ad28d9a8c53fbd05c13227f7394","scripts/xupgate/signature.lua":"f07de8a4093d08cc69d3c1d8296d23318c5d81344ece788d4453a9b3b700f000","scripts/codeoutline/mcp.lua":"f14a2d0b9625544ad32309358121a5ff304839780f52d5c1c8ec548d56c5e901","scripts/codeoutline/command.lua":"61629057894c21791bc2119769a79064453417005023a6b567d6119bfa8a0f3e","LICENSE":"1b63179362acd482b4a9a07ca526b3fce6d9103dcded361de2159ade174568b6","scripts/codeoutline/lang/c.lua":"1251352bcfac6b6d3704460e00b06cf4f41232144748b41b89db04a5ab594073","scripts/xupgate/proxy.lua":"5bf532e7005f44555d6a5277336e5ad395af060585c13a1cdc2441de50e0dcff","codeoutline":"3d3970e488e077e8acd67d174b506a361d43578b3360c7b29f2ec3f0103ba899","scripts/codeoutline/parse.lua":"ccda7a087dc90109fce7a1e64ebe1de0d7c7036990b81b3423ff14b4299bf38f","scripts/codeoutline/common.lua":"2fb29df01ccd5e7b54233d829cabdcb6d7c28d4f7a7b100292c6da0c9f63815a","keys/update-ca.crt":"d9b5ec3d4628de9c5559871f39841a5f84d47c53ded4d58d6e3bba2b4c669a02","lib/xhttp_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/codeoutline/lang/cpp.lua":"96aebcd8972d5272c11446257f37fe90c10f4130c3c1b5bb71c793d7c25456f4","keys/update-public.pem":"7ff853339e19631b20ed3fa2cf221daa31c581e2e84d161b344b8f06de6562a8","scripts/codeoutline/path.lua":"407bd960c1ad04e5006b321ce33263393bb40eee5dee5c123be9b36d3ad10937","scripts/codeoutline/control.lua":"1dfbea9f1397d9fb3c321c48a8d8ee7fc7928e864588226e55247bd548255bb4","licenses/libdeflate.txt":"41b60f2caab6bffdd5ba360687bd23ca653c0a1235c00380ecffc939b4cd8d75","scripts/xupgate/http_client.lua":"a189506c3d0fcc454f5e001fdeecdd6349a1019ea0970d11ce2fbfdf035166d6","scripts/codeoutline/lang/csharp.lua":"36ac648b8691c85b8c75d5bcb146fcdfc87992a278e4798f3eb194124e3df2bb","scripts/xupgate/common.lua":"86267648c0dbbd3a05f90de4d6e1dbee53ba57bf4801783c2ae636224b1f228c","scripts/codeoutline/service.lua":"186c6b22b5616cb0ff73bca0d5538df38aff790115a040f651ea483839188a6a","scripts/codeoutline/daemon.lua":"cd84983ee8db4da88bb4cf039e4f90eef617f413289d63d1b72d82a4edd94944","licenses/lua-cmsgpack.txt":"8edfdc5282278a1268d8a6ee52f9245f1a5fe3d1c8065be00330196b1de49873","scripts/codeoutline/xscan.lua":"bd95a1b0b7022d029a41aab615897502478b5834612505e8d299343cb5ca8ef9"},"releaseReady":true,"note":"Release build from a clean checkout","version":"0.1.8","updateSequence":8,"sourceDirty":false,"target":"win32-x64","runtimeCommit":"2d8803f860e88ec337cb85922a713b50bc55ee59","lua":"LuaJIT 2.1.1774896198","sourceCommit":"b23d4c3781ef0482097eff2f54ca4548bc3b36b8"}
|
package/codeoutline
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
set -eu
|
|
3
3
|
base=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
4
|
+
CODEOUTLINE_INITIAL=$base
|
|
5
|
+
export CODEOUTLINE_INITIAL
|
|
4
6
|
if [ -n "${CODEOUTLINE_LOG_DIR:-}" ]; then log_out="LOG_DIR=$CODEOUTLINE_LOG_DIR"; else log_out=LOG_FILE=0; fi
|
|
5
7
|
if [ "${1:-}" != "update" ]; then
|
|
6
8
|
if [ "${CODEOUTLINE_AUTO_UPDATE:-}" = "" ]; then
|
|
7
|
-
|
|
9
|
+
case "${1:-}" in serve|daemon|install) CODEOUTLINE_AUTO_UPDATE=1 ;; *) CODEOUTLINE_AUTO_UPDATE=0 ;; esac
|
|
8
10
|
export CODEOUTLINE_AUTO_UPDATE
|
|
9
11
|
fi
|
|
10
12
|
selected=$("$base/bin/xnet" "$base/scripts/codeoutline/updater.lua" LOG_STDERR=1 LOG_FILE=0 LOG_LEVEL=ERROR ACTION=select) || selected="$base"
|
package/codeoutline.cmd
CHANGED
|
@@ -4,9 +4,13 @@ if not defined CODEOUTLINE_LOG_LEVEL set "CODEOUTLINE_LOG_LEVEL=WARN"
|
|
|
4
4
|
set "CODEOUTLINE_LOG_OUT=LOG_FILE=0"
|
|
5
5
|
if defined CODEOUTLINE_LOG_DIR set "CODEOUTLINE_LOG_OUT=LOG_DIR=%CODEOUTLINE_LOG_DIR%"
|
|
6
6
|
set "CODEOUTLINE_BASE=%~dp0"
|
|
7
|
+
set "CODEOUTLINE_INITIAL=%~dp0"
|
|
7
8
|
if "%~1"=="update" goto run
|
|
8
9
|
if not defined CODEOUTLINE_AUTO_UPDATE (
|
|
9
|
-
|
|
10
|
+
set "CODEOUTLINE_AUTO_UPDATE=0"
|
|
11
|
+
if "%~1"=="serve" set "CODEOUTLINE_AUTO_UPDATE=1"
|
|
12
|
+
if "%~1"=="daemon" set "CODEOUTLINE_AUTO_UPDATE=1"
|
|
13
|
+
if "%~1"=="install" set "CODEOUTLINE_AUTO_UPDATE=1"
|
|
10
14
|
)
|
|
11
15
|
for /f "usebackq delims=" %%R in (`""%~dp0bin\xnet.exe" "%~dp0scripts\codeoutline\updater.lua" LOG_STDERR=1 LOG_FILE=0 LOG_LEVEL=ERROR ACTION=select"`) do set "CODEOUTLINE_BASE=%%R\"
|
|
12
16
|
:run
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"publishConfig":{"access":"public"},"description":"CodeOutline native runtime and Lua implementation for win32-x64","cpu":["x64","arm64"],"license":"BSD-2-Clause","
|
|
1
|
+
{"files":["bin/","lib/","keys/","scripts/","licenses/","LICENSE","codeoutline","codeoutline.cmd","build-info.json","*.md"],"publishConfig":{"access":"public"},"description":"CodeOutline native runtime and Lua implementation for win32-x64","os":["win32"],"cpu":["x64","arm64"],"license":"BSD-2-Clause","repository":{"type":"git","url":"git+https://github.com/1dao/codeoutline.git"},"name":"@codua/codeoutline-win32-x64","version":"0.1.8"}
|
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
-- Unified CLI. Launch through codeoutline (npm/native) or xnet with LOG_STDERR=1.
|
|
2
2
|
local source = assert(xutils.realpath(debug.getinfo(1, 'S').source:sub(2))):gsub('\\', '/')
|
|
3
3
|
local scripts = assert(source:match('^(.*)/codeoutline/[^/]+$'))
|
|
4
|
+
local install = assert(scripts:match('^(.*)/scripts$'))
|
|
4
5
|
package.path = scripts .. '/?.lua;' .. package.path
|
|
5
6
|
local version = require('codeoutline.version')
|
|
6
7
|
local help = [[CodeOutline - Lua code indexing and MCP
|
|
7
8
|
|
|
9
|
+
One shared background service serves every MCP client. A global npm install
|
|
10
|
+
starts it and registers it to start at login (codeoutline install does the same
|
|
11
|
+
for other installations); it keeps itself updated. Register its URL once:
|
|
12
|
+
claude mcp add --transport http codeoutline --scope user http://127.0.0.1:19876/mcp
|
|
13
|
+
|
|
8
14
|
Usage:
|
|
15
|
+
codeoutline install [--port PORT]
|
|
16
|
+
codeoutline uninstall [--port PORT]
|
|
17
|
+
codeoutline daemon [--port PORT]
|
|
9
18
|
codeoutline serve --stdio [--project PATH] [--allow-root PATH ...]
|
|
10
19
|
codeoutline serve --http [--host HOST] [--port PORT] [--project PATH] [--allow-root PATH ...]
|
|
11
20
|
codeoutline explore --project PATH --query QUERY [--budget BYTES]
|
|
12
21
|
codeoutline status [--project PATH]
|
|
13
22
|
codeoutline rebuild [--project PATH]
|
|
14
23
|
codeoutline doctor [--project PATH]
|
|
15
|
-
codeoutline update [--check
|
|
24
|
+
codeoutline update [--check] [--channel CHANNEL]
|
|
16
25
|
codeoutline --version
|
|
17
26
|
|
|
18
27
|
HTTP options: --allow-host HOST, --allow-origin ORIGIN (repeatable).
|
|
28
|
+
install starts the background service and registers it at login; uninstall
|
|
29
|
+
stops it and removes that entry. daemon is the service itself.
|
|
19
30
|
Remote HTTP requires CODEOUTLINE_TOKEN (at least 16 bytes).
|
|
20
31
|
Local HTTP without --allow-root serves any project; stdio and remote HTTP
|
|
21
32
|
default to --project or the working directory.
|
|
@@ -30,7 +41,14 @@ local function parse(args)
|
|
|
30
41
|
-- are read by xnet itself; the launchers add them before user args.
|
|
31
42
|
if not value:match('^LOG_[A-Z_]+=') then clean[#clean + 1] = value end
|
|
32
43
|
end
|
|
33
|
-
|
|
44
|
+
-- No command: an MCP client (redirected stdin) gets a stdio service, which
|
|
45
|
+
-- keeps registrations from 0.1.7 working; a terminal gets help. Windows
|
|
46
|
+
-- consoles are detected by the stdio service's first read.
|
|
47
|
+
local command = clean[1]
|
|
48
|
+
if not command then
|
|
49
|
+
local terminal = package.config:sub(1, 1) ~= '\\' and os.execute('test -t 0')
|
|
50
|
+
if terminal == true or terminal == 0 then command = '--help' else return 'serve', { stdio = true } end
|
|
51
|
+
end
|
|
34
52
|
if command == '--help' or command == '-h' or command == '--version' then
|
|
35
53
|
assert(#clean <= 1, 'unexpected arguments after ' .. command)
|
|
36
54
|
return command, {}
|
|
@@ -38,8 +56,9 @@ local function parse(args)
|
|
|
38
56
|
local allowed = {
|
|
39
57
|
serve = { stdio = true, http = true, project = true, host = true, port = true,
|
|
40
58
|
['allow-root'] = true, ['allow-host'] = true, ['allow-origin'] = true },
|
|
59
|
+
daemon = { port = true }, install = { port = true, npm = true }, uninstall = { port = true },
|
|
41
60
|
explore = { project = true, query = true, budget = true },
|
|
42
|
-
update = { check = true,
|
|
61
|
+
update = { check = true, channel = true },
|
|
43
62
|
status = { project = true }, rebuild = { project = true }, doctor = { project = true },
|
|
44
63
|
}
|
|
45
64
|
assert(allowed[command], 'unknown command: ' .. command)
|
|
@@ -48,7 +67,7 @@ local function parse(args)
|
|
|
48
67
|
local name, value = clean[i]:match('^%-%-([%w-]+)=(.*)$')
|
|
49
68
|
if not name then name = clean[i]:match('^%-%-([%w-]+)$') end
|
|
50
69
|
assert(name and (allowed[command][name] or name == 'help'), 'unknown option: ' .. clean[i])
|
|
51
|
-
local flag = name == 'check' or name == '
|
|
70
|
+
local flag = name == 'check' or name == 'stdio' or name == 'http' or name == 'help' or name == 'npm'
|
|
52
71
|
if flag then
|
|
53
72
|
assert(value == nil, '--' .. name .. ' does not take a value')
|
|
54
73
|
value = true
|
|
@@ -127,8 +146,72 @@ local function run()
|
|
|
127
146
|
if command == '--help' or command == '-h' or options.help then io.write(help); return 0 end
|
|
128
147
|
if command == '--version' then io.write(version, '\n'); return 0 end
|
|
129
148
|
if command == 'update' then
|
|
130
|
-
|
|
131
|
-
|
|
149
|
+
return require('codeoutline.updater').run(options.check and 'check' or 'update', options)
|
|
150
|
+
end
|
|
151
|
+
if command == 'daemon' or command == 'install' or command == 'uninstall' then
|
|
152
|
+
local daemon = require('codeoutline.daemon')
|
|
153
|
+
local port = tonumber(options.port or daemon.PORT)
|
|
154
|
+
assert(port and port % 1 == 0 and port >= 1 and port <= 65535, 'invalid --port')
|
|
155
|
+
if command == 'daemon' then
|
|
156
|
+
arg = { 'HTTP=1', 'DAEMON=1', 'PORT=' .. port }
|
|
157
|
+
return dofile(scripts .. '/codeoutline/main.lua')
|
|
158
|
+
end
|
|
159
|
+
-- npm runs install after every installation; only global ones start a
|
|
160
|
+
-- service, and nothing here may fail the installation.
|
|
161
|
+
local npm = options.npm
|
|
162
|
+
if npm and (os.getenv('npm_config_global') ~= 'true' or os.getenv('CODEOUTLINE_AUTOSTART') == '0') then return 0 end
|
|
163
|
+
local function say(text) io.write(text, '\n'); io.stdout:flush() end
|
|
164
|
+
local status = 0
|
|
165
|
+
local function attempt(fn, ...)
|
|
166
|
+
local ok, err = pcall(fn, ...)
|
|
167
|
+
if not ok then io.stderr:write('codeoutline: ', tostring(err), '\n'); status = npm and 0 or 1 end
|
|
168
|
+
return ok and err
|
|
169
|
+
end
|
|
170
|
+
-- Launchers name the installation they belong to; unlike an installed
|
|
171
|
+
-- update, it is never deleted, so the login entry points there.
|
|
172
|
+
local root = install
|
|
173
|
+
local initial = os.getenv('CODEOUTLINE_INITIAL')
|
|
174
|
+
if initial and initial ~= '' then
|
|
175
|
+
initial = initial:gsub('\\', '/'):gsub('/+$', '')
|
|
176
|
+
if xutils.stat(initial .. '/scripts/codeoutline/command.lua').exists then root = initial end
|
|
177
|
+
end
|
|
178
|
+
local function finish(code) xthread.stop(code) end
|
|
179
|
+
return {
|
|
180
|
+
__init = function()
|
|
181
|
+
assert(xnet.init()); xtimer.init(16)
|
|
182
|
+
if command == 'uninstall' then
|
|
183
|
+
for _, removed in ipairs(attempt(daemon.unregister) or {}) do say('removed login entry ' .. removed) end
|
|
184
|
+
daemon.stop(port, 10000, function(stopped)
|
|
185
|
+
say(stopped and 'service on port ' .. port .. ' stopped' or 'service on port ' .. port .. ' is still running')
|
|
186
|
+
finish(stopped and status or 1)
|
|
187
|
+
end)
|
|
188
|
+
return
|
|
189
|
+
end
|
|
190
|
+
if os.getenv('CODEOUTLINE_AUTOSTART') ~= '0' then
|
|
191
|
+
local entry = attempt(function()
|
|
192
|
+
-- Only launchers before 0.1.8 leave root inside an update.
|
|
193
|
+
assert(not root:match('/versions/%x+/files$'),
|
|
194
|
+
'cannot register an installed update; run npm install -g codeoutline, or install from the native launcher')
|
|
195
|
+
return daemon.register(root, port)
|
|
196
|
+
end)
|
|
197
|
+
if entry then say('registered login entry ' .. entry) end
|
|
198
|
+
end
|
|
199
|
+
-- Replace a running service so this installation takes effect now.
|
|
200
|
+
daemon.stop(port, 10000, function()
|
|
201
|
+
if not attempt(function() return assert(daemon.spawn(root, port), 'cannot start the service') end) then
|
|
202
|
+
finish(status); return
|
|
203
|
+
end
|
|
204
|
+
daemon.wait(port, 20000, function(listening)
|
|
205
|
+
if listening then say('service listening on http://127.0.0.1:' .. port .. '/mcp')
|
|
206
|
+
else io.stderr:write('codeoutline: the service did not start; see ', daemon.logs_dir(), '\n')
|
|
207
|
+
if not npm then status = 1 end end
|
|
208
|
+
finish(status)
|
|
209
|
+
end)
|
|
210
|
+
end)
|
|
211
|
+
end,
|
|
212
|
+
__uninit = function() xnet.uninit() end,
|
|
213
|
+
__thread_handle = function() end,
|
|
214
|
+
}
|
|
132
215
|
end
|
|
133
216
|
if command == 'serve' then
|
|
134
217
|
assert(not not options.stdio ~= not not options.http, 'serve requires exactly one of --stdio or --http')
|
|
@@ -158,9 +241,22 @@ local function run()
|
|
|
158
241
|
return 0
|
|
159
242
|
end
|
|
160
243
|
|
|
244
|
+
-- Lease the installed update this process runs from, so installing a newer
|
|
245
|
+
-- one does not delete files it may still load (language parsers load lazily).
|
|
246
|
+
local lease = require('xupgate.client').lease(install)
|
|
161
247
|
local ok, result = pcall(run)
|
|
162
248
|
if not ok then io.stderr:write('codeoutline: ', tostring(result), '\n'); result = 1 end
|
|
163
|
-
if type(result) == 'table' then
|
|
249
|
+
if type(result) == 'table' then
|
|
250
|
+
if lease then
|
|
251
|
+
local uninit = result.__uninit
|
|
252
|
+
result.__uninit = function(...)
|
|
253
|
+
lease.release()
|
|
254
|
+
if uninit then return uninit(...) end
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
return result
|
|
258
|
+
end
|
|
259
|
+
if lease then lease.release() end
|
|
164
260
|
io.stdout:flush()
|
|
165
261
|
-- One-shot commands exchange no thread messages; the empty handler keeps the
|
|
166
262
|
-- runtime from warning that none is set.
|
|
@@ -4,13 +4,17 @@
|
|
|
4
4
|
-- Result: {
|
|
5
5
|
-- path, language,
|
|
6
6
|
-- nodes = { {kind, name, qualified, line, end_line, sig?, parent?, static?, bases?} },
|
|
7
|
-
-- refs = { {from =
|
|
7
|
+
-- refs = { name = {...}, from = {...}, kind = {...}, line = {...}, recv = {...} },
|
|
8
8
|
-- imports = { {path, line, names?} },
|
|
9
9
|
-- }
|
|
10
10
|
-- Refs are attributed after parsing: a parser only records where each call
|
|
11
11
|
-- sits (token index) and assign_refs() hands it to the innermost node whose
|
|
12
12
|
-- token range contains it. That keeps nested functions/classes correct
|
|
13
13
|
-- without each parser tracking scope for every call site.
|
|
14
|
+
-- finish() then packs refs into parallel columns -- ref i is name[i],
|
|
15
|
+
-- from[i] (node index | 0 for file scope), kind[i], line[i], recv[i]
|
|
16
|
+
-- (false when absent) -- because a large tree holds hundreds of thousands of
|
|
17
|
+
-- refs and a table per ref costs several times the data it carries.
|
|
14
18
|
|
|
15
19
|
local M = {}
|
|
16
20
|
local text = require('codeoutline.text')
|
|
@@ -115,7 +119,11 @@ end
|
|
|
115
119
|
-- Drop parser-internal fields so the result is plain data.
|
|
116
120
|
function M.finish(r)
|
|
117
121
|
M.assign_refs(r)
|
|
118
|
-
|
|
122
|
+
local name, from, kind, line, recv = {}, {}, {}, {}, {}
|
|
123
|
+
for i, ref in ipairs(r.refs) do
|
|
124
|
+
name[i], from[i], kind[i], line[i], recv[i] = ref.name, ref.from, ref.kind, ref.line, ref.recv or false
|
|
125
|
+
end
|
|
126
|
+
r.refs = { name = name, from = from, kind = kind, line = line, recv = recv }
|
|
119
127
|
for _, n in ipairs(r.nodes) do n.ti, n.tj = nil, nil end
|
|
120
128
|
r.prefix, r.skip_calls = nil, nil
|
|
121
129
|
return r
|