gemiterm 2.0.0

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 (184) hide show
  1. package/.env +2 -0
  2. package/.github/workflows/manual-release.yml +34 -0
  3. package/.github/workflows/release.yml +198 -0
  4. package/.github/workflows/test.yml +29 -0
  5. package/.opencode/commands/opsx-apply.md +152 -0
  6. package/.opencode/commands/opsx-archive.md +157 -0
  7. package/.opencode/commands/opsx-explore.md +169 -0
  8. package/.opencode/commands/opsx-propose.md +104 -0
  9. package/.opencode/commands/opsx-sync.md +140 -0
  10. package/.opencode/commands/search-intelligently.md +9 -0
  11. package/.opencode/opencode.json +20 -0
  12. package/.opencode/skills/intellisearch/.version +1 -0
  13. package/.opencode/skills/intellisearch/SKILL.md +84 -0
  14. package/.opencode/skills/intellisearch/references/brave-search.md +67 -0
  15. package/.opencode/skills/intellisearch/references/ddg-search.md +79 -0
  16. package/.opencode/skills/intellisearch/references/deepwiki-tools.md +246 -0
  17. package/.opencode/skills/intellisearch/references/examples.md +97 -0
  18. package/.opencode/skills/intellisearch/references/gh-cli.md +143 -0
  19. package/.opencode/skills/intellisearch/references/google-search.md +40 -0
  20. package/.opencode/skills/intellisearch/references/search-workflow.md +143 -0
  21. package/.opencode/skills/intellisearch/references/workflow.md +115 -0
  22. package/.opencode/skills/openspec-apply-change/SKILL.md +159 -0
  23. package/.opencode/skills/openspec-archive-change/SKILL.md +117 -0
  24. package/.opencode/skills/openspec-explore/SKILL.md +287 -0
  25. package/.opencode/skills/openspec-propose/SKILL.md +111 -0
  26. package/.opencode/skills/openspec-sync-specs/SKILL.md +147 -0
  27. package/.serena/project.yml +133 -0
  28. package/AGENTS.md +136 -0
  29. package/CHANGELOG.md +3 -0
  30. package/README.md +245 -0
  31. package/bun.lock +105 -0
  32. package/docs/INSTALL.md +185 -0
  33. package/docs/PLAYWRIGHT_CLI_API.md +306 -0
  34. package/docs/python-release-for-reference.md +175 -0
  35. package/examples/sample_json_export.json +32 -0
  36. package/examples/sample_markdown_export.md +221 -0
  37. package/examples/usage_examples.sh +222 -0
  38. package/install.ps1 +264 -0
  39. package/install.sh +275 -0
  40. package/openspec/MAESTRO_MIGRATION.md +180 -0
  41. package/openspec/changes/archive/2026-06-08-command-spec-conformance/.openspec.yaml +2 -0
  42. package/openspec/changes/archive/2026-06-08-command-spec-conformance/design.md +194 -0
  43. package/openspec/changes/archive/2026-06-08-command-spec-conformance/proposal.md +52 -0
  44. package/openspec/changes/archive/2026-06-08-command-spec-conformance/specs/multi-profile-conversations/spec.md +133 -0
  45. package/openspec/changes/archive/2026-06-08-command-spec-conformance/tasks.md +95 -0
  46. package/openspec/changes/archive/2026-06-09-refactor-interactive-prompt-loop/.openspec.yaml +2 -0
  47. package/openspec/changes/archive/2026-06-09-refactor-interactive-prompt-loop/design.md +28 -0
  48. package/openspec/changes/archive/2026-06-09-refactor-interactive-prompt-loop/proposal.md +22 -0
  49. package/openspec/changes/archive/2026-06-09-refactor-interactive-prompt-loop/specs/interactive-prompt-loop/spec.md +35 -0
  50. package/openspec/changes/archive/2026-06-09-refactor-interactive-prompt-loop/tasks.md +28 -0
  51. package/openspec/changes/archive/2026-06-09-replace-gemini-api-placeholder-with-gemini-reverse/.openspec.yaml +2 -0
  52. package/openspec/changes/archive/2026-06-09-replace-gemini-api-placeholder-with-gemini-reverse/design.md +323 -0
  53. package/openspec/changes/archive/2026-06-09-replace-gemini-api-placeholder-with-gemini-reverse/proposal.md +122 -0
  54. package/openspec/changes/archive/2026-06-09-replace-gemini-api-placeholder-with-gemini-reverse/specs/no-capability-changes/spec.md +29 -0
  55. package/openspec/changes/archive/2026-06-09-replace-gemini-api-placeholder-with-gemini-reverse/tasks.md +172 -0
  56. package/openspec/changes/archive/2026-06-09-v2-install-migration/.openspec.yaml +2 -0
  57. package/openspec/changes/archive/2026-06-09-v2-install-migration/design.md +241 -0
  58. package/openspec/changes/archive/2026-06-09-v2-install-migration/proposal.md +41 -0
  59. package/openspec/changes/archive/2026-06-09-v2-install-migration/specs/v2-installer/spec.md +205 -0
  60. package/openspec/changes/archive/2026-06-09-v2-install-migration/tasks.md +97 -0
  61. package/openspec/changes/commander-cli-parser/.openspec.yaml +2 -0
  62. package/openspec/changes/commander-cli-parser/design.md +107 -0
  63. package/openspec/changes/commander-cli-parser/proposal.md +31 -0
  64. package/openspec/changes/commander-cli-parser/specs/cli/spec.md +48 -0
  65. package/openspec/changes/commander-cli-parser/tasks.md +33 -0
  66. package/openspec/changes/cross-platform-build-and-ci/.openspec.yaml +2 -0
  67. package/openspec/changes/cross-platform-build-and-ci/design.md +213 -0
  68. package/openspec/changes/cross-platform-build-and-ci/proposal.md +50 -0
  69. package/openspec/changes/cross-platform-build-and-ci/specs/path-and-file-mediation/spec.md +335 -0
  70. package/openspec/changes/cross-platform-build-and-ci/specs/release-pipeline/spec.md +95 -0
  71. package/openspec/changes/cross-platform-build-and-ci/tasks.md +164 -0
  72. package/openspec/config.yaml +20 -0
  73. package/openspec/specs/auth/spec.md +394 -0
  74. package/openspec/specs/cli/spec.md +108 -0
  75. package/openspec/specs/commands/spec.md +409 -0
  76. package/openspec/specs/configuration/spec.md +130 -0
  77. package/openspec/specs/conversations/spec.md +139 -0
  78. package/openspec/specs/domain-model/spec.md +128 -0
  79. package/openspec/specs/formatters/spec.md +158 -0
  80. package/openspec/specs/install-browser/spec.md +146 -0
  81. package/openspec/specs/interactive-prompt-loop/spec.md +41 -0
  82. package/openspec/specs/logger/spec.md +71 -0
  83. package/openspec/specs/mediator/spec.md +72 -0
  84. package/openspec/specs/multi-profile-conversations/spec.md +145 -0
  85. package/openspec/specs/path-utils/spec.md +101 -0
  86. package/openspec/specs/profiles/spec.md +94 -0
  87. package/openspec/specs/storage/spec.md +198 -0
  88. package/openspec/specs/testing/spec.md +237 -0
  89. package/openspec/specs/v2-installer/spec.md +205 -0
  90. package/openspec/specs/validators/spec.md +65 -0
  91. package/package.json +45 -0
  92. package/scripts/build.ts +88 -0
  93. package/scripts/clean-build.ps1 +4 -0
  94. package/scripts/clean-build.sh +5 -0
  95. package/scripts/install-browser.ps1 +5 -0
  96. package/scripts/install-browser.sh +6 -0
  97. package/scripts/lint-path-mediation.ps1 +65 -0
  98. package/scripts/lint-path-mediation.sh +40 -0
  99. package/src/cli/.gitkeep +0 -0
  100. package/src/cli/command-registry.ts +62 -0
  101. package/src/cli/commands/auth-command.ts +179 -0
  102. package/src/cli/commands/continue-command.ts +158 -0
  103. package/src/cli/commands/delete-command.ts +163 -0
  104. package/src/cli/commands/export-all-command.ts +243 -0
  105. package/src/cli/commands/export-command.ts +156 -0
  106. package/src/cli/commands/fetch-command.ts +176 -0
  107. package/src/cli/commands/help.ts +45 -0
  108. package/src/cli/commands/install-browser-command.ts +33 -0
  109. package/src/cli/commands/list-command.ts +226 -0
  110. package/src/cli/commands/new-command.ts +147 -0
  111. package/src/cli/commands/profile-command.ts +226 -0
  112. package/src/cli/commands/status-command.ts +59 -0
  113. package/src/cli/index.ts +213 -0
  114. package/src/cli/utils/interactive-prompt.ts +64 -0
  115. package/src/core/.gitkeep +0 -0
  116. package/src/core/command-handlers.ts +240 -0
  117. package/src/core/errors.ts +41 -0
  118. package/src/core/mediator.ts +58 -0
  119. package/src/core/query-handlers.ts +163 -0
  120. package/src/core/types.ts +43 -0
  121. package/src/infrastructure/.gitkeep +0 -0
  122. package/src/infrastructure/cli-table.ts +45 -0
  123. package/src/infrastructure/config.ts +52 -0
  124. package/src/infrastructure/formatters.ts +130 -0
  125. package/src/infrastructure/io.ts +161 -0
  126. package/src/infrastructure/logger.ts +41 -0
  127. package/src/infrastructure/path-utils.ts +157 -0
  128. package/src/infrastructure/storage.ts +209 -0
  129. package/src/infrastructure/validators.ts +28 -0
  130. package/src/services/.gitkeep +0 -0
  131. package/src/services/auth-service.ts +135 -0
  132. package/src/services/cookie-monitor.ts +159 -0
  133. package/src/services/cookie-storage-service.ts +74 -0
  134. package/src/services/gemini-client-wrapper.ts +239 -0
  135. package/src/services/install-browser-service.ts +205 -0
  136. package/src/services/playwright-cli-driver.ts +269 -0
  137. package/src/services/profile-auth-manager.ts +65 -0
  138. package/src/services/profile-service.ts +121 -0
  139. package/tests/cli/auth-command.test.ts +220 -0
  140. package/tests/cli/command-registry.test.ts +67 -0
  141. package/tests/cli/continue-command.test.ts +100 -0
  142. package/tests/cli/delete-command.test.ts +128 -0
  143. package/tests/cli/export-all-command.test.ts +375 -0
  144. package/tests/cli/install-browser-command.test.ts +48 -0
  145. package/tests/cli/list-command.test.ts +179 -0
  146. package/tests/cli/new-command.test.ts +139 -0
  147. package/tests/cli/status-command.test.ts +106 -0
  148. package/tests/core/query-handlers.test.ts +187 -0
  149. package/tests/fixtures/auth-fixtures.ts +98 -0
  150. package/tests/fixtures/chat-fixtures.ts +87 -0
  151. package/tests/infrastructure/cli-table.test.ts +107 -0
  152. package/tests/infrastructure/formatters.test.ts +202 -0
  153. package/tests/infrastructure/io.test.ts +197 -0
  154. package/tests/infrastructure/logger.test.ts +74 -0
  155. package/tests/infrastructure/storage.test.ts +335 -0
  156. package/tests/infrastructure/validators.test.ts +67 -0
  157. package/tests/integration/commands/auth.test.ts +186 -0
  158. package/tests/integration/commands/continue.test.ts +130 -0
  159. package/tests/integration/commands/delete.test.ts +140 -0
  160. package/tests/integration/commands/export.test.ts +266 -0
  161. package/tests/integration/commands/fetch.test.ts +238 -0
  162. package/tests/integration/commands/list.test.ts +281 -0
  163. package/tests/integration/commands/profile.test.ts +258 -0
  164. package/tests/integration/commands/status.test.ts +223 -0
  165. package/tests/integration/installer-script-shape.test.ts +67 -0
  166. package/tests/parity/compare-outputs.ts +359 -0
  167. package/tests/parity/test-commands-parity.ps1 +82 -0
  168. package/tests/parity/test-commands-parity.sh +61 -0
  169. package/tests/services/auth-service.test.ts +315 -0
  170. package/tests/services/cookie-monitor.test.ts +229 -0
  171. package/tests/services/cookie-storage-service.test.ts +230 -0
  172. package/tests/services/gemini-client-wrapper.test.ts +688 -0
  173. package/tests/services/install-browser-service.test.ts +83 -0
  174. package/tests/services/playwright-cli-driver.test.ts +468 -0
  175. package/tests/services/profile-auth-manager.test.ts +334 -0
  176. package/tests/services/profile-service.test.ts +224 -0
  177. package/tests/setup.ts +95 -0
  178. package/tests/smoke/smoke.test.ts +52 -0
  179. package/tests/unit/config.test.ts +159 -0
  180. package/tests/unit/errors.test.ts +119 -0
  181. package/tests/unit/formatters.test.ts +316 -0
  182. package/tests/unit/mediator.test.ts +152 -0
  183. package/tests/unit/path-utils.test.ts +289 -0
  184. package/tsconfig.json +16 -0
@@ -0,0 +1,230 @@
1
+ import { describe, test, expect, beforeEach, afterEach, mock } from "bun:test";
2
+ import { CookieStorageService } from "../../src/services/cookie-storage-service.ts";
3
+ import { Logger } from "../../src/infrastructure/logger.ts";
4
+ import type { Cookie } from "../../src/core/types.ts";
5
+ import type { CookieStorage } from "../../src/infrastructure/storage.ts";
6
+
7
+ function makeFreshCookies(): Cookie[] {
8
+ const farFuture = Math.floor(Date.now() / 1000) + 365 * 24 * 60 * 60;
9
+ return [
10
+ {
11
+ name: "__Secure-1PSID",
12
+ value: "fresh-psid",
13
+ domain: ".google.com",
14
+ path: "/",
15
+ expires: farFuture,
16
+ httpOnly: true,
17
+ secure: true,
18
+ sameSite: "Lax",
19
+ },
20
+ {
21
+ name: "__Secure-1PSIDTS",
22
+ value: "fresh-psidts",
23
+ domain: ".google.com",
24
+ path: "/",
25
+ expires: farFuture,
26
+ httpOnly: true,
27
+ secure: true,
28
+ sameSite: "Lax",
29
+ },
30
+ ];
31
+ }
32
+
33
+ function makeExpiredCookies(): Cookie[] {
34
+ const past = Math.floor(Date.now() / 1000) - 30 * 24 * 60 * 60;
35
+ return [
36
+ {
37
+ name: "__Secure-1PSID",
38
+ value: "expired-psid",
39
+ domain: ".google.com",
40
+ path: "/",
41
+ expires: past,
42
+ httpOnly: true,
43
+ secure: true,
44
+ sameSite: "Lax",
45
+ },
46
+ {
47
+ name: "__Secure-1PSIDTS",
48
+ value: "expired-psidts",
49
+ domain: ".google.com",
50
+ path: "/",
51
+ expires: past,
52
+ httpOnly: true,
53
+ secure: true,
54
+ sameSite: "Lax",
55
+ },
56
+ ];
57
+ }
58
+
59
+ function makeStaleCookies(): Cookie[] {
60
+ const soon = Math.floor(Date.now() / 1000) + 3 * 24 * 60 * 60;
61
+ return [
62
+ {
63
+ name: "__Secure-1PSID",
64
+ value: "stale-psid",
65
+ domain: ".google.com",
66
+ path: "/",
67
+ expires: soon,
68
+ httpOnly: true,
69
+ secure: true,
70
+ sameSite: "Lax",
71
+ },
72
+ {
73
+ name: "__Secure-1PSIDTS",
74
+ value: "stale-psidts",
75
+ domain: ".google.com",
76
+ path: "/",
77
+ expires: soon,
78
+ httpOnly: true,
79
+ secure: true,
80
+ sameSite: "Lax",
81
+ },
82
+ ];
83
+ }
84
+
85
+ function makePartialCookies(): Cookie[] {
86
+ const farFuture = Math.floor(Date.now() / 1000) + 365 * 24 * 60 * 60;
87
+ return [
88
+ {
89
+ name: "__Secure-1PSID",
90
+ value: "only-psid",
91
+ domain: ".google.com",
92
+ path: "/",
93
+ expires: farFuture,
94
+ httpOnly: true,
95
+ secure: true,
96
+ sameSite: "Lax",
97
+ },
98
+ ];
99
+ }
100
+
101
+ function createMockCookieStorage(): CookieStorage {
102
+ return {
103
+ save: mock((_profileName: string, _cookies: Cookie[]) => {}),
104
+ load: mock((_profileName: string) => [] as Cookie[]),
105
+ delete: mock((_profileName: string) => {}),
106
+ list: mock(() => [] as string[]),
107
+ } as unknown as CookieStorage;
108
+ }
109
+
110
+ describe("CookieStorageService", () => {
111
+ let storage: CookieStorage;
112
+ let service: CookieStorageService;
113
+ let logger: Logger;
114
+
115
+ beforeEach(() => {
116
+ storage = createMockCookieStorage();
117
+ logger = new Logger("test");
118
+ service = new CookieStorageService({ cookieStorage: storage, logger });
119
+ });
120
+
121
+ afterEach(() => {
122
+ mock.restore();
123
+ });
124
+
125
+ describe("loadCookiesForProfile", () => {
126
+ test("returns cookie values from profile", () => {
127
+ storage.load = mock(() => makeFreshCookies()) as CookieStorage["load"];
128
+
129
+ const result = service.loadCookiesForProfile("default");
130
+ expect(result.secure_1psid).toBe("fresh-psid");
131
+ expect(result.secure_1psidts).toBe("fresh-psidts");
132
+ });
133
+
134
+ test("returns null for 1PSIDTS when missing", () => {
135
+ storage.load = mock(() => makePartialCookies()) as CookieStorage["load"];
136
+
137
+ const result = service.loadCookiesForProfile("default");
138
+ expect(result.secure_1psid).toBe("only-psid");
139
+ expect(result.secure_1psidts).toBeNull();
140
+ });
141
+
142
+ test("throws when __Secure-1PSID is missing", () => {
143
+ storage.load = mock(() => [
144
+ {
145
+ name: "__Secure-1PSIDTS",
146
+ value: "no-psid",
147
+ domain: ".google.com",
148
+ path: "/",
149
+ expires: -1,
150
+ httpOnly: true,
151
+ secure: true,
152
+ sameSite: "Lax",
153
+ },
154
+ ]) as CookieStorage["load"];
155
+
156
+ expect(() => service.loadCookiesForProfile("default")).toThrow("Missing required cookie");
157
+ });
158
+ });
159
+
160
+ describe("validateCookies", () => {
161
+ test("returns true when both required cookies present", () => {
162
+ expect(service.validateCookies(makeFreshCookies())).toBe(true);
163
+ });
164
+
165
+ test("returns false when __Secure-1PSIDTS is missing", () => {
166
+ expect(service.validateCookies(makePartialCookies())).toBe(false);
167
+ });
168
+
169
+ test("returns false for empty array", () => {
170
+ expect(service.validateCookies([])).toBe(false);
171
+ });
172
+ });
173
+
174
+ describe("checkCookieFreshness", () => {
175
+ test("returns true when cookies expire far in the future", () => {
176
+ expect(service.checkCookieFreshness(makeFreshCookies())).toBe(true);
177
+ });
178
+
179
+ test("returns false when cookies are expired", () => {
180
+ expect(service.checkCookieFreshness(makeExpiredCookies())).toBe(false);
181
+ });
182
+
183
+ test("returns false when cookies expire within 7 days", () => {
184
+ expect(service.checkCookieFreshness(makeStaleCookies())).toBe(false);
185
+ });
186
+
187
+ test("returns true when 1PSIDTS is a session cookie (expires: -1)", () => {
188
+ const sessionCookies: Cookie[] = [
189
+ {
190
+ name: "__Secure-1PSID",
191
+ value: "sid",
192
+ domain: ".google.com",
193
+ path: "/",
194
+ expires: -1,
195
+ httpOnly: true,
196
+ secure: true,
197
+ sameSite: "Lax",
198
+ },
199
+ {
200
+ name: "__Secure-1PSIDTS",
201
+ value: "sidts",
202
+ domain: ".google.com",
203
+ path: "/",
204
+ expires: -1,
205
+ httpOnly: true,
206
+ secure: true,
207
+ sameSite: "Lax",
208
+ },
209
+ ];
210
+ expect(service.checkCookieFreshness(sessionCookies)).toBe(true);
211
+ });
212
+ });
213
+
214
+ describe("getCookieExpiry", () => {
215
+ test("returns Date for valid expiry", () => {
216
+ const result = service.getCookieExpiry(makeFreshCookies());
217
+ expect(result).toBeInstanceOf(Date);
218
+ expect(result!.getTime()).toBeGreaterThan(Date.now());
219
+ });
220
+
221
+ test("returns null when __Secure-1PSIDTS has no positive expires", () => {
222
+ const noExpiry = makePartialCookies();
223
+ expect(service.getCookieExpiry(noExpiry)).toBeNull();
224
+ });
225
+
226
+ test("returns null for empty cookies", () => {
227
+ expect(service.getCookieExpiry([])).toBeNull();
228
+ });
229
+ });
230
+ });