@clickminded/coauthor-cli 0.0.3 → 0.0.4
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/dist/commands.d.ts +1 -0
- package/dist/commands.js +1 -1
- package/dist/index.js +5 -1
- package/dist/parser.d.ts +2 -0
- package/dist/parser.js +3 -0
- package/package.json +1 -1
package/dist/commands.d.ts
CHANGED
package/dist/commands.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,12 +3,16 @@ import { realpathSync } from 'node:fs';
|
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { AgentHttpError, AgentClient } from './client.js';
|
|
5
5
|
import { resolveRuntimeConfig } from './config.js';
|
|
6
|
-
import { runCommand } from './commands.js';
|
|
6
|
+
import { helpResult, runCommand } from './commands.js';
|
|
7
7
|
import { renderError, renderResult } from './output.js';
|
|
8
8
|
import { parseCliArgs } from './parser.js';
|
|
9
9
|
export async function main(argv = process.argv.slice(2)) {
|
|
10
10
|
try {
|
|
11
11
|
const parsed = parseCliArgs(argv);
|
|
12
|
+
if (parsed.globals.help) {
|
|
13
|
+
process.stdout.write(renderResult(helpResult(), parsed.globals.json));
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
12
16
|
const runtimeConfig = await resolveRuntimeConfig({
|
|
13
17
|
baseUrlOverride: parsed.globals.baseUrl,
|
|
14
18
|
tokenOverride: parsed.globals.token,
|
package/dist/parser.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import type { JsonValue } from './client.js';
|
|
3
3
|
export type GlobalOptions = {
|
|
4
4
|
json: boolean;
|
|
5
|
+
help: boolean;
|
|
5
6
|
baseUrl?: string;
|
|
6
7
|
token?: string;
|
|
7
8
|
};
|
|
@@ -16,6 +17,7 @@ export declare const commandInputSchema: z.ZodObject<{
|
|
|
16
17
|
positionals: z.ZodArray<z.ZodString>;
|
|
17
18
|
globals: z.ZodObject<{
|
|
18
19
|
json: z.ZodBoolean;
|
|
20
|
+
help: z.ZodBoolean;
|
|
19
21
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
20
22
|
token: z.ZodOptional<z.ZodString>;
|
|
21
23
|
}, z.core.$strip>;
|
package/dist/parser.js
CHANGED
|
@@ -5,6 +5,7 @@ export const commandInputSchema = z.object({
|
|
|
5
5
|
positionals: z.array(z.string()),
|
|
6
6
|
globals: z.object({
|
|
7
7
|
json: z.boolean(),
|
|
8
|
+
help: z.boolean(),
|
|
8
9
|
baseUrl: z.string().url().optional(),
|
|
9
10
|
token: z.string().min(1).optional(),
|
|
10
11
|
}),
|
|
@@ -17,6 +18,7 @@ export function parseCliArgs(argv) {
|
|
|
17
18
|
strict: false,
|
|
18
19
|
options: {
|
|
19
20
|
json: { type: 'boolean', default: false },
|
|
21
|
+
help: { type: 'boolean', short: 'h', default: false },
|
|
20
22
|
'base-url': { type: 'string' },
|
|
21
23
|
token: { type: 'string' },
|
|
22
24
|
email: { type: 'string' },
|
|
@@ -61,6 +63,7 @@ export function parseCliArgs(argv) {
|
|
|
61
63
|
positionals: positionals.slice(command.length),
|
|
62
64
|
globals: {
|
|
63
65
|
json: Boolean(parsed.values.json),
|
|
66
|
+
help: Boolean(parsed.values.help),
|
|
64
67
|
baseUrl: stringValue(parsed.values['base-url']),
|
|
65
68
|
token: stringValue(parsed.values.token),
|
|
66
69
|
},
|