@codua/codeoutline-win32-x64 0.1.1 → 0.1.3
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 +53 -0
- package/README.md +30 -7
- package/README.zh-CN.md +30 -7
- package/bin/xnet.exe +0 -0
- package/build-info.json +1 -1
- package/codeoutline +8 -0
- package/codeoutline.cmd +14 -7
- package/keys/update-ca.crt +20 -0
- package/keys/update-public.pem +9 -0
- package/package.json +1 -1
- package/scripts/codeoutline/command.lua +10 -2
- package/scripts/codeoutline/index_worker.lua +1 -5
- package/scripts/codeoutline/main.lua +21 -2
- package/scripts/codeoutline/mcp.lua +1 -3
- package/scripts/codeoutline/path.lua +10 -0
- package/scripts/codeoutline/updater.lua +72 -0
- package/scripts/codeoutline/version.lua +1 -1
- package/scripts/xupgate/client.lua +135 -0
- package/scripts/xupgate/common.lua +76 -0
- package/scripts/xupgate/http_client.lua +382 -0
- package/scripts/xupgate/http_codec.lua +835 -0
- package/scripts/xupgate/proxy.lua +359 -0
- package/scripts/xupgate/signature.lua +311 -0
package/DISTRIBUTION.md
CHANGED
|
@@ -97,3 +97,56 @@ workflow does not mean its remote runs have passed. Windows npm launchers forwar
|
|
|
97
97
|
console signals; forcefully killing the Node process alone cannot forward a
|
|
98
98
|
signal. For supervised HTTP services on Windows, use the native launcher or stop
|
|
99
99
|
the process tree. Closing MCP stdin causes the native stdio service to exit.
|
|
100
|
+
|
|
101
|
+
## Signed self-updates
|
|
102
|
+
|
|
103
|
+
Starting with 0.1.3, npm and native launchers can run signed versions stored in
|
|
104
|
+
`~/.codeoutline/updates` (the user profile on Windows). npm remains the initial
|
|
105
|
+
installation and recovery version. An older npm installation needs one npm upgrade
|
|
106
|
+
to acquire this updater. Updating does not change npm's recorded package version;
|
|
107
|
+
`codeoutline --version` reports the version actually running.
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
codeoutline update --check
|
|
111
|
+
codeoutline update
|
|
112
|
+
codeoutline update --rollback
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`serve` checks for updates before starting. A verified update applies to that new
|
|
116
|
+
process; existing services keep running. Failed checks retain the local version.
|
|
117
|
+
Other commands select a verified installed version without requesting the network.
|
|
118
|
+
Set `CODEOUTLINE_AUTO_UPDATE=0` to disable automatic checks. Manual update still works.
|
|
119
|
+
Rollback switches between the two installed versions; after the first update it
|
|
120
|
+
returns to the initial installation. Accepted sequence numbers are retained, so a
|
|
121
|
+
rolled-back release is not immediately reinstalled by automatic checks.
|
|
122
|
+
|
|
123
|
+
The default endpoint is `https://43.133.255.193:51215`, project `codeoutline`,
|
|
124
|
+
channel `stable`. Packages pin the signing public key and the server's TLS CA in
|
|
125
|
+
`keys/`. Private signing keys stay outside the repository and update server.
|
|
126
|
+
`CODEOUTLINE_UPDATE_URL`, `CODEOUTLINE_UPDATE_PROJECT`,
|
|
127
|
+
`CODEOUTLINE_UPDATE_CHANNEL`, `CODEOUTLINE_UPDATE_DIR`,
|
|
128
|
+
`CODEOUTLINE_UPDATE_PUBLIC_KEY`, `CODEOUTLINE_UPDATE_CA`, and
|
|
129
|
+
`CODEOUTLINE_UPDATE_TARGET` override these settings for testing or private deployments.
|
|
130
|
+
Treat these overrides and the initial installation as trusted configuration.
|
|
131
|
+
|
|
132
|
+
To publish, stage a fresh native package for each target with
|
|
133
|
+
`UPDATE_SEQUENCE=N`; N must increase for every release (the 0.1.3 baseline is 3).
|
|
134
|
+
Use XUpgate's `tools/release.py` with the same version and sequence,
|
|
135
|
+
`--entry scripts/codeoutline/command.lua`, and
|
|
136
|
+
`--runtime bin/xnet.exe` for Windows or `--runtime bin/xnet` otherwise.
|
|
137
|
+
Sign the native directory with the project's offline private key, upload the signed
|
|
138
|
+
artifact in XUpgate, then publish its version to the desired channel. The updater
|
|
139
|
+
checks signatures, file hashes, platform, version, sequence and runtime health
|
|
140
|
+
before activating the directory. CI must produce each platform runtime; a Windows
|
|
141
|
+
package cannot update a Linux or macOS installation.
|
|
142
|
+
|
|
143
|
+
The opt-in deployed integration test needs Python, OpenSSL, a staged Windows
|
|
144
|
+
package, and the sibling XUpgate release builder:
|
|
145
|
+
|
|
146
|
+
```powershell
|
|
147
|
+
python tests/update-deployed.py --stage .update-test/final --credential-file C:/private/xupgate-admin.env
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The credential file contains `ADMIN_TOKEN=...`. The test creates a separate project,
|
|
151
|
+
exercises manual and automatic updates, rollback and tamper rejection, and disables
|
|
152
|
+
the project on exit. It never publishes to the production CodeOutline channel.
|
package/README.md
CHANGED
|
@@ -8,25 +8,48 @@ CodeOutline answers symbol queries with line-numbered source, call paths, and ca
|
|
|
8
8
|
|
|
9
9
|
## Installation and setup
|
|
10
10
|
|
|
11
|
-
Requires Node.js 20 or newer. npm downloads the runtime for your platform automatically; no compiler or Lua installation is needed.
|
|
11
|
+
Requires Node.js 20 or newer. npm downloads the runtime for your platform automatically; no compiler or Lua installation is needed. Install it globally rather than configuring clients with `npx -y`: npx keeps a full npm process running beside every server it starts.
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
|
|
14
|
+
npm install -g codeoutline
|
|
15
|
+
codeoutline --version
|
|
15
16
|
```
|
|
16
17
|
|
|
18
|
+
### Recommended: one shared HTTP service
|
|
19
|
+
|
|
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
|
+
|
|
22
|
+
```sh
|
|
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.
|
|
27
|
+
|
|
17
28
|
**Claude Code** (added globally, available in every project):
|
|
18
29
|
|
|
19
30
|
```sh
|
|
20
|
-
claude mcp add codeoutline --scope user
|
|
31
|
+
claude mcp add --transport http codeoutline --scope user http://127.0.0.1:19876/mcp
|
|
21
32
|
```
|
|
22
33
|
|
|
23
34
|
**Cursor** (`~/.cursor/mcp.json`):
|
|
24
35
|
|
|
25
36
|
```json
|
|
26
|
-
{ "mcpServers": { "codeoutline": { "
|
|
37
|
+
{ "mcpServers": { "codeoutline": { "url": "http://127.0.0.1:19876/mcp" } } }
|
|
27
38
|
```
|
|
28
39
|
|
|
29
|
-
|
|
40
|
+
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. Clients do not start an HTTP service, so start it at login (Task Scheduler on Windows, launchd on macOS, a systemd user unit on Linux). On Windows, supervise the native launcher rather than the npm one; see [DISTRIBUTION.md](docs/DISTRIBUTION.md).
|
|
41
|
+
|
|
42
|
+
### Alternative: stdio, one process per session
|
|
43
|
+
|
|
44
|
+
Use stdio when you do not want a resident service. Each session then starts and stops its own server.
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
claude mcp add codeoutline --scope user -- codeoutline serve --stdio
|
|
48
|
+
```
|
|
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"]`.
|
|
51
|
+
|
|
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.
|
|
30
53
|
|
|
31
54
|
Three tools are provided:
|
|
32
55
|
|
|
@@ -56,7 +79,7 @@ C, C++, C#, Go, Java, JavaScript / TypeScript (including JSX/TSX), Lua, Python,
|
|
|
56
79
|
|
|
57
80
|
```sh
|
|
58
81
|
codeoutline serve --stdio [--project PATH] [--allow-root PATH ...]
|
|
59
|
-
codeoutline serve --http [--host HOST] [--port PORT] [--project PATH]
|
|
82
|
+
codeoutline serve --http [--host HOST] [--port PORT] [--project PATH] [--allow-root PATH ...]
|
|
60
83
|
codeoutline explore --project PATH --query QUERY [--budget BYTES]
|
|
61
84
|
codeoutline status [--project PATH]
|
|
62
85
|
codeoutline rebuild [--project PATH]
|
|
@@ -71,7 +94,7 @@ The runtime logs only warnings and errors, to stderr, and writes no log files, s
|
|
|
71
94
|
|
|
72
95
|
The protocol baseline is [MCP 2025-06-18](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports). Query budgets range from 256 to 262144 bytes (default 16000); truncated output stays valid UTF-8 and ends with a truncation notice. Paths always refer to the machine running the service.
|
|
73
96
|
|
|
74
|
-
In stdio mode, stdout carries only MCP messages and logs go to stderr. HTTP listens on the local machine by default; clients connect to `http://127.0.0.1:19876/mcp`. Remote listening requires a `CODEOUTLINE_TOKEN` of at least 16 bytes and hosts allowed explicitly with `--allow-host`; clients send `Authorization: Bearer ...`. Repeat `--allow-origin` to allow full browser origins; unlisted origins are rejected. Protect the token with a TLS reverse proxy for remote deployments.
|
|
97
|
+
In stdio mode, stdout carries only MCP messages and logs go to stderr. HTTP listens on the local machine by default; clients connect to `http://127.0.0.1:19876/mcp`. Remote listening requires a `CODEOUTLINE_TOKEN` of at least 16 bytes and hosts allowed explicitly with `--allow-host`; clients send `Authorization: Bearer ...`. Unlike local HTTP, a remote service without `--allow-root` is limited to `--project` or its start directory. Repeat `--allow-origin` to allow full browser origins; unlisted origins are rejected. Protect the token with a TLS reverse proxy for remote deployments.
|
|
75
98
|
|
|
76
99
|
The main thread handles the protocol while a resident index thread serves queries one at a time. Requests with a progress token receive progress every second (over SSE for HTTP); there is no standalone GET/SSE endpoint (it returns 405). Limits: 64 sessions, 64 queued or running jobs, a 120-second job deadline, and sessions expire after 15 idle minutes. Cancellation takes effect at per-file checkpoints, so a single file's parse cannot be interrupted (files are capped at 1.5 MB); after a cancellation the possibly incomplete in-memory index is discarded and the next query recovers from the cache.
|
|
77
100
|
|
package/README.zh-CN.md
CHANGED
|
@@ -8,25 +8,48 @@ Lightweight code indexing and exploration for coding agents, as an MCP server. P
|
|
|
8
8
|
|
|
9
9
|
## 安装与配置
|
|
10
10
|
|
|
11
|
-
需要 Node.js 20 或更新版本。npm 会按系统自动下载对应平台的运行时,无需编译器或 Lua
|
|
11
|
+
需要 Node.js 20 或更新版本。npm 会按系统自动下载对应平台的运行时,无需编译器或 Lua。请全局安装,不要在客户端配置里写 `npx -y`:npx 会在它启动的每个服务旁边常驻一个完整的 npm 进程。
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
|
|
14
|
+
npm install -g codeoutline
|
|
15
|
+
codeoutline --version
|
|
15
16
|
```
|
|
16
17
|
|
|
18
|
+
### 推荐:共享一个 HTTP 服务
|
|
19
|
+
|
|
20
|
+
stdio 服务是客户端的子进程,每个智能体会话(每个 Claude Code 会话、每个 Cursor 窗口)都会各自启动一份,并各自建一份内存索引。HTTP 服务只用一个进程、一份索引,供所有会话共用。
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
codeoutline serve --http
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
服务监听 `127.0.0.1:19876`。不传 `--allow-root` 时可访问本机任意位置的项目,在不同盘的项目之间切换无需额外配置;只有本机进程能连到它,而本机进程本来就有你的文件访问权限。仍想限制时,为每个允许的目录树重复一次 `--allow-root`;启动时不可用的目录(如未挂载的盘)只会给出提示,出现后即可使用。
|
|
27
|
+
|
|
17
28
|
**Claude Code**(全局添加,在任意项目中可用):
|
|
18
29
|
|
|
19
30
|
```sh
|
|
20
|
-
claude mcp add codeoutline --scope user
|
|
31
|
+
claude mcp add --transport http codeoutline --scope user http://127.0.0.1:19876/mcp
|
|
21
32
|
```
|
|
22
33
|
|
|
23
34
|
**Cursor**(`~/.cursor/mcp.json`):
|
|
24
35
|
|
|
25
36
|
```json
|
|
26
|
-
{ "mcpServers": { "codeoutline": { "
|
|
37
|
+
{ "mcpServers": { "codeoutline": { "url": "http://127.0.0.1:19876/mcp" } } }
|
|
27
38
|
```
|
|
28
39
|
|
|
29
|
-
|
|
40
|
+
共享服务没有自己的项目:客户端提供 roots 时使用 roots,否则由智能体传入 `projectPath`,缺少时工具会提示需要它。客户端不会启动 HTTP 服务,请让它随登录启动(Windows 用任务计划程序,macOS 用 launchd,Linux 用 systemd 用户单元)。Windows 上请托管原生启动器而不是 npm 启动器,原因见 [DISTRIBUTION.md](docs/DISTRIBUTION.md)。
|
|
41
|
+
|
|
42
|
+
### 备选:stdio,每个会话一个进程
|
|
43
|
+
|
|
44
|
+
不想常驻服务时使用 stdio,每个会话自行启动和关闭自己的服务进程。
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
claude mcp add codeoutline --scope user -- codeoutline serve --stdio
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Windows 上 Claude Code 无法直接启动 `codeoutline.cmd`,请改用 `-- cmd /c codeoutline serve --stdio`。Cursor 配置为 `"command": "codeoutline", "args": ["serve", "--stdio"]`。
|
|
51
|
+
|
|
52
|
+
未指定项目时,服务依次使用:调用参数 `projectPath`、启动参数 `--project`、客户端 roots(`roots/list` 返回的第一个目录)、服务启动目录。客户端通常在项目目录中启动 stdio 服务,因此全局配置无需写项目路径。访问范围默认为 `--project` 或启动目录,可用可重复的 `--allow-root` 扩大。
|
|
30
53
|
|
|
31
54
|
提供三个工具:
|
|
32
55
|
|
|
@@ -56,7 +79,7 @@ C、C++、C#、Go、Java、JavaScript / TypeScript(含 JSX/TSX)、Lua、Pyth
|
|
|
56
79
|
|
|
57
80
|
```sh
|
|
58
81
|
codeoutline serve --stdio [--project PATH] [--allow-root PATH ...]
|
|
59
|
-
codeoutline serve --http [--host HOST] [--port PORT] [--project PATH]
|
|
82
|
+
codeoutline serve --http [--host HOST] [--port PORT] [--project PATH] [--allow-root PATH ...]
|
|
60
83
|
codeoutline explore --project PATH --query QUERY [--budget BYTES]
|
|
61
84
|
codeoutline status [--project PATH]
|
|
62
85
|
codeoutline rebuild [--project PATH]
|
|
@@ -71,7 +94,7 @@ codeoutline doctor [--project PATH]
|
|
|
71
94
|
|
|
72
95
|
协议基线为 [MCP 2025-06-18](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports)。查询预算为 256–262144 字节,默认 16000;超限输出保持 UTF-8 有效并附截断提示。路径均指服务所在机器。
|
|
73
96
|
|
|
74
|
-
stdio 模式下 stdout 只输出 MCP 消息,日志写入 stderr。HTTP 默认只监听本机,客户端地址为 `http://127.0.0.1:19876/mcp`。远程监听需设置至少 16 字节的 `CODEOUTLINE_TOKEN` 并用 `--allow-host` 显式允许主机,客户端使用 `Authorization: Bearer
|
|
97
|
+
stdio 模式下 stdout 只输出 MCP 消息,日志写入 stderr。HTTP 默认只监听本机,客户端地址为 `http://127.0.0.1:19876/mcp`。远程监听需设置至少 16 字节的 `CODEOUTLINE_TOKEN` 并用 `--allow-host` 显式允许主机,客户端使用 `Authorization: Bearer ...`;与本机 HTTP 不同,远程服务未传 `--allow-root` 时只允许访问 `--project` 或启动目录;`--allow-origin` 可重复指定允许的完整 Origin,未配置的浏览器 Origin 被拒绝。远程部署应由 TLS 反向代理保护令牌。
|
|
75
98
|
|
|
76
99
|
主线程处理协议,常驻索引线程串行处理查询。请求含进度 token 时每秒报告进度,HTTP 使用 SSE;没有独立的 GET/SSE 订阅端点(返回 405)。最多 64 个会话、64 个排队或执行中的任务;任务期限 120 秒,会话空闲 15 分钟过期。取消在每个文件的检查点生效,单个文件解析期间无法中断(单文件上限 1.5 MB);取消后丢弃可能不完整的内存索引,下次查询从缓存恢复。
|
|
77
100
|
|
package/bin/xnet.exe
CHANGED
|
Binary file
|
package/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"sourceDirty":false,"releaseReady":true,"version":"0.1.3","sha256":{"scripts/codeoutline/lang/c.lua":"1251352bcfac6b6d3704460e00b06cf4f41232144748b41b89db04a5ab594073","scripts/codeoutline/version.lua":"635bc8cc8a89fcfedfe2a3eaafaa6a061f84f72f832b0e39f98f302ba997ffda","scripts/codeoutline/parse.lua":"ccda7a087dc90109fce7a1e64ebe1de0d7c7036990b81b3423ff14b4299bf38f","scripts/codeoutline/command.lua":"a2e6f938897407f99573779b71948968cd743e331ca2cd0076cc1a9170559c30","scripts/codeoutline/lang/cpp.lua":"96aebcd8972d5272c11446257f37fe90c10f4130c3c1b5bb71c793d7c25456f4","scripts/codeoutline/common.lua":"ee775ed5b2f7ada7a02851f44b51bd4008bceacbf9700576a474e6732e3c03c2","scripts/codeoutline/lang/csharp.lua":"36ac648b8691c85b8c75d5bcb146fcdfc87992a278e4798f3eb194124e3df2bb","codeoutline":"8d00b52027511d56136c8bd345666d2a14ad49591313c80a016d6032f708c02b","keys/update-public.pem":"7ff853339e19631b20ed3fa2cf221daa31c581e2e84d161b344b8f06de6562a8","scripts/codeoutline/control.lua":"1dfbea9f1397d9fb3c321c48a8d8ee7fc7928e864588226e55247bd548255bb4","keys/update-ca.crt":"d9b5ec3d4628de9c5559871f39841a5f84d47c53ded4d58d6e3bba2b4c669a02","scripts/codeoutline/lang/go.lua":"f5717cbeabe6d30dad72c473fa445480d7fb6b5546bb262e5f4c46185f0959da","scripts/xupgate/client.lua":"4bcefd14802f5d44c7c7e5b5aeda25247957212605f426da8c9dfb84ed7f9758","licenses/xnet2lua.txt":"1aa8af3df70f60f1ebf2d23e14c27af1606057ad9c32a9a0d15fd76cff257532","scripts/codeoutline/explore.lua":"d9e4e0d0179d00205df96ad0e7442e7bbc87e27481e6d27eb772ca302b5f35d3","licenses/libdeflate.txt":"41b60f2caab6bffdd5ba360687bd23ca653c0a1235c00380ecffc939b4cd8d75","scripts/codeoutline/lang/java.lua":"435b6ddcd231679db9e705a604344a3fb6c00b84cc20b2ecd210423ee0b376a6","scripts/xupgate/common.lua":"7eb979277887dfae16b325ffdab493673f01b96d00b9c1de11d8aca297368752","scripts/codeoutline/graph.lua":"1ef35f2e92e9db3bbe9b612bb0cb336a9b57b440c9a066e7ba3ef81574326834","scripts/codeoutline/lang/js.lua":"7a25a195356deeef7da3fdaf6e8a483b2a3a230cae3064e5dde2a3556fdcbda9","scripts/xupgate/http_client.lua":"a189506c3d0fcc454f5e001fdeecdd6349a1019ea0970d11ce2fbfdf035166d6","scripts/codeoutline/http.lua":"33802130445b348ce607e9891d4a9789d34b18338bf5d296f56e0b3c7b0c5493","codeoutline.cmd":"6414f7fac4c7e384d5b8e9e5e8a89731f7950b48dbe08bcbe149c1a70dbc4407","scripts/codeoutline/lang/lua.lua":"33b038192425e4db29251674e30c73b7a1af849789c49ff6430ee409c062f812","DISTRIBUTION.md":"da25de66601fe22f19ee35a61b5880a1bc65c4ca81bafefb9c46fdbbfb3436da","scripts/xupgate/http_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/codeoutline/index.lua":"08c585a7cb264962ac04beb3bf5bc8a9dd22b4f85644b6fdd6a4e527843fbee9","scripts/codeoutline/path.lua":"407bd960c1ad04e5006b321ce33263393bb40eee5dee5c123be9b36d3ad10937","README.md":"a1757e831f9d60d14cf318bd47cf8d9481a3e65b7bf99922064445d5d4913c89","scripts/codeoutline/lang/python.lua":"f7219c04914673ee6bae387c222b09acd433596c746237bdd6650a4f4087b17c","README.zh-CN.md":"4c2ff0fe0b73b3052f067926e45f9f9792571d9d529c731567b2c0d3b1d2c844","scripts/xupgate/proxy.lua":"5bf532e7005f44555d6a5277336e5ad395af060585c13a1cdc2441de50e0dcff","scripts/codeoutline/index_worker.lua":"47f80807a458d5c706b1a54f60fb2200ae51f022b21d9039df44611035e9ac40","scripts/codeoutline/service.lua":"597c435309abc0d8149b5e88095896c3bba6516146fd587d53b4b6fbf23a553c","THIRD_PARTY.md":"a70238f26ec05b7be4b813fa49c337cfb4d3cd64c36fcd27401d121e0e6e38df","scripts/codeoutline/lang/rust.lua":"f7c21751b1ab08512a406f45bd53546dddfa98ff680b1374d29a4152ae110023","licenses/mbedtls.txt":"9b405ef4c89342f5eae1dd828882f931747f71001cfba7d114801039b52ad09b","scripts/xupgate/signature.lua":"f07de8a4093d08cc69d3c1d8296d23318c5d81344ece788d4453a9b3b700f000","licenses/rpmalloc.txt":"f6c10eb9ec349900767c3dcb8bc71fe4fba2aefea329f05e2608827188016c0f","scripts/codeoutline/text.lua":"75f9af87ff5ce62def74f69d8972a6b11ff660723fc5cf515369ee3012ff0675","licenses/lua-cmsgpack.txt":"8edfdc5282278a1268d8a6ee52f9245f1a5fe3d1c8065be00330196b1de49873","scripts/codeoutline/main.lua":"287c48d3006bf94fcf84e5e14b9a0a7379857c450f05bd850e3cb29119615d90","licenses/luajit.txt":"1b10a02c9474cb908da2d87bc908edd8798f9ad28d9a8c53fbd05c13227f7394","LICENSE":"1b63179362acd482b4a9a07ca526b3fce6d9103dcded361de2159ade174568b6","lib/xhttp_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/codeoutline/updater.lua":"772b097af670f2d61fb92e51b9862c2964f90cd911b7720c6b1ae6906082b7f0","scripts/codeoutline/cli.lua":"ba996c3c3def65aab08ba60141a7a98a19dfcc1bbe004ab5d8ea14a7f9f9a08b","scripts/codeoutline/mcp.lua":"f14a2d0b9625544ad32309358121a5ff304839780f52d5c1c8ec548d56c5e901","bin/xnet.exe":"33ecdb8cd80d3df1bf610dd3d0ba89c0010f408626860645c82620eb5db2e3fd","scripts/codeoutline/xscan.lua":"508d1fdccee4e856e0f198992bec45d7c8a9a3c191e0a5f71717741db9e00325"},"updateSequence":3,"note":"Release build from a clean checkout","target":"win32-x64","lua":"LuaJIT 2.1.1774896198","sourceCommit":"9a786639b6cfb46257bec1ff45fe038063270ed3","runtimeCommit":"f2c3ddfcbd3f04d7dd71543d0878d06e033519a0"}
|
package/codeoutline
CHANGED
|
@@ -2,4 +2,12 @@
|
|
|
2
2
|
set -eu
|
|
3
3
|
base=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
4
4
|
if [ -n "${CODEOUTLINE_LOG_DIR:-}" ]; then log_out="LOG_DIR=$CODEOUTLINE_LOG_DIR"; else log_out=LOG_FILE=0; fi
|
|
5
|
+
if [ "${1:-}" != "update" ]; then
|
|
6
|
+
if [ "${CODEOUTLINE_AUTO_UPDATE:-}" = "" ]; then
|
|
7
|
+
if [ "${1:-}" = "serve" ]; then CODEOUTLINE_AUTO_UPDATE=1; else CODEOUTLINE_AUTO_UPDATE=0; fi
|
|
8
|
+
export CODEOUTLINE_AUTO_UPDATE
|
|
9
|
+
fi
|
|
10
|
+
selected=$("$base/bin/xnet" "$base/scripts/codeoutline/updater.lua" LOG_STDERR=1 LOG_FILE=0 LOG_LEVEL=ERROR ACTION=select) || selected="$base"
|
|
11
|
+
base="$selected"
|
|
12
|
+
fi
|
|
5
13
|
exec "$base/bin/xnet" "$base/scripts/codeoutline/command.lua" LOG_STDERR=1 "LOG_LEVEL=${CODEOUTLINE_LOG_LEVEL:-WARN}" "$log_out" "$@"
|
package/codeoutline.cmd
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
setlocal
|
|
3
|
-
if not defined CODEOUTLINE_LOG_LEVEL set "CODEOUTLINE_LOG_LEVEL=WARN"
|
|
4
|
-
set "CODEOUTLINE_LOG_OUT=LOG_FILE=0"
|
|
5
|
-
if defined CODEOUTLINE_LOG_DIR set "CODEOUTLINE_LOG_OUT=LOG_DIR=%CODEOUTLINE_LOG_DIR%"
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
@echo off
|
|
2
|
+
setlocal
|
|
3
|
+
if not defined CODEOUTLINE_LOG_LEVEL set "CODEOUTLINE_LOG_LEVEL=WARN"
|
|
4
|
+
set "CODEOUTLINE_LOG_OUT=LOG_FILE=0"
|
|
5
|
+
if defined CODEOUTLINE_LOG_DIR set "CODEOUTLINE_LOG_OUT=LOG_DIR=%CODEOUTLINE_LOG_DIR%"
|
|
6
|
+
set "CODEOUTLINE_BASE=%~dp0"
|
|
7
|
+
if "%~1"=="update" goto run
|
|
8
|
+
if not defined CODEOUTLINE_AUTO_UPDATE (
|
|
9
|
+
if "%~1"=="serve" (set "CODEOUTLINE_AUTO_UPDATE=1") else (set "CODEOUTLINE_AUTO_UPDATE=0")
|
|
10
|
+
)
|
|
11
|
+
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
|
+
:run
|
|
13
|
+
"%CODEOUTLINE_BASE%bin\xnet.exe" "%CODEOUTLINE_BASE%scripts\codeoutline\command.lua" LOG_STDERR=1 "LOG_LEVEL=%CODEOUTLINE_LOG_LEVEL%" "%CODEOUTLINE_LOG_OUT%" %*
|
|
14
|
+
exit /b %errorlevel%
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
|
2
|
+
MIIDTDCCAjSgAwIBAgIUGk0p4hd1nhA01S7DyxwhvrKrcBYwDQYJKoZIhvcNAQEL
|
|
3
|
+
BQAwGTEXMBUGA1UEAwwONDMuMTMzLjI1NS4xOTMwHhcNMjYxMDAyMDk1MTM1WhcN
|
|
4
|
+
MjcxMDAyMDk1MTM1WjAZMRcwFQYDVQQDDA40My4xMzMuMjU1LjE5MzCCASIwDQYJ
|
|
5
|
+
KoZIhvcNAQEBBQADggEPADCCAQoCggEBAPog84zcjJT+Vv2UKbU9h/GIwZzBMQP4
|
|
6
|
+
p+vgubALn2s7DAbvS0vlKx0IG3QwP4bD3nlyzreGRisnYclV318/TWGtGUv+XH3U
|
|
7
|
+
xTSl5UXn3ReIm7qSylN2rDOqKjRzLozUk1an4UoQ/JWq8tNJzdyvGN9M+Cg+WvFK
|
|
8
|
+
1LkiTOjjKno7Q6lPixigcIlkWf714sV0M9wYBYD7zYISiiYOSav3Dp2YjPROluZh
|
|
9
|
+
jc5mQovHAAkZUrs3Sm8u+K74H3TwFb/IMpMmLFcTgsXupPdKnn3be42w4wrAQu4x
|
|
10
|
+
3Hi2tl4xRJhF61XsGx3gaXXAM2+rfjH7InpaSY+XUf45G3+7UJQ1cw8CAwEAAaOB
|
|
11
|
+
izCBiDAdBgNVHQ4EFgQUOzjvn3TnsLqiYNy97yCk+FFC9OQwHwYDVR0jBBgwFoAU
|
|
12
|
+
Ozjvn3TnsLqiYNy97yCk+FFC9OQwDwYDVR0TAQH/BAUwAwEB/zAgBgNVHREEGTAX
|
|
13
|
+
hwQrhf/BhwR/AAABgglsb2NhbGhvc3QwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDQYJ
|
|
14
|
+
KoZIhvcNAQELBQADggEBAE2iU6xmda3INrREUbvnJvY4UiBK1OfenvObO8avJ8VX
|
|
15
|
+
XeHvW3a4m7bGee90qm2+dTXL/elxPoWn04ph0CxjWTdI4pX9UhnS3SnYvRhALdOZ
|
|
16
|
+
hzDKY1oZkA0nXt3lXXCLfAN/mLi2xaMCVby2M6WX67MZBbdnWp+lpl037gHmRRcm
|
|
17
|
+
/aQtUJRnlQV1wwoxQWluhIJit6UP2Bx+DJgcQ/FlJjZnSdgb+ZpJ3SMrqyewmcnT
|
|
18
|
+
o+b/WKVWwUXFySrSuNmQ7bbbpCXOQTelE+iUM6PnuX5vX8CN2bQwuAV5T+9eSq6P
|
|
19
|
+
d/Ag5Bgs1g1VUkIeftzkQxZutroCk1PLVwEBZ8mtXaM=
|
|
20
|
+
-----END CERTIFICATE-----
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-----BEGIN PUBLIC KEY-----
|
|
2
|
+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArD2e8eaxNcdHZORDjU3E
|
|
3
|
+
+hfcn5zMuxEQdIr7EYVXOMlLg0nPaZ0OH97ZvoGRlDlr+inYJjLTAfGx5//GBt6d
|
|
4
|
+
ErCsa8D2brCFa65Wdj/hW+i2wDgDjovin1+rozNdD2mizucZNTiDjcYWOrbkiW0j
|
|
5
|
+
zp2lE+jDI2zJ8zJGFbMJ2u2Sxq8Ri3HbwqAsSHvBEzH/dg1UUldJZvN3ikyLHgae
|
|
6
|
+
P4IY6qlUrU09ZzzSEfcQSvSOHOay4Fx+GYpsQv7FswhS5t3153U6Nml47vbSoQDx
|
|
7
|
+
9zeCIBVfhdE2KMGQn+HXb9wbgdVzmvkzB8/98CR9tj08zy/ETlU35TshziSd4Ade
|
|
8
|
+
awIDAQAB
|
|
9
|
+
-----END PUBLIC KEY-----
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"name":"@codua/codeoutline-win32-x64","publishConfig":{"access":"public"},"description":"CodeOutline native runtime and Lua implementation for win32-x64","cpu":["x64","arm64"],"license":"BSD-2-Clause","repository":{"type":"git","url":"git+https://github.com/1dao/codeoutline.git"},"files":["bin/","lib/","keys/","scripts/","licenses/","LICENSE","codeoutline","codeoutline.cmd","build-info.json","*.md"],"version":"0.1.3","os":["win32"]}
|
|
@@ -7,15 +7,18 @@ local help = [[CodeOutline - Lua code indexing and MCP
|
|
|
7
7
|
|
|
8
8
|
Usage:
|
|
9
9
|
codeoutline serve --stdio [--project PATH] [--allow-root PATH ...]
|
|
10
|
-
codeoutline serve --http [--host HOST] [--port PORT] [--project PATH]
|
|
10
|
+
codeoutline serve --http [--host HOST] [--port PORT] [--project PATH] [--allow-root PATH ...]
|
|
11
11
|
codeoutline explore --project PATH --query QUERY [--budget BYTES]
|
|
12
12
|
codeoutline status [--project PATH]
|
|
13
13
|
codeoutline rebuild [--project PATH]
|
|
14
14
|
codeoutline doctor [--project PATH]
|
|
15
|
+
codeoutline update [--check | --rollback] [--channel CHANNEL]
|
|
15
16
|
codeoutline --version
|
|
16
17
|
|
|
17
18
|
HTTP options: --allow-host HOST, --allow-origin ORIGIN (repeatable).
|
|
18
19
|
Remote HTTP requires CODEOUTLINE_TOKEN (at least 16 bytes).
|
|
20
|
+
Local HTTP without --allow-root serves any project; stdio and remote HTTP
|
|
21
|
+
default to --project or the working directory.
|
|
19
22
|
Project defaults to the working directory for one-shot commands.
|
|
20
23
|
doctor reports JSON diagnostics and exits nonzero on a failed check.
|
|
21
24
|
]]
|
|
@@ -36,6 +39,7 @@ local function parse(args)
|
|
|
36
39
|
serve = { stdio = true, http = true, project = true, host = true, port = true,
|
|
37
40
|
['allow-root'] = true, ['allow-host'] = true, ['allow-origin'] = true },
|
|
38
41
|
explore = { project = true, query = true, budget = true },
|
|
42
|
+
update = { check = true, rollback = true, channel = true },
|
|
39
43
|
status = { project = true }, rebuild = { project = true }, doctor = { project = true },
|
|
40
44
|
}
|
|
41
45
|
assert(allowed[command], 'unknown command: ' .. command)
|
|
@@ -44,7 +48,7 @@ local function parse(args)
|
|
|
44
48
|
local name, value = clean[i]:match('^%-%-([%w-]+)=(.*)$')
|
|
45
49
|
if not name then name = clean[i]:match('^%-%-([%w-]+)$') end
|
|
46
50
|
assert(name and (allowed[command][name] or name == 'help'), 'unknown option: ' .. clean[i])
|
|
47
|
-
local flag = name == 'stdio' or name == 'http' or name == 'help'
|
|
51
|
+
local flag = name == 'check' or name == 'rollback' or name == 'stdio' or name == 'http' or name == 'help'
|
|
48
52
|
if flag then
|
|
49
53
|
assert(value == nil, '--' .. name .. ' does not take a value')
|
|
50
54
|
value = true
|
|
@@ -122,6 +126,10 @@ local function run()
|
|
|
122
126
|
local command, options = parse(arg or {})
|
|
123
127
|
if command == '--help' or command == '-h' or options.help then io.write(help); return 0 end
|
|
124
128
|
if command == '--version' then io.write(version, '\n'); return 0 end
|
|
129
|
+
if command == 'update' then
|
|
130
|
+
assert(not (options.check and options.rollback), '--check and --rollback are mutually exclusive')
|
|
131
|
+
return require('codeoutline.updater').run(options.check and 'check' or options.rollback and 'rollback' or 'update', options)
|
|
132
|
+
end
|
|
125
133
|
if command == 'serve' then
|
|
126
134
|
assert(not not options.stdio ~= not not options.http, 'serve requires exactly one of --stdio or --http')
|
|
127
135
|
arg = { options.stdio and 'STDIO=1' or 'HTTP=1' }
|
|
@@ -8,11 +8,7 @@ local shared = assert(xshared.dict('codeoutline_control'))
|
|
|
8
8
|
|
|
9
9
|
local function execute(req)
|
|
10
10
|
local root = assert(paths.canonical(req.projectPath))
|
|
11
|
-
|
|
12
|
-
for _, configured in ipairs(req.allowedRoots) do
|
|
13
|
-
if paths.contains(configured, root) then allowed = true; break end
|
|
14
|
-
end
|
|
15
|
-
assert(allowed, 'project path is outside allowed roots')
|
|
11
|
+
assert(paths.allowed(req.allowedRoots, root), 'project path is outside allowed roots')
|
|
16
12
|
if req.method == 'explore' then
|
|
17
13
|
local text, info = service.explore(root, req.query, { budget = req.budget })
|
|
18
14
|
return { text = text, truncated = info.truncated or false, refresh = info.refresh }
|
|
@@ -19,8 +19,27 @@ local config = { roots = {}, project = options.PROJECT and assert(paths.canonica
|
|
|
19
19
|
token = os.getenv('CODEOUTLINE_TOKEN'), hosts = options.ALLOW_HOST, origins = options.ALLOW_ORIGIN }
|
|
20
20
|
assert(config.port and config.port % 1 == 0 and config.port >= 1 and config.port <= 65535, 'Invalid PORT')
|
|
21
21
|
if config.token == '' then config.token = nil end
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
-- Stdio mode owns stdout for protocol messages, so its notices go to stderr.
|
|
23
|
+
local function notice(text)
|
|
24
|
+
local stream = options.STDIO == '1' and io.stderr or io.stdout
|
|
25
|
+
stream:write('[codeoutline] ', text, '\n'); stream:flush()
|
|
26
|
+
end
|
|
27
|
+
-- A missing root (an unmounted drive, say) is kept as written and matches once
|
|
28
|
+
-- it exists: failing startup would take down a service started at login.
|
|
29
|
+
for _, root in ipairs(options.ALLOW_ROOT) do
|
|
30
|
+
local canonical, err = paths.canonical(root)
|
|
31
|
+
if not canonical then notice('warning: allowed root ' .. root .. ' is unavailable (' .. err .. ')') end
|
|
32
|
+
config.roots[#config.roots + 1] = canonical or paths.normalize(root)
|
|
33
|
+
end
|
|
34
|
+
if #config.roots == 0 then
|
|
35
|
+
if options.HTTP == '1' and (config.host == '127.0.0.1' or config.host == 'localhost' or config.host == '::1') then
|
|
36
|
+
-- One loopback service serves every project of every session. Only local
|
|
37
|
+
-- processes reach it, and they already hold the user's file access.
|
|
38
|
+
config.roots = false
|
|
39
|
+
else
|
|
40
|
+
config.roots[1] = config.project or assert(paths.canonical('.'))
|
|
41
|
+
end
|
|
42
|
+
end
|
|
24
43
|
local shared = assert(xshared.create('codeoutline_control', 65536, 256))
|
|
25
44
|
local jobs, next_id, job_count, worker_ready = {}, 0, 0, false
|
|
26
45
|
local endpoint, stdio, input = nil, nil, ''
|
|
@@ -161,9 +161,7 @@ function M.new(config, submit, cancel)
|
|
|
161
161
|
local root, err
|
|
162
162
|
if project_path then root, err = paths.canonical(project_path)
|
|
163
163
|
else err = 'projectPath is required: no PROJECT, client root or working directory is available' end
|
|
164
|
-
|
|
165
|
-
if root then for _, r in ipairs(config.roots) do if paths.contains(r, root) then allowed = true; break end end end
|
|
166
|
-
if not root or not allowed then
|
|
164
|
+
if not root or not paths.allowed(config.roots, root) then
|
|
167
165
|
self.pending[id] = nil
|
|
168
166
|
result({ content = array({ { type = 'text', text = err or 'projectPath is outside allowed roots' } }), isError = true }); return
|
|
169
167
|
end
|
|
@@ -33,4 +33,14 @@ function M.contains(root, candidate)
|
|
|
33
33
|
return candidate == root or candidate:sub(1, #prefix) == prefix
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
-- `roots == false` is the unrestricted access of a loopback HTTP service
|
|
37
|
+
-- started without ALLOW_ROOT; otherwise the candidate must sit under a root.
|
|
38
|
+
function M.allowed(roots, candidate)
|
|
39
|
+
if roots == false then return true end
|
|
40
|
+
for _, root in ipairs(roots) do
|
|
41
|
+
if M.contains(root, candidate) then return true end
|
|
42
|
+
end
|
|
43
|
+
return false
|
|
44
|
+
end
|
|
45
|
+
|
|
36
46
|
return M
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
-- Update commands and bootstrap selection. Installation stays in Lua.
|
|
2
|
+
local source=assert(xutils.realpath(debug.getinfo(1,'S').source:sub(2))):gsub('\\','/')
|
|
3
|
+
local install=assert(source:match('^(.*)/scripts/codeoutline/[^/]+$'))
|
|
4
|
+
package.path=install .. '/scripts/?.lua;' .. package.path
|
|
5
|
+
local c,u=require('xupgate.common'),require('xutils')
|
|
6
|
+
local M={}
|
|
7
|
+
local function config(options)
|
|
8
|
+
options=options or {}
|
|
9
|
+
local build=c.decode_json(c.read(install .. '/build-info.json')) or {}
|
|
10
|
+
local home=os.getenv('USERPROFILE') or os.getenv('HOME')
|
|
11
|
+
local target=os.getenv('CODEOUTLINE_UPDATE_TARGET') or build.target
|
|
12
|
+
if not target then target=package.config:sub(1,1)=='\\' and 'win32-x64' or 'linux-x64' end
|
|
13
|
+
local cfg={
|
|
14
|
+
project=os.getenv('CODEOUTLINE_UPDATE_PROJECT') or 'codeoutline',
|
|
15
|
+
platform=target,url=os.getenv('CODEOUTLINE_UPDATE_URL') or 'https://43.133.255.193:51215',
|
|
16
|
+
channel=options.channel or os.getenv('CODEOUTLINE_UPDATE_CHANNEL') or 'stable',
|
|
17
|
+
publicKey=assert(c.read(os.getenv('CODEOUTLINE_UPDATE_PUBLIC_KEY') or install .. '/keys/update-public.pem'),'update public key missing'),
|
|
18
|
+
caFile=os.getenv('CODEOUTLINE_UPDATE_CA') or install .. '/keys/update-ca.crt',
|
|
19
|
+
directory=os.getenv('CODEOUTLINE_UPDATE_DIR') or assert(home,'set CODEOUTLINE_UPDATE_DIR') .. '/.codeoutline/updates',
|
|
20
|
+
minimumSequence=tonumber(os.getenv('CODEOUTLINE_UPDATE_MIN_SEQUENCE')) or build.updateSequence or 0,
|
|
21
|
+
http=require('xupgate.http_client'),
|
|
22
|
+
}
|
|
23
|
+
cfg.validate=function(root,m)
|
|
24
|
+
local info=c.decode_json(c.read(root .. '/build-info.json'))
|
|
25
|
+
assert(info and info.target==cfg.platform and info.version==m.version and info.updateSequence==m.sequence,'package platform/version/sequence mismatch')
|
|
26
|
+
assert(m.entry=='scripts/codeoutline/command.lua','invalid CodeOutline entry')
|
|
27
|
+
local expected=cfg.platform=='win32-x64' and 'bin/xnet.exe' or 'bin/xnet'
|
|
28
|
+
assert(m.runtime==expected,'package runtime missing')
|
|
29
|
+
local function quote(s)
|
|
30
|
+
assert(not s:find('[\r\n"%!&|<>^$;()]') and not s:find(string.char(96),1,true),'unsafe install path')
|
|
31
|
+
if package.config:sub(1,1)=='\\' then return '"' .. s .. '"' end
|
|
32
|
+
assert(not s:find("'",1,true),'unsafe install path');return "'" .. s .. "'"
|
|
33
|
+
end
|
|
34
|
+
local command=quote(root .. '/' .. m.runtime) .. ' ' .. quote(root .. '/' .. m.entry) .. ' LOG_STDERR=1 LOG_FILE=0 LOG_LEVEL=ERROR --version'
|
|
35
|
+
if package.config:sub(1,1)=='\\' then command='"' .. command .. '"' end
|
|
36
|
+
local pipe=assert(io.popen(command));local output=pipe:read('a');local ok=pipe:close()
|
|
37
|
+
assert(ok and output:match('^%s*(.-)%s*$')==m.version,'updated runtime health check failed')
|
|
38
|
+
return true
|
|
39
|
+
end
|
|
40
|
+
return cfg
|
|
41
|
+
end
|
|
42
|
+
function M.run(action,options)
|
|
43
|
+
local api=require('xupgate.client').open(config(options))
|
|
44
|
+
local function selected()
|
|
45
|
+
local ok,current=pcall(api.current)
|
|
46
|
+
if not ok then io.stderr:write('codeoutline: installed update invalid; using initial version\n')end
|
|
47
|
+
return ok and current and current.root or install
|
|
48
|
+
end
|
|
49
|
+
local function finish(err,result)
|
|
50
|
+
if action=='select' then
|
|
51
|
+
if err then io.stderr:write('codeoutline: update unavailable; using local version\n')end
|
|
52
|
+
io.write(selected(),'\n');io.stdout:flush();xthread.stop(0)
|
|
53
|
+
else
|
|
54
|
+
io.write(assert(u.json_pack({ok=not err,error=err,result=result})),'\n');io.stdout:flush();xthread.stop(err and 1 or 0)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
return {__init=function()
|
|
58
|
+
assert(xnet.init());xtimer.init(16)
|
|
59
|
+
if action=='select' and os.getenv('CODEOUTLINE_AUTO_UPDATE')~='1' then finish(nil)
|
|
60
|
+
elseif action=='rollback' then
|
|
61
|
+
local ok,result=pcall(api.rollback)
|
|
62
|
+
if not ok and tostring(result):find('no previous version',1,true)then ok,result=pcall(api.use_initial)end
|
|
63
|
+
finish(not ok and tostring(result) or nil,ok and result or nil)
|
|
64
|
+
elseif action=='current' then local ok,result=pcall(api.current);finish(not ok and tostring(result) or nil,ok and result or nil)
|
|
65
|
+
elseif action=='check' then api.check(finish)
|
|
66
|
+
else api.update(finish)end
|
|
67
|
+
end,__uninit=function()xnet.uninit()end,__thread_handle=function()end}
|
|
68
|
+
end
|
|
69
|
+
if ...=='codeoutline.updater' then return M end
|
|
70
|
+
local action='select'
|
|
71
|
+
for _,arg in ipairs(arg or {})do local v=arg:match('^ACTION=(.+)$');if v then action=v end end
|
|
72
|
+
return M.run(action)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
return '0.1.
|
|
1
|
+
return '0.1.3'
|