@agentrhq/webcmd 0.2.5 → 0.3.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.
- package/README.md +13 -2
- package/cli-manifest.json +217 -13
- package/clis/_shared/site-auth.js +3 -3
- package/clis/_shared/site-auth.test.js +4 -4
- package/clis/chatgpt/ask.js +1 -1
- package/clis/chatgpt/ask.test.js +11 -0
- package/clis/chatgpt/commands.test.js +102 -1
- package/clis/chatgpt/deep-research-result.js +45 -3
- package/clis/chatgpt/image.js +22 -2
- package/clis/chatgpt/project-file-add.js +24 -1
- package/clis/chatgpt/utils.js +258 -52
- package/clis/chatgpt/utils.test.js +259 -1
- package/clis/claude/ask.js +21 -1
- package/clis/facebook/feed.js +110 -24
- package/clis/facebook/feed.test.js +62 -0
- package/clis/facebook/search.js +185 -38
- package/clis/facebook/search.test.js +95 -50
- package/clis/instagram/explore.js +30 -12
- package/clis/instagram/explore.test.js +77 -0
- package/clis/instagram/post.js +14 -1
- package/clis/instagram/reel.js +13 -1
- package/clis/linkedin/company.js +153 -0
- package/clis/linkedin/company.test.js +111 -0
- package/clis/linkedin/connections.js +135 -0
- package/clis/linkedin/connections.test.js +141 -0
- package/clis/mercury/reimbursement-draft.js +12 -1
- package/clis/slock/whoami.test.js +2 -2
- package/clis/twitter/article-evaluate.test.js +27 -0
- package/clis/twitter/article.js +73 -16
- package/clis/twitter/article.test.js +209 -0
- package/clis/twitter/download.js +6 -1
- package/clis/twitter/post.js +14 -1
- package/clis/twitter/profile.js +1 -1
- package/clis/twitter/profile.test.js +8 -0
- package/clis/twitter/quote.js +11 -1
- package/clis/twitter/reply.js +11 -1
- package/dist/src/browser/base-page.d.ts +26 -0
- package/dist/src/browser/base-page.js +23 -8
- package/dist/src/browser/base-page.test.js +45 -12
- package/dist/src/browser/command-catalog.d.ts +6 -0
- package/dist/src/browser/command-catalog.js +259 -0
- package/dist/src/browser/command-catalog.test.d.ts +1 -0
- package/dist/src/browser/command-catalog.test.js +79 -0
- package/dist/src/browser/daemon-client.d.ts +2 -1
- package/dist/src/browser/runtime/local-cloak/actions.js +4 -1
- package/dist/src/browser/runtime/local-cloak/darwin-background-launch.d.ts +17 -0
- package/dist/src/browser/runtime/local-cloak/darwin-background-launch.js +106 -0
- package/dist/src/browser/runtime/local-cloak/darwin-background-launch.test.d.ts +1 -0
- package/dist/src/browser/runtime/local-cloak/darwin-background-launch.test.js +65 -0
- package/dist/src/browser/runtime/local-cloak/provider.test.js +36 -0
- package/dist/src/browser/runtime/local-cloak/session-manager.d.ts +10 -2
- package/dist/src/browser/runtime/local-cloak/session-manager.js +25 -9
- package/dist/src/browser/runtime/local-cloak/session-manager.test.js +36 -0
- package/dist/src/browser/target-resolver.d.ts +1 -0
- package/dist/src/browser/target-resolver.js +99 -4
- package/dist/src/browser/target-resolver.test.js +141 -1
- package/dist/src/build-manifest.d.ts +6 -0
- package/dist/src/build-manifest.js +18 -1
- package/dist/src/build-manifest.test.js +57 -1
- package/dist/src/builtin-command-surface.d.ts +9 -0
- package/dist/src/builtin-command-surface.js +16 -0
- package/dist/src/check-hosted-contract.test.d.ts +1 -0
- package/dist/src/check-hosted-contract.test.js +56 -0
- package/dist/src/cli.js +63 -110
- package/dist/src/cli.test.js +82 -6
- package/dist/src/command-presentation.d.ts +95 -0
- package/dist/src/command-presentation.js +486 -0
- package/dist/src/command-presentation.test.d.ts +1 -0
- package/dist/src/command-presentation.test.js +97 -0
- package/dist/src/command-surface.d.ts +43 -0
- package/dist/src/command-surface.js +205 -0
- package/dist/src/command-surface.test.d.ts +1 -0
- package/dist/src/command-surface.test.js +406 -0
- package/dist/src/commanderAdapter.d.ts +5 -1
- package/dist/src/commanderAdapter.js +12 -55
- package/dist/src/commanderAdapter.test.js +15 -3
- package/dist/src/commands/auth.js +3 -2
- package/dist/src/commands/auth.test.js +6 -6
- package/dist/src/community-plugin-sync.d.ts +11 -0
- package/dist/src/community-plugin-sync.js +138 -0
- package/dist/src/community-plugin-sync.test.d.ts +1 -0
- package/dist/src/community-plugin-sync.test.js +123 -0
- package/dist/src/completion-fast.d.ts +4 -4
- package/dist/src/completion-fast.js +15 -34
- package/dist/src/completion-shared.d.ts +4 -0
- package/dist/src/completion-shared.js +38 -0
- package/dist/src/completion.js +3 -27
- package/dist/src/completion.test.js +31 -2
- package/dist/src/docs-sync-review-cli.test.d.ts +1 -0
- package/dist/src/docs-sync-review-cli.test.js +322 -0
- package/dist/src/docs-sync-review.d.ts +117 -0
- package/dist/src/docs-sync-review.js +475 -0
- package/dist/src/docs-sync-review.test.d.ts +1 -0
- package/dist/src/docs-sync-review.test.js +324 -0
- package/dist/src/errors.d.ts +12 -3
- package/dist/src/errors.js +11 -7
- package/dist/src/errors.test.js +14 -1
- package/dist/src/execution.d.ts +1 -2
- package/dist/src/execution.js +4 -45
- package/dist/src/generate-release-notes-cli.test.js +11 -1
- package/dist/src/help.d.ts +4 -0
- package/dist/src/help.js +50 -255
- package/dist/src/help.test.js +27 -1
- package/dist/src/hosted/args.d.ts +4 -0
- package/dist/src/hosted/args.js +4 -0
- package/dist/src/hosted/args.test.d.ts +1 -0
- package/dist/src/hosted/args.test.js +49 -0
- package/dist/src/hosted/availability.d.ts +13 -0
- package/dist/src/hosted/availability.js +16 -0
- package/dist/src/hosted/availability.test.d.ts +1 -0
- package/dist/src/hosted/availability.test.js +180 -0
- package/dist/src/hosted/browser-args.d.ts +18 -0
- package/dist/src/hosted/browser-args.js +152 -0
- package/dist/src/hosted/browser-args.test.d.ts +1 -0
- package/dist/src/hosted/browser-args.test.js +182 -0
- package/dist/src/hosted/client.d.ts +59 -0
- package/dist/src/hosted/client.js +510 -0
- package/dist/src/hosted/client.test.d.ts +1 -0
- package/dist/src/hosted/client.test.js +738 -0
- package/dist/src/hosted/config.d.ts +55 -0
- package/dist/src/hosted/config.js +112 -0
- package/dist/src/hosted/config.test.d.ts +1 -0
- package/dist/src/hosted/config.test.js +81 -0
- package/dist/src/hosted/contract.d.ts +94 -0
- package/dist/src/hosted/contract.js +208 -0
- package/dist/src/hosted/contract.test.d.ts +1 -0
- package/dist/src/hosted/contract.test.js +361 -0
- package/dist/src/hosted/credentials.d.ts +38 -0
- package/dist/src/hosted/credentials.js +248 -0
- package/dist/src/hosted/credentials.test.d.ts +1 -0
- package/dist/src/hosted/credentials.test.js +93 -0
- package/dist/src/hosted/file-contract.test.d.ts +1 -0
- package/dist/src/hosted/file-contract.test.js +174 -0
- package/dist/src/hosted/files.d.ts +29 -0
- package/dist/src/hosted/files.js +296 -0
- package/dist/src/hosted/files.test.d.ts +1 -0
- package/dist/src/hosted/files.test.js +231 -0
- package/dist/src/hosted/main-lifecycle.test.d.ts +1 -0
- package/dist/src/hosted/main-lifecycle.test.js +213 -0
- package/dist/src/hosted/manifest.d.ts +14 -0
- package/dist/src/hosted/manifest.js +47 -0
- package/dist/src/hosted/manifest.test.d.ts +1 -0
- package/dist/src/hosted/manifest.test.js +164 -0
- package/dist/src/hosted/output-parity.test.d.ts +1 -0
- package/dist/src/hosted/output-parity.test.js +108 -0
- package/dist/src/hosted/root-command-surface.test.d.ts +1 -0
- package/dist/src/hosted/root-command-surface.test.js +646 -0
- package/dist/src/hosted/runner.d.ts +19 -0
- package/dist/src/hosted/runner.js +705 -0
- package/dist/src/hosted/runner.test.d.ts +1 -0
- package/dist/src/hosted/runner.test.js +1607 -0
- package/dist/src/hosted/setup.d.ts +10 -0
- package/dist/src/hosted/setup.js +79 -0
- package/dist/src/hosted/setup.test.d.ts +1 -0
- package/dist/src/hosted/setup.test.js +195 -0
- package/dist/src/hosted/types.d.ts +175 -0
- package/dist/src/hosted/types.js +1 -0
- package/dist/src/main.js +123 -97
- package/dist/src/manifest-types.d.ts +2 -0
- package/dist/src/output.d.ts +17 -2
- package/dist/src/output.js +88 -81
- package/dist/src/output.test.js +141 -51
- package/dist/src/pipeline/executor.test.js +1 -0
- package/dist/src/pipeline/steps/download.test.js +1 -0
- package/dist/src/plugin-create-cli.test.d.ts +1 -0
- package/dist/src/plugin-create-cli.test.js +37 -0
- package/dist/src/plugin-manifest.d.ts +12 -0
- package/dist/src/plugin-manifest.js +16 -0
- package/dist/src/plugin-manifest.test.js +19 -1
- package/dist/src/plugin-scaffold.d.ts +4 -1
- package/dist/src/plugin-scaffold.js +4 -1
- package/dist/src/plugin-scaffold.test.js +23 -8
- package/dist/src/plugin.js +4 -1
- package/dist/src/plugin.test.js +13 -0
- package/dist/src/registry.d.ts +2 -0
- package/dist/src/release-notes.d.ts +6 -1
- package/dist/src/release-notes.js +192 -4
- package/dist/src/release-notes.test.js +143 -4
- package/dist/src/root-command-surface.d.ts +31 -0
- package/dist/src/root-command-surface.js +106 -0
- package/dist/src/serialization.d.ts +1 -16
- package/dist/src/serialization.js +5 -55
- package/dist/src/stream-write.d.ts +12 -0
- package/dist/src/stream-write.js +91 -0
- package/dist/src/stream-write.test.d.ts +1 -0
- package/dist/src/stream-write.test.js +186 -0
- package/dist/src/types.d.ts +5 -0
- package/dist/src/utils.d.ts +1 -1
- package/dist/src/utils.js +2 -8
- package/dist/src/utils.test.js +50 -0
- package/hosted-contract.json +36748 -0
- package/package.json +6 -1
- package/scripts/check-hosted-contract.mjs +108 -0
- package/scripts/docs-sync-review.ts +332 -0
- package/scripts/generate-release-notes.ts +1 -1
- package/scripts/sync-community-plugins.ts +14 -0
- package/skills/smart-search/SKILL.md +14 -3
- package/skills/webcmd-autofix/SKILL.md +26 -37
- package/skills/webcmd-usage/SKILL.md +21 -7
- package/clis/antigravity/SKILL.md +0 -38
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Writable } from 'node:stream';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { Strategy } from '../registry.js';
|
|
5
|
+
import { registerCommandToProgram } from '../commanderAdapter.js';
|
|
6
|
+
import { makeHostedConfig } from './config.js';
|
|
7
|
+
import { runHostedCli } from './runner.js';
|
|
8
|
+
const { mockExecuteCommand } = vi.hoisted(() => ({
|
|
9
|
+
mockExecuteCommand: vi.fn(),
|
|
10
|
+
}));
|
|
11
|
+
vi.mock('../execution.js', async () => {
|
|
12
|
+
const actual = await vi.importActual('../execution.js');
|
|
13
|
+
return { ...actual, executeCommand: mockExecuteCommand };
|
|
14
|
+
});
|
|
15
|
+
const command = {
|
|
16
|
+
site: 'github',
|
|
17
|
+
name: 'whoami',
|
|
18
|
+
description: 'Show GitHub identity',
|
|
19
|
+
access: 'read',
|
|
20
|
+
strategy: Strategy.PUBLIC,
|
|
21
|
+
browser: false,
|
|
22
|
+
args: [],
|
|
23
|
+
columns: ['username'],
|
|
24
|
+
};
|
|
25
|
+
const manifest = {
|
|
26
|
+
userId: 'user_demo',
|
|
27
|
+
metadata: {
|
|
28
|
+
contractSchemaVersion: 1,
|
|
29
|
+
webcmdPackageVersion: '0.3.0',
|
|
30
|
+
generatedAt: '2026-07-14T00:00:00.000Z',
|
|
31
|
+
},
|
|
32
|
+
commands: [{
|
|
33
|
+
site: 'github',
|
|
34
|
+
name: 'whoami',
|
|
35
|
+
command: 'github/whoami',
|
|
36
|
+
description: 'Show GitHub identity',
|
|
37
|
+
access: 'read',
|
|
38
|
+
strategy: 'PUBLIC',
|
|
39
|
+
browser: false,
|
|
40
|
+
args: [],
|
|
41
|
+
columns: ['username'],
|
|
42
|
+
}],
|
|
43
|
+
};
|
|
44
|
+
function sink(isTTY) {
|
|
45
|
+
let data = '';
|
|
46
|
+
const stream = new Writable({
|
|
47
|
+
write(chunk, _encoding, callback) {
|
|
48
|
+
data += String(chunk);
|
|
49
|
+
callback();
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(stream, 'isTTY', { value: isTTY });
|
|
53
|
+
return { stream, text: () => data };
|
|
54
|
+
}
|
|
55
|
+
function clock() {
|
|
56
|
+
const values = [1_000, 1_250];
|
|
57
|
+
return () => values.shift() ?? 1_250;
|
|
58
|
+
}
|
|
59
|
+
async function localBytes(result, argv, isTTY, footerExtra) {
|
|
60
|
+
mockExecuteCommand.mockResolvedValueOnce(result);
|
|
61
|
+
const stdout = sink(isTTY);
|
|
62
|
+
const program = new Command();
|
|
63
|
+
const site = program.command('github');
|
|
64
|
+
registerCommandToProgram(site, {
|
|
65
|
+
...command,
|
|
66
|
+
...(footerExtra ? { footerExtra: () => footerExtra } : {}),
|
|
67
|
+
}, { stdout: stdout.stream, now: clock() });
|
|
68
|
+
await program.parseAsync(['node', 'webcmd', 'github', 'whoami', ...argv]);
|
|
69
|
+
return stdout.text();
|
|
70
|
+
}
|
|
71
|
+
async function hostedBytes(result, argv, isTTY, footerExtra) {
|
|
72
|
+
const stdout = sink(isTTY);
|
|
73
|
+
await runHostedCli(['github', 'whoami', ...argv], {
|
|
74
|
+
config: makeHostedConfig({ apiBaseUrl: 'https://api.example.com', apiKey: 'key' }),
|
|
75
|
+
stdout: stdout.stream,
|
|
76
|
+
now: clock(),
|
|
77
|
+
fetchImpl: async (url) => String(url).endsWith('/v1/manifest')
|
|
78
|
+
? new Response(JSON.stringify({ ok: true, manifest }), { status: 200 })
|
|
79
|
+
: new Response(JSON.stringify({
|
|
80
|
+
ok: true,
|
|
81
|
+
result,
|
|
82
|
+
columns: ['username'],
|
|
83
|
+
...(footerExtra ? { footerExtra } : {}),
|
|
84
|
+
execution: { id: 'exec_parity', command: 'github/whoami', status: 'succeeded' },
|
|
85
|
+
}), { status: 200 }),
|
|
86
|
+
});
|
|
87
|
+
return stdout.text();
|
|
88
|
+
}
|
|
89
|
+
beforeEach(() => {
|
|
90
|
+
mockExecuteCommand.mockReset();
|
|
91
|
+
});
|
|
92
|
+
describe('local/hosted command output differential', () => {
|
|
93
|
+
it('suppresses a null result in both modes', async () => {
|
|
94
|
+
const result = null;
|
|
95
|
+
const hosted = await hostedBytes(result, ['-f', 'json'], false);
|
|
96
|
+
const local = await localBytes(result, ['-f', 'json'], false);
|
|
97
|
+
expect(hosted).toBe(local);
|
|
98
|
+
expect(local).toBe('');
|
|
99
|
+
});
|
|
100
|
+
it.each([undefined, 'canonical footer'])('matches canonical local TTY table decorations byte-for-byte with footer %s', async (footerExtra) => {
|
|
101
|
+
const result = [{ username: 'octocat' }];
|
|
102
|
+
const hosted = await hostedBytes(result, ['-f', 'table'], true, footerExtra);
|
|
103
|
+
const local = await localBytes(result, ['-f', 'table'], true, footerExtra);
|
|
104
|
+
expect(hosted).toBe(local);
|
|
105
|
+
expect(local).toContain(' github/whoami');
|
|
106
|
+
expect(local).toContain(`1 items | 0.3s | github/whoami${footerExtra ? ` | ${footerExtra}` : ''}`);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|