@pitcher/cli-scripts 2.7.0 → 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.
@@ -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) => {
@@ -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.7.0",
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",