@jackwener/opencli 1.7.15 → 1.7.16
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.
- package/README.md +9 -6
- package/README.zh-CN.md +9 -6
- package/cli-manifest.json +161 -31
- package/clis/chatgpt/ask.js +2 -1
- package/clis/chatgpt/detail.js +6 -1
- package/clis/chatgpt/read.js +2 -1
- package/clis/chatgpt/send.js +2 -1
- package/clis/chatgpt/utils.js +54 -12
- package/clis/chatgpt/utils.test.js +36 -1
- package/clis/claude/ask.js +22 -7
- package/clis/claude/detail.js +9 -2
- package/clis/claude/new.js +8 -2
- package/clis/claude/read.js +2 -1
- package/clis/claude/send.js +8 -3
- package/clis/claude/utils.js +27 -4
- package/clis/deepseek/ask.js +21 -8
- package/clis/deepseek/detail.js +9 -1
- package/clis/deepseek/new.js +13 -2
- package/clis/deepseek/read.js +2 -1
- package/clis/deepseek/utils.js +8 -1
- package/clis/linkedin/search.js +8 -11
- package/clis/maimai/search-talents.js +10 -6
- package/clis/openreview/author.js +58 -0
- package/clis/openreview/openreview.test.js +83 -1
- package/clis/openreview/utils.js +14 -0
- package/clis/reddit/comment.js +1 -0
- package/clis/reddit/frontpage.js +1 -0
- package/clis/reddit/popular.js +1 -0
- package/clis/reddit/read.js +2 -0
- package/clis/reddit/read.test.js +4 -0
- package/clis/reddit/save.js +1 -0
- package/clis/reddit/saved.js +1 -0
- package/clis/reddit/search.js +1 -0
- package/clis/reddit/subreddit.js +1 -0
- package/clis/reddit/subscribe.js +1 -0
- package/clis/reddit/upvote.js +1 -0
- package/clis/reddit/upvoted.js +1 -0
- package/clis/reddit/user-comments.js +1 -0
- package/clis/reddit/user-posts.js +1 -0
- package/clis/reddit/user.js +1 -0
- package/clis/twitter/article.js +7 -4
- package/clis/twitter/bookmark-folder.js +3 -5
- package/clis/twitter/bookmark-folder.test.js +5 -2
- package/clis/twitter/bookmark-folders.js +3 -5
- package/clis/twitter/bookmark-folders.test.js +3 -1
- package/clis/twitter/bookmarks.js +3 -5
- package/clis/twitter/download.js +1 -0
- package/clis/twitter/followers.js +1 -0
- package/clis/twitter/following.js +3 -6
- package/clis/twitter/following.test.js +2 -1
- package/clis/twitter/likes.js +3 -5
- package/clis/twitter/list-add.js +4 -3
- package/clis/twitter/list-add.test.js +23 -1
- package/clis/twitter/list-remove.js +4 -3
- package/clis/twitter/list-remove.test.js +23 -1
- package/clis/twitter/list-tweets.js +3 -5
- package/clis/twitter/lists.js +3 -5
- package/clis/twitter/notifications.js +1 -0
- package/clis/twitter/profile.js +7 -4
- package/clis/twitter/search.js +1 -0
- package/clis/twitter/thread.js +5 -7
- package/clis/twitter/timeline.js +5 -7
- package/clis/twitter/trending.js +4 -4
- package/clis/twitter/tweets.js +3 -6
- package/clis/youtube/like.js +6 -2
- package/clis/youtube/subscribe.js +6 -2
- package/clis/youtube/unlike.js +6 -2
- package/clis/youtube/unsubscribe.js +6 -2
- package/clis/youtube/utils.js +19 -13
- package/clis/youtube/utils.test.js +17 -1
- package/dist/src/browser/bridge.d.ts +1 -0
- package/dist/src/browser/bridge.js +1 -1
- package/dist/src/browser/cdp.d.ts +1 -0
- package/dist/src/browser/daemon-client.d.ts +2 -2
- package/dist/src/browser/daemon-client.js +6 -3
- package/dist/src/browser/daemon-client.test.js +10 -0
- package/dist/src/browser/page.d.ts +2 -1
- package/dist/src/browser/page.js +5 -1
- package/dist/src/cli.js +70 -2
- package/dist/src/cli.test.js +139 -7
- package/dist/src/commanderAdapter.js +7 -0
- package/dist/src/doctor.js +2 -2
- package/dist/src/doctor.test.js +4 -4
- package/dist/src/execution.d.ts +2 -0
- package/dist/src/execution.js +31 -6
- package/dist/src/execution.test.js +43 -16
- package/dist/src/external-clis.yaml +24 -0
- package/dist/src/help.d.ts +1 -0
- package/dist/src/help.js +29 -0
- package/dist/src/main.js +4 -14
- package/dist/src/runtime.d.ts +3 -0
- package/dist/src/runtime.js +1 -0
- package/dist/src/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/src/help.js
CHANGED
|
@@ -28,6 +28,20 @@ const COMMON_OPTIONS = [
|
|
|
28
28
|
help: 'display help for command',
|
|
29
29
|
},
|
|
30
30
|
];
|
|
31
|
+
const BROWSER_COMMON_OPTIONS = [
|
|
32
|
+
{
|
|
33
|
+
flags: '--window <mode>',
|
|
34
|
+
name: 'window',
|
|
35
|
+
help: 'Browser window mode: foreground or background',
|
|
36
|
+
choices: ['foreground', 'background'],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
flags: '--keep-tab <bool>',
|
|
40
|
+
name: 'keep-tab',
|
|
41
|
+
help: 'Keep the browser tab lease after the command finishes',
|
|
42
|
+
choices: ['true', 'false'],
|
|
43
|
+
},
|
|
44
|
+
];
|
|
31
45
|
function normalizeStructuredHelpFormat(value) {
|
|
32
46
|
const normalized = value?.toLowerCase();
|
|
33
47
|
if (normalized === 'yaml' || normalized === 'yml')
|
|
@@ -307,6 +321,7 @@ function compactCommand(cmd) {
|
|
|
307
321
|
...(cmd.aliases?.length ? { aliases: cmd.aliases } : {}),
|
|
308
322
|
positionals: positionals(cmd).map(compactArg),
|
|
309
323
|
command_options: commandOptions(cmd).map(compactArg),
|
|
324
|
+
...(cmd.browser ? { browser_common_options: BROWSER_COMMON_OPTIONS.map(compactCommonOption) } : {}),
|
|
310
325
|
example: formatCommandExample(cmd),
|
|
311
326
|
...(cmd.browserSession ? { browserSession: cmd.browserSession } : {}),
|
|
312
327
|
...(cmd.defaultFormat ? { defaultFormat: cmd.defaultFormat } : {}),
|
|
@@ -353,6 +368,7 @@ export function siteHelpData(site, commands) {
|
|
|
353
368
|
command_count: unique.length,
|
|
354
369
|
commands: unique.map(cmd => compactCommand(cmd)),
|
|
355
370
|
common_options: COMMON_OPTIONS.map(compactCommonOption),
|
|
371
|
+
...(unique.some(cmd => cmd.browser) ? { browser_common_options: BROWSER_COMMON_OPTIONS.map(compactCommonOption) } : {}),
|
|
356
372
|
next: [
|
|
357
373
|
`opencli ${site} <command> --help -f yaml`,
|
|
358
374
|
`opencli ${site} <command> -f yaml`,
|
|
@@ -364,6 +380,7 @@ export function commandHelpData(cmd) {
|
|
|
364
380
|
site: cmd.site,
|
|
365
381
|
...compactCommand(cmd),
|
|
366
382
|
common_options: COMMON_OPTIONS.map(compactCommonOption),
|
|
383
|
+
...(cmd.browser ? { browser_common_options: BROWSER_COMMON_OPTIONS.map(compactCommonOption) } : {}),
|
|
367
384
|
output_formats: ['table', 'plain', 'yaml', 'json', 'md', 'csv'],
|
|
368
385
|
};
|
|
369
386
|
}
|
|
@@ -394,6 +411,15 @@ export function formatCommonOptionsHelpText() {
|
|
|
394
411
|
});
|
|
395
412
|
return ['Common options:', ...formatRows(rows)].join('\n');
|
|
396
413
|
}
|
|
414
|
+
export function formatBrowserCommonOptionsHelpText() {
|
|
415
|
+
const rows = BROWSER_COMMON_OPTIONS.map(option => {
|
|
416
|
+
const details = [option.help];
|
|
417
|
+
if ('choices' in option)
|
|
418
|
+
details.push(`choices: ${option.choices.join(', ')}`);
|
|
419
|
+
return [option.flags, details.join(' ')];
|
|
420
|
+
});
|
|
421
|
+
return ['Browser common options:', ...formatRows(rows)].join('\n');
|
|
422
|
+
}
|
|
397
423
|
export function formatSiteHelpText(site, commands) {
|
|
398
424
|
const unique = [...new Map(commands.map(cmd => [fullName(cmd), cmd])).values()]
|
|
399
425
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -406,6 +432,7 @@ export function formatSiteHelpText(site, commands) {
|
|
|
406
432
|
...formatRows(unique.map(cmd => [formatCommandListTerm(cmd), formatSiteCommandDescription(cmd)])),
|
|
407
433
|
'',
|
|
408
434
|
formatCommonOptionsHelpText(),
|
|
435
|
+
...(unique.some(cmd => cmd.browser) ? ['', formatBrowserCommonOptionsHelpText()] : []),
|
|
409
436
|
'',
|
|
410
437
|
`Agent tip: use 'opencli ${site} --help -f yaml' to get all command args/options in one structured response.`,
|
|
411
438
|
'',
|
|
@@ -434,6 +461,8 @@ export function formatCommandHelpText(cmd) {
|
|
|
434
461
|
lines.push('Command options:', ...formatRows(optionRows), '');
|
|
435
462
|
}
|
|
436
463
|
lines.push(formatCommonOptionsHelpText(), '');
|
|
464
|
+
if (cmd.browser)
|
|
465
|
+
lines.push(formatBrowserCommonOptionsHelpText(), '');
|
|
437
466
|
const meta = [];
|
|
438
467
|
meta.push(`Access: ${cmd.access}`);
|
|
439
468
|
meta.push(`Browser: ${cmd.browser ? 'yes' : 'no'}`);
|
package/dist/src/main.js
CHANGED
|
@@ -27,21 +27,11 @@ const __dirname = path.dirname(__filename);
|
|
|
27
27
|
// Use findPackageRoot so the path works both in dev (src/main.ts) and prod (dist/src/main.js).
|
|
28
28
|
const BUILTIN_CLIS = path.join(findPackageRoot(__filename), 'clis');
|
|
29
29
|
const USER_CLIS = path.join(os.homedir(), '.opencli', 'clis');
|
|
30
|
-
// ──
|
|
31
|
-
// `--
|
|
32
|
-
//
|
|
33
|
-
//
|
|
30
|
+
// ── Browser reuse flag ───────────────────────────────────────────────────
|
|
31
|
+
// `--reuse` is a runtime-level browser session override rather than an adapter
|
|
32
|
+
// arg. Strip it before Commander runs and expose it through an explicit env
|
|
33
|
+
// name. Window/keep-tab are registered on browser-backed commands directly.
|
|
34
34
|
{
|
|
35
|
-
const liveIdx = process.argv.indexOf('--live');
|
|
36
|
-
if (liveIdx !== -1) {
|
|
37
|
-
process.env.OPENCLI_LIVE = '1';
|
|
38
|
-
process.argv.splice(liveIdx, 1);
|
|
39
|
-
}
|
|
40
|
-
const focusIdx = process.argv.indexOf('--focus');
|
|
41
|
-
if (focusIdx !== -1) {
|
|
42
|
-
process.env.OPENCLI_WINDOW_FOCUSED = '1';
|
|
43
|
-
process.argv.splice(focusIdx, 1);
|
|
44
|
-
}
|
|
45
35
|
const reuseIdx = process.argv.findIndex(arg => arg === '--reuse' || arg.startsWith('--reuse='));
|
|
46
36
|
if (reuseIdx !== -1) {
|
|
47
37
|
const arg = process.argv[reuseIdx];
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { IPage } from './types.js';
|
|
|
6
6
|
export declare function getBrowserFactory(site?: string): new () => IBrowserFactory;
|
|
7
7
|
export declare const DEFAULT_BROWSER_CONNECT_TIMEOUT: number;
|
|
8
8
|
export declare const DEFAULT_BROWSER_COMMAND_TIMEOUT: number;
|
|
9
|
+
export type BrowserWindowMode = 'foreground' | 'background';
|
|
9
10
|
/**
|
|
10
11
|
* Timeout with seconds unit. Used for high-level command timeouts.
|
|
11
12
|
*/
|
|
@@ -28,6 +29,7 @@ export interface IBrowserFactory {
|
|
|
28
29
|
cdpEndpoint?: string;
|
|
29
30
|
contextId?: string;
|
|
30
31
|
idleTimeout?: number;
|
|
32
|
+
windowMode?: BrowserWindowMode;
|
|
31
33
|
}): Promise<IPage>;
|
|
32
34
|
close(): Promise<void>;
|
|
33
35
|
}
|
|
@@ -36,4 +38,5 @@ export declare function browserSession<T>(BrowserFactory: new () => IBrowserFact
|
|
|
36
38
|
cdpEndpoint?: string;
|
|
37
39
|
contextId?: string;
|
|
38
40
|
idleTimeout?: number;
|
|
41
|
+
windowMode?: BrowserWindowMode;
|
|
39
42
|
}): Promise<T>;
|
package/dist/src/runtime.js
CHANGED
package/dist/src/types.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export interface BrowserSessionInfo {
|
|
|
68
68
|
owned?: boolean;
|
|
69
69
|
ownership?: 'owned' | 'borrowed';
|
|
70
70
|
lifecycle?: 'ephemeral' | 'persistent' | 'pinned';
|
|
71
|
-
|
|
71
|
+
windowRole?: 'interactive' | 'automation' | 'borrowed-user';
|
|
72
72
|
contextId?: string;
|
|
73
73
|
tabCount?: number;
|
|
74
74
|
idleMsRemaining?: number | null;
|