@productlobster/plob 0.1.2
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/LICENSE +202 -0
- package/README.md +198 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +17939 -0
- package/dist/index.d.ts +110 -0
- package/dist/index.js +17941 -0
- package/package.json +67 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
|
|
3
|
+
interface CredentialStore {
|
|
4
|
+
deleteBearerToken(): Promise<boolean>;
|
|
5
|
+
loadBearerToken(): Promise<string | null>;
|
|
6
|
+
saveBearerToken(secret: string): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare const EXIT_CODES: {
|
|
10
|
+
readonly success: 0;
|
|
11
|
+
readonly internal: 1;
|
|
12
|
+
readonly invalidArguments: 2;
|
|
13
|
+
readonly unauthorized: 10;
|
|
14
|
+
readonly unauthorizedScope: 11;
|
|
15
|
+
readonly workspaceMismatch: 12;
|
|
16
|
+
readonly needsSharpening: 13;
|
|
17
|
+
readonly conflict: 14;
|
|
18
|
+
readonly idempotencyKeyReuse: 15;
|
|
19
|
+
readonly rateLimited: 16;
|
|
20
|
+
readonly versionRevoked: 17;
|
|
21
|
+
readonly serviceUnavailable: 18;
|
|
22
|
+
readonly network: 70;
|
|
23
|
+
};
|
|
24
|
+
type CliExitCode = (typeof EXIT_CODES)[keyof typeof EXIT_CODES];
|
|
25
|
+
|
|
26
|
+
interface McpClientConfig {
|
|
27
|
+
bearerToken: string;
|
|
28
|
+
endpoint: string;
|
|
29
|
+
userAgent: string;
|
|
30
|
+
}
|
|
31
|
+
interface McpToolCall {
|
|
32
|
+
arguments?: Record<string, unknown>;
|
|
33
|
+
name: string;
|
|
34
|
+
}
|
|
35
|
+
interface McpToolResult {
|
|
36
|
+
content?: Array<{
|
|
37
|
+
text?: string;
|
|
38
|
+
type: string;
|
|
39
|
+
}>;
|
|
40
|
+
isError?: boolean;
|
|
41
|
+
structuredContent?: unknown;
|
|
42
|
+
}
|
|
43
|
+
interface McpToolClient {
|
|
44
|
+
callTool(call: McpToolCall): Promise<McpToolResult>;
|
|
45
|
+
close(): Promise<void>;
|
|
46
|
+
}
|
|
47
|
+
type McpClientFactory = (config: McpClientConfig) => Promise<McpToolClient>;
|
|
48
|
+
declare function createSdkMcpClient(config: McpClientConfig): Promise<McpToolClient>;
|
|
49
|
+
|
|
50
|
+
interface WritableLike {
|
|
51
|
+
isTTY?: boolean;
|
|
52
|
+
write(chunk: string): unknown;
|
|
53
|
+
}
|
|
54
|
+
interface ReadableLike {
|
|
55
|
+
isTTY?: boolean;
|
|
56
|
+
[Symbol.asyncIterator]?(): AsyncIterator<Buffer | string>;
|
|
57
|
+
}
|
|
58
|
+
interface CliIO {
|
|
59
|
+
readLine?: (prompt: string) => Promise<string>;
|
|
60
|
+
stderr: WritableLike;
|
|
61
|
+
stdin: ReadableLike;
|
|
62
|
+
stdout: WritableLike;
|
|
63
|
+
}
|
|
64
|
+
interface RunnerGlobalOptions {
|
|
65
|
+
debug?: boolean;
|
|
66
|
+
json?: boolean;
|
|
67
|
+
workspace?: string;
|
|
68
|
+
}
|
|
69
|
+
interface CommandRunnerDeps {
|
|
70
|
+
credentialStore: CredentialStore;
|
|
71
|
+
getMcpEndpoint: () => string;
|
|
72
|
+
mcpClientFactory: McpClientFactory;
|
|
73
|
+
openUrl: (url: string) => Promise<void> | void;
|
|
74
|
+
}
|
|
75
|
+
interface CommandPostProcessContext {
|
|
76
|
+
bearerToken: string;
|
|
77
|
+
endpoint: string;
|
|
78
|
+
globalOptions: RunnerGlobalOptions;
|
|
79
|
+
io: CliIO;
|
|
80
|
+
}
|
|
81
|
+
interface CommandSpec<TParsedResponse, TRenderedResponse = TParsedResponse> {
|
|
82
|
+
outputSchema?: {
|
|
83
|
+
parse(input: unknown): TParsedResponse;
|
|
84
|
+
};
|
|
85
|
+
postProcessSuccess?: (response: TParsedResponse, context: CommandPostProcessContext) => Promise<TRenderedResponse> | TRenderedResponse;
|
|
86
|
+
renderHuman?: (response: TRenderedResponse) => string;
|
|
87
|
+
toolArguments?: Record<string, unknown>;
|
|
88
|
+
toolName: string;
|
|
89
|
+
}
|
|
90
|
+
interface RunCommandContext {
|
|
91
|
+
globalOptions: RunnerGlobalOptions;
|
|
92
|
+
io: CliIO;
|
|
93
|
+
runnerDeps?: Partial<CommandRunnerDeps>;
|
|
94
|
+
}
|
|
95
|
+
declare function runCommand<TParsedResponse, TRenderedResponse = TParsedResponse>(spec: CommandSpec<TParsedResponse, TRenderedResponse>, context: RunCommandContext): Promise<number>;
|
|
96
|
+
|
|
97
|
+
interface CliProgramConfig {
|
|
98
|
+
io?: CliIO;
|
|
99
|
+
runnerDeps?: Partial<CommandRunnerDeps>;
|
|
100
|
+
}
|
|
101
|
+
interface ProgramState {
|
|
102
|
+
exitCode: number;
|
|
103
|
+
}
|
|
104
|
+
declare function createProgram(config?: CliProgramConfig): {
|
|
105
|
+
program: Command;
|
|
106
|
+
state: ProgramState;
|
|
107
|
+
};
|
|
108
|
+
declare function runCli(argv?: readonly string[], config?: CliProgramConfig): Promise<number>;
|
|
109
|
+
|
|
110
|
+
export { type CliExitCode, type CliIO, type CliProgramConfig, type CommandRunnerDeps, EXIT_CODES, type McpClientConfig, type McpToolClient, type RunnerGlobalOptions, createProgram, createSdkMcpClient, runCli, runCommand };
|