heroku 10.8.0 → 10.9.0-beta.0
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 +1 -0
- package/bin/heroku-prompts.js +235 -0
- package/bin/heroku-repl.js +682 -0
- package/bin/run +35 -7
- package/lib/analytics.js +3 -1
- package/lib/global_telemetry.d.ts +1 -1
- package/lib/global_telemetry.js +3 -1
- package/oclif.manifest.json +1161 -1161
- package/package.json +8 -5
package/bin/run
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
const {Config} = require('@oclif/core')
|
|
4
|
+
const root = require.resolve('../package.json')
|
|
5
|
+
const config = new Config({root})
|
|
6
|
+
|
|
3
7
|
process.env.HEROKU_UPDATE_INSTRUCTIONS = process.env.HEROKU_UPDATE_INSTRUCTIONS || 'update with: "npm update -g heroku"'
|
|
4
8
|
|
|
5
9
|
const now = new Date()
|
|
6
10
|
const cliStartTime = now.getTime()
|
|
7
11
|
const globalTelemetry = require('../lib/global_telemetry')
|
|
12
|
+
const yargs = require('yargs-parser')(process.argv.slice(2))
|
|
8
13
|
|
|
9
14
|
process.once('beforeExit', async code => {
|
|
10
15
|
// capture as successful exit
|
|
@@ -38,13 +43,36 @@ process.on('SIGTERM', async () => {
|
|
|
38
43
|
globalTelemetry.initializeInstrumentation()
|
|
39
44
|
|
|
40
45
|
const oclif = require('@oclif/core')
|
|
46
|
+
const oclifFlush = require('@oclif/core/flush')
|
|
47
|
+
const oclifError = require('@oclif/core/handle')
|
|
48
|
+
const {promptUser} = require('./heroku-prompts')
|
|
49
|
+
const {herokuRepl} = require('./heroku-repl')
|
|
41
50
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
const main = async () => {
|
|
52
|
+
try {
|
|
53
|
+
await config.load()
|
|
54
|
+
const {_: [commandName, ...args], ...flags} = yargs
|
|
55
|
+
if (flags.repl && args.length === 0 && Object.keys(flags).length === 1) {
|
|
56
|
+
return herokuRepl(config)
|
|
57
|
+
}
|
|
47
58
|
|
|
48
|
-
|
|
49
|
-
|
|
59
|
+
if (flags.prompt) {
|
|
60
|
+
delete flags.prompt
|
|
61
|
+
await promptUser(config, commandName, args, flags)
|
|
62
|
+
await oclif.run([commandName, ...args], config)
|
|
63
|
+
} else {
|
|
64
|
+
await oclif.run(undefined, config)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
await oclifFlush()
|
|
68
|
+
} catch (error) {
|
|
69
|
+
// capture any errors raised by oclif
|
|
70
|
+
const cliError = error
|
|
71
|
+
cliError.cliRunDuration = globalTelemetry.computeDuration(cliStartTime)
|
|
72
|
+
await globalTelemetry.sendTelemetry(cliError)
|
|
73
|
+
|
|
74
|
+
oclifError(error)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
50
77
|
|
|
78
|
+
main()
|
package/lib/analytics.js
CHANGED
|
@@ -15,6 +15,8 @@ class AnalyticsCommand {
|
|
|
15
15
|
}
|
|
16
16
|
async record(opts) {
|
|
17
17
|
await this.initialize;
|
|
18
|
+
const mcpMode = process.env.HEROKU_MCP_MODE === 'true';
|
|
19
|
+
const mcpServerVersion = process.env.HEROKU_MCP_SERVER_VERSION || 'unknown';
|
|
18
20
|
const plugin = opts.Command.plugin;
|
|
19
21
|
if (!plugin) {
|
|
20
22
|
debug('no plugin found for analytics');
|
|
@@ -29,7 +31,7 @@ class AnalyticsCommand {
|
|
|
29
31
|
cli: this.config.name,
|
|
30
32
|
command: opts.Command.id,
|
|
31
33
|
completion: await this._acAnalytics(opts.Command.id),
|
|
32
|
-
version: this.config.version
|
|
34
|
+
version: `${this.config.version}${mcpMode ? ` (MCP ${mcpServerVersion})` : ''}`,
|
|
33
35
|
plugin: plugin.name,
|
|
34
36
|
plugin_version: plugin.version,
|
|
35
37
|
os: this.config.platform,
|
|
@@ -25,7 +25,7 @@ export declare function initializeInstrumentation(): void;
|
|
|
25
25
|
export declare function setupTelemetry(config: any, opts: any): {
|
|
26
26
|
command: any;
|
|
27
27
|
os: any;
|
|
28
|
-
version:
|
|
28
|
+
version: string;
|
|
29
29
|
exitCode: number;
|
|
30
30
|
exitState: string;
|
|
31
31
|
cliRunDuration: number;
|
package/lib/global_telemetry.js
CHANGED
|
@@ -57,10 +57,12 @@ function setupTelemetry(config, opts) {
|
|
|
57
57
|
const now = new Date();
|
|
58
58
|
const cmdStartTime = now.getTime();
|
|
59
59
|
const isRegularCmd = Boolean(opts.Command);
|
|
60
|
+
const mcpMode = process.env.HEROKU_MCP_MODE === 'true';
|
|
61
|
+
const mcpServerVersion = process.env.HEROKU_MCP_SERVER_VERSION || 'unknown';
|
|
60
62
|
const irregularTelemetryObject = {
|
|
61
63
|
command: opts.id,
|
|
62
64
|
os: config.platform,
|
|
63
|
-
version: config.version
|
|
65
|
+
version: `${config.version}${mcpMode ? ` (MCP ${mcpServerVersion})` : ''}`,
|
|
64
66
|
exitCode: 0,
|
|
65
67
|
exitState: 'successful',
|
|
66
68
|
cliRunDuration: 0,
|