kiteline 0.3.1 → 0.3.2
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/README.md
CHANGED
|
@@ -27,7 +27,7 @@ It's self-hosted: your phone talks straight to your computer, and Claude Code ke
|
|
|
27
27
|
You need Node.js 22.18 or newer, and Claude Code signed in on the computer.
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
npx kiteline --relay
|
|
30
|
+
npx kiteline --relay # or: pnpm dlx kiteline --relay, or: bunx kiteline --relay
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Scan the QR code it prints with your phone's camera, check that the phone and the terminal show the same six digits, and allow it: you're in, on any network. `--relay` connects through Kiteline's relay, sealed end to end: it passes your sessions on without being able to read them. Leave it out to keep Kiteline to your own Wi-Fi, or [use Tailscale](https://kiteline.seefun.dev/docs/#tailscale).
|
|
@@ -35,7 +35,7 @@ Scan the QR code it prints with your phone's camera, check that the phone and th
|
|
|
35
35
|
To keep it running in the background, starting with your computer (Linux):
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
npm install -g kiteline
|
|
38
|
+
npm install -g kiteline # or: pnpm add -g kiteline, or: bun add -g kiteline
|
|
39
39
|
kiteline service install --relay
|
|
40
40
|
```
|
|
41
41
|
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as version } from "./package-
|
|
2
|
+
import { t as version } from "./package-D0hl72v4.mjs";
|
|
3
3
|
import { h as startedFromCli, i as dim, r as bold, t as accent } from "./banner-C1Jj4n4W.mjs";
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
5
5
|
// src/cli.ts
|
|
@@ -107,7 +107,7 @@ switch (command) {
|
|
|
107
107
|
case void 0:
|
|
108
108
|
case "start":
|
|
109
109
|
if (action) fail(`"${action}" isn't something Kiteline takes. Run ${bold("kiteline --help")}.`);
|
|
110
|
-
await import("./src-
|
|
110
|
+
await import("./src-DekrqcQL.mjs");
|
|
111
111
|
break;
|
|
112
112
|
case "pair": {
|
|
113
113
|
if (action) fail(`"${action}" isn't something kiteline pair takes. Run ${bold("kiteline --help")}.`);
|
|
@@ -122,7 +122,7 @@ switch (command) {
|
|
|
122
122
|
break;
|
|
123
123
|
}
|
|
124
124
|
case "service": {
|
|
125
|
-
const { service } = await import("./service-
|
|
125
|
+
const { service } = await import("./service-Fzh98Meh.mjs");
|
|
126
126
|
await service(action, { force: values.force === true });
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
@@ -2,7 +2,7 @@ import { a as localAddress, r as kitelineHome } from "./auth-CYNu-f_h.mjs";
|
|
|
2
2
|
import { d as SettingsError, i as dim, m as readSettings, r as bold, t as accent } from "./banner-C1Jj4n4W.mjs";
|
|
3
3
|
import { homedir, userInfo } from "node:os";
|
|
4
4
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
|
-
import { delimiter, dirname, join } from "node:path";
|
|
5
|
+
import { delimiter, dirname, join, resolve } from "node:path";
|
|
6
6
|
import { spawnSync } from "node:child_process";
|
|
7
7
|
// src/service.ts
|
|
8
8
|
/**
|
|
@@ -62,7 +62,41 @@ function shellPath() {
|
|
|
62
62
|
const kept = (process.env.PATH ?? "").split(delimiter).filter(Boolean).filter((folder) => !/[\\/]_npx[\\/]|node_modules[\\/]\.bin/.test(folder));
|
|
63
63
|
return [...new Set(kept)].join(delimiter) || "/usr/local/bin:/usr/bin:/bin";
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
/** One-off runners keep their copy only for a while; each one's own way to install it for good. */
|
|
66
|
+
const RUNNERS = [
|
|
67
|
+
{
|
|
68
|
+
pattern: /[\\/]_npx[\\/]/,
|
|
69
|
+
name: "npx",
|
|
70
|
+
install: "npm install -g kiteline"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
pattern: /[\\/]dlx[\\/]/,
|
|
74
|
+
name: "pnpm dlx",
|
|
75
|
+
install: "pnpm add -g kiteline"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
pattern: /[\\/]bunx-/,
|
|
79
|
+
name: "bunx",
|
|
80
|
+
install: "bun add -g kiteline"
|
|
81
|
+
}
|
|
82
|
+
];
|
|
83
|
+
/**
|
|
84
|
+
* What the service runs. npm and bun install Kiteline at a path that stays put across updates, so the
|
|
85
|
+
* service runs that file with this Node. pnpm keeps each global install in a folder of its own and
|
|
86
|
+
* points its `kiteline` command at the current one, so there the service runs that command, which
|
|
87
|
+
* still finds Kiteline after an update.
|
|
88
|
+
*/
|
|
89
|
+
function launcher(script, node) {
|
|
90
|
+
const given = resolve(script);
|
|
91
|
+
const real = realpathSync(given);
|
|
92
|
+
const pnpmHome = /^(.*?)[\\/]global[\\/]v?\d+[\\/]/.exec(given)?.[1];
|
|
93
|
+
if (pnpmHome && /[\\/]\.pnpm[\\/]/.test(real)) {
|
|
94
|
+
const command = [join(pnpmHome, "bin", "kiteline"), join(pnpmHome, "kiteline")].find((shim) => existsSync(shim));
|
|
95
|
+
if (command) return [command];
|
|
96
|
+
}
|
|
97
|
+
return [node, real];
|
|
98
|
+
}
|
|
99
|
+
function unitText(command) {
|
|
66
100
|
const settings = KEPT.flatMap((key) => {
|
|
67
101
|
const value = process.env[key]?.trim();
|
|
68
102
|
return value ? [`Environment=${quote(`${key}=${value}`)}`] : [];
|
|
@@ -76,7 +110,7 @@ Wants=network-online.target
|
|
|
76
110
|
|
|
77
111
|
[Service]
|
|
78
112
|
Type=simple
|
|
79
|
-
ExecStart=${
|
|
113
|
+
ExecStart=${command.map((part) => quote(part, { command: true })).join(" ")}
|
|
80
114
|
${settings.length ? `${settings.join("\n")}\n` : ""}# Claude Code's Bash tool runs with this shell and finds tools in these folders, as in your terminal.
|
|
81
115
|
Environment=${quote(`SHELL=${process.env.SHELL || "/bin/sh"}`)}
|
|
82
116
|
Environment=${quote(`PATH=${shellPath()}`)}
|
|
@@ -94,8 +128,10 @@ async function answers(url) {
|
|
|
94
128
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
95
129
|
async function install({ force }) {
|
|
96
130
|
requireSystemd();
|
|
97
|
-
const script =
|
|
98
|
-
|
|
131
|
+
const script = process.argv[1] ?? "";
|
|
132
|
+
const real = realpathSync(script);
|
|
133
|
+
const runner = RUNNERS.find(({ pattern }) => pattern.test(real) || pattern.test(script));
|
|
134
|
+
if (runner) fail(`This copy of Kiteline came from ${runner.name}, which may clear it out later, and a service needs one that stays.`, "Install it, then set up the service with that copy:", "", ` ${accent(runner.install)}`, ` ${accent("kiteline service install")}`);
|
|
99
135
|
let settings;
|
|
100
136
|
try {
|
|
101
137
|
settings = readSettings();
|
|
@@ -110,7 +146,7 @@ async function install({ force }) {
|
|
|
110
146
|
if (!(systemctl("is-active", NAME).stdout.trim() === "active") && await answers(url)) fail(`Something already answers on port ${settings.port}, perhaps Kiteline in another terminal.`, `Stop it first (Ctrl C in its window), then run ${bold("kiteline service install")} again.`);
|
|
111
147
|
mkdirSync(dirname(file), { recursive: true });
|
|
112
148
|
if (existing !== null && !existing.includes(MARK)) copyFileSync(file, `${file}.bak`);
|
|
113
|
-
writeFileSync(file, unitText(process.execPath
|
|
149
|
+
writeFileSync(file, unitText(launcher(script, process.execPath)));
|
|
114
150
|
const serverFile = join(kitelineHome(settings.home), "server.json");
|
|
115
151
|
const before = existsSync(serverFile) ? statSync(serverFile).mtimeMs : 0;
|
|
116
152
|
for (const step of [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as runWithSpan, C as isObject$1, D as parseEmptyableJSON, E as overlayProxy, M as toArray, N as value, S as isAsyncIteratorObject, T as onError, _ as toORPCError, a as toHttpPath, b as asyncIteratorWithSpan, c as toStandardLazyRequest, d as HibernationEventIterator, f as flattenHeader, g as isORPCErrorStatus, h as fallbackORPCErrorStatus, i as StandardRPCSerializer, j as setSpanError, k as resolveMaybeOptionalOptions, n as StandardRPCJsonSerializer, p as ORPCError, s as toFetchResponse, u as mapEventIterator, v as NullProtoObj, w as isTypescriptObject, x as intercept, y as ORPC_NAME } from "./client.BPI7fHX3-CSey2FaL.mjs";
|
|
2
|
-
import { t as version$1 } from "./package-
|
|
2
|
+
import { t as version$1 } from "./package-D0hl72v4.mjs";
|
|
3
3
|
import { a as localAddress, c as safeEqual, i as loadComputerKey, l as saveServerInfo, n as PairLimiter, r as kitelineHome, t as DEVICE_COOKIE } from "./auth-CYNu-f_h.mjs";
|
|
4
4
|
import { _ as RelayPath, a as pairingLinks, b as relaySocketUrl, c as printPairingCode, d as SettingsError, f as command, g as RelayClose, i as dim, l as printSettingsError, m as readSettings, n as addressesFor, o as printAlreadyRunning, r as bold, s as printBanner, t as accent, u as spaced, v as fromBase64Url, x as toBase64Url, y as hostIdFor } from "./banner-C1Jj4n4W.mjs";
|
|
5
5
|
import { homedir, hostname, platform } from "node:os";
|