@linxiraos/editor 1.2.1 → 1.3.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.
package/LICENSE CHANGED
@@ -1,7 +1,9 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Eugene Yakhnenko
4
- Copyright (c) 2026 Linxira-OS (Zeta)
3
+ Copyright (c) 2025-2026 Nick Nizovtsev and TermIDE contributors
4
+
5
+ Copyright (c) 2026 Linxira-OS / Zeta Contributors (vendored distribution;
6
+ see VENDOR.md for the modification-layer ledger)
5
7
 
6
8
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
9
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,21 +1,51 @@
1
1
  # @linxiraos/editor
2
2
 
3
- Zeta's bundled terminal editor (vendored [TTT Editor](https://github.com/eugenioenko/ttt) v1.5.0, MIT).
3
+ Zeta's built-in terminal editor, as a per-platform binary payload.
4
4
 
5
- This package installs the editor binary for your platform via `optionalDependencies` and provides a `zeta-editor` launcher that execs it.
5
+ The editor is a full-screen text editor with LSP (completion, code actions,
6
+ diagnostics), tree-sitter highlighting, vim mode and git diff markers — the
7
+ `panel-editor` of the vendored TermIDE workspace (`termide/`), built as its
8
+ own **editor-only entry point** (`termide/src/bin/termide-editor.rs`). It
9
+ opens files the way `$EDITOR` consumers expect:
10
+
11
+ ```sh
12
+ # Absolute path to the payload, then the editor's own command line:
13
+ termide-editor FILE[:line[:col]]... [DIRECTORY]
14
+ ```
15
+
16
+ - `FILE:line:col` / `FILE:line` / `FILE` — open with the cursor placed
17
+ (1-based; a Windows drive letter is never a position separator).
18
+ - `DIRECTORY` — becomes the project root (LSP/git/config resolve there).
19
+ - No argument — one empty editor in the current directory.
20
+ - The process blocks until the editor is closed, and closing the last panel
21
+ returns control to the caller, so it works as `$EDITOR` for `git commit`,
22
+ `crontab -e`, `visudo`, and for tools that spawn an editor by path.
23
+
24
+ ## No command, by design
25
+
26
+ This package installs **no command**: there is no `bin` entry, and the editor
27
+ is not part of the user-visible command surface (`zetawork` / `zetacode` /
28
+ `zetaide`). Consumers resolve the platform leaf's executable and spawn it:
29
+
30
+ | Consumer | How it resolves the payload |
31
+ |---|---|
32
+ | `plugins/official/pi-messenger` (`/editor`) | `editor-binary.ts` — `require.resolve("@linxiraos/editor-<platform>-<arch>/bin/…")`, auto-installing this package when missing |
33
+ | other integrations | `node_modules/@linxiraos/editor/launcher.js` (`node launcher.js FILE[:line[:col]]`), or `require("@linxiraos/editor/launcher.js").resolveEditor()` |
34
+
35
+ The platform leaf that matches your system (`@linxiraos/editor-windows-x64`,
36
+ `@linxiraos/editor-linux-x64`) carries the executable in its `bin/`
37
+ directory through `optionalDependencies`.
6
38
 
7
39
  ## Install
8
40
 
9
41
  ```sh
10
42
  npm install -g @linxiraos/editor
11
- zeta-editor # launches the editor
12
43
  ```
13
44
 
14
45
  Or as a dependency:
15
46
 
16
47
  ```sh
17
48
  npm install @linxiraos/editor
18
- npx zeta-editor --version
19
49
  ```
20
50
 
21
51
  ## Platform support
@@ -25,8 +55,26 @@ npx zeta-editor --version
25
55
  | `@linxiraos/editor-windows-x64` | Windows | x64 | supported |
26
56
  | `@linxiraos/editor-linux-x64` | Linux | x64 | supported |
27
57
 
28
- Only **x64 (amd64)** builds of Linux and Windows are provided. macOS and ARM (arm64/armv7) builds are **not** available yet. On unsupported platforms the launcher exits with a clear error; the rest of Zeta is unaffected.
58
+ Only **x64 (amd64)** builds of Linux and Windows are provided. macOS and ARM
59
+ (arm64/armv7) builds are **not** available yet.
60
+
61
+ ## Migration from 1.2.1 (the TTT handover)
62
+
63
+ `@linxiraos/editor@1.2.1` on npm is still the **retired TTT editor**: it carries
64
+ `bin/zeta-editor.js` and its platform leaves carry `ttt.exe`. From the next
65
+ published version the package is the payload described above:
66
+
67
+ - the old editor command is **gone** (this package has no `bin` by design;
68
+ spawn the payload, or `node launcher.js`),
69
+ - the leaves carry `termide-editor[.exe]` instead of `ttt.exe`,
70
+ - the editor's command line is `FILE[:line[:col]]` (`$EDITOR` semantics: no
71
+ sessions, no detach, no layout persistence).
72
+
73
+ Nothing else in the repository refers to TTT; the package name stayed because
74
+ it is the slot `$EDITOR` consumers point at.
29
75
 
30
76
  ## License
31
77
 
32
- The vendored editor is MIT-licensed (see [upstream](https://github.com/eugenioenko/ttt)). Zeta packaging is part of [linxira-zeta](https://github.com/Linxira-OS/linxira-zeta) (MIT).
78
+ MIT. The payload is built from the vendored TermIDE snapshot; see
79
+ [`VENDOR.md`](./VENDOR.md) and `termide/VENDOR.md` in the source repository
80
+ for the modification-layer ledger.
package/VENDOR.md CHANGED
@@ -1,29 +1,14 @@
1
- # VENDOR — TTT Editor 快照账目
2
-
3
- | 项 | 值 |
4
- |---|---|
5
- | 上游仓库 | https://github.com/eugenioenko/ttt |
6
- | 来源 tag | `v1.5.0` |
7
- | peeled SHA | `765048940a54d9765fa574ae62df43abed398fa8` |
8
- | 引入方式 | `git archive v1.5.0`(无上游 git 历史)|
9
- | 协议 | MIT(`LICENSE` 原样保留,未改动)|
10
- | 引入日期 | 2026-09-19 |
11
- | npm 包 | `@linxiraos/editor`(Go 二进制分发,版本对齐 Zeta 产品线)|
12
-
13
- ## 出局方案(选型记录)
14
-
15
- - fresh(Rust,GPL-2.0):臂长引用价值不足,协议不可 vendor。
16
- - termide(MIT):功能差一档(无多光标/插件)。
17
- - subtree 全历史:ttt/.git 实测 57MB,超 50MB push 红线。
18
- - submodule:树不可改、force-push 场景易碎。
19
-
20
- ## 修改层清单(对上游 v1.5.0 的全部偏离)
21
-
22
- (当前为纯净快照,无修改。后续每一处偏离在此登记:文件、内容、原因。)
23
-
24
- ## bump 流程
25
-
26
- 1. `git -C temp/ttt fetch origin && git -C temp/ttt tag` 确认新 tag;
27
- 2. `git -C temp/ttt archive <new-tag> | tar -x -C editor`(覆盖前 `diff -r` 对账
28
- 本清单的修改层,逐项重新应用并登记);
29
- 3. 更新本文件 tag/SHA/修改层;单 commit 提交(`vendor: bump editor to <tag>`)。
1
+ # VENDOR — `@linxiraos/editor` 载荷账目
2
+
3
+ | 项 | 值 |
4
+ | ---------- | ------------------------------------------------------------------ |
5
+ | 载荷 | Zeta 内置编辑器:vendored TermIDE(`termide/`)的 `panel-editor`,编为**编辑器专用入口** `termide-editor` |
6
+ | 上游仓库 | https://github.com/termide/termide(快照 tag `0.41.0`) |
7
+ | 协议 | MIT(上游版权行 + Linxira-OS 发行行,见本目录 `LICENSE`) |
8
+ | 载荷引入 | 2026-10-17(此前的 vendored TTT Editor/Go 载荷于 2026-10-16 退场) |
9
+ | npm 包 | `@linxiraos/editor`(launcher,无 `bin`)+ 平台叶 `@linxiraos/editor-{windows,linux}-x64` |
10
+ | 偏离账本 | **`termide/VENDOR.md`**(本载荷是它对上游快照的偏离第 23 项:新增编辑器专用入口;本目录不重复登记) |
11
+ | 二进制来源 | `cargo build --release --locked -p termide --bin termide-editor`(在 `termide/` 内;Windows 侧走 `--target x86_64-pc-windows-gnu`),产物拷进对应平台叶的 `bin/`(见 `termide/VENDOR.md` 的重编配方) |
12
+
13
+ 本目录不再有"vendored 第三方编辑器的独立台账":载荷来自我们自己的 vendored
14
+ TermIDE 树,上游与偏离口径以 `termide/VENDOR.md` 为准。
package/launcher.js ADDED
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env node
2
+ // @linxiraos/editor launcher — resolves the platform payload from the
3
+ // optionalDependencies leaves and runs it with the arguments it was given.
4
+ //
5
+ // The package deliberately has no `bin`: @linxiraos/editor is not a
6
+ // user-visible command. It is the built-in editor's payload, spawned by path
7
+ // by other programs (the pi-messenger `/editor` command, `$EDITOR` from git /
8
+ // crontab / visudo, and the workbench's own integrations), so consumers
9
+ // resolve the platform leaf's executable and hand it the editor's
10
+ // `FILE[:line[:col]]` positional protocol. This file is the one place that
11
+ // knows the leaf naming, for a consumer that would rather run
12
+ // `node launcher.js notes.md:12:3` than reimplement the resolution.
13
+ //
14
+ // `require("@linxiraos/editor/launcher.js")` exposes `resolveEditor()` for
15
+ // callers that spawn the payload themselves. Node-only: no Bun needed.
16
+
17
+ const fs = require("node:fs");
18
+ const path = require("node:path");
19
+ const { spawn } = require("node:child_process");
20
+
21
+ /** npm package names use "windows"; Node's `process.platform` is "win32". */
22
+ const PKG_PLATFORM = process.platform === "win32" ? "windows" : process.platform;
23
+
24
+ /** The platform leaf that carries the executable. */
25
+ const LEAF_PACKAGE = `@linxiraos/editor-${PKG_PLATFORM}-${process.arch}`;
26
+
27
+ /** The executable's file name inside the leaf package. */
28
+ const LEAF_EXE = process.platform === "win32" ? "termide-editor.exe" : "termide-editor-linux-x64";
29
+
30
+ function die(msg) {
31
+ process.stderr.write(`editor: ${msg}\n`);
32
+ process.exit(1);
33
+ }
34
+
35
+ /**
36
+ * Absolute path to the platform editor executable, or null when the package
37
+ * is not installed for this platform. Resolution goes through Node's own
38
+ * algorithm from this package's directory, so the leaf is found whether it
39
+ * sits beside the launcher (the normal install shape) or nested; `extraRoots`
40
+ * lets a caller that already knows where it looked add its own roots.
41
+ */
42
+ function resolveEditor(extraRoots = []) {
43
+ try {
44
+ const resolved = require.resolve(`${LEAF_PACKAGE}/bin/${LEAF_EXE}`, {
45
+ paths: [__dirname, ...extraRoots],
46
+ });
47
+ fs.accessSync(resolved, fs.constants.X_OK);
48
+ return resolved;
49
+ } catch {
50
+ return null;
51
+ }
52
+ }
53
+
54
+ module.exports = { resolveEditor, LEAF_PACKAGE, LEAF_EXE };
55
+
56
+ if (require.main === module) {
57
+ const binary = resolveEditor();
58
+ if (!binary) {
59
+ die(
60
+ `no binary for ${process.platform}-${process.arch}; ` +
61
+ `install @linxiraos/editor (supported: windows-x64, linux-x64)`,
62
+ );
63
+ }
64
+ // Inherit stdio and forward the exit code: the editor takes over the
65
+ // terminal and the launcher blocks, exactly like the payload it runs.
66
+ const child = spawn(binary, process.argv.slice(2), { stdio: "inherit" });
67
+ child.on("error", err => die(String(err)));
68
+ child.on("close", (code, signal) => {
69
+ if (signal) {
70
+ process.kill(process.pid, signal);
71
+ } else {
72
+ process.exit(code ?? 0);
73
+ }
74
+ });
75
+ }
package/package.json CHANGED
@@ -1,28 +1,27 @@
1
1
  {
2
2
  "name": "@linxiraos/editor",
3
- "version": "1.2.1",
4
- "description": "zetaeditor — the Zeta terminal editor (vendored TTT Editor v1.6.0): single-binary terminal text editor",
3
+ "version": "1.3.0",
4
+ "description": "Zeta's built-in terminal editor (the termide panel-editor, editor-only entry), per-platform binary payload resolved by path",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/Linxira-OS/linxira-zeta.git",
9
9
  "directory": "editor"
10
10
  },
11
- "bin": {
12
- "zetaeditor": "./bin/zeta-editor.js",
13
- "zeta-editor": "./bin/zeta-editor.js",
14
- "zeta-e": "./bin/zeta-editor.js"
15
- },
16
11
  "optionalDependencies": {
17
- "@linxiraos/editor-windows-x64": "1.2.1",
18
- "@linxiraos/editor-linux-x64": "1.2.1"
12
+ "@linxiraos/editor-windows-x64": "1.3.0",
13
+ "@linxiraos/editor-linux-x64": "1.3.0"
19
14
  },
20
15
  "publishConfig": {
21
16
  "access": "public"
22
17
  },
23
18
  "files": [
24
- "bin",
19
+ "launcher.js",
25
20
  "LICENSE",
21
+ "README.md",
26
22
  "VENDOR.md"
27
- ]
23
+ ],
24
+ "engines": {
25
+ "node": ">=18"
26
+ }
28
27
  }
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env node
2
- // @linxiraos/editor launcher: resolves the platform binary installed via
3
- // optionalDependencies and execs it with all arguments forwarded.
4
- "use strict";
5
- const { existsSync } = require("node:fs");
6
- const path = require("node:path");
7
-
8
- // npm package names use "windows"; Node's process.platform is "win32".
9
- const PKG_PLATFORM = process.platform === "win32" ? "windows" : process.platform;
10
- const EXE = process.platform === "win32" ? "ttt.exe" : "ttt-linux-x64";
11
- const PKG = `@linxiraos/editor-${PKG_PLATFORM}-${process.arch}`;
12
-
13
- // Resolve through Node's own algorithm: optionalDependencies may land flat in
14
- // node_modules/@linxiraos/ or nested under our package's node_modules
15
- // depending on the surrounding dependency tree.
16
- let found;
17
- try {
18
- const pkgDir = path.dirname(require.resolve(`${PKG}/package.json`, { paths: [__dirname, ...module.paths] }));
19
- const candidate = path.join(pkgDir, "bin", EXE);
20
- if (existsSync(candidate)) found = candidate;
21
- } catch {
22
- // fall through to the legacy flat-layout probe below
23
- }
24
- if (!found) {
25
- const flat = path.join(__dirname, "..", "..", PKG, "bin", EXE);
26
- if (existsSync(flat)) found = flat;
27
- }
28
- if (!found) {
29
- console.error(`@linxiraos/editor: no binary for ${process.platform}-${process.arch}. Install the matching @linxiraos/editor-* package.`);
30
- process.exit(1);
31
- }
32
- const { spawn } = require("node:child_process");
33
- const child = spawn(found, process.argv.slice(2), { stdio: "inherit" });
34
- child.on("exit", code => process.exit(code ?? 0));