@jackwener/opencli 1.5.8 → 1.5.9

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 (194) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +17 -1
  3. package/README.zh-CN.md +17 -1
  4. package/dist/browser/base-page.d.ts +48 -0
  5. package/dist/browser/base-page.js +160 -0
  6. package/dist/browser/cdp.js +4 -106
  7. package/dist/browser/daemon-client.d.ts +1 -7
  8. package/dist/browser/daemon-client.js +2 -9
  9. package/dist/browser/discover.d.ts +1 -4
  10. package/dist/browser/discover.js +1 -4
  11. package/dist/browser/errors.d.ts +4 -0
  12. package/dist/browser/errors.js +20 -0
  13. package/dist/browser/index.d.ts +1 -1
  14. package/dist/browser/index.js +1 -1
  15. package/dist/browser/page.d.ts +6 -35
  16. package/dist/browser/page.js +10 -189
  17. package/dist/browser/tabs.js +5 -5
  18. package/dist/browser.test.js +15 -15
  19. package/dist/cli-manifest.json +294 -22
  20. package/dist/clis/amazon/bestsellers.d.ts +21 -0
  21. package/dist/clis/amazon/bestsellers.js +130 -0
  22. package/dist/clis/amazon/bestsellers.test.js +20 -0
  23. package/dist/clis/amazon/discussion.d.ts +20 -0
  24. package/dist/clis/amazon/discussion.js +91 -0
  25. package/dist/clis/amazon/discussion.test.js +36 -0
  26. package/dist/clis/amazon/offer.d.ts +23 -0
  27. package/dist/clis/amazon/offer.js +140 -0
  28. package/dist/clis/amazon/offer.test.d.ts +1 -0
  29. package/dist/clis/amazon/offer.test.js +29 -0
  30. package/dist/clis/amazon/product.d.ts +18 -0
  31. package/dist/clis/amazon/product.js +92 -0
  32. package/dist/clis/amazon/product.test.d.ts +1 -0
  33. package/dist/clis/amazon/product.test.js +24 -0
  34. package/dist/clis/amazon/search.d.ts +18 -0
  35. package/dist/clis/amazon/search.js +87 -0
  36. package/dist/clis/amazon/search.test.d.ts +1 -0
  37. package/dist/clis/amazon/search.test.js +22 -0
  38. package/dist/clis/amazon/shared.d.ts +64 -0
  39. package/dist/clis/amazon/shared.js +255 -0
  40. package/dist/clis/amazon/shared.test.d.ts +1 -0
  41. package/dist/clis/amazon/shared.test.js +33 -0
  42. package/dist/clis/gemini/ask.d.ts +1 -0
  43. package/dist/clis/gemini/ask.js +40 -0
  44. package/dist/clis/gemini/image.d.ts +1 -0
  45. package/dist/clis/gemini/image.js +105 -0
  46. package/dist/clis/gemini/new.d.ts +1 -0
  47. package/dist/clis/gemini/new.js +20 -0
  48. package/dist/clis/gemini/utils.d.ts +34 -0
  49. package/dist/clis/gemini/utils.js +463 -0
  50. package/dist/clis/gemini/utils.test.d.ts +1 -0
  51. package/dist/clis/gemini/utils.test.js +31 -0
  52. package/dist/clis/notebooklm/compat.test.d.ts +1 -1
  53. package/dist/clis/notebooklm/compat.test.js +3 -3
  54. package/dist/clis/notebooklm/current.js +2 -3
  55. package/dist/clis/notebooklm/get.js +2 -3
  56. package/dist/clis/notebooklm/history.js +2 -3
  57. package/dist/clis/notebooklm/note-list.js +2 -3
  58. package/dist/clis/notebooklm/notes-get.js +2 -3
  59. package/dist/clis/notebooklm/open.d.ts +1 -0
  60. package/dist/clis/notebooklm/open.js +41 -0
  61. package/dist/clis/notebooklm/open.test.d.ts +1 -0
  62. package/dist/clis/notebooklm/open.test.js +63 -0
  63. package/dist/clis/notebooklm/source-fulltext.js +2 -3
  64. package/dist/clis/notebooklm/source-get.js +2 -3
  65. package/dist/clis/notebooklm/source-guide.js +2 -3
  66. package/dist/clis/notebooklm/source-list.js +2 -3
  67. package/dist/clis/notebooklm/status.js +1 -2
  68. package/dist/clis/notebooklm/summary.js +2 -3
  69. package/dist/clis/notebooklm/utils.d.ts +2 -1
  70. package/dist/clis/notebooklm/utils.js +20 -21
  71. package/dist/clis/xiaohongshu/creator-note-detail.test.js +11 -11
  72. package/dist/clis/xiaohongshu/creator-notes-summary.test.js +6 -6
  73. package/dist/clis/xiaohongshu/creator-notes.test.js +22 -22
  74. package/dist/commanderAdapter.js +6 -3
  75. package/dist/commanderAdapter.test.js +33 -0
  76. package/dist/commands/daemon.js +1 -1
  77. package/dist/commands/daemon.test.js +1 -1
  78. package/dist/doctor.d.ts +1 -2
  79. package/dist/doctor.js +7 -8
  80. package/dist/explore.js +1 -1
  81. package/dist/output.js +28 -0
  82. package/dist/output.test.js +15 -0
  83. package/dist/pipeline/executor.js +2 -7
  84. package/dist/pipeline/steps/browser.js +1 -1
  85. package/dist/pipeline/template.js +25 -3
  86. package/dist/record.d.ts +50 -0
  87. package/dist/record.js +298 -57
  88. package/dist/record.test.d.ts +1 -0
  89. package/dist/record.test.js +293 -0
  90. package/dist/registry.d.ts +2 -0
  91. package/dist/registry.js +1 -0
  92. package/dist/registry.test.js +10 -0
  93. package/dist/runtime.js +3 -3
  94. package/dist/snapshotFormatter.d.ts +1 -1
  95. package/dist/snapshotFormatter.js +4 -4
  96. package/dist/snapshotFormatter.test.d.ts +1 -1
  97. package/dist/snapshotFormatter.test.js +2 -2
  98. package/dist/types.d.ts +3 -1
  99. package/dist/types.js +1 -1
  100. package/docs/.vitepress/config.mts +2 -0
  101. package/docs/adapters/browser/amazon.md +53 -0
  102. package/docs/adapters/browser/gemini.md +72 -0
  103. package/docs/adapters/browser/notebooklm.md +5 -5
  104. package/docs/adapters/index.md +3 -1
  105. package/extension/dist/background.js +5 -143
  106. package/extension/src/background.test.ts +7 -163
  107. package/extension/src/background.ts +7 -157
  108. package/extension/src/protocol.ts +1 -5
  109. package/package.json +1 -1
  110. package/skills/opencli-explorer/SKILL.md +847 -0
  111. package/skills/opencli-oneshot/SKILL.md +216 -0
  112. package/skills/opencli-usage/SKILL.md +71 -0
  113. package/skills/opencli-usage/browser.md +429 -0
  114. package/skills/opencli-usage/desktop.md +118 -0
  115. package/skills/opencli-usage/plugins.md +82 -0
  116. package/skills/opencli-usage/public-api.md +149 -0
  117. package/src/browser/base-page.ts +197 -0
  118. package/src/browser/cdp.ts +7 -131
  119. package/src/browser/daemon-client.ts +3 -14
  120. package/src/browser/discover.ts +1 -4
  121. package/src/browser/errors.ts +22 -0
  122. package/src/browser/index.ts +1 -1
  123. package/src/browser/page.ts +13 -212
  124. package/src/browser/tabs.ts +5 -5
  125. package/src/browser.test.ts +15 -15
  126. package/src/clis/amazon/bestsellers.test.ts +22 -0
  127. package/src/clis/amazon/bestsellers.ts +180 -0
  128. package/src/clis/amazon/discussion.test.ts +38 -0
  129. package/src/clis/amazon/discussion.ts +131 -0
  130. package/src/clis/amazon/offer.test.ts +35 -0
  131. package/src/clis/amazon/offer.ts +185 -0
  132. package/src/clis/amazon/product.test.ts +26 -0
  133. package/src/clis/amazon/product.ts +131 -0
  134. package/src/clis/amazon/search.test.ts +24 -0
  135. package/src/clis/amazon/search.ts +128 -0
  136. package/src/clis/amazon/shared.test.ts +37 -0
  137. package/src/clis/amazon/shared.ts +316 -0
  138. package/src/clis/gemini/ask.ts +46 -0
  139. package/src/clis/gemini/image.ts +115 -0
  140. package/src/clis/gemini/new.ts +22 -0
  141. package/src/clis/gemini/utils.test.ts +36 -0
  142. package/src/clis/gemini/utils.ts +523 -0
  143. package/src/clis/notebooklm/compat.test.ts +3 -3
  144. package/src/clis/notebooklm/current.ts +2 -3
  145. package/src/clis/notebooklm/get.ts +1 -3
  146. package/src/clis/notebooklm/history.ts +1 -3
  147. package/src/clis/notebooklm/note-list.ts +1 -3
  148. package/src/clis/notebooklm/notes-get.ts +1 -3
  149. package/src/clis/notebooklm/open.test.ts +78 -0
  150. package/src/clis/notebooklm/open.ts +61 -0
  151. package/src/clis/notebooklm/source-fulltext.ts +1 -3
  152. package/src/clis/notebooklm/source-get.ts +1 -3
  153. package/src/clis/notebooklm/source-guide.ts +1 -3
  154. package/src/clis/notebooklm/source-list.ts +1 -3
  155. package/src/clis/notebooklm/status.ts +1 -2
  156. package/src/clis/notebooklm/summary.ts +1 -3
  157. package/src/clis/notebooklm/utils.ts +29 -20
  158. package/src/clis/xiaohongshu/creator-note-detail.test.ts +11 -11
  159. package/src/clis/xiaohongshu/creator-notes-summary.test.ts +6 -6
  160. package/src/clis/xiaohongshu/creator-notes.test.ts +22 -22
  161. package/src/commanderAdapter.test.ts +47 -0
  162. package/src/commanderAdapter.ts +7 -3
  163. package/src/commands/daemon.test.ts +1 -1
  164. package/src/commands/daemon.ts +1 -1
  165. package/src/doctor.ts +7 -8
  166. package/src/explore.ts +1 -1
  167. package/src/output.test.ts +17 -0
  168. package/src/output.ts +27 -0
  169. package/src/pipeline/executor.ts +2 -7
  170. package/src/pipeline/steps/browser.ts +1 -1
  171. package/src/pipeline/template.ts +27 -4
  172. package/src/record.test.ts +362 -0
  173. package/src/record.ts +341 -62
  174. package/src/registry.test.ts +12 -0
  175. package/src/registry.ts +3 -0
  176. package/src/runtime.ts +3 -3
  177. package/src/snapshotFormatter.test.ts +2 -2
  178. package/src/snapshotFormatter.ts +4 -4
  179. package/src/types.ts +3 -1
  180. package/.agents/skills/cross-project-adapter-migration/SKILL.md +0 -249
  181. package/.agents/workflows/cross-project-adapter-migration.md +0 -54
  182. package/SKILL.md +0 -879
  183. package/dist/clis/notebooklm/bind-current.js +0 -29
  184. package/dist/clis/notebooklm/bind-current.test.d.ts +0 -1
  185. package/dist/clis/notebooklm/bind-current.test.js +0 -35
  186. package/dist/clis/notebooklm/binding.test.js +0 -44
  187. package/src/clis/notebooklm/bind-current.test.ts +0 -43
  188. package/src/clis/notebooklm/bind-current.ts +0 -36
  189. package/src/clis/notebooklm/binding.test.ts +0 -53
  190. /package/dist/browser/{mcp.d.ts → bridge.d.ts} +0 -0
  191. /package/dist/browser/{mcp.js → bridge.js} +0 -0
  192. /package/dist/clis/{notebooklm/bind-current.d.ts → amazon/bestsellers.test.d.ts} +0 -0
  193. /package/dist/clis/{notebooklm/binding.test.d.ts → amazon/discussion.test.d.ts} +0 -0
  194. /package/src/browser/{mcp.ts → bridge.ts} +0 -0
@@ -1,29 +0,0 @@
1
- import { cli, Strategy } from '../../registry.js';
2
- import { bindCurrentTab } from '../../browser/daemon-client.js';
3
- import { NOTEBOOKLM_DOMAIN, NOTEBOOKLM_SITE } from './shared.js';
4
- import { parseNotebooklmIdFromUrl } from './utils.js';
5
- cli({
6
- site: NOTEBOOKLM_SITE,
7
- name: 'bind-current',
8
- aliases: ['use'],
9
- description: 'Bind the current active NotebookLM notebook tab into the site:notebooklm workspace',
10
- domain: NOTEBOOKLM_DOMAIN,
11
- strategy: Strategy.COOKIE,
12
- browser: true,
13
- navigateBefore: false,
14
- args: [],
15
- columns: ['workspace', 'tab_id', 'notebook_id', 'title', 'url'],
16
- func: async () => {
17
- const result = await bindCurrentTab(`site:${NOTEBOOKLM_SITE}`, {
18
- matchDomain: NOTEBOOKLM_DOMAIN,
19
- matchPathPrefix: '/notebook/',
20
- });
21
- return [{
22
- workspace: result.workspace ?? `site:${NOTEBOOKLM_SITE}`,
23
- tab_id: result.tabId ?? null,
24
- notebook_id: result.url ? parseNotebooklmIdFromUrl(result.url) : '',
25
- title: result.title ?? '',
26
- url: result.url ?? '',
27
- }];
28
- },
29
- });
@@ -1 +0,0 @@
1
- import './bind-current.js';
@@ -1,35 +0,0 @@
1
- import { beforeEach, describe, expect, it, vi } from 'vitest';
2
- const { mockBindCurrentTab } = vi.hoisted(() => ({
3
- mockBindCurrentTab: vi.fn(),
4
- }));
5
- vi.mock('../../browser/daemon-client.js', () => ({
6
- bindCurrentTab: mockBindCurrentTab,
7
- }));
8
- import { getRegistry } from '../../registry.js';
9
- import './bind-current.js';
10
- describe('notebooklm bind-current', () => {
11
- const command = getRegistry().get('notebooklm/bind-current');
12
- beforeEach(() => {
13
- mockBindCurrentTab.mockReset();
14
- });
15
- it('binds the current notebook tab into site:notebooklm', async () => {
16
- mockBindCurrentTab.mockResolvedValue({
17
- workspace: 'site:notebooklm',
18
- tabId: 123,
19
- title: 'Bound Notebook',
20
- url: 'https://notebooklm.google.com/notebook/nb-live',
21
- });
22
- const result = await command.func({}, {});
23
- expect(mockBindCurrentTab).toHaveBeenCalledWith('site:notebooklm', {
24
- matchDomain: 'notebooklm.google.com',
25
- matchPathPrefix: '/notebook/',
26
- });
27
- expect(result).toEqual([{
28
- workspace: 'site:notebooklm',
29
- tab_id: 123,
30
- notebook_id: 'nb-live',
31
- title: 'Bound Notebook',
32
- url: 'https://notebooklm.google.com/notebook/nb-live',
33
- }]);
34
- });
35
- });
@@ -1,44 +0,0 @@
1
- import { beforeEach, describe, expect, it, vi } from 'vitest';
2
- const { mockBindCurrentTab } = vi.hoisted(() => ({
3
- mockBindCurrentTab: vi.fn(),
4
- }));
5
- vi.mock('../../browser/daemon-client.js', () => ({
6
- bindCurrentTab: mockBindCurrentTab,
7
- }));
8
- import { ensureNotebooklmNotebookBinding } from './utils.js';
9
- describe('notebooklm automatic binding', () => {
10
- const originalEndpoint = process.env.OPENCLI_CDP_ENDPOINT;
11
- beforeEach(() => {
12
- mockBindCurrentTab.mockReset();
13
- if (originalEndpoint === undefined)
14
- delete process.env.OPENCLI_CDP_ENDPOINT;
15
- else
16
- process.env.OPENCLI_CDP_ENDPOINT = originalEndpoint;
17
- });
18
- it('does nothing when the current page is already a notebook page', async () => {
19
- const page = {
20
- getCurrentUrl: async () => 'https://notebooklm.google.com/notebook/nb-demo',
21
- };
22
- await expect(ensureNotebooklmNotebookBinding(page)).resolves.toBe(false);
23
- expect(mockBindCurrentTab).not.toHaveBeenCalled();
24
- });
25
- it('best-effort binds a notebook page through the browser bridge when currently on home', async () => {
26
- const page = {
27
- getCurrentUrl: async () => 'https://notebooklm.google.com/',
28
- };
29
- mockBindCurrentTab.mockResolvedValue({});
30
- await expect(ensureNotebooklmNotebookBinding(page)).resolves.toBe(true);
31
- expect(mockBindCurrentTab).toHaveBeenCalledWith('site:notebooklm', {
32
- matchDomain: 'notebooklm.google.com',
33
- matchPathPrefix: '/notebook/',
34
- });
35
- });
36
- it('skips daemon binding in direct CDP mode', async () => {
37
- process.env.OPENCLI_CDP_ENDPOINT = 'ws://127.0.0.1:9222/devtools/page/1';
38
- const page = {
39
- getCurrentUrl: async () => 'https://notebooklm.google.com/',
40
- };
41
- await expect(ensureNotebooklmNotebookBinding(page)).resolves.toBe(false);
42
- expect(mockBindCurrentTab).not.toHaveBeenCalled();
43
- });
44
- });
@@ -1,43 +0,0 @@
1
- import { beforeEach, describe, expect, it, vi } from 'vitest';
2
-
3
- const { mockBindCurrentTab } = vi.hoisted(() => ({
4
- mockBindCurrentTab: vi.fn(),
5
- }));
6
-
7
- vi.mock('../../browser/daemon-client.js', () => ({
8
- bindCurrentTab: mockBindCurrentTab,
9
- }));
10
-
11
- import { getRegistry } from '../../registry.js';
12
- import './bind-current.js';
13
-
14
- describe('notebooklm bind-current', () => {
15
- const command = getRegistry().get('notebooklm/bind-current');
16
-
17
- beforeEach(() => {
18
- mockBindCurrentTab.mockReset();
19
- });
20
-
21
- it('binds the current notebook tab into site:notebooklm', async () => {
22
- mockBindCurrentTab.mockResolvedValue({
23
- workspace: 'site:notebooklm',
24
- tabId: 123,
25
- title: 'Bound Notebook',
26
- url: 'https://notebooklm.google.com/notebook/nb-live',
27
- });
28
-
29
- const result = await command!.func!({} as any, {});
30
-
31
- expect(mockBindCurrentTab).toHaveBeenCalledWith('site:notebooklm', {
32
- matchDomain: 'notebooklm.google.com',
33
- matchPathPrefix: '/notebook/',
34
- });
35
- expect(result).toEqual([{
36
- workspace: 'site:notebooklm',
37
- tab_id: 123,
38
- notebook_id: 'nb-live',
39
- title: 'Bound Notebook',
40
- url: 'https://notebooklm.google.com/notebook/nb-live',
41
- }]);
42
- });
43
- });
@@ -1,36 +0,0 @@
1
- import { cli, Strategy } from '../../registry.js';
2
- import { bindCurrentTab } from '../../browser/daemon-client.js';
3
- import { NOTEBOOKLM_DOMAIN, NOTEBOOKLM_SITE } from './shared.js';
4
- import { parseNotebooklmIdFromUrl } from './utils.js';
5
-
6
- cli({
7
- site: NOTEBOOKLM_SITE,
8
- name: 'bind-current',
9
- aliases: ['use'],
10
- description: 'Bind the current active NotebookLM notebook tab into the site:notebooklm workspace',
11
- domain: NOTEBOOKLM_DOMAIN,
12
- strategy: Strategy.COOKIE,
13
- browser: true,
14
- navigateBefore: false,
15
- args: [],
16
- columns: ['workspace', 'tab_id', 'notebook_id', 'title', 'url'],
17
- func: async () => {
18
- const result = await bindCurrentTab(`site:${NOTEBOOKLM_SITE}`, {
19
- matchDomain: NOTEBOOKLM_DOMAIN,
20
- matchPathPrefix: '/notebook/',
21
- }) as {
22
- tabId?: number;
23
- workspace?: string;
24
- title?: string;
25
- url?: string;
26
- };
27
-
28
- return [{
29
- workspace: result.workspace ?? `site:${NOTEBOOKLM_SITE}`,
30
- tab_id: result.tabId ?? null,
31
- notebook_id: result.url ? parseNotebooklmIdFromUrl(result.url) : '',
32
- title: result.title ?? '',
33
- url: result.url ?? '',
34
- }];
35
- },
36
- });
@@ -1,53 +0,0 @@
1
- import { beforeEach, describe, expect, it, vi } from 'vitest';
2
-
3
- const { mockBindCurrentTab } = vi.hoisted(() => ({
4
- mockBindCurrentTab: vi.fn(),
5
- }));
6
-
7
- vi.mock('../../browser/daemon-client.js', () => ({
8
- bindCurrentTab: mockBindCurrentTab,
9
- }));
10
-
11
- import { ensureNotebooklmNotebookBinding } from './utils.js';
12
-
13
- describe('notebooklm automatic binding', () => {
14
- const originalEndpoint = process.env.OPENCLI_CDP_ENDPOINT;
15
-
16
- beforeEach(() => {
17
- mockBindCurrentTab.mockReset();
18
- if (originalEndpoint === undefined) delete process.env.OPENCLI_CDP_ENDPOINT;
19
- else process.env.OPENCLI_CDP_ENDPOINT = originalEndpoint;
20
- });
21
-
22
- it('does nothing when the current page is already a notebook page', async () => {
23
- const page = {
24
- getCurrentUrl: async () => 'https://notebooklm.google.com/notebook/nb-demo',
25
- };
26
-
27
- await expect(ensureNotebooklmNotebookBinding(page as any)).resolves.toBe(false);
28
- expect(mockBindCurrentTab).not.toHaveBeenCalled();
29
- });
30
-
31
- it('best-effort binds a notebook page through the browser bridge when currently on home', async () => {
32
- const page = {
33
- getCurrentUrl: async () => 'https://notebooklm.google.com/',
34
- };
35
-
36
- mockBindCurrentTab.mockResolvedValue({});
37
- await expect(ensureNotebooklmNotebookBinding(page as any)).resolves.toBe(true);
38
- expect(mockBindCurrentTab).toHaveBeenCalledWith('site:notebooklm', {
39
- matchDomain: 'notebooklm.google.com',
40
- matchPathPrefix: '/notebook/',
41
- });
42
- });
43
-
44
- it('skips daemon binding in direct CDP mode', async () => {
45
- process.env.OPENCLI_CDP_ENDPOINT = 'ws://127.0.0.1:9222/devtools/page/1';
46
- const page = {
47
- getCurrentUrl: async () => 'https://notebooklm.google.com/',
48
- };
49
-
50
- await expect(ensureNotebooklmNotebookBinding(page as any)).resolves.toBe(false);
51
- expect(mockBindCurrentTab).not.toHaveBeenCalled();
52
- });
53
- });
File without changes
File without changes
File without changes