@fishwithcat/dsh-tui 0.0.0-stage → 0.2.2-alpha.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.
@@ -0,0 +1,7 @@
1
+ # Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
2
+ # section, a hash of its English and Chinese blocks outside code blocks and generated regions.
3
+ # After editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write apps/tui-launcher/README.md
5
+ /deepseek-ai-dsh-tui-launcher:
6
+ en: 439609bb2db15ecd
7
+ zh: 146bfa54eb9ee207
package/README.md CHANGED
@@ -1,3 +1,20 @@
1
- # Temporary Holding Version
1
+ # `@deepseek-ai/dsh-tui-launcher`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ English | [中文](README.zh.md)
4
+
5
+ The npm-installed terminal entry. `dsh-tui` creates the `tui` profile when it
6
+ is missing, resolves the installed `@deepseek-ai/dsh` CLI, and runs it with
7
+ `--profile tui`, forwarding every application argument. The packed manifest
8
+ aliases that CLI dependency to this fork's build, so the resolved command is
9
+ the fork's launcher rather than the upstream package. The launcher owns the
10
+ profile choice: `--profile`, `--from-default-profile`, and `dsh plugin` are
11
+ rejected.
12
+
13
+ The published package is `@fishwithcat/dsh-tui`. Its packed manifest replaces
14
+ the workspace dependencies with `npm:` aliases for the fork-only packages, so
15
+ the upstream CLI resolves those names to the fork's builds. Keep the launcher
16
+ and every aliased package on the upstream version; a `-fork.N` version does
17
+ not satisfy the exact ranges upstream packages declare.
18
+
19
+ `dsh-tui watch <session-id>` is translated to `--watch <session-id>`, and
20
+ `dsh-tui --version` does not create a profile.
package/README.zh.md ADDED
@@ -0,0 +1,17 @@
1
+ # `@deepseek-ai/dsh-tui-launcher`
2
+
3
+ [English](README.md) | 中文
4
+
5
+ npm 安装后的终端入口。`dsh-tui` 在 `tui` profile 不存在时创建它,解析已安装的
6
+ `@deepseek-ai/dsh` CLI,并以 `--profile tui` 启动,原样转发应用参数。打包后的
7
+ manifest 把这个 CLI 依赖别名到本 fork 的构建,因此实际解析到的是 fork 的启动器,
8
+ 而不是上游包。profile 由启动器固定:`--profile`、`--from-default-profile` 和
9
+ `dsh plugin` 会被拒绝。
10
+
11
+ 实际发布的包名是 `@fishwithcat/dsh-tui`。打包后的 manifest 会把 workspace
12
+ 依赖替换成指向 fork 包的 `npm:` 别名,让上游 CLI 按同一批依赖名解析到 fork 的
13
+ 构建。启动器和所有被别名的包必须与上游同号;`-fork.N` 不满足上游包声明的精确
14
+ 范围。
15
+
16
+ `dsh-tui watch <session-id>` 会转换成 `--watch <session-id>`,`dsh-tui --version`
17
+ 不会创建 profile。
package/lib/bin.js ADDED
@@ -0,0 +1,117 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from "node:module";
3
+ import { spawn } from "node:child_process";
4
+ import { constants } from "node:os";
5
+ import { existsSync } from "node:fs";
6
+ import { join } from "node:path";
7
+ import { initProfile, resolveProfileDir } from "@deepseek-ai/dsh-app-boot";
8
+ /** Bundle layers a launcher-created `tui` profile starts from. */
9
+ const TUI_PROFILE_BUNDLES = ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-tui-app"];
10
+ /** Launcher flags that would select a different profile. */
11
+ const PROFILE_FLAGS = new Set(["--profile", "--from-default-profile"]);
12
+ /**
13
+ * Turn the launcher arguments into the dsh CLI arguments.
14
+ *
15
+ * The launcher owns the profile, so profile-selection flags and plugin
16
+ * management are rejected. `watch <id>` becomes the equivalent `--watch <id>`
17
+ * application flag, which the CLI routes to the tui profile on its own.
18
+ * @param argv - arguments after the `dsh-tui` command.
19
+ * @returns the arguments for the dsh CLI.
20
+ * @throws when a caller selects a profile or asks for plugin management.
21
+ */
22
+ function launcherCliArgs(argv) {
23
+ for (const argument of argv) {
24
+ const flag = argument.split("=", 1)[0];
25
+ if (flag !== void 0 && PROFILE_FLAGS.has(flag)) throw new Error(`dsh-tui: ${flag} is fixed to "tui"; run dsh directly to select another profile`);
26
+ }
27
+ if (argv[0] === "plugin") throw new Error("dsh-tui: plugin management runs through dsh plugin --profile tui <pnpm arguments>");
28
+ if (argv[0] === "watch") {
29
+ const sessionId = argv[1];
30
+ if (sessionId === void 0) throw new Error("dsh-tui: watch needs a session id");
31
+ return [
32
+ "--profile",
33
+ "tui",
34
+ "--watch",
35
+ sessionId,
36
+ ...argv.slice(2)
37
+ ];
38
+ }
39
+ return [
40
+ "--profile",
41
+ "tui",
42
+ ...argv
43
+ ];
44
+ }
45
+ /**
46
+ * Create the `tui` profile when the directory has no manifest yet.
47
+ *
48
+ * An existing profile is left untouched: it may carry the user's own patch
49
+ * layer and plugin list, and the bundle names resolve from the launcher's
50
+ * installation before the profile anyway.
51
+ * @param dir - profile directory; defaults to `$DSH_HOME/profiles/tui`.
52
+ * @returns the profile directory.
53
+ */
54
+ function ensureTuiProfile(dir = resolveProfileDir("tui")) {
55
+ if (!existsSync(join(dir, "package.json"))) initProfile(dir, TUI_PROFILE_BUNDLES);
56
+ return dir;
57
+ }
58
+ /**
59
+ * Resolve the installed CLI entry from the launcher's own installation.
60
+ * @param resolve - Node resolution function anchored at this launcher.
61
+ * @returns the absolute path of the dsh bin script.
62
+ */
63
+ function resolveCliEntry(resolve) {
64
+ return resolve("@deepseek-ai/dsh/lib/bin.js");
65
+ }
66
+ /**
67
+ * Whether the invocation only asks for the CLI version and must not create a
68
+ * profile.
69
+ * @param argv - normalized CLI arguments.
70
+ * @returns true when the invocation carries a version flag.
71
+ */
72
+ function isVersionRequest(argv) {
73
+ return argv.some((argument) => argument === "--version" || argument === "-V");
74
+ }
75
+ //#endregion
76
+ //#region lib/types/bin.js
77
+ /* v8 ignore file -- self-executing entry; launch.ts owns the tested decisions. */
78
+ /**
79
+ * Stop the launcher with one stderr line.
80
+ * @param message - diagnostic text.
81
+ * @param code - process exit status.
82
+ * @returns never.
83
+ */
84
+ function fail(message, code) {
85
+ process.stderr.write(`${message}\n`);
86
+ process.exit(code);
87
+ }
88
+ const require = createRequire(import.meta.url);
89
+ const invocation = (() => {
90
+ try {
91
+ const args = launcherCliArgs(process.argv.slice(2));
92
+ if (!isVersionRequest(args)) ensureTuiProfile();
93
+ return {
94
+ args,
95
+ entry: resolveCliEntry(require.resolve)
96
+ };
97
+ } catch (error) {
98
+ fail(error instanceof Error ? error.message : String(error), 1);
99
+ }
100
+ })();
101
+ const child = spawn(process.execPath, [invocation.entry, ...invocation.args], {
102
+ stdio: "inherit",
103
+ env: process.env
104
+ });
105
+ process.on("SIGINT", () => {});
106
+ process.on("SIGTERM", () => {
107
+ child.kill("SIGTERM");
108
+ });
109
+ child.on("error", (error) => {
110
+ fail(`dsh-tui: ${error.message}`, 1);
111
+ });
112
+ child.on("exit", (code, signal) => {
113
+ if (signal !== null) process.exit(128 + constants.signals[signal]);
114
+ process.exit(code ?? 1);
115
+ });
116
+ //#endregion
117
+ export {};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Launcher decisions for the npm-installed terminal entry: argument
3
+ * normalization, the fresh `tui` profile, and the CLI entry lookup.
4
+ * @module @deepseek-ai/dsh-tui-launcher/launch
5
+ */
6
+ /** Profile this launcher always boots. */
7
+ export declare const TUI_PROFILE = "tui";
8
+ /** Bundle layers a launcher-created `tui` profile starts from. */
9
+ export declare const TUI_PROFILE_BUNDLES: readonly string[];
10
+ /**
11
+ * Turn the launcher arguments into the dsh CLI arguments.
12
+ *
13
+ * The launcher owns the profile, so profile-selection flags and plugin
14
+ * management are rejected. `watch <id>` becomes the equivalent `--watch <id>`
15
+ * application flag, which the CLI routes to the tui profile on its own.
16
+ * @param argv - arguments after the `dsh-tui` command.
17
+ * @returns the arguments for the dsh CLI.
18
+ * @throws when a caller selects a profile or asks for plugin management.
19
+ */
20
+ export declare function launcherCliArgs(argv: readonly string[]): string[];
21
+ /**
22
+ * Create the `tui` profile when the directory has no manifest yet.
23
+ *
24
+ * An existing profile is left untouched: it may carry the user's own patch
25
+ * layer and plugin list, and the bundle names resolve from the launcher's
26
+ * installation before the profile anyway.
27
+ * @param dir - profile directory; defaults to `$DSH_HOME/profiles/tui`.
28
+ * @returns the profile directory.
29
+ */
30
+ export declare function ensureTuiProfile(dir?: string): string;
31
+ /**
32
+ * Resolve the installed CLI entry from the launcher's own installation.
33
+ * @param resolve - Node resolution function anchored at this launcher.
34
+ * @returns the absolute path of the dsh bin script.
35
+ */
36
+ export declare function resolveCliEntry(resolve: (specifier: string) => string): string;
37
+ /**
38
+ * Whether the invocation only asks for the CLI version and must not create a
39
+ * profile.
40
+ * @param argv - normalized CLI arguments.
41
+ * @returns true when the invocation carries a version flag.
42
+ */
43
+ export declare function isVersionRequest(argv: readonly string[]): boolean;
44
+ //# sourceMappingURL=launch.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "@fishwithcat/dsh-tui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "The npm-installable terminal entry: creates the tui profile and launches the installed dsh CLI",
4
+ "version": "0.2.2-alpha.2",
5
+ "type": "module",
6
+ "bin": {
7
+ "dsh-tui": "lib/bin.js"
8
+ },
9
+ "files": [
10
+ "lib/*.js",
11
+ "lib/types/*.d.ts"
12
+ ],
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/FishwithCat/deepseek-harness-tui",
17
+ "directory": "apps/tui-launcher"
18
+ },
19
+ "engines": {
20
+ "node": ">=24.9.0"
21
+ },
22
+ "dependencies": {
23
+ "@deepseek-ai/dsh": "npm:@fishwithcat/dsh@0.2.2-alpha.2",
24
+ "@deepseek-ai/dsh-app-boot": "0.2.2-alpha.2",
25
+ "@deepseek-ai/dsh-base": "0.2.2-alpha.2",
26
+ "@deepseek-ai/dsh-agent": "npm:@fishwithcat/dsh-agent@0.2.2-alpha.2",
27
+ "@deepseek-ai/dsh-session": "npm:@fishwithcat/dsh-session@0.2.2-alpha.2",
28
+ "@deepseek-ai/dsh-user-approval": "npm:@fishwithcat/dsh-user-approval@0.2.2-alpha.2",
29
+ "@deepseek-ai/dsh-tool-ask-user": "npm:@fishwithcat/dsh-tool-ask-user@0.2.2-alpha.2",
30
+ "@deepseek-ai/dsh-compaction": "npm:@fishwithcat/dsh-compaction@0.2.2-alpha.2",
31
+ "@deepseek-ai/dsh-compaction-basic": "npm:@fishwithcat/dsh-compaction-basic@0.2.2-alpha.2",
32
+ "@deepseek-ai/dsh-subagent": "npm:@fishwithcat/dsh-subagent@0.2.2-alpha.2",
33
+ "@deepseek-ai/dsh-tool-todo": "npm:@fishwithcat/dsh-tool-todo@0.2.2-alpha.2",
34
+ "@deepseek-ai/dsh-tui-app": "npm:@fishwithcat/dsh-tui-app@0.2.2-alpha.2"
35
+ }
36
+ }