gemiterm 2.0.0 → 2.1.1

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 (155) hide show
  1. package/README.md +32 -9
  2. package/package.json +13 -4
  3. package/src/cli/command-registry.ts +66 -62
  4. package/src/cli/commands/continue-command.ts +75 -1
  5. package/src/cli/commands/install-skills-command.ts +35 -0
  6. package/src/cli/commands/new-command.ts +62 -0
  7. package/src/cli/index.ts +19 -44
  8. package/src/cli/utils/long-arg-guard.ts +28 -0
  9. package/src/cli/utils/prompt-file.ts +26 -0
  10. package/src/infrastructure/cli-parser.ts +77 -0
  11. package/src/infrastructure/io.ts +9 -0
  12. package/src/services/skills-cli-driver.ts +58 -0
  13. package/src/services/skills-service.ts +52 -0
  14. package/.env +0 -2
  15. package/.github/workflows/manual-release.yml +0 -34
  16. package/.github/workflows/release.yml +0 -198
  17. package/.github/workflows/test.yml +0 -29
  18. package/.opencode/commands/opsx-apply.md +0 -152
  19. package/.opencode/commands/opsx-archive.md +0 -157
  20. package/.opencode/commands/opsx-explore.md +0 -169
  21. package/.opencode/commands/opsx-propose.md +0 -104
  22. package/.opencode/commands/opsx-sync.md +0 -140
  23. package/.opencode/commands/search-intelligently.md +0 -9
  24. package/.opencode/opencode.json +0 -20
  25. package/.opencode/skills/intellisearch/.version +0 -1
  26. package/.opencode/skills/intellisearch/SKILL.md +0 -84
  27. package/.opencode/skills/intellisearch/references/brave-search.md +0 -67
  28. package/.opencode/skills/intellisearch/references/ddg-search.md +0 -79
  29. package/.opencode/skills/intellisearch/references/deepwiki-tools.md +0 -246
  30. package/.opencode/skills/intellisearch/references/examples.md +0 -97
  31. package/.opencode/skills/intellisearch/references/gh-cli.md +0 -143
  32. package/.opencode/skills/intellisearch/references/google-search.md +0 -40
  33. package/.opencode/skills/intellisearch/references/search-workflow.md +0 -143
  34. package/.opencode/skills/intellisearch/references/workflow.md +0 -115
  35. package/.opencode/skills/openspec-apply-change/SKILL.md +0 -159
  36. package/.opencode/skills/openspec-archive-change/SKILL.md +0 -117
  37. package/.opencode/skills/openspec-explore/SKILL.md +0 -287
  38. package/.opencode/skills/openspec-propose/SKILL.md +0 -111
  39. package/.opencode/skills/openspec-sync-specs/SKILL.md +0 -147
  40. package/.serena/project.yml +0 -133
  41. package/AGENTS.md +0 -136
  42. package/CHANGELOG.md +0 -3
  43. package/bun.lock +0 -105
  44. package/docs/INSTALL.md +0 -185
  45. package/docs/PLAYWRIGHT_CLI_API.md +0 -306
  46. package/docs/python-release-for-reference.md +0 -175
  47. package/examples/sample_json_export.json +0 -32
  48. package/examples/sample_markdown_export.md +0 -221
  49. package/examples/usage_examples.sh +0 -222
  50. package/install.ps1 +0 -264
  51. package/install.sh +0 -275
  52. package/openspec/MAESTRO_MIGRATION.md +0 -180
  53. package/openspec/changes/archive/2026-06-08-command-spec-conformance/.openspec.yaml +0 -2
  54. package/openspec/changes/archive/2026-06-08-command-spec-conformance/design.md +0 -194
  55. package/openspec/changes/archive/2026-06-08-command-spec-conformance/proposal.md +0 -52
  56. package/openspec/changes/archive/2026-06-08-command-spec-conformance/specs/multi-profile-conversations/spec.md +0 -133
  57. package/openspec/changes/archive/2026-06-08-command-spec-conformance/tasks.md +0 -95
  58. package/openspec/changes/archive/2026-06-09-refactor-interactive-prompt-loop/.openspec.yaml +0 -2
  59. package/openspec/changes/archive/2026-06-09-refactor-interactive-prompt-loop/design.md +0 -28
  60. package/openspec/changes/archive/2026-06-09-refactor-interactive-prompt-loop/proposal.md +0 -22
  61. package/openspec/changes/archive/2026-06-09-refactor-interactive-prompt-loop/specs/interactive-prompt-loop/spec.md +0 -35
  62. package/openspec/changes/archive/2026-06-09-refactor-interactive-prompt-loop/tasks.md +0 -28
  63. package/openspec/changes/archive/2026-06-09-replace-gemini-api-placeholder-with-gemini-reverse/.openspec.yaml +0 -2
  64. package/openspec/changes/archive/2026-06-09-replace-gemini-api-placeholder-with-gemini-reverse/design.md +0 -323
  65. package/openspec/changes/archive/2026-06-09-replace-gemini-api-placeholder-with-gemini-reverse/proposal.md +0 -122
  66. package/openspec/changes/archive/2026-06-09-replace-gemini-api-placeholder-with-gemini-reverse/specs/no-capability-changes/spec.md +0 -29
  67. package/openspec/changes/archive/2026-06-09-replace-gemini-api-placeholder-with-gemini-reverse/tasks.md +0 -172
  68. package/openspec/changes/archive/2026-06-09-v2-install-migration/.openspec.yaml +0 -2
  69. package/openspec/changes/archive/2026-06-09-v2-install-migration/design.md +0 -241
  70. package/openspec/changes/archive/2026-06-09-v2-install-migration/proposal.md +0 -41
  71. package/openspec/changes/archive/2026-06-09-v2-install-migration/specs/v2-installer/spec.md +0 -205
  72. package/openspec/changes/archive/2026-06-09-v2-install-migration/tasks.md +0 -97
  73. package/openspec/changes/commander-cli-parser/.openspec.yaml +0 -2
  74. package/openspec/changes/commander-cli-parser/design.md +0 -107
  75. package/openspec/changes/commander-cli-parser/proposal.md +0 -31
  76. package/openspec/changes/commander-cli-parser/specs/cli/spec.md +0 -48
  77. package/openspec/changes/commander-cli-parser/tasks.md +0 -33
  78. package/openspec/changes/cross-platform-build-and-ci/.openspec.yaml +0 -2
  79. package/openspec/changes/cross-platform-build-and-ci/design.md +0 -213
  80. package/openspec/changes/cross-platform-build-and-ci/proposal.md +0 -50
  81. package/openspec/changes/cross-platform-build-and-ci/specs/path-and-file-mediation/spec.md +0 -335
  82. package/openspec/changes/cross-platform-build-and-ci/specs/release-pipeline/spec.md +0 -95
  83. package/openspec/changes/cross-platform-build-and-ci/tasks.md +0 -164
  84. package/openspec/config.yaml +0 -20
  85. package/openspec/specs/auth/spec.md +0 -394
  86. package/openspec/specs/cli/spec.md +0 -108
  87. package/openspec/specs/commands/spec.md +0 -409
  88. package/openspec/specs/configuration/spec.md +0 -130
  89. package/openspec/specs/conversations/spec.md +0 -139
  90. package/openspec/specs/domain-model/spec.md +0 -128
  91. package/openspec/specs/formatters/spec.md +0 -158
  92. package/openspec/specs/install-browser/spec.md +0 -146
  93. package/openspec/specs/interactive-prompt-loop/spec.md +0 -41
  94. package/openspec/specs/logger/spec.md +0 -71
  95. package/openspec/specs/mediator/spec.md +0 -72
  96. package/openspec/specs/multi-profile-conversations/spec.md +0 -145
  97. package/openspec/specs/path-utils/spec.md +0 -101
  98. package/openspec/specs/profiles/spec.md +0 -94
  99. package/openspec/specs/storage/spec.md +0 -198
  100. package/openspec/specs/testing/spec.md +0 -237
  101. package/openspec/specs/v2-installer/spec.md +0 -205
  102. package/openspec/specs/validators/spec.md +0 -65
  103. package/scripts/build.ts +0 -88
  104. package/scripts/clean-build.ps1 +0 -4
  105. package/scripts/clean-build.sh +0 -5
  106. package/scripts/install-browser.ps1 +0 -5
  107. package/scripts/install-browser.sh +0 -6
  108. package/scripts/lint-path-mediation.ps1 +0 -65
  109. package/scripts/lint-path-mediation.sh +0 -40
  110. package/tests/cli/auth-command.test.ts +0 -220
  111. package/tests/cli/command-registry.test.ts +0 -67
  112. package/tests/cli/continue-command.test.ts +0 -100
  113. package/tests/cli/delete-command.test.ts +0 -128
  114. package/tests/cli/export-all-command.test.ts +0 -375
  115. package/tests/cli/install-browser-command.test.ts +0 -48
  116. package/tests/cli/list-command.test.ts +0 -179
  117. package/tests/cli/new-command.test.ts +0 -139
  118. package/tests/cli/status-command.test.ts +0 -106
  119. package/tests/core/query-handlers.test.ts +0 -187
  120. package/tests/fixtures/auth-fixtures.ts +0 -98
  121. package/tests/fixtures/chat-fixtures.ts +0 -87
  122. package/tests/infrastructure/cli-table.test.ts +0 -107
  123. package/tests/infrastructure/formatters.test.ts +0 -202
  124. package/tests/infrastructure/io.test.ts +0 -197
  125. package/tests/infrastructure/logger.test.ts +0 -74
  126. package/tests/infrastructure/storage.test.ts +0 -335
  127. package/tests/infrastructure/validators.test.ts +0 -67
  128. package/tests/integration/commands/auth.test.ts +0 -186
  129. package/tests/integration/commands/continue.test.ts +0 -130
  130. package/tests/integration/commands/delete.test.ts +0 -140
  131. package/tests/integration/commands/export.test.ts +0 -266
  132. package/tests/integration/commands/fetch.test.ts +0 -238
  133. package/tests/integration/commands/list.test.ts +0 -281
  134. package/tests/integration/commands/profile.test.ts +0 -258
  135. package/tests/integration/commands/status.test.ts +0 -223
  136. package/tests/integration/installer-script-shape.test.ts +0 -67
  137. package/tests/parity/compare-outputs.ts +0 -359
  138. package/tests/parity/test-commands-parity.ps1 +0 -82
  139. package/tests/parity/test-commands-parity.sh +0 -61
  140. package/tests/services/auth-service.test.ts +0 -315
  141. package/tests/services/cookie-monitor.test.ts +0 -229
  142. package/tests/services/cookie-storage-service.test.ts +0 -230
  143. package/tests/services/gemini-client-wrapper.test.ts +0 -688
  144. package/tests/services/install-browser-service.test.ts +0 -83
  145. package/tests/services/playwright-cli-driver.test.ts +0 -468
  146. package/tests/services/profile-auth-manager.test.ts +0 -334
  147. package/tests/services/profile-service.test.ts +0 -224
  148. package/tests/setup.ts +0 -95
  149. package/tests/smoke/smoke.test.ts +0 -52
  150. package/tests/unit/config.test.ts +0 -159
  151. package/tests/unit/errors.test.ts +0 -119
  152. package/tests/unit/formatters.test.ts +0 -316
  153. package/tests/unit/mediator.test.ts +0 -152
  154. package/tests/unit/path-utils.test.ts +0 -289
  155. package/tsconfig.json +0 -16
@@ -1,152 +0,0 @@
1
- import { describe, test, expect, beforeEach } from "bun:test";
2
- import {
3
- Mediator,
4
- type QueryHandler,
5
- type CommandHandler,
6
- type Query,
7
- type Command,
8
- } from "../../src/core/mediator.ts";
9
-
10
- describe("Mediator", () => {
11
- let mediator: Mediator;
12
-
13
- beforeEach(() => {
14
- mediator = new Mediator();
15
- });
16
-
17
- describe("registerQueryHandler and send (queries)", () => {
18
- test("resolves a query via a registered handler", async () => {
19
- const handler: QueryHandler<string, number> = {
20
- queryType: "GetLength",
21
- handle(query: Query<string>) {
22
- return Promise.resolve(query.payload.length);
23
- },
24
- };
25
-
26
- mediator.registerQueryHandler(handler);
27
-
28
- const result = await mediator.send<number>({
29
- type: "GetLength",
30
- payload: "hello",
31
- });
32
-
33
- expect(result).toBe(5);
34
- });
35
-
36
- test("throws if two handlers are registered for the same query type", () => {
37
- const handlerA: QueryHandler<void, void> = {
38
- queryType: "Duplicate",
39
- handle() {
40
- return Promise.resolve();
41
- },
42
- };
43
- const handlerB: QueryHandler<void, void> = {
44
- queryType: "Duplicate",
45
- handle() {
46
- return Promise.resolve();
47
- },
48
- };
49
-
50
- mediator.registerQueryHandler(handlerA);
51
-
52
- expect(() => mediator.registerQueryHandler(handlerB)).toThrow(
53
- "Query handler already registered for type: Duplicate",
54
- );
55
- });
56
-
57
- test("passes the full query object to the handler", async () => {
58
- let received: Query<{ key: string }> | undefined;
59
- const handler: QueryHandler<{ key: string }, string> = {
60
- queryType: "Inspect",
61
- handle(query) {
62
- received = query;
63
- return Promise.resolve("ok");
64
- },
65
- };
66
-
67
- mediator.registerQueryHandler(handler);
68
-
69
- await mediator.send({ type: "Inspect", payload: { key: "val" } });
70
-
71
- expect(received).toBeDefined();
72
- expect(received!.type).toBe("Inspect");
73
- expect(received!.payload).toEqual({ key: "val" });
74
- });
75
- });
76
-
77
- describe("registerCommandHandler and send (commands)", () => {
78
- test("resolves a command via a registered handler", async () => {
79
- const handler: CommandHandler<string, string> = {
80
- commandType: "Echo",
81
- handle(cmd: Command<string>) {
82
- return Promise.resolve(cmd.payload);
83
- },
84
- };
85
-
86
- mediator.registerCommandHandler(handler);
87
-
88
- const result = await mediator.send<string>({
89
- type: "Echo",
90
- payload: "hello world",
91
- });
92
-
93
- expect(result).toBe("hello world");
94
- });
95
-
96
- test("throws if two handlers are registered for the same command type", () => {
97
- const handlerA: CommandHandler<void, void> = {
98
- commandType: "Duplicate",
99
- handle() {
100
- return Promise.resolve();
101
- },
102
- };
103
- const handlerB: CommandHandler<void, void> = {
104
- commandType: "Duplicate",
105
- handle() {
106
- return Promise.resolve();
107
- },
108
- };
109
-
110
- mediator.registerCommandHandler(handlerA);
111
-
112
- expect(() => mediator.registerCommandHandler(handlerB)).toThrow(
113
- "Command handler already registered for type: Duplicate",
114
- );
115
- });
116
- });
117
-
118
- describe("unknown message type", () => {
119
- test("throws when sending a message with no registered handler", async () => {
120
- await expect(
121
- mediator.send({ type: "NobodyHandlesMe", payload: null }),
122
- ).rejects.toThrow(
123
- "No handler registered for message type: NobodyHandlesMe",
124
- );
125
- });
126
-
127
- test("does not mix query and command handlers", async () => {
128
- mediator.registerQueryHandler<void, string>({
129
- queryType: "OnlyQuery",
130
- handle() {
131
- return Promise.resolve("query-result");
132
- },
133
- });
134
-
135
- await expect(
136
- mediator.send({ type: "OnlyQuery", payload: undefined }),
137
- ).resolves.toBe("query-result");
138
-
139
- const fresh = new Mediator();
140
- fresh.registerCommandHandler<void, string>({
141
- commandType: "OnlyCommand",
142
- handle() {
143
- return Promise.resolve("command-result");
144
- },
145
- });
146
-
147
- await expect(
148
- fresh.send({ type: "OnlyCommand", payload: undefined }),
149
- ).resolves.toBe("command-result");
150
- });
151
- });
152
- });
@@ -1,289 +0,0 @@
1
- import { describe, test, expect, beforeEach, afterEach, spyOn } from "bun:test";
2
- import { join, resolve } from "node:path";
3
- import * as os from "node:os";
4
- import * as fs from "node:fs";
5
- import {
6
- resolvePath,
7
- getConfigDir,
8
- getProfilesDir,
9
- getProfilePath,
10
- getProfileDir,
11
- getDefaultProfileMarkerPath,
12
- isWSL,
13
- getProjectRoot,
14
- getPackageJson,
15
- STORAGE_STATE_FILE,
16
- PROFILES_DIR,
17
- DEFAULT_PROFILE_MARKER,
18
- } from "../../src/infrastructure/path-utils.ts";
19
-
20
- describe("path-utils", () => {
21
- describe("constants", () => {
22
- test("STORAGE_STATE_FILE is storage_state.json", () => {
23
- expect(STORAGE_STATE_FILE).toBe("storage_state.json");
24
- });
25
-
26
- test("PROFILES_DIR is profiles", () => {
27
- expect(PROFILES_DIR).toBe("profiles");
28
- });
29
-
30
- test("DEFAULT_PROFILE_MARKER is .default", () => {
31
- expect(DEFAULT_PROFILE_MARKER).toBe(".default");
32
- });
33
- });
34
-
35
- describe("resolvePath", () => {
36
- test("joins and resolves path segments", () => {
37
- const result = resolvePath("foo", "bar", "baz.txt");
38
- expect(result).toBe(resolve(join("foo", "bar", "baz.txt")));
39
- });
40
-
41
- test("resolves relative paths to absolute", () => {
42
- const result = resolvePath("a", "b");
43
- expect(result).toBe(resolve(join("a", "b")));
44
- });
45
-
46
- test("handles single segment", () => {
47
- const result = resolvePath("single");
48
- expect(result).toBe(resolve("single"));
49
- });
50
-
51
- test("normalizes paths with .. and .", () => {
52
- const result = resolvePath("foo", "..", "bar");
53
- expect(result).toBe(resolve(join("foo", "..", "bar")));
54
- });
55
-
56
- test("handles empty input", () => {
57
- const result = resolvePath();
58
- expect(result).toBe(resolve(join()));
59
- });
60
- });
61
-
62
- describe("getConfigDir", () => {
63
- let originalConfigDir: string | undefined;
64
- let originalAppData: string | undefined;
65
-
66
- beforeEach(() => {
67
- originalConfigDir = process.env.GEMITERM_CONFIG_DIR;
68
- originalAppData = process.env.APPDATA;
69
- delete process.env.GEMITERM_CONFIG_DIR;
70
- });
71
-
72
- afterEach(() => {
73
- if (originalConfigDir !== undefined) {
74
- process.env.GEMITERM_CONFIG_DIR = originalConfigDir;
75
- } else {
76
- delete process.env.GEMITERM_CONFIG_DIR;
77
- }
78
- if (originalAppData !== undefined) {
79
- process.env.APPDATA = originalAppData;
80
- } else {
81
- delete process.env.APPDATA;
82
- }
83
- });
84
-
85
- test("returns GEMITERM_CONFIG_DIR env override when set", () => {
86
- process.env.GEMITERM_CONFIG_DIR = "/tmp/my-custom-config";
87
- expect(getConfigDir()).toBe("/tmp/my-custom-config");
88
- });
89
-
90
- test("on win32 with APPDATA, returns APPDATA/gemiterm", () => {
91
- const platformSpy = spyOn(os, "platform").mockReturnValue("win32");
92
- process.env.APPDATA = "C:\\Users\\test\\AppData\\Roaming";
93
- expect(getConfigDir()).toBe(join("C:\\Users\\test\\AppData\\Roaming", "gemiterm"));
94
- platformSpy.mockRestore();
95
- });
96
-
97
- test("on win32 without APPDATA, falls back to homedir/gemiterm", () => {
98
- const platformSpy = spyOn(os, "platform").mockReturnValue("win32");
99
- delete process.env.APPDATA;
100
- expect(getConfigDir()).toBe(join(os.homedir(), "gemiterm"));
101
- platformSpy.mockRestore();
102
- });
103
-
104
- test("on linux, returns homedir/gemiterm", () => {
105
- const platformSpy = spyOn(os, "platform").mockReturnValue("linux");
106
- delete process.env.APPDATA;
107
- expect(getConfigDir()).toBe(join(os.homedir(), "gemiterm"));
108
- platformSpy.mockRestore();
109
- });
110
-
111
- test("on darwin, returns homedir/gemiterm", () => {
112
- const platformSpy = spyOn(os, "platform").mockReturnValue("darwin");
113
- expect(getConfigDir()).toBe(join(os.homedir(), "gemiterm"));
114
- platformSpy.mockRestore();
115
- });
116
-
117
- test("env override takes precedence over platform-specific path", () => {
118
- const platformSpy = spyOn(os, "platform").mockReturnValue("win32");
119
- process.env.GEMITERM_CONFIG_DIR = "/override/path";
120
- process.env.APPDATA = "C:\\AppData";
121
- expect(getConfigDir()).toBe("/override/path");
122
- platformSpy.mockRestore();
123
- });
124
- });
125
-
126
- describe("getProfilesDir", () => {
127
- let originalConfigDir: string | undefined;
128
-
129
- beforeEach(() => {
130
- originalConfigDir = process.env.GEMITERM_CONFIG_DIR;
131
- });
132
-
133
- afterEach(() => {
134
- if (originalConfigDir !== undefined) {
135
- process.env.GEMITERM_CONFIG_DIR = originalConfigDir;
136
- } else {
137
- delete process.env.GEMITERM_CONFIG_DIR;
138
- }
139
- });
140
-
141
- test("returns config dir + profiles", () => {
142
- process.env.GEMITERM_CONFIG_DIR = "/tmp/gemiterm";
143
- expect(getProfilesDir()).toBe(join("/tmp/gemiterm", PROFILES_DIR));
144
- });
145
- });
146
-
147
- describe("getProfilePath", () => {
148
- let originalConfigDir: string | undefined;
149
-
150
- beforeEach(() => {
151
- originalConfigDir = process.env.GEMITERM_CONFIG_DIR;
152
- });
153
-
154
- afterEach(() => {
155
- if (originalConfigDir !== undefined) {
156
- process.env.GEMITERM_CONFIG_DIR = originalConfigDir;
157
- } else {
158
- delete process.env.GEMITERM_CONFIG_DIR;
159
- }
160
- });
161
-
162
- test("returns profiles/<name>/storage_state.json", () => {
163
- process.env.GEMITERM_CONFIG_DIR = "/tmp/gemiterm";
164
- expect(getProfilePath("default")).toBe(
165
- join("/tmp/gemiterm", PROFILES_DIR, "default", STORAGE_STATE_FILE),
166
- );
167
- });
168
-
169
- test("handles profile names with special characters", () => {
170
- process.env.GEMITERM_CONFIG_DIR = "/tmp/gemiterm";
171
- expect(getProfilePath("my-profile")).toBe(
172
- join("/tmp/gemiterm", PROFILES_DIR, "my-profile", STORAGE_STATE_FILE),
173
- );
174
- });
175
- });
176
-
177
- describe("getProfileDir", () => {
178
- let originalConfigDir: string | undefined;
179
-
180
- beforeEach(() => {
181
- originalConfigDir = process.env.GEMITERM_CONFIG_DIR;
182
- });
183
-
184
- afterEach(() => {
185
- if (originalConfigDir !== undefined) {
186
- process.env.GEMITERM_CONFIG_DIR = originalConfigDir;
187
- } else {
188
- delete process.env.GEMITERM_CONFIG_DIR;
189
- }
190
- });
191
-
192
- test("returns profiles/<name>", () => {
193
- process.env.GEMITERM_CONFIG_DIR = "/tmp/gemiterm";
194
- expect(getProfileDir("work")).toBe(join("/tmp/gemiterm", PROFILES_DIR, "work"));
195
- });
196
- });
197
-
198
- describe("getDefaultProfileMarkerPath", () => {
199
- let originalConfigDir: string | undefined;
200
-
201
- beforeEach(() => {
202
- originalConfigDir = process.env.GEMITERM_CONFIG_DIR;
203
- });
204
-
205
- afterEach(() => {
206
- if (originalConfigDir !== undefined) {
207
- process.env.GEMITERM_CONFIG_DIR = originalConfigDir;
208
- } else {
209
- delete process.env.GEMITERM_CONFIG_DIR;
210
- }
211
- });
212
-
213
- test("returns profiles/.default", () => {
214
- process.env.GEMITERM_CONFIG_DIR = "/tmp/gemiterm";
215
- expect(getDefaultProfileMarkerPath()).toBe(
216
- join("/tmp/gemiterm", PROFILES_DIR, DEFAULT_PROFILE_MARKER),
217
- );
218
- });
219
- });
220
-
221
- describe("isWSL", () => {
222
- let originalPlatform: NodeJS.Platform;
223
- let originalWslDistro: string | undefined;
224
-
225
- beforeEach(() => {
226
- originalPlatform = process.platform;
227
- originalWslDistro = process.env.WSL_DISTRO_NAME;
228
- });
229
-
230
- afterEach(() => {
231
- Object.defineProperty(process, "platform", { value: originalPlatform, configurable: true });
232
- if (originalWslDistro !== undefined) {
233
- process.env.WSL_DISTRO_NAME = originalWslDistro;
234
- } else {
235
- delete process.env.WSL_DISTRO_NAME;
236
- }
237
- });
238
-
239
- test("returns false on Windows", () => {
240
- Object.defineProperty(process, "platform", { value: "win32", configurable: true });
241
- delete process.env.WSL_DISTRO_NAME;
242
- expect(isWSL()).toBe(false);
243
- });
244
-
245
- test("returns false on macOS", () => {
246
- Object.defineProperty(process, "platform", { value: "darwin", configurable: true });
247
- delete process.env.WSL_DISTRO_NAME;
248
- expect(isWSL()).toBe(false);
249
- });
250
-
251
- test("returns true on Linux when WSL_DISTRO_NAME is set and non-empty", () => {
252
- Object.defineProperty(process, "platform", { value: "linux", configurable: true });
253
- process.env.WSL_DISTRO_NAME = "Ubuntu";
254
- expect(isWSL()).toBe(true);
255
- });
256
-
257
- test("returns false on Linux when WSL_DISTRO_NAME is unset and no /proc/version marker", () => {
258
- Object.defineProperty(process, "platform", { value: "linux", configurable: true });
259
- delete process.env.WSL_DISTRO_NAME;
260
- const existsSpy = spyOn(fs, "existsSync").mockReturnValue(false);
261
- try {
262
- expect(isWSL()).toBe(false);
263
- } finally {
264
- existsSpy.mockRestore();
265
- }
266
- });
267
- });
268
-
269
- describe("getProjectRoot", () => {
270
- test("returns the repo root when called from a file under the repo", () => {
271
- const root = getProjectRoot(import.meta.url);
272
- expect(root).toBeTruthy();
273
- expect(fs.existsSync(join(root, "package.json"))).toBe(true);
274
- });
275
-
276
- test("is idempotent — multiple calls return the same path", () => {
277
- const a = getProjectRoot(import.meta.url);
278
- const b = getProjectRoot(import.meta.url);
279
- expect(a).toBe(b);
280
- });
281
- });
282
-
283
- describe("getPackageJson", () => {
284
- test("returns the parsed package.json with name and version", () => {
285
- const pkg = getPackageJson(import.meta.url);
286
- expect(pkg.name).toBe("gemiterm");
287
- });
288
- });
289
- });
package/tsconfig.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "strict": true,
7
- "esModuleInterop": true,
8
- "skipLibCheck": true,
9
- "noEmit": true,
10
- "allowImportingTsExtensions": true,
11
- "types": ["bun"],
12
- "outDir": "dist"
13
- },
14
- "include": ["src/**/*.ts"],
15
- "exclude": ["node_modules", "dist", "**/*.test.ts"]
16
- }