@pitcher/cli-scripts 2.6.1 → 2.7.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 CHANGED
@@ -394,3 +394,23 @@ p roles list --scope instance --api-key myapikey
394
394
  ```
395
395
 
396
396
  `list` returns a `{ items: [...] }` object; each item's `role_key` is **prefixed** (`org:admin`, `instance:editor`). Pass the **short** name (e.g. `editor`) to `set-role`, not the prefixed key. Like `set-role`, `roles list` currently needs an **org-admin** key: while the granular-permissions rollout is off (the production default), the endpoint 403s non-org-admin callers.
397
+
398
+ ## To run the `metadata-template` command:
399
+
400
+ Read and additively build an instance's metadata-field schema. `list` and `upsert` require `--instance-id` (`get` only needs `--id`; `scaffold` makes no request).
401
+
402
+ ```bash
403
+ # Read the schema for an instance (0 or 1 template — one per instance)
404
+ p metadata-template list --instance-id 01... --api-key myapikey
405
+
406
+ # Get one template by id (ids are ULIDs)
407
+ p metadata-template get --id 01TEMPLATEID... --api-key myapikey
408
+
409
+ # Print a starter schema to fill in (optionally to a file)
410
+ p metadata-template scaffold --out ./schema.json
411
+
412
+ # Additively upsert the schema (merges by section label)
413
+ p metadata-template upsert --instance-id 01... --sections-file ./schema.json --api-key myapikey
414
+ ```
415
+
416
+ `upsert` merges the incoming sections by section `label` — a section whose label matches an existing one is replaced, other sections are preserved. It **cannot remove** a section or field (that's a UI operation). `options` for `select`/`multi-select` fields are `{ label, value }` objects (bare strings are rejected). `upsert` requires an instance- or org-admin key; a non-admin member key is rejected (400 → `VALIDATION`).
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ import { createInvitationsCommand } from './src/commands/invitations.js';
23
23
  import { createMembershipsCommand } from './src/commands/memberships.js';
24
24
  import { createGroupsCommand } from './src/commands/groups.js';
25
25
  import { createRolesCommand } from './src/commands/roles.js';
26
+ import { createMetadataTemplateCommand } from './src/commands/metadataTemplate.js';
26
27
  const __filename = fileURLToPath(import.meta.url);
27
28
  const __dirname = dirname(__filename);
28
29
  const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
@@ -51,6 +52,7 @@ program.addCommand(createInvitationsCommand());
51
52
  program.addCommand(createMembershipsCommand());
52
53
  program.addCommand(createGroupsCommand());
53
54
  program.addCommand(createRolesCommand());
55
+ program.addCommand(createMetadataTemplateCommand());
54
56
  program.addCommand(createOrgCommand());
55
57
  program.addCommand(createAnalyticsCommand());
56
58
  program.parseAsync(process.argv);
@@ -35,7 +35,7 @@ export function createAnalyticsCommand() {
35
35
  emitEnvelope(await runAnalyticsOrg({ ...options, quiet: globals.quiet }), globals);
36
36
  });
37
37
  withAuthFlags(cmd.command('instance'))
38
- .requiredOption('--instance-id <id>', 'Instance ID')
38
+ .option('--instance-id <id>', 'Instance ID (required)')
39
39
  .description('instance rollups (instance-admin or org-admin key required)')
40
40
  .action(async (options, command) => {
41
41
  const globals = command.optsWithGlobals();
@@ -50,7 +50,7 @@ export async function runCanvasesGet(opts, deps = {}) {
50
50
  export function createCanvasesCommand() {
51
51
  const cmd = new Command('canvases').description('read Pitcher canvases (presentations, sections, blocks)');
52
52
  withAuthFlags(cmd.command('list'))
53
- .requiredOption('--instance-id <id>', 'Instance ID')
53
+ .option('--instance-id <id>', 'Instance ID (required)')
54
54
  .option('--is-template', 'Only templates')
55
55
  .option('--is-section', 'Only sections')
56
56
  .option('--is-block', 'Only blocks (blocks are hidden unless this flag is set)')
@@ -116,8 +116,8 @@ export async function runDsrLandingScaffold(opts, _deps = {}) {
116
116
  export function createDsrLandingCommand() {
117
117
  const cmd = new Command('dsr-landing').description('create/list DSR (Digital Sales Room) landing-page templates, and set one as default');
118
118
  withInstanceFlag(withAuthFlags(cmd.command('create')))
119
- .requiredOption('--name <name>', 'Template name')
120
- .requiredOption('--html-file <path>', `Path to the landing HTML (must contain ${REQUIRED_MARKER})`)
119
+ .option('--name <name>', 'Template name (required)')
120
+ .option('--html-file <path>', `Path to the landing HTML (required; must contain ${REQUIRED_MARKER})`)
121
121
  .option('--css-file <path>', 'Path to a CSS file for the template')
122
122
  .option('--merge-schema <json>', 'Merge schema array as inline JSON')
123
123
  .option('--language <lang>', 'Language code (max 10 chars)')
@@ -129,7 +129,7 @@ export function createDsrLandingCommand() {
129
129
  emitEnvelope(await runDsrLandingCreate({ ...options, quiet: globals.quiet }), globals);
130
130
  });
131
131
  withInstanceFlag(withAuthFlags(cmd.command('set-default')))
132
- .requiredOption('--id <id>', 'Template ID')
132
+ .option('--id <id>', 'Template ID (required)')
133
133
  .action(async (options, command) => {
134
134
  const globals = command.optsWithGlobals();
135
135
  emitEnvelope(await runDsrLandingSetDefault({ ...options, quiet: globals.quiet }), globals);
@@ -85,7 +85,7 @@ export async function runEmailTemplateScaffold(opts, _deps = {}) {
85
85
  export function createEmailTemplateCommand() {
86
86
  const cmd = new Command('email-template').description('create/list/get HTML email templates for the emails app');
87
87
  withInstanceFlag(withAuthFlags(cmd.command('create')))
88
- .requiredOption('--name <name>', 'Template name')
88
+ .option('--name <name>', 'Template name (required)')
89
89
  .option('--body-file <path>', 'Path to an HTML file (inline CSS) used as the template body')
90
90
  .option('--subject <text>', 'Email subject (supports {{tokens}})')
91
91
  .option('--tags <json>', 'Tags object as inline JSON')
@@ -107,7 +107,7 @@ export function createEmailTemplateCommand() {
107
107
  emitEnvelope(await runEmailTemplateList({ ...options, quiet: globals.quiet }), globals);
108
108
  });
109
109
  withInstanceFlag(withAuthFlags(cmd.command('get')))
110
- .requiredOption('--id <id>', 'Template ID')
110
+ .option('--id <id>', 'Template ID (required)')
111
111
  .action(async (options, command) => {
112
112
  const globals = command.optsWithGlobals();
113
113
  emitEnvelope(await runEmailTemplateGet({ ...options, quiet: globals.quiet }), globals);
@@ -119,7 +119,7 @@ export async function runFilesUpdate(opts, deps = {}) {
119
119
  export function createFilesCommand() {
120
120
  const cmd = new Command('files').description('manage Pitcher content files');
121
121
  withAuthFlags(cmd.command('list'))
122
- .requiredOption('--instance-id <id>', 'Instance ID')
122
+ .option('--instance-id <id>', 'Instance ID (required)')
123
123
  .option('--id-in <ids>', 'Comma-separated file IDs')
124
124
  .option('--tags <tags>', 'Comma-separated tags (filters via tags__in)')
125
125
  .option('--page <n>', 'Page number', (v) => parseInt(v, 10))
@@ -135,7 +135,7 @@ export function createFilesCommand() {
135
135
  emitEnvelope(await runFilesGet({ ...options, id, quiet: globals.quiet }), globals);
136
136
  });
137
137
  withAuthFlags(cmd.command('create'))
138
- .requiredOption('--instance-id <id>', 'Instance ID')
138
+ .option('--instance-id <id>', 'Instance ID (required)')
139
139
  .option('--name <name>', 'File name')
140
140
  .option('--folder-id <id>', 'Destination folder')
141
141
  .option('--file <path>', 'Local file to upload')
@@ -83,7 +83,7 @@ export async function runFoldersUpdate(opts, deps = {}) {
83
83
  export function createFoldersCommand() {
84
84
  const cmd = new Command('folders').description('manage Pitcher content folders');
85
85
  withAuthFlags(cmd.command('list'))
86
- .requiredOption('--instance-id <id>', 'Instance ID')
86
+ .option('--instance-id <id>', 'Instance ID (required)')
87
87
  .option('--page <n>', 'Page number', (v) => parseInt(v, 10))
88
88
  .option('--page-size <n>', 'Page size (max 500)', (v) => parseInt(v, 10))
89
89
  .action(async (options, command) => {
@@ -99,8 +99,8 @@ export function createFoldersCommand() {
99
99
  emitEnvelope(await runFoldersGet({ ...options, id, quiet: globals.quiet }), globals);
100
100
  });
101
101
  withAuthFlags(cmd.command('create'))
102
- .requiredOption('--name <name>', 'Folder name')
103
- .requiredOption('--parent-folder-id <id>', 'Parent folder ID')
102
+ .option('--name <name>', 'Folder name (required)')
103
+ .option('--parent-folder-id <id>', 'Parent folder ID (required)')
104
104
  .option('--access-type <type>', 'public | restricted | personal')
105
105
  .option('--rules <json>', 'Smart-folder rules JSON array')
106
106
  .action(async (options, command) => {
@@ -0,0 +1,27 @@
1
+ import { Command } from 'commander';
2
+ import type { AxiosInstance } from 'axios';
3
+ import { type CommonOpts } from '../core/http.js';
4
+ import { type Envelope } from '../core/envelope.js';
5
+ export interface MetadataTemplateDeps {
6
+ client?: AxiosInstance;
7
+ }
8
+ export declare function runMetadataTemplateScaffold(opts: CommonOpts & {
9
+ out?: string;
10
+ }, _deps?: MetadataTemplateDeps): Promise<Envelope<unknown>>;
11
+ export declare function runMetadataTemplateList(opts: CommonOpts & {
12
+ instanceId?: string;
13
+ page?: number;
14
+ pageSize?: number;
15
+ }, deps?: MetadataTemplateDeps): Promise<Envelope<{
16
+ results: unknown[];
17
+ pagination: Record<string, unknown>;
18
+ }>>;
19
+ export declare function runMetadataTemplateGet(opts: CommonOpts & {
20
+ id?: string;
21
+ }, deps?: MetadataTemplateDeps): Promise<Envelope<unknown>>;
22
+ export declare function runMetadataTemplateUpsert(opts: CommonOpts & {
23
+ instanceId?: string;
24
+ sections?: string;
25
+ sectionsFile?: string;
26
+ }, deps?: MetadataTemplateDeps): Promise<Envelope<unknown>>;
27
+ export declare function createMetadataTemplateCommand(): Command;
@@ -0,0 +1,112 @@
1
+ import { Command } from 'commander';
2
+ import { clientFor, toCliError } from '../core/http.js';
3
+ import { ok, fail } from '../core/envelope.js';
4
+ import { createCliError } from '../core/errors.js';
5
+ import { emitEnvelope } from '../core/output.js';
6
+ import { listPageParams, listPaginationEcho } from '../core/pagination.js';
7
+ import { assertIntFlags, parseJsonArray } from '../schema/content.js';
8
+ import { readTextFile } from '../core/readInput.js';
9
+ import { withAuthFlags } from './withAuth.js';
10
+ import { emitScaffold, METADATA_TEMPLATE_SCAFFOLD_JSON } from './scaffolds.js';
11
+ const ENDPOINT = '/api/v1/metadata-templates/';
12
+ export async function runMetadataTemplateScaffold(opts, _deps = {}) {
13
+ return emitScaffold(METADATA_TEMPLATE_SCAFFOLD_JSON, opts.out);
14
+ }
15
+ export async function runMetadataTemplateList(opts, deps = {}) {
16
+ try {
17
+ if (!opts.instanceId)
18
+ throw createCliError('VALIDATION', '--instance-id is required for metadata-template list');
19
+ assertIntFlags(opts);
20
+ const client = clientFor(opts, deps);
21
+ const params = { instance_id: opts.instanceId, ...listPageParams(opts) };
22
+ const res = await client.get(ENDPOINT, {
23
+ params,
24
+ });
25
+ return ok({ results: res.data.results, pagination: listPaginationEcho(opts, res.data) });
26
+ }
27
+ catch (e) {
28
+ return fail(toCliError(e));
29
+ }
30
+ }
31
+ export async function runMetadataTemplateGet(opts, deps = {}) {
32
+ try {
33
+ if (!opts.id)
34
+ throw createCliError('VALIDATION', '--id is required for metadata-template get');
35
+ const client = clientFor(opts, deps);
36
+ const res = await client.get(`${ENDPOINT}${encodeURIComponent(opts.id)}`);
37
+ return ok(res.data);
38
+ }
39
+ catch (e) {
40
+ return fail(toCliError(e));
41
+ }
42
+ }
43
+ export async function runMetadataTemplateUpsert(opts, deps = {}) {
44
+ try {
45
+ if (!opts.instanceId)
46
+ throw createCliError('VALIDATION', '--instance-id is required for metadata-template upsert');
47
+ // Presence-based (not truthiness) so an explicit empty --sections '' is still
48
+ // counted as a source and can't silently coexist with --sections-file.
49
+ if (opts.sections !== undefined && opts.sectionsFile !== undefined)
50
+ throw createCliError('VALIDATION', 'pass exactly one of --sections or --sections-file');
51
+ // readTextFile → parseJsonArray (NOT readJsonFile, which would bypass the
52
+ // array-shape VALIDATION check). Both throw a VALIDATION CliError.
53
+ const raw = opts.sections !== undefined
54
+ ? opts.sections
55
+ : opts.sectionsFile !== undefined
56
+ ? readTextFile(opts.sectionsFile)
57
+ : undefined;
58
+ if (raw === undefined)
59
+ throw createCliError('VALIDATION', 'pass exactly one of --sections or --sections-file');
60
+ const sections = parseJsonArray(raw, 'sections');
61
+ const client = clientFor(opts, deps);
62
+ const res = await client.post(ENDPOINT, { instance_id: opts.instanceId, sections });
63
+ return ok(res.data);
64
+ }
65
+ catch (e) {
66
+ return fail(toCliError(e));
67
+ }
68
+ }
69
+ const UPSERT_HELP = `
70
+ Upserts the instance's metadata-field schema. POST is an upsert keyed by
71
+ instance that MERGES the incoming sections by section 'label' — a section whose
72
+ label matches an existing one is replaced, other sections are preserved. It
73
+ CANNOT remove a section or field (a full-replace / UI operation).
74
+ --instance-id the instance whose schema to upsert (required)
75
+ --sections inline JSON array of sections, OR
76
+ --sections-file path to a JSON file with the sections array (exactly one)
77
+ Run 'p metadata-template scaffold' for a starter. Requires an instance- or
78
+ org-admin key; a non-admin member key is rejected (400 -> VALIDATION).`;
79
+ export function createMetadataTemplateCommand() {
80
+ const cmd = new Command('metadata-template').description('read and additively build an instance metadata-field schema');
81
+ withAuthFlags(cmd.command('list'))
82
+ .option('--instance-id <id>', 'Instance ID (required)')
83
+ .option('--page <n>', 'Page number', (v) => parseInt(v, 10))
84
+ .option('--page-size <n>', 'Page size (max 500)', (v) => parseInt(v, 10))
85
+ .action(async (options, command) => {
86
+ const globals = command.optsWithGlobals();
87
+ emitEnvelope(await runMetadataTemplateList({ ...options, quiet: globals.quiet }), globals);
88
+ });
89
+ withAuthFlags(cmd.command('get'))
90
+ .option('--id <id>', 'Metadata template ID (ULID)')
91
+ .action(async (options, command) => {
92
+ const globals = command.optsWithGlobals();
93
+ emitEnvelope(await runMetadataTemplateGet({ ...options, quiet: globals.quiet }), globals);
94
+ });
95
+ withAuthFlags(cmd.command('upsert'))
96
+ .option('--instance-id <id>', 'Instance ID (required)')
97
+ .option('--sections <json>', 'Sections JSON array (inline)')
98
+ .option('--sections-file <path>', 'Path to a JSON file with the sections array')
99
+ .addHelpText('after', UPSERT_HELP)
100
+ .action(async (options, command) => {
101
+ const globals = command.optsWithGlobals();
102
+ emitEnvelope(await runMetadataTemplateUpsert({ ...options, quiet: globals.quiet }), globals);
103
+ });
104
+ withAuthFlags(cmd.command('scaffold'))
105
+ .description('print a starter metadata-field schema (sections array) to fill in and upsert')
106
+ .option('--out <path>', 'Write the scaffold to a file instead of stdout')
107
+ .action(async (options, command) => {
108
+ const globals = command.optsWithGlobals();
109
+ emitEnvelope(await runMetadataTemplateScaffold({ ...options, quiet: globals.quiet }), globals);
110
+ });
111
+ return cmd;
112
+ }
@@ -17,3 +17,4 @@ export declare const EMAIL_SCAFFOLD_HTML = "<!doctype html>\n<html lang=\"en\">\
17
17
  */
18
18
  export declare const DSR_SCAFFOLD_HTML = "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <title>Sample DSR Landing Page</title>\n </head>\n <body style=\"margin:0;padding:0;background-color:#f4f4f4;font-family:Arial,Helvetica,sans-serif;color:#212121;\">\n <table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"padding:32px 0;\">\n <tr>\n <td align=\"center\">\n <table role=\"presentation\" width=\"640\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color:#ffffff;border-radius:8px;overflow:hidden;\">\n <tr>\n <td style=\"background-color:var(--p-primary, #29335C);padding:28px;text-align:center;\">\n <!-- token: organization.name -> the sharing org's display name -->\n <span style=\"color:#ffffff;font-size:20px;font-weight:bold;\">{{organization.name}}</span>\n </td>\n </tr>\n <tr>\n <td style=\"padding:32px;\">\n <!-- token: recipient.firstName -> the recipient's first name -->\n <!-- token: customer.name -> the recipient's company name -->\n <h1 style=\"margin:0 0 8px 0;font-size:22px;\">Welcome, {{recipient.firstName}}</h1>\n <p style=\"margin:0 0 24px 0;color:#757575;font-size:14px;\">Prepared for {{customer.name}}</p>\n\n <!--\n Editable region: admins can edit this block's text in the DSR\n landing editor without touching markup. data-field-char-limit\n enforces a max length in that editor.\n -->\n <div\n data-field-id=\"welcome-message\"\n data-field-editable=\"true\"\n data-field-char-limit=\"120\"\n style=\"padding:16px;margin:0 0 24px 0;border-left:3px solid var(--p-primary, #29335C);background-color:#f7f8fb;font-size:15px;line-height:1.5;\"\n >\n Thanks for stopping by. Everything you need for this conversation is right here.\n </div>\n\n <!-- token: rep.name -> the sharing rep's display name -->\n <p style=\"margin:0 0 24px 0;font-size:14px;color:#757575;\">Shared by {{rep.name}}</p>\n\n <!--\n Required marker: the platform injects the email-gate form\n into this div at render time. It MUST be present verbatim\n (a literal data-pitcher-email-gate attribute) or the\n server rejects the template on create/update.\n -->\n <div data-pitcher-email-gate></div>\n </td>\n </tr>\n <tr>\n <td style=\"padding:16px 32px;border-top:1px solid #e0e2ed;text-align:center;color:#757575;font-size:12px;\">\n <!-- token: sharedLink.valid_until -> when this share expires, if the share sets an expiry -->\n This link is valid until {{sharedLink.valid_until}}.\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </body>\n</html>\n";
19
19
  export declare const ANNOUNCEMENT_SCAFFOLD_JSON: string;
20
+ export declare const METADATA_TEMPLATE_SCAFFOLD_JSON: string;
@@ -174,3 +174,98 @@ const ANNOUNCEMENT_SCAFFOLD_DATA = {
174
174
  popup_link_label: null,
175
175
  };
176
176
  export const ANNOUNCEMENT_SCAFFOLD_JSON = JSON.stringify(ANNOUNCEMENT_SCAFFOLD_DATA, null, 2);
177
+ /**
178
+ * Starter metadata-field schema for `p metadata-template scaffold`. A working
179
+ * example, not a blank template: one section demonstrating every field `type`
180
+ * (text/number/date/select/multi-select/checkbox/html) and every attribute the
181
+ * serializer accepts. NOTE: `options` (select/multi-select) MUST be
182
+ * { label, value } objects — bare strings are rejected 400. `multi-select`
183
+ * cannot be `is_sortable`. A select/multi-select `default` is an option `value`.
184
+ * Section-level `are_fields_dependent` and field-level `help_text` are optional.
185
+ */
186
+ const METADATA_TEMPLATE_SCAFFOLD_DATA = [
187
+ {
188
+ label: 'Product Info',
189
+ are_fields_dependent: false,
190
+ fields: [
191
+ {
192
+ name: 'product_name',
193
+ label: 'Product Name',
194
+ type: 'text',
195
+ is_required: true,
196
+ is_filterable: true,
197
+ is_sortable: true,
198
+ is_pitch_master: false,
199
+ help_text: 'Marketed product name',
200
+ default: '',
201
+ },
202
+ {
203
+ name: 'launch_date',
204
+ label: 'Launch Date',
205
+ type: 'date',
206
+ is_required: false,
207
+ is_filterable: true,
208
+ is_sortable: true,
209
+ is_pitch_master: false,
210
+ },
211
+ {
212
+ name: 'therapeutic_area',
213
+ label: 'Therapeutic Area',
214
+ type: 'select',
215
+ is_required: false,
216
+ is_filterable: true,
217
+ is_sortable: false,
218
+ is_pitch_master: false,
219
+ options: [
220
+ { label: 'Cardiology', value: 'cardiology' },
221
+ { label: 'Oncology', value: 'oncology' },
222
+ ],
223
+ default: 'cardiology',
224
+ },
225
+ {
226
+ name: 'audiences',
227
+ label: 'Audiences',
228
+ type: 'multi-select',
229
+ is_required: false,
230
+ is_filterable: true,
231
+ is_sortable: false,
232
+ is_pitch_master: false,
233
+ options: [
234
+ { label: 'HCP', value: 'hcp' },
235
+ { label: 'Payer', value: 'payer' },
236
+ { label: 'Patient', value: 'patient' },
237
+ ],
238
+ },
239
+ {
240
+ name: 'priority',
241
+ label: 'Priority',
242
+ type: 'number',
243
+ is_required: false,
244
+ is_filterable: false,
245
+ is_sortable: true,
246
+ is_pitch_master: false,
247
+ default: 0,
248
+ },
249
+ {
250
+ name: 'is_approved',
251
+ label: 'Approved',
252
+ type: 'checkbox',
253
+ is_required: false,
254
+ is_filterable: true,
255
+ is_sortable: false,
256
+ is_pitch_master: false,
257
+ default: false,
258
+ },
259
+ {
260
+ name: 'notes',
261
+ label: 'Notes',
262
+ type: 'html',
263
+ is_required: false,
264
+ is_filterable: false,
265
+ is_sortable: false,
266
+ is_pitch_master: false,
267
+ },
268
+ ],
269
+ },
270
+ ];
271
+ export const METADATA_TEMPLATE_SCAFFOLD_JSON = JSON.stringify(METADATA_TEMPLATE_SCAFFOLD_DATA, null, 2);
@@ -25,8 +25,8 @@ export async function runSearch(opts, deps = {}) {
25
25
  }
26
26
  export function createSearchCommand() {
27
27
  return withAuthFlags(new Command('search').description('search content across an instance (files, canvases, users, apps)'))
28
- .requiredOption('--instance-id <id>', 'Instance ID')
29
- .requiredOption('--query <text>', 'Search query')
28
+ .option('--instance-id <id>', 'Instance ID (required)')
29
+ .option('--query <text>', 'Search query (required)')
30
30
  .option('--include-expired', 'Include expired content')
31
31
  .action(async (options, command) => {
32
32
  const globals = command.optsWithGlobals();
@@ -37,8 +37,8 @@ export async function runTagsList(opts, deps = {}) {
37
37
  export function createTagsCommand() {
38
38
  const cmd = new Command('tags').description('list tags in an instance (search term of >=3 chars required)');
39
39
  withAuthFlags(cmd.command('list'))
40
- .requiredOption('--instance-id <id>', 'Instance ID')
41
- .requiredOption('--search <text>', 'Search term (server requires at least 3 characters)')
40
+ .option('--instance-id <id>', 'Instance ID (required)')
41
+ .option('--search <text>', 'Search term (required; at least 3 characters)')
42
42
  .option('--type <type>', 'files | canvases')
43
43
  .option('--canvas-type <type>', 'Canvas type filter')
44
44
  .option('--include-hidden', 'Include hidden tags')
@@ -1,3 +1,8 @@
1
1
  import { Command } from 'commander';
2
- /** Attach the shared --instance-id flag to a (sub)command. */
2
+ /**
3
+ * Attach the shared --instance-id flag to a (sub)command.
4
+ * Uses .option (not .requiredOption) so a missing flag flows through the
5
+ * command's in-run VALIDATION guard and yields the JSON envelope (exit 3),
6
+ * instead of commander aborting with plain text on stderr (exit 1).
7
+ */
3
8
  export declare function withInstanceFlag(c: Command): Command;
@@ -1,4 +1,9 @@
1
- /** Attach the shared --instance-id flag to a (sub)command. */
1
+ /**
2
+ * Attach the shared --instance-id flag to a (sub)command.
3
+ * Uses .option (not .requiredOption) so a missing flag flows through the
4
+ * command's in-run VALIDATION guard and yields the JSON envelope (exit 3),
5
+ * instead of commander aborting with plain text on stderr (exit 1).
6
+ */
2
7
  export function withInstanceFlag(c) {
3
- return c.requiredOption('--instance-id <id>', 'Instance ID');
8
+ return c.option('--instance-id <id>', 'Instance ID (required)');
4
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pitcher/cli-scripts",
3
- "version": "2.6.1",
3
+ "version": "2.7.1",
4
4
  "description": "The Pitcher CLI for various tasks in its ecosystem.",
5
5
  "author": "Pitcher AG",
6
6
  "license": "MIT",