dsh-bash-terminal-ts 0.9.0 → 0.9.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +205 -201
  2. package/CHANGELOG.pt.md +151 -0
  3. package/README.de.md +206 -206
  4. package/README.en.md +212 -212
  5. package/README.es.md +206 -206
  6. package/README.fr.md +206 -206
  7. package/README.it.md +206 -206
  8. package/README.md +423 -423
  9. package/README.pt.md +212 -0
  10. package/README.ru.md +206 -206
  11. package/agent-presets/README.md +171 -171
  12. package/agent-presets/install-presets.mjs +180 -180
  13. package/agent-presets/standard-win/agent.cordis.yml +271 -271
  14. package/agent-presets/standard-win/preset.yml +2 -2
  15. package/agent-presets/standard-win-gitbash/agent.cordis.yml +271 -271
  16. package/agent-presets/standard-win-gitbash/preset.yml +2 -2
  17. package/agent-presets/standard-win-msys2/agent.cordis.yml +272 -272
  18. package/agent-presets/standard-win-msys2/preset.yml +2 -2
  19. package/agent-presets/standard-win-niu/agent.cordis.yml +270 -270
  20. package/agent-presets/standard-win-niu/preset.yml +2 -2
  21. package/agent-presets/standard-win-payload/agent.cordis.yml +271 -271
  22. package/agent-presets/standard-win-payload/preset.yml +2 -2
  23. package/agent-presets/standard-win-wsl2/agent.cordis.yml +271 -271
  24. package/agent-presets/standard-win-wsl2/preset.yml +2 -2
  25. package/cordis.patch.yml +72 -84
  26. package/dist/client.core.js +54 -16
  27. package/dist/client.js +54 -16
  28. package/docs/niu-backend.md +197 -197
  29. package/dsh.plugin.json +23 -22
  30. package/lib/client.js +54 -16
  31. package/lib/dsh-types.d.ts +0 -2
  32. package/lib/index.d.ts +2 -23
  33. package/lib/index.js +4 -34
  34. package/lib/locales.js +49 -11
  35. package/lib/payload.d.ts +72 -72
  36. package/lib/payload.js +279 -279
  37. package/lib/shell-id.d.ts +2 -2
  38. package/lib/shells.d.ts +2 -11
  39. package/lib/shells.js +4 -14
  40. package/lib/terminal.js +0 -1
  41. package/lib/webterminals/catalog.d.ts +0 -2
  42. package/lib/webterminals/catalog.js +0 -1
  43. package/lib/webterminals/mount.d.ts +0 -5
  44. package/lib/webterminals/mount.js +0 -4
  45. package/locale/de.json +5 -5
  46. package/locale/en.json +5 -5
  47. package/locale/es.json +5 -5
  48. package/locale/fr.json +5 -5
  49. package/locale/it.json +5 -5
  50. package/locale/ja.json +5 -5
  51. package/locale/ko.json +5 -5
  52. package/locale/pt.json +6 -0
  53. package/locale/ru.json +5 -5
  54. package/locale/zh.json +5 -5
  55. package/package.json +3 -5
  56. package/scripts/check-artifacts.mjs +96 -96
  57. package/scripts/link-shells.mjs +0 -21
  58. package/src/client.tsx +685 -685
  59. package/src/dsh-types.ts +330 -332
  60. package/src/index.ts +1267 -1316
  61. package/src/locales.ts +499 -461
  62. package/src/shell-id.ts +11 -11
  63. package/src/shells.ts +263 -279
  64. package/src/terminal.ts +615 -616
  65. package/src/webterminals/catalog.ts +0 -3
  66. package/src/webterminals/host.ts +361 -361
  67. package/src/webterminals/mount.ts +228 -237
  68. package/scripts/payload-alias.mjs +0 -97
  69. package/scripts/provision-payload.mjs +0 -233
  70. package/src/payload.ts +0 -322
package/lib/terminal.js CHANGED
@@ -49,7 +49,6 @@ export function terminalArgv(shell, paths, distro) {
49
49
  switch (shell) {
50
50
  case "powershell": return [paths.pwsh, "-NoLogo", "-NoProfile"];
51
51
  case "gitbash": return [paths.gitbash, "-i"];
52
- case "payload": return [paths.payload, "-i"];
53
52
  case "niu":
54
53
  // Interactive non-login: reads ~/.niubashrc (the only startup file niu
55
54
  // reads on Windows), keeps the user's prompt and colours.
@@ -16,8 +16,6 @@ export interface CatalogSource {
16
16
  paths(): ResolvedPaths;
17
17
  switches(): ShellSwitches;
18
18
  wslDistro(): string;
19
- /** Why the payload row has no path: vetoed by a detected WSL distro. */
20
- payloadSuppressed(): boolean;
21
19
  /** Cached distro list; undefined means "unknown", [] means "none installed". */
22
20
  distros(): readonly string[] | undefined;
23
21
  }
@@ -75,7 +75,6 @@ export function createCatalogProvider(source, now = Date.now) {
75
75
  distros: source.distros(),
76
76
  switches: source.switches(),
77
77
  wslDistro: source.wslDistro(),
78
- payloadSuppressed: source.payloadSuppressed(),
79
78
  });
80
79
  return {
81
80
  catalog: () => {
@@ -30,11 +30,6 @@ export interface MountInput {
30
30
  * service instance only exists here, so it is passed back in.
31
31
  */
32
32
  persist(svc: unknown, path: readonly string[], value: unknown): Promise<void>;
33
- /**
34
- * True when the startup payload gate was vetoed by a detected WSL distro
35
- * (index.ts owns the answer; the catalog only uses it for the row badge).
36
- */
37
- payloadSuppressed?(): boolean;
38
33
  platform?: NodeJS.Platform;
39
34
  }
40
35
  /** The mount outcome, reported through the routes' `unavailable` field. */
@@ -62,9 +62,6 @@ export function mountBrowserTerminals(input) {
62
62
  gitbash: readField("shellGitBash", true),
63
63
  msys2: readField("shellMsys2", true),
64
64
  wsl: readField("shellWsl", true),
65
- // Opt-in twice over: enablePosixPayload provisions the runtime, this
66
- // switch decides whether a provisioned payload may show in pickers.
67
- payload: readField("shellPayload", false),
68
65
  niu: readField("shellNiu", true),
69
66
  });
70
67
  const wslDistro = () => readField("wslDistro", "").trim();
@@ -98,7 +95,6 @@ export function mountBrowserTerminals(input) {
98
95
  paths: () => input.paths,
99
96
  switches,
100
97
  wslDistro,
101
- payloadSuppressed: input.payloadSuppressed ?? (() => false),
102
98
  distros: () => {
103
99
  if (distros === undefined && !probing)
104
100
  reprobe();
package/locale/de.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "meta": {
3
- "title": "Unteres Terminal",
4
- "description": "Shell-Werkzeug plus eingebettetes Terminal im unteren Dock (PowerShell / Git Bash / MSYS2 / WSL / Niubash), mit Aktivierung pro Shell und Rückfallkette."
5
- }
1
+ {
2
+ "meta": {
3
+ "title": "Unteres Terminal",
4
+ "description": "Shell-Werkzeug plus eingebettetes Terminal im unteren Dock (PowerShell / Git Bash / MSYS2 / WSL / Niubash), mit Aktivierung pro Shell und Rückfallkette."
5
+ }
6
6
  }
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "meta": {
3
- "title": "Bottom terminal",
4
- "description": "The shell tool plus an embedded terminal for the bottom dock (PowerShell / Git Bash / MSYS2 / WSL / Niubash), with per-shell activation switches and a default-shell fallback chain."
5
- }
1
+ {
2
+ "meta": {
3
+ "title": "Bottom terminal",
4
+ "description": "The shell tool plus an embedded terminal for the bottom dock (PowerShell / Git Bash / MSYS2 / WSL / Niubash), with per-shell activation switches and a default-shell fallback chain."
5
+ }
6
6
  }
package/locale/es.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "meta": {
3
- "title": "Terminal inferior",
4
- "description": "La herramienta shell y un terminal incrustado del panel inferior (PowerShell / Git Bash / MSYS2 / WSL / Niubash), con activación por shell y cadena de sustitución."
5
- }
1
+ {
2
+ "meta": {
3
+ "title": "Terminal inferior",
4
+ "description": "La herramienta shell y un terminal incrustado del panel inferior (PowerShell / Git Bash / MSYS2 / WSL / Niubash), con activación por shell y cadena de sustitución."
5
+ }
6
6
  }
package/locale/fr.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "meta": {
3
- "title": "Terminal inférieur",
4
- "description": "L'outil shell et un terminal intégré du dock bas (PowerShell / Git Bash / MSYS2 / WSL / Niubash), avec activation par shell et chaîne de repli."
5
- }
1
+ {
2
+ "meta": {
3
+ "title": "Terminal inférieur",
4
+ "description": "L'outil shell et un terminal intégré du dock bas (PowerShell / Git Bash / MSYS2 / WSL / Niubash), avec activation par shell et chaîne de repli."
5
+ }
6
6
  }
package/locale/it.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "meta": {
3
- "title": "Terminale inferiore",
4
- "description": "Strumento shell e terminale incorporato del dock inferiore (PowerShell / Git Bash / MSYS2 / WSL / Niubash), con attivazione per shell e catena di ripiego."
5
- }
1
+ {
2
+ "meta": {
3
+ "title": "Terminale inferiore",
4
+ "description": "Strumento shell e terminale incorporato del dock inferiore (PowerShell / Git Bash / MSYS2 / WSL / Niubash), con attivazione per shell e catena di ripiego."
5
+ }
6
6
  }
package/locale/ja.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "meta": {
3
- "title": "下部ターミナル",
4
- "description": "shell ツールと下部ドックの埋め込みターミナル(PowerShell / Git Bash / MSYS2 / WSL / Niubash)。shell 単位の有効化スイッチと既定 shell の代替チェーン付き。"
5
- }
1
+ {
2
+ "meta": {
3
+ "title": "下部ターミナル",
4
+ "description": "shell ツールと下部ドックの埋め込みターミナル(PowerShell / Git Bash / MSYS2 / WSL / Niubash)。shell 単位の有効化スイッチと既定 shell の代替チェーン付き。"
5
+ }
6
6
  }
package/locale/ko.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "meta": {
3
- "title": "하단 터미널",
4
- "description": "shell 도구와 하단 독의 내장 터미널(PowerShell / Git Bash / MSYS2 / WSL / Niubash). shell별 활성화 스위치와 기본 shell 대체 체인을 제공합니다."
5
- }
1
+ {
2
+ "meta": {
3
+ "title": "하단 터미널",
4
+ "description": "shell 도구와 하단 독의 내장 터미널(PowerShell / Git Bash / MSYS2 / WSL / Niubash). shell별 활성화 스위치와 기본 shell 대체 체인을 제공합니다."
5
+ }
6
6
  }
package/locale/pt.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Terminal inferior",
4
+ "description": "A ferramenta shell e o terminal embutido do painel inferior (PowerShell / Git Bash / MSYS2 / WSL / Niubash), com chaves de ativação por shell e cadeia de fallback do shell padrão."
5
+ }
6
+ }
package/locale/ru.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "meta": {
3
- "title": "Нижний терминал",
4
- "description": "Инструмент shell и встроенный терминал нижней панели (PowerShell / Git Bash / MSYS2 / WSL / Niubash) с активацией по оболочкам и цепочкой замещения."
5
- }
1
+ {
2
+ "meta": {
3
+ "title": "Нижний терминал",
4
+ "description": "Инструмент shell и встроенный терминал нижней панели (PowerShell / Git Bash / MSYS2 / WSL / Niubash) с активацией по оболочкам и цепочкой замещения."
5
+ }
6
6
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "meta": {
3
- "title": "底部终端",
4
- "description": "shell 工具与底部工作台终端(PowerShell / Git Bash / MSYS2 / WSL / Niubash),带激活开关与默认 shell 回落链。"
5
- }
1
+ {
2
+ "meta": {
3
+ "title": "底部终端",
4
+ "description": "shell 工具与底部工作台终端(PowerShell / Git Bash / MSYS2 / WSL / Niubash),带激活开关与默认 shell 回落链。"
5
+ }
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-bash-terminal-ts",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "tag": "latest"
@@ -61,11 +61,13 @@
61
61
  "README.it.md",
62
62
  "README.ru.md",
63
63
  "README.es.md",
64
+ "README.pt.md",
64
65
  "CHANGELOG.de.md",
65
66
  "CHANGELOG.fr.md",
66
67
  "CHANGELOG.it.md",
67
68
  "CHANGELOG.ru.md",
68
69
  "CHANGELOG.es.md",
70
+ "CHANGELOG.pt.md",
69
71
  "LICENSE",
70
72
  "CHANGELOG.md",
71
73
  "cordis.patch.yml",
@@ -80,7 +82,6 @@
80
82
  "test": "node test-dist/unit.js && node test-dist/apply.js && node test-dist/client.js && node test-dist/terminal.js && node test-dist/shells.js && node test-dist/webterminals.js && node test/browser.mjs",
81
83
  "lint": "eslint .",
82
84
  "link:shells": "node scripts/link-shells.mjs",
83
- "payload:provision": "node scripts/provision-payload.mjs",
84
85
  "presets:install": "node agent-presets/install-presets.mjs"
85
86
  },
86
87
  "dsh": {
@@ -95,9 +96,6 @@
95
96
  ]
96
97
  }
97
98
  },
98
- "optionalDependencies": {
99
- "@drscrewdriver/posix-runtime-win32-x64": "0.1.2"
100
- },
101
99
  "peerDependencies": {
102
100
  "@deepseek-ai/cordis": "^4.0.2",
103
101
  "@deepseek-ai/dsh-client-locale": ">=0.1.0-rc.2 <0.3.0-0",
@@ -1,96 +1,96 @@
1
- // Artifact gates: the checks that only make sense against the BUILT bundle.
2
- //
3
- // Unit tests cannot see these. Every one of them is a failure mode that ships
4
- // green through `tsc` and then dies silently in the browser:
5
- //
6
- // - `__ModuleLoader__.load({ id })` must equal the package name, or the host never
7
- // binds the client half and the whole UI side goes dark without an error;
8
- // - the client bundle must carry no Node builtins (the browser has none, and a
9
- // leaked `node:` import is a runtime `require is not defined`);
10
- // - `ws` must stay an EXTERNAL import in the host bundle: bundling it pulls
11
- // `buffer`/`net` into a browser-shaped artifact and breaks the PTY socket;
12
- // - `locale/en.json` is the anchor the host's package-meta scan insists on, so all
13
- // nine files have to be present in the tarball list.
14
-
15
- import { readdirSync, readFileSync } from "node:fs";
16
- import assert from "node:assert";
17
-
18
- const pkg = JSON.parse(readFileSync("package.json", "utf8"));
19
- const bundle = readFileSync("lib/client.js", "utf8");
20
- const host = readFileSync("lib/webterminals/ws.js", "utf8");
21
-
22
- // 1) the loader identity.
23
- const idMatch = /id:\s*"([^"]+)"/.exec(bundle);
24
- assert.ok(idMatch, "the client bundle wraps itself in __ModuleLoader__.load({ id })");
25
- assert.strictEqual(idMatch[1], pkg.name, "the client bundle id equals the package name");
26
-
27
- // 2) client purity.
28
- const leaks = ["node:crypto", "node:stream", "node:http", "node:fs", "node:path", "node:os", "string_decoder", "WebSocketServer"].filter((needle) => bundle.includes(needle));
29
- assert.deepStrictEqual(leaks, [], `the client bundle must carry no Node-only module: ${leaks.join(", ")}`);
30
-
31
- // 3) ws stays external on the host side.
32
- assert.ok(/from "ws"/.test(host) || /require\("ws"\)/.test(host), "the host socket module imports ws as an external dependency");
33
-
34
- // 4) the nine metadata files the host scans, with en as the anchor.
35
- const langs = ["zh", "en", "ja", "ko", "fr", "de", "it", "ru", "es"];
36
- for (const lang of langs) {
37
- const parsed = JSON.parse(readFileSync(`locale/${lang}.json`, "utf8"));
38
- // locale 元数据落成 `{ meta: { title, description } }`(gen-locale-meta 的产物形状);
39
- // 兼容旧的根级平铺形状,避免误报。
40
- const meta = parsed.meta ?? parsed;
41
- assert.ok(typeof meta.title === "string" && meta.title.length > 0, `locale/${lang}.json needs a title`);
42
- assert.ok(typeof meta.description === "string" && meta.description.length > 0, `locale/${lang}.json needs a description`);
43
- }
44
-
45
- // 5) the client dictionary really ships nine languages, keyed identically to zh.
46
- const locales = readFileSync("lib/locales.js", "utf8");
47
- const registered = /dictionaries\s*=\s*\{([^}]*)\}/.exec(locales)?.[1] ?? "";
48
- for (const lang of langs) {
49
- assert.ok(new RegExp(`\\b${lang}\\b`).test(registered), `lib/locales.js registers ${lang}`);
50
- }
51
-
52
- // 6) the multi-shell bottom tab ships, and xterm is INSIDE the bundle.
53
- //
54
- // Three failure modes worth a gate each. Registering the tab without `bottomOnly`
55
- // turns it into a second "Terminal" capsule in DSH's native right sidebar, shadowing
56
- // the host's. Leaving xterm EXTERNAL cannot work at all - the client module table
57
- // resolves only seed words, shell-owned modules, registered factories and boot
58
- // modules, and a live desktop host answered `require("@xterm/xterm")` with "missed the
59
- // module table" - so the gate now asserts the opposite of what it did, with the
60
- // emulator's own DOM marker as the witness. And the ceiling catches the reverse drift:
61
- // a second heavyweight dependency creeping in unannounced.
62
- assert.ok(bundle.includes("dsh-bash-terminal-ts:multi"), "the multi-shell tab id is in the client bundle");
63
- assert.ok(bundle.includes("bottomOnly"), "the tab declares itself bottom-workbench only");
64
- assert.ok(bundle.includes("xterm-helper-textarea"), "xterm is bundled (an external require cannot resolve in the client module table)");
65
- assert.ok(!/require\("@xterm\/xterm"\)/.test(bundle), "no external @xterm require survives in the bundle");
66
- assert.ok(bundle.includes("xterm-screen"), "xterm's stylesheet is inlined as text");
67
- assert.ok(bundle.length < 900_000, `the client bundle did not grow unexpectedly: ${bundle.length} bytes`);
68
-
69
- // 7) no dead copy: every dictionary key must be referenced by something that renders.
70
- //
71
- // A key defined in nine languages and read by nobody is not a spare string - it is a
72
- // feature that was planned, translated, and never wired (this family shipped exactly
73
- // that once: a `notice.standsDown` key with no renderer, and here a seven-language
74
- // dictionary the component bypassed by reading `zh[...]` directly).
75
- //
76
- // Checked against the SOURCES, not the bundle: the dictionary itself is bundled, so a
77
- // bundle substring test would match every key against its own definition and pass
78
- // forever. Concatenated keys (`"shell." + id`) are covered by the prefix below.
79
- //
80
- // The consumer set walks the browser directory rather than listing files: a key moved
81
- // into a new component used to read as dead copy here, which is the wrong lesson to
82
- // teach whoever split the file up.
83
- const consumerFiles = [
84
- "src/client.tsx",
85
- "src/browser-i18n.ts",
86
- ...readdirSync("src/webterminals/browser", { recursive: true }).map((rel) => `src/webterminals/browser/${String(rel)}`),
87
- ];
88
- const consumers = consumerFiles.map((rel) => readFileSync(rel, "utf8"));
89
- const zhKeys = [...new Set([...locales.matchAll(/"((?:shell|dock|tab)\.[A-Za-z0-9.]+)"\s*:/g)].map((match) => match[1]))];
90
- assert.ok(zhKeys.length >= 30, `expected the full key set in lib/locales.js, found ${zhKeys.length}`);
91
- const unusedKeys = zhKeys.filter((key) => !consumers.some((text) => text.includes(`"${key}"`)));
92
- // `shell.<id>` is built by concatenation in the preference row, so those are wired.
93
- const trulyUnused = unusedKeys.filter((key) => !/^shell\.(powershell|gitbash|msys2|wsl|payload|niu)$/.test(key));
94
- assert.deepStrictEqual(trulyUnused, [], `dictionary keys rendered by nothing: ${trulyUnused.join(", ")}`);
95
-
96
- console.log(`ARTIFACT GATES PASS: id=${idMatch[1]} | client ${(bundle.length / 1024).toFixed(0)}KB, no node leaks, xterm bundled, css inlined | ws external | ${langs.length} locale files | ${zhKeys.length} dictionary keys, none dead`);
1
+ // Artifact gates: the checks that only make sense against the BUILT bundle.
2
+ //
3
+ // Unit tests cannot see these. Every one of them is a failure mode that ships
4
+ // green through `tsc` and then dies silently in the browser:
5
+ //
6
+ // - `__ModuleLoader__.load({ id })` must equal the package name, or the host never
7
+ // binds the client half and the whole UI side goes dark without an error;
8
+ // - the client bundle must carry no Node builtins (the browser has none, and a
9
+ // leaked `node:` import is a runtime `require is not defined`);
10
+ // - `ws` must stay an EXTERNAL import in the host bundle: bundling it pulls
11
+ // `buffer`/`net` into a browser-shaped artifact and breaks the PTY socket;
12
+ // - `locale/en.json` is the anchor the host's package-meta scan insists on, so all
13
+ // ten files have to be present in the tarball list.
14
+
15
+ import { readdirSync, readFileSync } from "node:fs";
16
+ import assert from "node:assert";
17
+
18
+ const pkg = JSON.parse(readFileSync("package.json", "utf8"));
19
+ const bundle = readFileSync("lib/client.js", "utf8");
20
+ const host = readFileSync("lib/webterminals/ws.js", "utf8");
21
+
22
+ // 1) the loader identity.
23
+ const idMatch = /id:\s*"([^"]+)"/.exec(bundle);
24
+ assert.ok(idMatch, "the client bundle wraps itself in __ModuleLoader__.load({ id })");
25
+ assert.strictEqual(idMatch[1], pkg.name, "the client bundle id equals the package name");
26
+
27
+ // 2) client purity.
28
+ const leaks = ["node:crypto", "node:stream", "node:http", "node:fs", "node:path", "node:os", "string_decoder", "WebSocketServer"].filter((needle) => bundle.includes(needle));
29
+ assert.deepStrictEqual(leaks, [], `the client bundle must carry no Node-only module: ${leaks.join(", ")}`);
30
+
31
+ // 3) ws stays external on the host side.
32
+ assert.ok(/from "ws"/.test(host) || /require\("ws"\)/.test(host), "the host socket module imports ws as an external dependency");
33
+
34
+ // 4) the ten metadata files the host scans, with en as the anchor.
35
+ const langs = ["zh", "en", "ja", "ko", "fr", "de", "it", "ru", "es", "pt"];
36
+ for (const lang of langs) {
37
+ const parsed = JSON.parse(readFileSync(`locale/${lang}.json`, "utf8"));
38
+ // locale 元数据落成 `{ meta: { title, description } }`(gen-locale-meta 的产物形状);
39
+ // 兼容旧的根级平铺形状,避免误报。
40
+ const meta = parsed.meta ?? parsed;
41
+ assert.ok(typeof meta.title === "string" && meta.title.length > 0, `locale/${lang}.json needs a title`);
42
+ assert.ok(typeof meta.description === "string" && meta.description.length > 0, `locale/${lang}.json needs a description`);
43
+ }
44
+
45
+ // 5) the client dictionary really ships ten languages, keyed identically to zh.
46
+ const locales = readFileSync("lib/locales.js", "utf8");
47
+ const registered = /dictionaries\s*=\s*\{([^}]*)\}/.exec(locales)?.[1] ?? "";
48
+ for (const lang of langs) {
49
+ assert.ok(new RegExp(`\\b${lang}\\b`).test(registered), `lib/locales.js registers ${lang}`);
50
+ }
51
+
52
+ // 6) the multi-shell bottom tab ships, and xterm is INSIDE the bundle.
53
+ //
54
+ // Three failure modes worth a gate each. Registering the tab without `bottomOnly`
55
+ // turns it into a second "Terminal" capsule in DSH's native right sidebar, shadowing
56
+ // the host's. Leaving xterm EXTERNAL cannot work at all - the client module table
57
+ // resolves only seed words, shell-owned modules, registered factories and boot
58
+ // modules, and a live desktop host answered `require("@xterm/xterm")` with "missed the
59
+ // module table" - so the gate now asserts the opposite of what it did, with the
60
+ // emulator's own DOM marker as the witness. And the ceiling catches the reverse drift:
61
+ // a second heavyweight dependency creeping in unannounced.
62
+ assert.ok(bundle.includes("dsh-bash-terminal-ts:multi"), "the multi-shell tab id is in the client bundle");
63
+ assert.ok(bundle.includes("bottomOnly"), "the tab declares itself bottom-workbench only");
64
+ assert.ok(bundle.includes("xterm-helper-textarea"), "xterm is bundled (an external require cannot resolve in the client module table)");
65
+ assert.ok(!/require\("@xterm\/xterm"\)/.test(bundle), "no external @xterm require survives in the bundle");
66
+ assert.ok(bundle.includes("xterm-screen"), "xterm's stylesheet is inlined as text");
67
+ assert.ok(bundle.length < 900_000, `the client bundle did not grow unexpectedly: ${bundle.length} bytes`);
68
+
69
+ // 7) no dead copy: every dictionary key must be referenced by something that renders.
70
+ //
71
+ // A key defined in ten languages and read by nobody is not a spare string - it is a
72
+ // feature that was planned, translated, and never wired (this family shipped exactly
73
+ // that once: a `notice.standsDown` key with no renderer, and here a seven-language
74
+ // dictionary the component bypassed by reading `zh[...]` directly).
75
+ //
76
+ // Checked against the SOURCES, not the bundle: the dictionary itself is bundled, so a
77
+ // bundle substring test would match every key against its own definition and pass
78
+ // forever. Concatenated keys (`"shell." + id`) are covered by the prefix below.
79
+ //
80
+ // The consumer set walks the browser directory rather than listing files: a key moved
81
+ // into a new component used to read as dead copy here, which is the wrong lesson to
82
+ // teach whoever split the file up.
83
+ const consumerFiles = [
84
+ "src/client.tsx",
85
+ "src/browser-i18n.ts",
86
+ ...readdirSync("src/webterminals/browser", { recursive: true }).map((rel) => `src/webterminals/browser/${String(rel)}`),
87
+ ];
88
+ const consumers = consumerFiles.map((rel) => readFileSync(rel, "utf8"));
89
+ const zhKeys = [...new Set([...locales.matchAll(/"((?:shell|dock|tab)\.[A-Za-z0-9.]+)"\s*:/g)].map((match) => match[1]))];
90
+ assert.ok(zhKeys.length >= 30, `expected the full key set in lib/locales.js, found ${zhKeys.length}`);
91
+ const unusedKeys = zhKeys.filter((key) => !consumers.some((text) => text.includes(`"${key}"`)));
92
+ // `shell.<id>` is built by concatenation in the preference row, so those are wired.
93
+ const trulyUnused = unusedKeys.filter((key) => !/^shell\.(powershell|gitbash|msys2|wsl|payload|niu)$/.test(key));
94
+ assert.deepStrictEqual(trulyUnused, [], `dictionary keys rendered by nothing: ${trulyUnused.join(", ")}`);
95
+
96
+ console.log(`ARTIFACT GATES PASS: id=${idMatch[1]} | client ${(bundle.length / 1024).toFixed(0)}KB, no node leaks, xterm bundled, css inlined | ws external | ${langs.length} locale files | ${zhKeys.length} dictionary keys, none dead`);
@@ -19,7 +19,6 @@
19
19
 
20
20
  import { existsSync, linkSync, statSync } from "node:fs";
21
21
  import { join } from "node:path";
22
- import { ensurePayloadAlias, findPayloadStoreRoot, payloadAliasPaths } from "./payload-alias.mjs";
23
22
 
24
23
  /** Each alias: the link to create and the shell it must point at. */
25
24
  const ALIASES = [
@@ -68,26 +67,6 @@ for (const alias of ALIASES) {
68
67
  }
69
68
  }
70
69
 
71
- // The pinned POSIX payload's menu entry: a hard link inside its own bin\ named
72
- // bash-terminal.exe plus the stable `payloads\bash-terminal` junction the bundle
73
- // patch points at. Absent payload = nothing to do (the candidate is skipped by
74
- // the host per-candidate), so this never counts as blocked.
75
- {
76
- const paths = payloadAliasPaths(process.env);
77
- if (paths === undefined) {
78
- console.log("skip payload LOCALAPPDATA unset; no payload alias target");
79
- } else {
80
- const rootName = findPayloadStoreRoot(paths.store);
81
- if (rootName === undefined) {
82
- console.log(`skip payload no provisioned root under ${paths.store} (run scripts/provision-payload.mjs first)`);
83
- } else {
84
- const done = ensurePayloadAlias({ root: join(paths.store, rootName), junction: paths.junction });
85
- if (done.skipped !== undefined) console.log(`BAD payload ${done.skipped}`);
86
- else console.log(`ok payload ${done.link} + junction`);
87
- }
88
- }
89
- }
90
-
91
70
  console.log("");
92
71
  if (blocked > 0) {
93
72
  console.log(`${blocked} alias(es) still missing - the official shell menu will not offer them until they exist.`);