@automattic/vip 3.8.7 → 3.8.8

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.
@@ -339,7 +339,7 @@ void (0, _command.default)({
339
339
  requiredArgs: 1,
340
340
  module: 'import-sql',
341
341
  usage
342
- }).command('status', 'Check the status of a SQL database import currently in progress.').option('skip-validate', 'Do not perform file validation prior to import. If the file contains unsupported entries, the import is likely to fail.').option('search-replace', 'Search for a string in the SQL file and replace it with a new string. Separate the values by a comma only; no spaces (e.g. --search-replace=“from,to”).').option('in-place', 'Perform a search and replace operation on a local SQL file, save the results to the file, then import the updated file.').option('output', 'Create a local copy of the imported file with the completed search and replace operations. Ignored if the command includes --in-place, or excludes a --search-replace operation. Accepts a local file path.').examples(examples).argv(process.argv, async (arg, opts) => {
342
+ }).command('status', 'Check the status of a SQL database import currently in progress.').option('skip-validate', 'Do not perform file validation prior to import. If the file contains unsupported entries, the import is likely to fail.').option('search-replace', 'Search for a string in the SQL file and replace it with a new string. Separate the values by a comma only; no spaces (e.g. --search-replace=“from,to”).').option('in-place', 'Overwrite the local input file with the results of the search and replace operation prior to import.').option('output', 'The local file path to save a copy of the results from the search and replace operation when the --search-replace option is passed. Ignored when used with the --in-place option.').examples(examples).argv(process.argv, async (arg, opts) => {
343
343
  const {
344
344
  app,
345
345
  env
@@ -30,6 +30,9 @@ const MAX_POLLING_DELAY_IN_SECONDS = 300;
30
30
  * @param {string[]} arg
31
31
  */
32
32
  async function getLogs(arg, opt) {
33
+ opt.type ??= 'app';
34
+ opt.limit ??= LIMIT_DEFAULT;
35
+ opt.format ??= 'table';
33
36
  validateInputs(opt.type, opt.limit, opt.format);
34
37
  const trackingParams = getBaseTrackingParams(opt);
35
38
  await (0, _tracker.trackEvent)('logs_command_execute', trackingParams);
@@ -177,9 +180,6 @@ function printLogs(logs, format) {
177
180
  * @param {string} format
178
181
  */
179
182
  function validateInputs(type, limit, format) {
180
- if (limit === undefined) {
181
- limit = LIMIT_DEFAULT;
182
- }
183
183
  if (!ALLOWED_TYPES.includes(type)) {
184
184
  exit.withError(`Invalid type: ${type}. The supported types are: ${ALLOWED_TYPES.join(', ')}.`);
185
185
  }
@@ -187,7 +187,7 @@ function validateInputs(type, limit, format) {
187
187
  exit.withError(`Invalid format: ${format}. The supported formats are: ${ALLOWED_FORMATS.join(', ')}.`);
188
188
  }
189
189
  if (!Number.isInteger(limit) || limit < LIMIT_MIN || limit > logsLib.LIMIT_MAX) {
190
- exit.withError(`Invalid limit: ${limit}. It should be a number between ${LIMIT_MIN} and ${logsLib.LIMIT_MAX}.`);
190
+ exit.withError(`Invalid limit: ${limit}. Set the limit to an integer between ${LIMIT_MIN} and ${logsLib.LIMIT_MAX}.`);
191
191
  }
192
192
  }
193
193
  const appQuery = exports.appQuery = `
@@ -209,21 +209,18 @@ const appQuery = exports.appQuery = `
209
209
  appQuery,
210
210
  envContext: true,
211
211
  module: 'logs'
212
- }).option('type', 'The type of logs to be returned: "app" or "batch"', 'app')
212
+ }).option('type', 'Specify the type of Runtime Logs to retrieve. Accepts "batch" (only valid for WordPress environments).', 'app')
213
213
  // The default limit is set manually in the validateInputs function to address validation issues, avoiding incorrect replacement of the default value.
214
- .option('limit', `The maximum number of log lines (defaults to ${LIMIT_DEFAULT})`).option('follow', 'Keep fetching new logs as they are generated').option('format', 'Output the log lines in CSV or JSON format', 'table').examples([{
215
- usage: 'vip @mysite.production logs',
216
- description: 'Get the most recent app logs'
217
- }, {
218
- usage: 'vip @mysite.production logs --type batch',
219
- description: 'Get the most recent batch logs'
214
+ .option('limit', `The maximum number of entries to return. Accepts an integer value between 1 and 5000 (defaults to ${LIMIT_DEFAULT}).`).option('follow', 'Output new entries as they are generated.').option('format', 'Render output in a particular format. Accepts “csv”, and “json”.', 'table').examples([{
215
+ usage: 'vip @example-app.production logs',
216
+ description: 'Retrieve up to 500 of the most recent entries of application Runtime Logs from web containers.'
220
217
  }, {
221
- usage: 'vip @mysite.production logs --limit 100',
222
- description: 'Get the most recent 100 log entries'
218
+ usage: 'vip @example-app.production logs --type=batch',
219
+ description: 'Retrieve up to 500 of the most recent entries generated by cron tasks or WP-CLI commands from batch containers.'
223
220
  }, {
224
- usage: 'vip @mysite.production logs --limit 100 --format csv',
225
- description: 'Get the most recent 100 log entries formatted as comma-separated values (CSV)'
221
+ usage: 'vip @example-app.production logs --limit=100',
222
+ description: 'Retrieve up to 100 of the most recent entries of application logs.'
226
223
  }, {
227
- usage: 'vip @mysite.production logs --limit 100 --format json',
228
- description: 'Get the most recent 100 log entries formatted as JSON'
224
+ usage: 'vip @example-app.production logs --type=batch --limit=800 --format=csv',
225
+ description: 'Retrieve up to 800 of the most recent entries of batch logs and output them in CSV format.'
229
226
  }]).argv(process.argv, getLogs);
@@ -14,22 +14,22 @@ const debug = (0, _debug.default)('@automattic/vip:bin:vip-search-replace');
14
14
  const examples = [
15
15
  // `search-replace` flag
16
16
  {
17
- usage: 'vip search-replace <file.sql> --search-replace="from,to"',
18
- description: 'Replace instances of <from> with <to> in the provided <file.sql>\n' + ' * Ensure there are no spaces between your search-replace parameters'
17
+ usage: 'vip search-replace file.sql --search-replace="from,to"',
18
+ description: 'Search for every instance of the value "from" in the local input file named "file.sql" and replace it with the value "to".\n' + ' * Results of the operation output to STDOUT by default.'
19
19
  },
20
20
  // `in-place` flag
21
21
  {
22
- usage: 'vip search-replace <file.sql> --search-replace="from,to" --in-place',
23
- description: 'Perform Search and Replace explicitly on the provided input <file.sql> file'
22
+ usage: 'vip search-replace file.sql --search-replace="from,to" --in-place',
23
+ description: 'Perform the search and replace operation on the local input file "file.sql" and overwrite the file with the results.'
24
24
  },
25
25
  // `output` flag
26
26
  {
27
- usage: 'vip search-replace <file.sql> --search-replace="from,to" --output="<output.sql>"',
28
- description: 'Search and Replace to the specified output <output.sql> file\n' + ' * Has no effect when the `in-place` flag is used'
27
+ usage: 'vip search-replace file.sql --search-replace="from,to" --output=output-file.sql',
28
+ description: 'Perform the search and replace operation and save the results to a local clone of the input file named "output-file.sql".'
29
29
  }];
30
30
  (0, _command.default)({
31
31
  requiredArgs: 1
32
- }).option('search-replace', 'Specify the <from> and <to> pairs to be replaced').option('in-place', 'Perform the search and replace explicitly on the input file').option('output', 'Create a local copy of the file with the completed search and replace operations. Ignored if the command includes --in-place. Accepts a local file path. Defaults to STDOUT.').examples(examples).argv(process.argv, async (arg, opt) => {
32
+ }).option('search-replace', 'A comma-separated pair of strings that specify the values to search for and replace (e.g. --search-replace="from,to").').option('in-place', 'Overwrite the local input file with the results of the search and replace operation.').option('output', 'The local file path used to save a copy of the results from the search and replace operation. Ignored when used with the --in-place option.').examples(examples).argv(process.argv, async (arg, opt) => {
33
33
  // TODO: tracks event for usage of this command stand alone
34
34
  const {
35
35
  searchReplace,
@@ -25,6 +25,7 @@ const MAX_POLLING_DELAY_IN_SECONDS = 300;
25
25
  const exampleUsage = 'vip @example-app.develop slowlogs';
26
26
  const baseUsage = 'vip slowlogs';
27
27
  async function getSlowlogs(arg, opt) {
28
+ opt.format ??= 'table';
28
29
  validateInputs(opt.limit, opt.format);
29
30
  const trackingParams = getBaseTrackingParams(opt);
30
31
  await (0, _tracker.trackEvent)('slowlogs_command_execute', trackingParams);
@@ -147,7 +148,7 @@ function validateInputs(limit, format) {
147
148
  exit.withError(`Invalid format: ${format}. The supported formats are: ${ALLOWED_FORMATS.join(', ')}.`);
148
149
  }
149
150
  if (!Number.isInteger(limit) || limit < LIMIT_MIN || limit > slowlogsLib.LIMIT_MAX) {
150
- exit.withError(`Invalid limit: ${limit}. It should be a number between ${LIMIT_MIN} and ${slowlogsLib.LIMIT_MAX}.`);
151
+ exit.withError(`Invalid limit: ${limit}. Set the limit to an integer between ${LIMIT_MIN} and ${slowlogsLib.LIMIT_MAX}.`);
151
152
  }
152
153
  }
153
154
  const appQuery = exports.appQuery = `
@@ -171,7 +172,7 @@ void (0, _command.default)({
171
172
  format: false,
172
173
  module: 'slowlogs',
173
174
  usage: baseUsage
174
- }).option('limit', 'The maximum number of log entries', 500).option('format', 'Output the log entries in CSV or JSON format', 'table').examples([{
175
+ }).option('limit', 'Set the maximum number of log entries. Accepts an integer value between 1 and 500.', 500).option('format', 'Render output in a particular format. Accepts “csv”, and “json”.', 'table').examples([{
175
176
  description: 'Retrieve up to 500 of the most recent entries from the MySQL slow query logs in the default format.',
176
177
  usage: exampleUsage
177
178
  }, {
package/dist/bin/vip.js CHANGED
@@ -22,7 +22,7 @@ const tokenURL = 'https://dashboard.wpvip.com/me/cli/token';
22
22
  const customDeployToken = process.env.WPVIP_DEPLOY_TOKEN;
23
23
  const runCmd = async function () {
24
24
  const cmd = (0, _command.default)();
25
- cmd.command('logout', 'Log out the current authenticated VIP-CLI user.').command('app', 'Interact with applications that the current authenticated VIP-CLI user has permission to access.').command('backup', 'Generate a backup of an environment.').command('cache', 'Manage page cache for an environment.').command('config', 'Manage environment configurations.').command('dev-env', 'Create and manage VIP Local Development Environments.').command('export', 'Export a copy of data associated with an environment.').command('import', 'Import media or SQL database files to an environment.').command('logs', 'Get logs from your VIP applications').command('search-replace', 'Perform search and replace tasks on files').command('slowlogs', 'Retrieve MySQL slow query logs from an environment.').command('db', "Access an environment's database.").command('sync', 'Sync the database from production to a non-production environment.').command('whoami', 'Retrieve details about the current authenticated VIP-CLI user.').command('validate', 'Validate your VIP application and environment').command('wp', 'Execute a WP-CLI command against an environment.');
25
+ cmd.command('logout', 'Log out the current authenticated VIP-CLI user.').command('app', 'Interact with applications that the current authenticated VIP-CLI user has permission to access.').command('backup', 'Generate a backup of an environment.').command('cache', 'Manage page cache for an environment.').command('config', 'Manage environment configurations.').command('dev-env', 'Create and manage VIP Local Development Environments.').command('export', 'Export a copy of data associated with an environment.').command('import', 'Import media or SQL database files to an environment.').command('logs', 'Retrieve Runtime Logs from an environment.').command('search-replace', 'Search for a string in a local SQL file and replace it with a new string.').command('slowlogs', 'Retrieve MySQL slow query logs from an environment.').command('db', "Access an environment's database.").command('sync', 'Sync the database from production to a non-production environment.').command('whoami', 'Retrieve details about the current authenticated VIP-CLI user.').command('validate', 'Validate your VIP application and environment').command('wp', 'Execute a WP-CLI command against an environment.');
26
26
  cmd.argv(process.argv);
27
27
  };
28
28
 
@@ -534,7 +534,7 @@ function _default(opts) {
534
534
  _args.default.option('force', 'Skip confirmation.', false);
535
535
  }
536
536
  if (_opts.format) {
537
- _args.default.option('format', 'Render output in a particular format. Accepts "table" (default), "csv", and "json".');
537
+ _args.default.option('format', 'Render output in a particular format. Accepts csv”, and json”.', 'table');
538
538
  }
539
539
 
540
540
  // Add help and version to all subcommands
package/docs/CHANGELOG.md CHANGED
@@ -1,18 +1,29 @@
1
1
  ## Changelog
2
2
 
3
- ## 3.8.7
3
+ ### 3.8.8
4
+
5
+ * build(deps-dev): bump @types/dockerode from 3.3.31 to 3.3.32
6
+ * Update the `search-replace` command to follow the VIP-CLI style guide
7
+ * Update the`vip logs` command to follow the VIP-CLI style guide
8
+ * build(deps-dev): bump @types/node from 22.9.0 to 22.9.1
9
+ * build(deps): bump actions/dependency-review-action from 4.4.0 to 4.5.0
10
+ * build(deps): bump step-security/harden-runner from 2.10.1 to 2.10.2
11
+
12
+ **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.7...3.8.8
13
+
14
+ ### 3.8.7
4
15
 
5
16
  * fix(dev-env): SQL sync for single sites
6
17
 
7
18
  **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.6...3.8.7
8
19
 
9
- ## 3.8.6
20
+ ### 3.8.6
10
21
 
11
22
  * Updating Node.js versions and standardize the format
12
23
 
13
24
  **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.5...3.8.6
14
25
 
15
- ## 3.8.5
26
+ ### 3.8.5
16
27
 
17
28
  * build(deps-dev): bump the babel group with 4 updates
18
29
  * build(deps-dev): bump typescript from 5.6.2 to 5.6.3
@@ -52,7 +63,7 @@
52
63
 
53
64
  **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.4...3.8.5
54
65
 
55
- ## 3.8.4
66
+ ### 3.8.4
56
67
 
57
68
  * build(deps): bump step-security/harden-runner from 2.9.1 to 2.10.1
58
69
  * build(deps-dev): bump @types/jest from 29.5.12 to 29.5.13 in the testing group
@@ -66,7 +77,7 @@
66
77
 
67
78
  **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.3...3.8.4
68
79
 
69
- ## 3.8.3
80
+ ### 3.8.3
70
81
 
71
82
  * build(deps): bump adm-zip from 0.5.15 to 0.5.16
72
83
  * build(deps): bump debug from 4.3.6 to 4.3.7
@@ -78,7 +89,7 @@
78
89
 
79
90
  **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.2...3.8.3
80
91
 
81
- ## 3.8.2
92
+ ### 3.8.2
82
93
 
83
94
  * chore(deps): make `node-fetch` 2.x depend on `whatwg-url` 14.x to address deprecations
84
95
  * build(deps-dev): bump nock from 13.5.4 to 13.5.5
@@ -93,14 +104,14 @@
93
104
 
94
105
  **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.1...3.8.2
95
106
 
96
- ## 3.8.1
107
+ ### 3.8.1
97
108
 
98
109
  * fix(dev-env): clean up data after `vip dev-env sync sql`
99
110
  * security: fix high severity CVE-2024-39338 in `axios`
100
111
 
101
112
  **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.0...3.8.1
102
113
 
103
- ## 3.8.0
114
+ ### 3.8.0
104
115
 
105
116
  * build(deps-dev): bump @babel/preset-env from 7.24.8 to 7.25.0 in the babel group
106
117
  * build(deps): bump debug from 4.3.5 to 4.3.6
@@ -115,7 +126,7 @@
115
126
 
116
127
  **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.7.1...3.8.0
117
128
 
118
- ## 3.7.1
129
+ ### 3.7.1
119
130
 
120
131
  * build(deps): bump step-security/harden-runner from 2.8.1 to 2.9.0
121
132
  * build(deps): bump semver from 7.6.2 to 7.6.3
@@ -131,7 +142,7 @@
131
142
 
132
143
  **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.7.0...3.7.1
133
144
 
134
- ## 3.7.0
145
+ ### 3.7.0
135
146
 
136
147
  * build(deps-dev): bump @automattic/eslint-plugin-wpvip from 0.12.0 to 0.13.0
137
148
  * build(deps-dev): bump the babel group with 3 updates
@@ -143,14 +154,14 @@
143
154
 
144
155
  **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.6.0...3.7.0
145
156
 
146
- ## 3.6.0
157
+ ### 3.6.0
147
158
 
148
159
  * build(deps-dev): bump rimraf from 5.0.7 to 5.0.8
149
160
  * feat(dev-env): add DNS check to health check to ensure domains resolve correctly
150
161
 
151
162
  **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.5.1...3.6.0
152
163
 
153
- ## 3.5.1
164
+ ### 3.5.1
154
165
 
155
166
  * fix(dev-env): display cron status in `vip dev-env info --extended`
156
167
  * build(deps-dev): bump typescript from 5.5.2 to 5.5.3
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "3.8.7",
3
+ "version": "3.8.8",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@automattic/vip",
9
- "version": "3.8.7",
9
+ "version": "3.8.8",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
@@ -3526,9 +3526,9 @@
3526
3526
  }
3527
3527
  },
3528
3528
  "node_modules/@types/dockerode": {
3529
- "version": "3.3.31",
3530
- "resolved": "https://registry.npmjs.org/@types/dockerode/-/dockerode-3.3.31.tgz",
3531
- "integrity": "sha512-42R9eoVqJDSvVspV89g7RwRqfNExgievLNWoHkg7NoWIqAmavIbgQBb4oc0qRtHkxE+I3Xxvqv7qVXFABKPBTg==",
3529
+ "version": "3.3.32",
3530
+ "resolved": "https://registry.npmjs.org/@types/dockerode/-/dockerode-3.3.32.tgz",
3531
+ "integrity": "sha512-xxcG0g5AWKtNyh7I7wswLdFvym4Mlqks5ZlKzxEUrGHS0r0PUOfxm2T0mspwu10mHQqu3Ck3MI3V2HqvLWE1fg==",
3532
3532
  "dev": true,
3533
3533
  "dependencies": {
3534
3534
  "@types/docker-modem": "*",
@@ -3618,9 +3618,9 @@
3618
3618
  "dev": true
3619
3619
  },
3620
3620
  "node_modules/@types/node": {
3621
- "version": "22.9.0",
3622
- "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.0.tgz",
3623
- "integrity": "sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==",
3621
+ "version": "22.9.1",
3622
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.1.tgz",
3623
+ "integrity": "sha512-p8Yy/8sw1caA8CdRIQBG5tiLHmxtQKObCijiAa9Ez+d4+PRffM4054xbju0msf+cvhJpnFEeNjxmVT/0ipktrg==",
3624
3624
  "dependencies": {
3625
3625
  "undici-types": "~6.19.8"
3626
3626
  }
@@ -15786,9 +15786,9 @@
15786
15786
  }
15787
15787
  },
15788
15788
  "@types/dockerode": {
15789
- "version": "3.3.31",
15790
- "resolved": "https://registry.npmjs.org/@types/dockerode/-/dockerode-3.3.31.tgz",
15791
- "integrity": "sha512-42R9eoVqJDSvVspV89g7RwRqfNExgievLNWoHkg7NoWIqAmavIbgQBb4oc0qRtHkxE+I3Xxvqv7qVXFABKPBTg==",
15789
+ "version": "3.3.32",
15790
+ "resolved": "https://registry.npmjs.org/@types/dockerode/-/dockerode-3.3.32.tgz",
15791
+ "integrity": "sha512-xxcG0g5AWKtNyh7I7wswLdFvym4Mlqks5ZlKzxEUrGHS0r0PUOfxm2T0mspwu10mHQqu3Ck3MI3V2HqvLWE1fg==",
15792
15792
  "dev": true,
15793
15793
  "requires": {
15794
15794
  "@types/docker-modem": "*",
@@ -15878,9 +15878,9 @@
15878
15878
  "dev": true
15879
15879
  },
15880
15880
  "@types/node": {
15881
- "version": "22.9.0",
15882
- "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.0.tgz",
15883
- "integrity": "sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==",
15881
+ "version": "22.9.1",
15882
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.1.tgz",
15883
+ "integrity": "sha512-p8Yy/8sw1caA8CdRIQBG5tiLHmxtQKObCijiAa9Ez+d4+PRffM4054xbju0msf+cvhJpnFEeNjxmVT/0ipktrg==",
15884
15884
  "requires": {
15885
15885
  "undici-types": "~6.19.8"
15886
15886
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "3.8.7",
3
+ "version": "3.8.8",
4
4
  "description": "The VIP Javascript library & CLI",
5
5
  "main": "index.js",
6
6
  "bin": {