@hyperdrive.bot/cli 1.0.6 → 1.0.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.
- package/README.md +415 -67
- package/dist/commands/account/add.d.ts +6 -6
- package/dist/commands/account/list.d.ts +3 -0
- package/dist/commands/account/list.js +9 -2
- package/dist/commands/account/remove.d.ts +3 -3
- package/dist/commands/auth/login.d.ts +4 -4
- package/dist/commands/auth/login.js +1 -0
- package/dist/commands/ci/account/create.d.ts +7 -6
- package/dist/commands/ci/account/create.js +49 -3
- package/dist/commands/ci/account/delete.d.ts +3 -3
- package/dist/commands/ci/account/list.d.ts +2 -2
- package/dist/commands/config/get.d.ts +1 -1
- package/dist/commands/config/set.d.ts +2 -2
- package/dist/commands/deployment/create.d.ts +10 -10
- package/dist/commands/deployment/get.d.ts +4 -4
- package/dist/commands/deployment/launch.d.ts +6 -6
- package/dist/commands/deployment/list.d.ts +3 -3
- package/dist/commands/deployment/list.js +17 -17
- package/dist/commands/domain/switch.d.ts +1 -1
- package/dist/commands/example.d.ts +3 -3
- package/dist/commands/git/connect.d.ts +2 -2
- package/dist/commands/git/connect.js +1 -0
- package/dist/commands/git/disconnect.d.ts +3 -3
- package/dist/commands/git/list.d.ts +2 -2
- package/dist/commands/git/sync.d.ts +7 -7
- package/dist/commands/git/sync.js +24 -23
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +20 -19
- package/dist/commands/jira/connect.d.ts +2 -1
- package/dist/commands/jira/connect.js +17 -6
- package/dist/commands/jira/hook/add.d.ts +17 -0
- package/dist/commands/jira/hook/add.js +147 -0
- package/dist/commands/jira/hook/list.d.ts +14 -0
- package/dist/commands/jira/hook/list.js +105 -0
- package/dist/commands/jira/hook/remove.d.ts +15 -0
- package/dist/commands/jira/hook/remove.js +119 -0
- package/dist/commands/jira/hook/toggle.d.ts +15 -0
- package/dist/commands/jira/hook/toggle.js +136 -0
- package/dist/commands/jira/status.d.ts +1 -1
- package/dist/commands/module/analyze.d.ts +5 -5
- package/dist/commands/module/create.d.ts +17 -17
- package/dist/commands/module/create.js +9 -1
- package/dist/commands/module/destroy.d.ts +3 -3
- package/dist/commands/module/get.d.ts +2 -2
- package/dist/commands/module/link.d.ts +4 -4
- package/dist/commands/module/list.d.ts +1 -1
- package/dist/commands/module/list.js +12 -11
- package/dist/commands/module/reanalyze.d.ts +6 -6
- package/dist/commands/module/update.d.ts +19 -19
- package/dist/commands/parameter/add.d.ts +7 -7
- package/dist/commands/parameter/backfill.d.ts +4 -4
- package/dist/commands/parameter/backfill.js +4 -3
- package/dist/commands/parameter/clear.d.ts +6 -6
- package/dist/commands/parameter/list.d.ts +6 -6
- package/dist/commands/parameter/list.js +4 -3
- package/dist/commands/parameter/pull.d.ts +6 -6
- package/dist/commands/parameter/remove.d.ts +7 -7
- package/dist/commands/parameter/sync.d.ts +6 -6
- package/dist/commands/parameter/update.d.ts +7 -7
- package/dist/commands/project/init.d.ts +21 -0
- package/dist/commands/project/init.js +576 -0
- package/dist/commands/project/list.d.ts +10 -0
- package/dist/commands/project/list.js +119 -0
- package/dist/commands/project/status.d.ts +13 -0
- package/dist/commands/project/status.js +163 -0
- package/dist/commands/project/sync.d.ts +26 -0
- package/dist/commands/project/sync.js +388 -0
- package/dist/commands/stage/access.d.ts +15 -0
- package/dist/commands/stage/access.js +130 -0
- package/dist/commands/stage/create.d.ts +11 -11
- package/dist/commands/stage/list.d.ts +1 -1
- package/dist/commands/stage/list.js +21 -20
- package/dist/commands/stage/revoke.d.ts +18 -0
- package/dist/commands/stage/revoke.js +171 -0
- package/dist/commands/stage/share.d.ts +23 -0
- package/dist/commands/stage/share.js +292 -0
- package/dist/commands/test-api.d.ts +1 -1
- package/dist/services/auth-service.d.ts +15 -82
- package/dist/services/auth-service.js +24 -237
- package/dist/services/hyperdrive-sigv4.d.ts +162 -24
- package/dist/services/hyperdrive-sigv4.js +107 -193
- package/dist/services/tenant-service.d.ts +6 -0
- package/dist/services/tenant-service.js +13 -0
- package/dist/utils/account-flow.d.ts +2 -2
- package/dist/utils/account-flow.js +4 -4
- package/dist/utils/auth-flow.d.ts +1 -0
- package/dist/utils/auth-flow.js +2 -0
- package/dist/utils/git-flow.d.ts +1 -0
- package/dist/utils/git-flow.js +2 -2
- package/dist/utils/hook-flow.d.ts +21 -0
- package/dist/utils/hook-flow.js +154 -0
- package/dist/utils/jira-flow.d.ts +2 -2
- package/dist/utils/jira-flow.js +4 -4
- package/dist/utils/table.d.ts +17 -0
- package/dist/utils/table.js +41 -0
- package/oclif.manifest.json +844 -154
- package/package.json +59 -15
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import inquirer from 'inquirer';
|
|
2
|
+
/**
|
|
3
|
+
* Prompt user to select a trigger status from available Jira statuses
|
|
4
|
+
*/
|
|
5
|
+
export async function promptTriggerStatus(statuses) {
|
|
6
|
+
const choices = [
|
|
7
|
+
{ name: '* (any status)', value: '*' },
|
|
8
|
+
...statuses.map(s => ({ name: s, value: s })),
|
|
9
|
+
];
|
|
10
|
+
const { triggerStatus } = await inquirer.prompt([{
|
|
11
|
+
choices,
|
|
12
|
+
message: 'Select trigger status:',
|
|
13
|
+
name: 'triggerStatus',
|
|
14
|
+
type: 'list',
|
|
15
|
+
}]);
|
|
16
|
+
return triggerStatus;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Prompt user to select an action type
|
|
20
|
+
*/
|
|
21
|
+
export async function promptActionType() {
|
|
22
|
+
const { actionType } = await inquirer.prompt([{
|
|
23
|
+
choices: [
|
|
24
|
+
{ name: 'Slack notification', value: 'slack-notify' },
|
|
25
|
+
{ name: 'ADHB enrichment', value: 'adhb-enrich' },
|
|
26
|
+
{ name: 'Webhook', value: 'webhook' },
|
|
27
|
+
{ name: 'CI trigger', value: 'ci-trigger' },
|
|
28
|
+
],
|
|
29
|
+
message: 'Select action type:',
|
|
30
|
+
name: 'actionType',
|
|
31
|
+
type: 'list',
|
|
32
|
+
}]);
|
|
33
|
+
return actionType;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Prompt for action-specific configuration based on action type
|
|
37
|
+
*/
|
|
38
|
+
export async function promptActionConfig(actionType) {
|
|
39
|
+
switch (actionType) {
|
|
40
|
+
case 'slack-notify': {
|
|
41
|
+
const answers = await inquirer.prompt([
|
|
42
|
+
{
|
|
43
|
+
message: 'Slack channel (e.g. #deploys):',
|
|
44
|
+
name: 'channel',
|
|
45
|
+
type: 'input',
|
|
46
|
+
validate: (input) => input.trim() ? true : 'Channel is required',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
default: '',
|
|
50
|
+
message: 'Message template (optional):',
|
|
51
|
+
name: 'template',
|
|
52
|
+
type: 'input',
|
|
53
|
+
},
|
|
54
|
+
]);
|
|
55
|
+
const config = { channel: answers.channel };
|
|
56
|
+
if (answers.template)
|
|
57
|
+
config.template = answers.template;
|
|
58
|
+
return config;
|
|
59
|
+
}
|
|
60
|
+
case 'adhb-enrich': {
|
|
61
|
+
const { priority } = await inquirer.prompt([{
|
|
62
|
+
choices: [
|
|
63
|
+
{ name: 'high', value: 'high' },
|
|
64
|
+
{ name: 'normal', value: 'normal' },
|
|
65
|
+
{ name: 'low', value: 'low' },
|
|
66
|
+
],
|
|
67
|
+
default: 'normal',
|
|
68
|
+
message: 'Priority:',
|
|
69
|
+
name: 'priority',
|
|
70
|
+
type: 'list',
|
|
71
|
+
}]);
|
|
72
|
+
return { priority };
|
|
73
|
+
}
|
|
74
|
+
case 'webhook': {
|
|
75
|
+
const answers = await inquirer.prompt([
|
|
76
|
+
{
|
|
77
|
+
message: 'Webhook URL:',
|
|
78
|
+
name: 'url',
|
|
79
|
+
type: 'input',
|
|
80
|
+
validate: (input) => input.trim().startsWith('http') ? true : 'Valid URL is required',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
choices: [
|
|
84
|
+
{ name: 'POST', value: 'POST' },
|
|
85
|
+
{ name: 'PUT', value: 'PUT' },
|
|
86
|
+
],
|
|
87
|
+
default: 'POST',
|
|
88
|
+
message: 'HTTP method:',
|
|
89
|
+
name: 'method',
|
|
90
|
+
type: 'list',
|
|
91
|
+
},
|
|
92
|
+
]);
|
|
93
|
+
return { method: answers.method, url: answers.url };
|
|
94
|
+
}
|
|
95
|
+
case 'ci-trigger': {
|
|
96
|
+
const answers = await inquirer.prompt([
|
|
97
|
+
{
|
|
98
|
+
choices: [
|
|
99
|
+
{ name: 'GitHub', value: 'github' },
|
|
100
|
+
{ name: 'GitLab', value: 'gitlab' },
|
|
101
|
+
],
|
|
102
|
+
message: 'Provider:',
|
|
103
|
+
name: 'provider',
|
|
104
|
+
type: 'list',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
message: 'Pipeline identifier:',
|
|
108
|
+
name: 'pipeline',
|
|
109
|
+
type: 'input',
|
|
110
|
+
validate: (input) => input.trim() ? true : 'Pipeline identifier is required',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
default: '',
|
|
114
|
+
message: 'Git ref (optional):',
|
|
115
|
+
name: 'ref',
|
|
116
|
+
type: 'input',
|
|
117
|
+
},
|
|
118
|
+
]);
|
|
119
|
+
const config = { pipeline: answers.pipeline, provider: answers.provider };
|
|
120
|
+
if (answers.ref)
|
|
121
|
+
config.ref = answers.ref;
|
|
122
|
+
return config;
|
|
123
|
+
}
|
|
124
|
+
default:
|
|
125
|
+
throw new Error(`Unknown action type: ${actionType}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Prompt user to select a hook from a list
|
|
130
|
+
*/
|
|
131
|
+
export async function promptSelectHook(hooks) {
|
|
132
|
+
const { selectedHook } = await inquirer.prompt([{
|
|
133
|
+
choices: hooks.map(h => ({
|
|
134
|
+
name: `[${h.triggerStatus}] ${h.actionType} (${h.enabled ? 'enabled' : 'disabled'})`,
|
|
135
|
+
value: h,
|
|
136
|
+
})),
|
|
137
|
+
message: 'Select a hook:',
|
|
138
|
+
name: 'selectedHook',
|
|
139
|
+
type: 'list',
|
|
140
|
+
}]);
|
|
141
|
+
return selectedHook;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Prompt user to confirm hook deletion
|
|
145
|
+
*/
|
|
146
|
+
export async function promptConfirmDelete(hook) {
|
|
147
|
+
const { confirmed } = await inquirer.prompt([{
|
|
148
|
+
default: false,
|
|
149
|
+
message: `Delete hook [${hook.triggerStatus}] ${hook.actionType}?`,
|
|
150
|
+
name: 'confirmed',
|
|
151
|
+
type: 'confirm',
|
|
152
|
+
}]);
|
|
153
|
+
return confirmed;
|
|
154
|
+
}
|
|
@@ -59,7 +59,7 @@ export declare function promptJiraConnect(includeSkip?: boolean): Promise<'skip'
|
|
|
59
59
|
* This function is separated from user input collection to allow
|
|
60
60
|
* proper spinner timing and better separation of concerns.
|
|
61
61
|
*/
|
|
62
|
-
export declare function registerJiraDomain(jiraDomain: string): Promise<JiraConnectResult>;
|
|
62
|
+
export declare function registerJiraDomain(jiraDomain: string, tenantDomain?: string): Promise<JiraConnectResult>;
|
|
63
63
|
/**
|
|
64
64
|
* Execute the Jira connect flow
|
|
65
65
|
*
|
|
@@ -68,4 +68,4 @@ export declare function registerJiraDomain(jiraDomain: string): Promise<JiraConn
|
|
|
68
68
|
* 2. Pre-registering the domain with Hyperdrive API
|
|
69
69
|
* 3. Returning result with marketplace URL
|
|
70
70
|
*/
|
|
71
|
-
export declare function executeJiraConnect(): Promise<JiraConnectResult>;
|
|
71
|
+
export declare function executeJiraConnect(tenantDomain?: string): Promise<JiraConnectResult>;
|
package/dist/utils/jira-flow.js
CHANGED
|
@@ -75,9 +75,9 @@ export async function promptJiraConnect(includeSkip = false) {
|
|
|
75
75
|
* This function is separated from user input collection to allow
|
|
76
76
|
* proper spinner timing and better separation of concerns.
|
|
77
77
|
*/
|
|
78
|
-
export async function registerJiraDomain(jiraDomain) {
|
|
78
|
+
export async function registerJiraDomain(jiraDomain, tenantDomain) {
|
|
79
79
|
try {
|
|
80
|
-
const service = new HyperdriveSigV4Service();
|
|
80
|
+
const service = new HyperdriveSigV4Service(tenantDomain);
|
|
81
81
|
// Use the public API method instead of accessing private method
|
|
82
82
|
const response = await service.jiraPreRegister({ jiraDomain });
|
|
83
83
|
return {
|
|
@@ -103,12 +103,12 @@ export async function registerJiraDomain(jiraDomain) {
|
|
|
103
103
|
* 2. Pre-registering the domain with Hyperdrive API
|
|
104
104
|
* 3. Returning result with marketplace URL
|
|
105
105
|
*/
|
|
106
|
-
export async function executeJiraConnect() {
|
|
106
|
+
export async function executeJiraConnect(tenantDomain) {
|
|
107
107
|
try {
|
|
108
108
|
// Step 1: Prompt for Jira domain (no spinner - user needs to see prompts)
|
|
109
109
|
const domainData = await promptJiraDomain();
|
|
110
110
|
// Step 2: Register domain with API (caller should wrap this with spinner)
|
|
111
|
-
return await registerJiraDomain(domainData.jiraDomain);
|
|
111
|
+
return await registerJiraDomain(domainData.jiraDomain, tenantDomain);
|
|
112
112
|
}
|
|
113
113
|
catch (error) {
|
|
114
114
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface ColumnConfig<T> {
|
|
2
|
+
header: string;
|
|
3
|
+
minWidth?: number;
|
|
4
|
+
get?: (row: T) => string;
|
|
5
|
+
}
|
|
6
|
+
type TableColumns<T> = Record<string, ColumnConfig<T>>;
|
|
7
|
+
/**
|
|
8
|
+
* Print data in a table format using cli-table3
|
|
9
|
+
* Replacement for oclif's deprecated ux.table
|
|
10
|
+
*/
|
|
11
|
+
export declare function printTable<T extends Record<string, unknown>>(data: T[], columns: TableColumns<T>, logger: (msg: string) => void): void;
|
|
12
|
+
/**
|
|
13
|
+
* Print a styled header
|
|
14
|
+
* Replacement for oclif's deprecated ux.styledHeader
|
|
15
|
+
*/
|
|
16
|
+
export declare function printHeader(text: string, logger: (msg: string) => void): void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Table from 'cli-table3';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
/**
|
|
4
|
+
* Print data in a table format using cli-table3
|
|
5
|
+
* Replacement for oclif's deprecated ux.table
|
|
6
|
+
*/
|
|
7
|
+
export function printTable(data, columns, logger) {
|
|
8
|
+
const columnKeys = Object.keys(columns);
|
|
9
|
+
const headers = columnKeys.map(key => chalk.bold(columns[key].header));
|
|
10
|
+
const colWidths = columnKeys.map(key => columns[key].minWidth ?? null);
|
|
11
|
+
const hasColWidths = colWidths.some(w => w !== null);
|
|
12
|
+
const tableOptions = {
|
|
13
|
+
head: headers,
|
|
14
|
+
style: { head: [], border: [] },
|
|
15
|
+
};
|
|
16
|
+
if (hasColWidths) {
|
|
17
|
+
tableOptions.colWidths = colWidths;
|
|
18
|
+
}
|
|
19
|
+
const table = new Table(tableOptions);
|
|
20
|
+
for (const row of data) {
|
|
21
|
+
const rowData = columnKeys.map(key => {
|
|
22
|
+
const col = columns[key];
|
|
23
|
+
if (col.get) {
|
|
24
|
+
return col.get(row);
|
|
25
|
+
}
|
|
26
|
+
const value = row[key];
|
|
27
|
+
return value !== undefined && value !== null ? String(value) : '';
|
|
28
|
+
});
|
|
29
|
+
table.push(rowData);
|
|
30
|
+
}
|
|
31
|
+
logger(table.toString());
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Print a styled header
|
|
35
|
+
* Replacement for oclif's deprecated ux.styledHeader
|
|
36
|
+
*/
|
|
37
|
+
export function printHeader(text, logger) {
|
|
38
|
+
logger('');
|
|
39
|
+
logger(chalk.bold(text));
|
|
40
|
+
logger(chalk.gray('─'.repeat(Math.min(text.length + 10, 60))));
|
|
41
|
+
}
|