@linzumi/cli 0.0.19-beta → 0.0.22-beta
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 +70 -69
- package/bin/linzumi.js +10 -18
- package/dist/assets/linzumi-logo.svg +1 -0
- package/dist/index.js +9135 -0
- package/package.json +9 -4
- package/src/agentBootstrap.ts +0 -872
- package/src/authCache.ts +0 -157
- package/src/authResolution.ts +0 -77
- package/src/boundedCache.ts +0 -57
- package/src/channelSession.ts +0 -4301
- package/src/channelSessionSupport.ts +0 -308
- package/src/codexAppServer.ts +0 -380
- package/src/codexOutput.ts +0 -846
- package/src/codexRuntimeOptions.ts +0 -80
- package/src/dependencyStatus.ts +0 -198
- package/src/forwardTunnel.ts +0 -859
- package/src/forwardTunnelProtocol.ts +0 -324
- package/src/index.ts +0 -1079
- package/src/json.ts +0 -49
- package/src/kandanQueue.ts +0 -113
- package/src/kandanTls.ts +0 -86
- package/src/localCapabilities.ts +0 -143
- package/src/localCodexMessageState.ts +0 -135
- package/src/localCodexTurnState.ts +0 -108
- package/src/localConfig.ts +0 -99
- package/src/localEditor.ts +0 -1061
- package/src/localEditorRuntime.ts +0 -717
- package/src/localForwarding.ts +0 -523
- package/src/oauth.ts +0 -425
- package/src/pendingKandanMessageQueue.ts +0 -109
- package/src/phoenix.ts +0 -359
- package/src/portForwardApproval.ts +0 -181
- package/src/portForwardWatcher.ts +0 -404
- package/src/protocol.ts +0 -321
- package/src/runner.ts +0 -943
- package/src/runnerConsoleReporter.ts +0 -142
- package/src/runnerLogger.ts +0 -50
- package/src/streamDeltaCoalescing.ts +0 -129
- package/src/streamDeltaQueue.ts +0 -102
package/src/localConfig.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
- Date: 2026-05-01
|
|
3
|
-
Spec: ../../kandan/server_v2/plans/2026-05-01-runner-editor-dropdown-and-thread-controls.md
|
|
4
|
-
Relationship: Owns the npm-first local runner's trusted-folder config at
|
|
5
|
-
~/.linzumi/config.json so README path-management commands are product truth.
|
|
6
|
-
*/
|
|
7
|
-
import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
8
|
-
import { homedir } from "node:os";
|
|
9
|
-
import { dirname, resolve } from "node:path";
|
|
10
|
-
import { expandUserPath } from "./localCapabilities";
|
|
11
|
-
|
|
12
|
-
export type LinzumiConfig = {
|
|
13
|
-
readonly version: 1;
|
|
14
|
-
readonly allowedCwds: readonly string[];
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export function localConfigPath(env: NodeJS.ProcessEnv = process.env): string {
|
|
18
|
-
const override = env.LINZUMI_CONFIG_FILE;
|
|
19
|
-
|
|
20
|
-
return override !== undefined && override.trim() !== ""
|
|
21
|
-
? resolve(expandUserPath(override))
|
|
22
|
-
: resolve(homedir(), ".linzumi", "config.json");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function readLocalConfig(path: string = localConfigPath()): LinzumiConfig {
|
|
26
|
-
if (!existsSync(path)) {
|
|
27
|
-
return { version: 1, allowedCwds: [] };
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const parsed = JSON.parse(readFileSync(path, "utf8")) as unknown;
|
|
31
|
-
|
|
32
|
-
if (!isConfigPayload(parsed)) {
|
|
33
|
-
throw new Error(`invalid Linzumi config: ${path}`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
version: 1,
|
|
38
|
-
allowedCwds: uniqueStrings(parsed.allowedCwds),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function readConfiguredAllowedCwds(path: string = localConfigPath()): string[] {
|
|
43
|
-
return readLocalConfig(path).allowedCwds.map((cwd) => {
|
|
44
|
-
try {
|
|
45
|
-
return realpathSync(resolve(expandUserPath(cwd)));
|
|
46
|
-
} catch (_error) {
|
|
47
|
-
throw new Error(`invalid Linzumi config allowed path: ${cwd} does not exist`);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function addAllowedCwd(pathValue: string, path: string = localConfigPath()): string[] {
|
|
53
|
-
const normalizedPath = realpathSync(resolve(expandUserPath(pathValue)));
|
|
54
|
-
const config = readLocalConfig(path);
|
|
55
|
-
const allowedCwds = uniqueStrings([...config.allowedCwds, normalizedPath]);
|
|
56
|
-
writeLocalConfig({ version: 1, allowedCwds }, path);
|
|
57
|
-
return allowedCwds;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function removeAllowedCwd(pathValue: string, path: string = localConfigPath()): string[] {
|
|
61
|
-
const requestedPath = resolve(expandUserPath(pathValue));
|
|
62
|
-
const normalizedRequest = realpathOrResolved(requestedPath);
|
|
63
|
-
const config = readLocalConfig(path);
|
|
64
|
-
const allowedCwds = config.allowedCwds.filter((cwd) => {
|
|
65
|
-
const normalizedExisting = realpathOrResolved(cwd);
|
|
66
|
-
return cwd !== pathValue && normalizedExisting !== normalizedRequest;
|
|
67
|
-
});
|
|
68
|
-
writeLocalConfig({ version: 1, allowedCwds }, path);
|
|
69
|
-
return allowedCwds;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function writeLocalConfig(config: LinzumiConfig, path: string = localConfigPath()): void {
|
|
73
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
74
|
-
writeFileSync(path, `${JSON.stringify(config, null, 2)}\n`, "utf8");
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function isConfigPayload(value: unknown): value is LinzumiConfig {
|
|
78
|
-
return (
|
|
79
|
-
typeof value === "object" &&
|
|
80
|
-
value !== null &&
|
|
81
|
-
(value as { readonly version?: unknown }).version === 1 &&
|
|
82
|
-
Array.isArray((value as { readonly allowedCwds?: unknown }).allowedCwds) &&
|
|
83
|
-
(value as { readonly allowedCwds: readonly unknown[] }).allowedCwds.every(
|
|
84
|
-
(cwd) => typeof cwd === "string" && cwd.trim() !== "",
|
|
85
|
-
)
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function uniqueStrings(values: readonly string[]): string[] {
|
|
90
|
-
return [...new Set(values.map((value) => value.trim()).filter((value) => value !== ""))];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function realpathOrResolved(pathValue: string): string {
|
|
94
|
-
try {
|
|
95
|
-
return realpathSync(resolve(expandUserPath(pathValue)));
|
|
96
|
-
} catch (_error) {
|
|
97
|
-
return resolve(expandUserPath(pathValue));
|
|
98
|
-
}
|
|
99
|
-
}
|